blob: ffa826e4fdd7581dbac8ed601287f693cfcbaf38 [file] [log] [blame]
Zsolt Harasztiec7df102016-05-05 13:34:18 -07001# -*- mode: ruby -*-
2# vi: set ft=ruby :
3
4Vagrant.configure(2) do |config|
5
6 if (/cygwin|mswin|mingw|bccwin|wince|emx/ =~ RUBY_PLATFORM) != nil
alshabibb6ae0862016-08-26 10:55:48 -07007 config.vm.synced_folder "..", "/cord", mount_options: ["dmode=700,fmode=600"]
Zsolt Harasztiec7df102016-05-05 13:34:18 -07008 else
alshabibb6ae0862016-08-26 10:55:48 -07009 config.vm.synced_folder "..", "/cord"
Zsolt Harasztiec7df102016-05-05 13:34:18 -070010 end
11
Srikanth Vavilapallib1c4da02016-11-17 15:24:28 -060012 #By default, this variable is set to 2, such that Vagrantfile allows creation
13 #of compute nodes up to 2. If the number of compute nodes to be supported more
14 #than 2, set the environment variable NUM_COMPUTE_NODES to the desired value
15 #before executing this Vagrantfile.
16 num_compute_nodes = (ENV['NUM_COMPUTE_NODES'] || 2).to_i
17 compute_ip_base = "10.6.1."
18 compute_ips = num_compute_nodes.times.collect { |n| compute_ip_base + "#{n+2}" }
19
Zsolt Harasztiec7df102016-05-05 13:34:18 -070020 config.vm.define "corddev" do |d|
Zsolt Haraszti5b5a42a2016-05-12 22:19:57 -070021 d.ssh.forward_agent = true
Zsolt Harasztiec7df102016-05-05 13:34:18 -070022 d.vm.box = "ubuntu/trusty64"
Andy Bavier5c2e4fa2016-10-31 13:50:52 -040023 d.vm.synced_folder '.', '/vagrant', disabled: true
Zsolt Harasztiec7df102016-05-05 13:34:18 -070024 d.vm.hostname = "corddev"
25 d.vm.network "private_network", ip: "10.100.198.200"
David K. Bainbridge0bdec192016-10-13 18:10:10 -070026 d.vm.provision :shell, path: "scripts/bootstrap_ansible.sh"
27 d.vm.provision :shell, inline: "PYTHONUNBUFFERED=1 ansible-playbook /cord/build/ansible/corddev.yml -c local"
Zsolt Harasztiec7df102016-05-05 13:34:18 -070028 d.vm.provider "virtualbox" do |v|
29 v.memory = 2048
30 end
Andy Bavier5c2e4fa2016-10-31 13:50:52 -040031 d.vm.provider :libvirt do |v, override|
Andy Bavier8ce395f2016-10-14 12:51:30 -040032 v.memory = 2048
Andy Bavier5c2e4fa2016-10-31 13:50:52 -040033 override.vm.synced_folder "..", "/cord", type: "nfs"
Andy Bavier99c11d32016-09-14 17:21:20 -040034 end
Zsolt Harasztiec7df102016-05-05 13:34:18 -070035 end
36
37 config.vm.define "prod" do |d|
38 d.vm.box = "ubuntu/trusty64"
Andy Bavier5c2e4fa2016-10-31 13:50:52 -040039 d.vm.synced_folder '.', '/vagrant', disabled: true
Zsolt Harasztiec7df102016-05-05 13:34:18 -070040 d.vm.hostname = "prod"
41 d.vm.network "private_network", ip: "10.100.198.201"
David K. Bainbridge6f2cbe72016-08-19 15:48:07 -070042 d.vm.network "private_network", ip: "0.0.0.0", virtualbox__intnet: "cord-test-network"
43 d.vm.provision :shell, path: "scripts/bootstrap_ansible.sh"
alshabibb6ae0862016-08-26 10:55:48 -070044 d.vm.provision :shell, inline: "PYTHONUNBUFFERED=1 ansible-playbook /cord/build/ansible/prod.yml -c local"
Zsolt Harasztiec7df102016-05-05 13:34:18 -070045 d.vm.provider "virtualbox" do |v|
David K. Bainbridge97b3f2f2016-06-16 18:08:49 -070046 v.memory = 2048
47 end
48 end
49
David K. Bainbridged506aa62016-06-22 16:06:39 -070050 config.vm.define "switch" do |s|
51 s.vm.box = "ubuntu/trusty64"
52 s.vm.hostname = "fakeswitch"
53 s.vm.network "private_network", ip: "10.100.198.253"
54 s.vm.network "private_network",
55 type: "dhcp",
56 virtualbox__intnet: "cord-test-network",
57 mac: "cc37ab000001"
58 s.vm.provision :shell, path: "scripts/bootstrap_ansible.sh"
alshabibb6ae0862016-08-26 10:55:48 -070059 s.vm.provision :shell, inline: "PYTHONUNBUFFERED=1 ansible-playbook /cord/build/ansible/fakeswitch.yml -c local"
David K. Bainbridged506aa62016-06-22 16:06:39 -070060 s.vm.provider "virtualbox" do |v|
David K. Bainbridge97b3f2f2016-06-16 18:08:49 -070061 v.memory = 1048
David K. Bainbridged506aa62016-06-22 16:06:39 -070062 v.name = "fakeswitch"
63 end
64 end
65
alshabibcb8e09b2016-09-06 11:41:29 -070066 config.vm.define "testbox" do |d|
67 d.vm.box = "fgrehm/trusty64-lxc"
68 d.ssh.forward_agent = true
69 d.vm.hostname = "testbox"
70 d.vm.network "private_network", ip: "10.0.3.100", lxc__bridge_name: 'lxcbr0'
71 d.vm.provision :shell, path: "scripts/bootstrap_ansible.sh"
72 d.vm.provision :shell, inline: "PYTHONUNBUFFERED=1 ansible-playbook /cord/build/ansible/corddev.yml -c local"
73 config.vm.provider :lxc do |lxc|
74 # Same effect as 'customize ["modifyvm", :id, "--memory", "1024"]' for VirtualBox
75 lxc.customize 'cgroup.memory.limit_in_bytes', '2048M'
alshabib270d7662016-09-06 14:09:18 -070076 lxc.customize 'aa_profile', 'unconfined'
77 lxc.customize 'cgroup.devices.allow', 'b 7:* rwm'
78 lxc.customize 'cgroup.devices.allow', 'c 10:237 rwm'
alshabibcb8e09b2016-09-06 11:41:29 -070079 end
David K. Bainbridgea0a36e92016-10-13 18:05:33 -070080 end
alshabibcb8e09b2016-09-06 11:41:29 -070081
David K. Bainbridged506aa62016-06-22 16:06:39 -070082 (1..3).each do |i|
83 # Defining VM properties
84 config.vm.define "compute_node#{i}" do |c|
85 c.vm.box = "clink15/pxe"
Andy Bavier5c2e4fa2016-10-31 13:50:52 -040086 c.vm.synced_folder '.', '/vagrant', disabled: true
David K. Bainbridged506aa62016-06-22 16:06:39 -070087 c.vm.communicator = "none"
88 c.vm.hostname = "computenode"
89 c.vm.network "private_network",
90 adapter: "1",
91 type: "dhcp",
92 auto_config: false,
93 virtualbox__intnet: "cord-test-network"
94 c.vm.provider "virtualbox" do |v|
95 v.name = "compute_node#{i}"
96 v.memory = 1048
97 v.gui = "true"
98 end
Zsolt Harasztiec7df102016-05-05 13:34:18 -070099 end
100 end
101
Srikanth Vavilapallib1c4da02016-11-17 15:24:28 -0600102 num_compute_nodes.times do |n|
103 # Libvirt compute node
104 # Not able to merge with virtualbox config for compute nodes above
105 # Issue is that here no box and no private network are specified
106 config.vm.define "compute_node-#{n+1}" do |c|
107 compute_ip = compute_ips[n]
108 compute_index = n+1
109 c.vm.synced_folder '.', '/vagrant', disabled: true
110 c.vm.communicator = "none"
111 c.vm.hostname = "computenode-#{compute_index}"
112 c.vm.network "public_network",
113 adapter: 1,
114 auto_config: false,
115 dev: "mgmtbr",
116 mode: "bridge",
117 type: "bridge"
118 c.vm.network "private_network",
119 adapter: 2,
120 ip: "#{compute_ip}"
121 c.vm.provider :libvirt do |domain|
122 domain.memory = 8192
123 domain.cpus = 4
124 domain.machine_virtual_size = 100
125 domain.storage :file, :size => '100G', :type => 'qcow2'
126 domain.boot 'network'
127 domain.boot 'hd'
128 domain.nested = true
129 end
Andy Bavier99c11d32016-09-14 17:21:20 -0400130 end
131 end
132
Zsolt Harasztiec7df102016-05-05 13:34:18 -0700133 if Vagrant.has_plugin?("vagrant-cachier")
134 config.cache.scope = :box
135 end
136
137end