blob: 7cba18e48a77fcb81941b6711d1484ad22dcd9a2 [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#
peusterm1f291592016-06-08 18:23:45 +09007#
peusterm0f52fc12016-06-08 17:55:04 +09008# 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.
peustermcdda1f62016-06-09 09:58:09 +090035 config.vm.network "forwarded_port", guest: 5000, host: 5000
peusterm0f52fc12016-06-08 17:55:04 +090036
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
peustermcdda1f62016-06-09 09:58:09 +090081 sudo apt-get update
peusterm0f52fc12016-06-08 17:55:04 +090082 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
peustermcdda1f62016-06-09 09:58:09 +090098 sudo python setup.py develop
peusterm0f52fc12016-06-08 17:55:04 +090099 sudo py.test -v
peustermcdda1f62016-06-09 09:58:09 +0900100
101 # place motd
102 sudo cp utils/vagrant/motd /etc/motd
peusterm0f52fc12016-06-08 17:55:04 +0900103 SHELL
104
105 # TODO the native ansible provisioner does not work so we directly call the shell commands
106 # install containernet using its ansible script
107 #config.vm.provision "ansible_local" do |ansible|
108 # ansible.provisioning_path = "/home/vagrant/containernet/ansible"
109 # ansible.playbook = "install.yml"
110 # ansible.sudo = true
111 # ansible.verbose = "v"
112 # ansible.limit = "all"
113 #end
114end