blob: 8df0f0eea6ef6cbd2c148e0bd450461db9359eea [file] [log] [blame]
peusterm0f52fc12016-06-08 17:55:04 +09001# -*- mode: ruby -*-
2# vi: set ft=ruby :
3
4#
5# This Vagrant file create a son-emu VM.
6#
7
8# All Vagrant configuration is done below. The "2" in Vagrant.configure
9# configures the configuration version (we support older styles for
10# backwards compatibility). Please don't change it unless you know what
11# you're doing.
12Vagrant.configure(2) do |config|
13 # The most common configuration options are documented and commented below.
14 # For a complete reference, please see the online documentation at
15 # https://docs.vagrantup.com.
16
17 # Every Vagrant development environment requires a box. You can search for
18 # boxes at https://atlas.hashicorp.com/search.
19
20 # there is a bug in the /etc/hosts of 16.04: https://bugs.launchpad.net/ubuntu/+source/livecd-rootfs/+bug/1561250
21 #config.vm.box = "ubuntu/xenial64"
22
23 # so we use 14.04 for now
24 config.vm.box = "ubuntu/trusty64"
25
26
27 # Disable automatic box update checking. If you disable this, then
28 # boxes will only be checked for updates when the user runs
29 # `vagrant box outdated`. This is not recommended.
30 # config.vm.box_check_update = false
31
32 # Create a forwarded port mapping which allows access to a specific port
33 # within the machine from a port on the host machine. In the example below,
34 # accessing "localhost:8080" will access port 80 on the guest machine.
35 # config.vm.network "forwarded_port", guest: 80, host: 8080
36
37 # Create a private network, which allows host-only access to the machine
38 # using a specific IP.
39 # config.vm.network "private_network", ip: "192.168.33.10"
40
41 # Create a public network, which generally matched to bridged network.
42 # Bridged networks make the machine appear as another physical device on
43 # your network.
44 # config.vm.network "public_network"
45
46 # Share an additional folder to the guest VM. The first argument is
47 # the path on the host to the actual folder. The second argument is
48 # the path on the guest to mount the folder. And the optional third
49 # argument is a set of non-required options.
50 config.vm.synced_folder ".", "/vagrant", disabled: true
51 config.vm.synced_folder ".", "/home/vagrant/son-emu"
52
53
54 # Provider-specific configuration so you can fine-tune various
55 # backing providers for Vagrant. These expose provider-specific options.
56 # Example for VirtualBox:
57 #
58 config.vm.provider "virtualbox" do |vb|
59 vb.name = "son-emu"
60 # # Display the VirtualBox GUI when booting the machine
61 # vb.gui = true
62 #
63 # # Customize the amount of memory on the VM:
64 vb.memory = "1024"
65 end
66 #
67 # View the documentation for the provider you are using for more
68 # information on available options.
69
70 # Define a Vagrant Push strategy for pushing to Atlas. Other push strategies
71 # such as FTP and Heroku are also available. See the documentation at
72 # https://docs.vagrantup.com/v2/push/atlas.html for more information.
73 # config.push.define "atlas" do |push|
74 # push.app = "YOUR_ATLAS_USERNAME/YOUR_APPLICATION_NAME"
75 # end
76
77 # Enable provisioning with a shell script. Additional provisioners such as
78 # Puppet, Chef, Ansible, Salt, and Docker are also available. Please see the
79 # documentation for more information about their specific syntax and use.
80 config.vm.provision "shell", inline: <<-SHELL
81 #sudo apt-get update
82 sudo apt-get install -y git ansible aptitude
83 sudo echo "localhost ansible_connection=local" >> /etc/ansible/hosts
84 # install containernet
85 git clone https://github.com/mpeuster/containernet.git
86 echo "Installing containernet (will take some time ~30 minutes) ..."
87 cd /home/vagrant/containernet/ansible
88 sudo ansible-playbook install.yml
89
90 # install son-emu
91 echo "Installing son-emu (will take some time) ..."
92 cd /home/vagrant/son-emu/ansible
93 sudo ansible-playbook install.yml
94
95 # execute son-emu tests at the end to validate installation
96 echo "Running son-emu unit tests to validate installation"
97 cd /home/vagrant/son-emu
98 sudo py.test -v
99 SHELL
100
101 # TODO the native ansible provisioner does not work so we directly call the shell commands
102 # install containernet using its ansible script
103 #config.vm.provision "ansible_local" do |ansible|
104 # ansible.provisioning_path = "/home/vagrant/containernet/ansible"
105 # ansible.playbook = "install.yml"
106 # ansible.sudo = true
107 # ansible.verbose = "v"
108 # ansible.limit = "all"
109 #end
110end