blob: 6de0e0f1e27c9394a16d60308e3cbf16bce27545 [file] [log] [blame]
Zsolt Haraszti3d163532016-09-08 15:57:32 -07001# -*- mode: ruby -*-
2# vi: set ft=ruby :
3
Sergio Slobodrianbf77c862017-06-08 13:24:27 -04004require 'yaml'
5
6settings = YAML.load_file 'settings.vagrant.yaml'
7
Zsolt Haraszti3d163532016-09-08 15:57:32 -07008Vagrant.configure(2) do |config|
9
Sergio Slobodrian2f1a3f82017-05-31 10:35:00 -040010 if /cygwin|mswin|mingw|bccwin|wince|emx/ =~ RUBY_PLATFORM
11 puts("Configuring for windows")
alshabibeef9b132017-02-02 17:46:51 -080012 config.vm.synced_folder "../..", "/cord", mount_options: ["dmode=700,fmode=600"]
Sergio Slobodrian2f1a3f82017-05-31 10:35:00 -040013 Box = "ubuntu/xenial64"
14 Provider = "virtualbox"
15 elsif RUBY_PLATFORM =~ /linux/
16 puts("Configuring for linux")
Sergio Slobodrianbf77c862017-06-08 13:24:27 -040017 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 Slobodrianbf77c862017-06-08 13:24:27 -040024 Box = "ubuntu1604"
25 Provider = "libvirt"
Sergio Slobodrian36e16552017-06-19 11:00:45 -040026 if settings['testMode'] == "true" or settings['installMode'] == "true"
Sergio Slobodrian7c483622017-06-13 15:51:34 -040027 config.vm.synced_folder ".", "/vagrant", disabled: true
Sergio Slobodrian36e16552017-06-19 11:00:45 -040028 config.vm.synced_folder "../..", "/cord", type: "rsync", rsync__exclude: [".git", "venv-linux", "install/volthaInstaller", "install/volthaInstaller-2"], rsync__args: ["--verbose", "--archive", "--delete", "-z", "--links"]
Sergio Slobodrian7c483622017-06-13 15:51:34 -040029 else
30 config.vm.synced_folder "../..", "/cord", type: "nfs"
31 end
Sergio Slobodrianbf77c862017-06-08 13:24:27 -040032 end
Zsolt Haraszti3d163532016-09-08 15:57:32 -070033 else
Sergio Slobodrian2f1a3f82017-05-31 10:35:00 -040034 puts("Configuring for other")
alshabibeef9b132017-02-02 17:46:51 -080035 config.vm.synced_folder "../..", "/cord"
Sergio Slobodrian2f1a3f82017-05-31 10:35:00 -040036 Box = "ubuntu/xenial64"
37 Provider = "virtualbox"
Zsolt Haraszti3d163532016-09-08 15:57:32 -070038 end
39
Sergio Slobodrian7c483622017-06-13 15:51:34 -040040 config.vm.define "#{settings['server_name']}" do |d|
Zsolt Haraszti3d163532016-09-08 15:57:32 -070041 d.ssh.forward_agent = true
Sergio Slobodrian2f1a3f82017-05-31 10:35:00 -040042 d.vm.box = Box
Sergio Slobodrian7c483622017-06-13 15:51:34 -040043 d.vm.hostname = "#{settings['server_name']}"
Zsolt Haraszti3d163532016-09-08 15:57:32 -070044 d.vm.network "private_network", ip: "10.100.198.220"
45 d.vm.provision :shell, path: "ansible/scripts/bootstrap_ansible.sh"
alshabibeef9b132017-02-02 17:46:51 -080046 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 Slobodrian2f1a3f82017-05-31 10:35:00 -040048 d.vm.provider Provider do |v|
Zsolt Haraszti9b485fb2016-12-26 23:11:15 -080049 v.memory = 6144
Sergio Slobodriancab0a392017-07-13 08:42:10 -040050 v.cpus = 4
Zsolt Haraszti3d163532016-09-08 15:57:32 -070051 end
52 end
53
54 if Vagrant.has_plugin?("vagrant-cachier")
55 config.cache.scope = :box
56 end
57
58end