1 # Copyright (c) 2015 SONATA-NFV and Paderborn University
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at
8 # http://www.apache.org/licenses/LICENSE-2.0
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
16 # Neither the name of the SONATA-NFV [, ANY ADDITIONAL AFFILIATION]
17 # nor the names of its contributors may be used to endorse or promote
18 # products derived from this software without specific prior written
21 # This work has been performed in the framework of the SONATA project,
22 # funded by the European Commission under Grant number 671517 through
23 # the Horizon 2020 and 5G-PPP programmes. The authors would like to
24 # acknowledge the contributions of their colleagues of the SONATA
25 # partner consortium (www.sonata-nfv.eu).
31 # This Vagrant file create a son-emu VM.
34 # All Vagrant configuration is done below. The "2" in Vagrant.configure
35 # configures the configuration version (we support older styles for
36 # backwards compatibility). Please don't change it unless you know what
38 Vagrant.configure(2) do |config|
39 # The most common configuration options are documented and commented below.
40 # For a complete reference, please see the online documentation at
41 # https://docs.vagrantup.com.
43 # Every Vagrant development environment requires a box. You can search for
44 # boxes at https://atlas.hashicorp.com/search.
46 # there is a bug in the /etc/hosts of 16.04: https://bugs.launchpad.net/ubuntu/+source/livecd-rootfs/+bug/1561250
47 #config.vm.box = "ubuntu/xenial64"
49 # so we use 14.04 for now
50 config.vm.box = "ubuntu/trusty64"
53 # Disable automatic box update checking. If you disable this, then
54 # boxes will only be checked for updates when the user runs
55 # `vagrant box outdated`. This is not recommended.
56 # config.vm.box_check_update = false
58 # Create a forwarded port mapping which allows access to a specific port
59 # within the machine from a port on the host machine. In the example below,
60 # accessing "localhost:8080" will access port 80 on the guest machine.
61 config.vm.network "forwarded_port", guest: 5000, host: 5000
63 # Create a private network, which allows host-only access to the machine
64 # using a specific IP.
65 # config.vm.network "private_network", ip: "192.168.33.10"
67 # Create a public network, which generally matched to bridged network.
68 # Bridged networks make the machine appear as another physical device on
70 # config.vm.network "public_network"
72 # Share an additional folder to the guest VM. The first argument is
73 # the path on the host to the actual folder. The second argument is
74 # the path on the guest to mount the folder. And the optional third
75 # argument is a set of non-required options.
76 config.vm.synced_folder ".", "/vagrant", disabled: true
77 config.vm.synced_folder ".", "/home/vagrant/son-emu"
80 # Provider-specific configuration so you can fine-tune various
81 # backing providers for Vagrant. These expose provider-specific options.
82 # Example for VirtualBox:
84 config.vm.provider "virtualbox" do |vb|
86 # # Display the VirtualBox GUI when booting the machine
89 # # Customize the amount of memory on the VM:
93 # View the documentation for the provider you are using for more
94 # information on available options.
96 # Define a Vagrant Push strategy for pushing to Atlas. Other push strategies
97 # such as FTP and Heroku are also available. See the documentation at
98 # https://docs.vagrantup.com/v2/push/atlas.html for more information.
99 # config.push.define "atlas" do |push|
100 # push.app = "YOUR_ATLAS_USERNAME/YOUR_APPLICATION_NAME"
103 # Enable provisioning with a shell script. Additional provisioners such as
104 # Puppet, Chef, Ansible, Salt, and Docker are also available. Please see the
105 # documentation for more information about their specific syntax and use.
106 config.vm.provision "shell", inline: <<-SHELL
108 sudo apt-get install -y git ansible aptitude
109 sudo echo "localhost ansible_connection=local" >> /etc/ansible/hosts
110 # install containernet
111 git clone https://github.com/mpeuster/containernet.git
112 echo "Installing containernet (will take some time ~30 minutes) ..."
113 cd /home/vagrant/containernet/ansible
114 sudo ansible-playbook install.yml
117 echo "Installing son-emu (will take some time) ..."
118 cd /home/vagrant/son-emu/ansible
119 sudo ansible-playbook install.yml
121 # execute son-emu tests at the end to validate installation
122 echo "Running son-emu unit tests to validate installation"
123 cd /home/vagrant/son-emu
124 sudo python setup.py develop
128 sudo cp utils/vagrant/motd /etc/motd
131 # TODO the native ansible provisioner does not work so we directly call the shell commands
132 # install containernet using its ansible script
133 #config.vm.provision "ansible_local" do |ansible|
134 # ansible.provisioning_path = "/home/vagrant/containernet/ansible"
135 # ansible.playbook = "install.yml"
136 # ansible.sudo = true
137 # ansible.verbose = "v"
138 # ansible.limit = "all"