Zsolt Haraszti | 3d16353 | 2016-09-08 15:57:32 -0700 | [diff] [blame] | 1 | # -*- mode: ruby -*- |
| 2 | # vi: set ft=ruby : |
| 3 | |
Sergio Slobodrian | bf77c86 | 2017-06-08 13:24:27 -0400 | [diff] [blame] | 4 | require 'yaml' |
| 5 | |
| 6 | settings = YAML.load_file 'settings.vagrant.yaml' |
| 7 | |
Zsolt Haraszti | 3d16353 | 2016-09-08 15:57:32 -0700 | [diff] [blame] | 8 | Vagrant.configure(2) do |config| |
| 9 | |
Sergio Slobodrian | 2f1a3f8 | 2017-05-31 10:35:00 -0400 | [diff] [blame] | 10 | if /cygwin|mswin|mingw|bccwin|wince|emx/ =~ RUBY_PLATFORM |
| 11 | puts("Configuring for windows") |
alshabib | eef9b13 | 2017-02-02 17:46:51 -0800 | [diff] [blame] | 12 | config.vm.synced_folder "../..", "/cord", mount_options: ["dmode=700,fmode=600"] |
Sergio Slobodrian | 2f1a3f8 | 2017-05-31 10:35:00 -0400 | [diff] [blame] | 13 | Box = "ubuntu/xenial64" |
| 14 | Provider = "virtualbox" |
| 15 | elsif RUBY_PLATFORM =~ /linux/ |
| 16 | puts("Configuring for linux") |
Sergio Slobodrian | bf77c86 | 2017-06-08 13:24:27 -0400 | [diff] [blame] | 17 | if settings['vProvider'] == "virtualbox" |
| 18 | puts("Using the virtualbox configuration"); |
| 19 | config.vm.synced_folder "../..", "/cord" |
| 20 | Box = "ubuntu/xenial64" |
| 21 | Provider = "virtualbox" |
| 22 | else |
| 23 | puts("Using the QEMU/KVM configuration"); |
Sergio Slobodrian | bf77c86 | 2017-06-08 13:24:27 -0400 | [diff] [blame] | 24 | Box = "ubuntu1604" |
| 25 | Provider = "libvirt" |
Sergio Slobodrian | 7c48362 | 2017-06-13 15:51:34 -0400 | [diff] [blame^] | 26 | if settings['testMode'] == "true" |
| 27 | config.vm.synced_folder ".", "/vagrant", disabled: true |
| 28 | config.vm.synced_folder "../..", "/cord", type: "rsync", rsync__exclude: [".git", "venv-linux"] |
| 29 | else |
| 30 | config.vm.synced_folder "../..", "/cord", type: "nfs" |
| 31 | end |
Sergio Slobodrian | bf77c86 | 2017-06-08 13:24:27 -0400 | [diff] [blame] | 32 | end |
Zsolt Haraszti | 3d16353 | 2016-09-08 15:57:32 -0700 | [diff] [blame] | 33 | else |
Sergio Slobodrian | 2f1a3f8 | 2017-05-31 10:35:00 -0400 | [diff] [blame] | 34 | puts("Configuring for other") |
alshabib | eef9b13 | 2017-02-02 17:46:51 -0800 | [diff] [blame] | 35 | config.vm.synced_folder "../..", "/cord" |
Sergio Slobodrian | 2f1a3f8 | 2017-05-31 10:35:00 -0400 | [diff] [blame] | 36 | Box = "ubuntu/xenial64" |
| 37 | Provider = "virtualbox" |
Zsolt Haraszti | 3d16353 | 2016-09-08 15:57:32 -0700 | [diff] [blame] | 38 | end |
| 39 | |
Sergio Slobodrian | 7c48362 | 2017-06-13 15:51:34 -0400 | [diff] [blame^] | 40 | config.vm.define "#{settings['server_name']}" do |d| |
Zsolt Haraszti | 3d16353 | 2016-09-08 15:57:32 -0700 | [diff] [blame] | 41 | d.ssh.forward_agent = true |
Sergio Slobodrian | 2f1a3f8 | 2017-05-31 10:35:00 -0400 | [diff] [blame] | 42 | d.vm.box = Box |
Sergio Slobodrian | 7c48362 | 2017-06-13 15:51:34 -0400 | [diff] [blame^] | 43 | d.vm.hostname = "#{settings['server_name']}" |
Zsolt Haraszti | 3d16353 | 2016-09-08 15:57:32 -0700 | [diff] [blame] | 44 | d.vm.network "private_network", ip: "10.100.198.220" |
| 45 | d.vm.provision :shell, path: "ansible/scripts/bootstrap_ansible.sh" |
alshabib | eef9b13 | 2017-02-02 17:46:51 -0800 | [diff] [blame] | 46 | d.vm.provision :shell, inline: "PYTHONUNBUFFERED=1 ansible-playbook /cord/incubator/voltha/ansible/voltha.yml -c local" |
| 47 | d.vm.provision :shell, inline: "cd /cord/incubator/voltha && source env.sh && make install-protoc && chmod 777 /tmp/fluentd" |
Sergio Slobodrian | 2f1a3f8 | 2017-05-31 10:35:00 -0400 | [diff] [blame] | 48 | d.vm.provider Provider do |v| |
Zsolt Haraszti | 9b485fb | 2016-12-26 23:11:15 -0800 | [diff] [blame] | 49 | v.memory = 6144 |
Zsolt Haraszti | 3d16353 | 2016-09-08 15:57:32 -0700 | [diff] [blame] | 50 | end |
| 51 | end |
| 52 | |
| 53 | if Vagrant.has_plugin?("vagrant-cachier") |
| 54 | config.cache.scope = :box |
| 55 | end |
| 56 | |
| 57 | end |