blob: fc1e459a569d918ca310fe639bdb06f6ab3baa77 [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");
24 config.vm.synced_folder "../..", "/cord", type: "nfs"
25 Box = "ubuntu1604"
26 Provider = "libvirt"
27 end
Zsolt Haraszti3d163532016-09-08 15:57:32 -070028 else
Sergio Slobodrian2f1a3f82017-05-31 10:35:00 -040029 puts("Configuring for other")
alshabibeef9b132017-02-02 17:46:51 -080030 config.vm.synced_folder "../..", "/cord"
Sergio Slobodrian2f1a3f82017-05-31 10:35:00 -040031 Box = "ubuntu/xenial64"
32 Provider = "virtualbox"
Zsolt Haraszti3d163532016-09-08 15:57:32 -070033 end
34
35 config.vm.define "voltha" do |d|
36 d.ssh.forward_agent = true
Sergio Slobodrian2f1a3f82017-05-31 10:35:00 -040037 d.vm.box = Box
Zsolt Haraszti3d163532016-09-08 15:57:32 -070038 d.vm.hostname = "voltha"
39 d.vm.network "private_network", ip: "10.100.198.220"
40 d.vm.provision :shell, path: "ansible/scripts/bootstrap_ansible.sh"
alshabibeef9b132017-02-02 17:46:51 -080041 d.vm.provision :shell, inline: "PYTHONUNBUFFERED=1 ansible-playbook /cord/incubator/voltha/ansible/voltha.yml -c local"
42 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 -040043 d.vm.provider Provider do |v|
Zsolt Haraszti9b485fb2016-12-26 23:11:15 -080044 v.memory = 6144
Zsolt Haraszti3d163532016-09-08 15:57:32 -070045 end
46 end
47
48 if Vagrant.has_plugin?("vagrant-cachier")
49 config.cache.scope = :box
50 end
51
52end