blob: 691c3a148b86a99ae9e096cd164805bfe72e5ed6 [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
Andy Bavier2505f592016-11-11 15:58:55 -050013 #of compute nodes up to 2. If the number of compute nodes to be supported more
Srikanth Vavilapallib1c4da02016-11-17 15:24:28 -060014 #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"
Andy Bavier2505f592016-11-11 15:58:55 -050041 d.vm.network "forwarded_port", guest: 80, host: 80, host_ip: '*'
Zsolt Harasztiec7df102016-05-05 13:34:18 -070042 d.vm.network "private_network", ip: "10.100.198.201"
Andy Bavier2505f592016-11-11 15:58:55 -050043 d.vm.network "private_network",
44 ip: "0.0.0.0",
45 auto_config: false,
46 virtualbox__intnet: "cord-mgmt-network",
47 libvirt__network_name: "cord-mgmt-network",
48 libvirt__forward_mode: "none",
49 libvirt__dhcp_enabled: false
50 d.vm.network "private_network",
51 ip: "10.6.1.201", # To set up the 10.6.1.1 IP address on bridge
52 virtualbox__intnet: "cord-fabric-network",
53 libvirt__network_name: "cord-fabric-network",
54 libvirt__forward_mode: "nat",
55 libvirt__dhcp_enabled: false
David K. Bainbridge6f2cbe72016-08-19 15:48:07 -070056 d.vm.provision :shell, path: "scripts/bootstrap_ansible.sh"
alshabibb6ae0862016-08-26 10:55:48 -070057 d.vm.provision :shell, inline: "PYTHONUNBUFFERED=1 ansible-playbook /cord/build/ansible/prod.yml -c local"
Zsolt Harasztiec7df102016-05-05 13:34:18 -070058 d.vm.provider "virtualbox" do |v|
David K. Bainbridge97b3f2f2016-06-16 18:08:49 -070059 v.memory = 2048
60 end
Andy Bavier2505f592016-11-11 15:58:55 -050061 d.vm.provider :libvirt do |v, override|
62 v.memory = 16384
63 v.cpus = 8
64 v.storage :file, :size => '100G', :type => 'qcow2'
65 override.vm.provision :shell, inline: "PYTHONUNBUFFERED=1 ansible-playbook /cord/build/ansible/add-extra-drive.yml -c local"
66 end
David K. Bainbridge97b3f2f2016-06-16 18:08:49 -070067 end
68
David K. Bainbridged506aa62016-06-22 16:06:39 -070069 config.vm.define "switch" do |s|
70 s.vm.box = "ubuntu/trusty64"
71 s.vm.hostname = "fakeswitch"
72 s.vm.network "private_network", ip: "10.100.198.253"
73 s.vm.network "private_network",
74 type: "dhcp",
Andy Bavier2505f592016-11-11 15:58:55 -050075 virtualbox__intnet: "cord-fabric-network",
76 libvirt__network_name: "cord-fabric-network",
David K. Bainbridged506aa62016-06-22 16:06:39 -070077 mac: "cc37ab000001"
78 s.vm.provision :shell, path: "scripts/bootstrap_ansible.sh"
alshabibb6ae0862016-08-26 10:55:48 -070079 s.vm.provision :shell, inline: "PYTHONUNBUFFERED=1 ansible-playbook /cord/build/ansible/fakeswitch.yml -c local"
David K. Bainbridged506aa62016-06-22 16:06:39 -070080 s.vm.provider "virtualbox" do |v|
David K. Bainbridge97b3f2f2016-06-16 18:08:49 -070081 v.memory = 1048
David K. Bainbridged506aa62016-06-22 16:06:39 -070082 v.name = "fakeswitch"
83 end
84 end
85
alshabibcb8e09b2016-09-06 11:41:29 -070086 config.vm.define "testbox" do |d|
87 d.vm.box = "fgrehm/trusty64-lxc"
88 d.ssh.forward_agent = true
89 d.vm.hostname = "testbox"
90 d.vm.network "private_network", ip: "10.0.3.100", lxc__bridge_name: 'lxcbr0'
91 d.vm.provision :shell, path: "scripts/bootstrap_ansible.sh"
92 d.vm.provision :shell, inline: "PYTHONUNBUFFERED=1 ansible-playbook /cord/build/ansible/corddev.yml -c local"
93 config.vm.provider :lxc do |lxc|
94 # Same effect as 'customize ["modifyvm", :id, "--memory", "1024"]' for VirtualBox
95 lxc.customize 'cgroup.memory.limit_in_bytes', '2048M'
alshabib270d7662016-09-06 14:09:18 -070096 lxc.customize 'aa_profile', 'unconfined'
97 lxc.customize 'cgroup.devices.allow', 'b 7:* rwm'
98 lxc.customize 'cgroup.devices.allow', 'c 10:237 rwm'
alshabibcb8e09b2016-09-06 11:41:29 -070099 end
David K. Bainbridgea0a36e92016-10-13 18:05:33 -0700100 end
alshabibcb8e09b2016-09-06 11:41:29 -0700101
Srikanth Vavilapallib1c4da02016-11-17 15:24:28 -0600102 num_compute_nodes.times do |n|
Srikanth Vavilapallib1c4da02016-11-17 15:24:28 -0600103 config.vm.define "compute_node-#{n+1}" do |c|
104 compute_ip = compute_ips[n]
105 compute_index = n+1
106 c.vm.synced_folder '.', '/vagrant', disabled: true
107 c.vm.communicator = "none"
108 c.vm.hostname = "computenode-#{compute_index}"
Andy Bavier2505f592016-11-11 15:58:55 -0500109 c.vm.network "private_network",
Srikanth Vavilapallib1c4da02016-11-17 15:24:28 -0600110 adapter: 1,
Andy Bavier2505f592016-11-11 15:58:55 -0500111 ip: "0.0.0.0",
Srikanth Vavilapallib1c4da02016-11-17 15:24:28 -0600112 auto_config: false,
Andy Bavier2505f592016-11-11 15:58:55 -0500113 virtualbox__intnet: "cord-mgmt-network",
114 libvirt__network_name: "cord-mgmt-network"
Srikanth Vavilapallib1c4da02016-11-17 15:24:28 -0600115 c.vm.network "private_network",
116 adapter: 2,
Andy Bavier2505f592016-11-11 15:58:55 -0500117 ip: "#{compute_ip}",
118 auto_config: false,
119 virtualbox__intnet: "cord-fabric-network",
120 libvirt__network_name: "cord-fabric-network",
121 libvirt__forward_mode: "nat",
122 libvirt__dhcp_enabled: false
123 c.vm.provider :libvirt do |v|
124 v.memory = 8192
125 v.cpus = 4
126 v.machine_virtual_size = 100
127 v.storage :file, :size => '100G', :type => 'qcow2'
128 v.boot 'network'
129 v.boot 'hd'
130 v.nested = true
131 end
132 c.vm.provider "virtualbox" do |v, override|
133 override.vm.box = "clink15/pxe"
134 v.memory = 1048
135 v.gui = "true"
Srikanth Vavilapallib1c4da02016-11-17 15:24:28 -0600136 end
Andy Bavier99c11d32016-09-14 17:21:20 -0400137 end
138 end
139
Zsolt Harasztiec7df102016-05-05 13:34:18 -0700140 if Vagrant.has_plugin?("vagrant-cachier")
141 config.cache.scope = :box
142 end
143
144end