blob: 2044f7da87ec55244c64ea330ffb25327262fee4 [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
12 config.vm.define "corddev" do |d|
Zsolt Haraszti5b5a42a2016-05-12 22:19:57 -070013 d.ssh.forward_agent = true
Zsolt Harasztiec7df102016-05-05 13:34:18 -070014 d.vm.box = "ubuntu/trusty64"
Andy Bavier8ce395f2016-10-14 12:51:30 -040015 d.vm.synced_folder '.', '/vagrant', disable: true
Zsolt Harasztiec7df102016-05-05 13:34:18 -070016 d.vm.hostname = "corddev"
17 d.vm.network "private_network", ip: "10.100.198.200"
David K. Bainbridge0bdec192016-10-13 18:10:10 -070018 d.vm.provision :shell, path: "scripts/bootstrap_ansible.sh"
19 d.vm.provision :shell, inline: "PYTHONUNBUFFERED=1 ansible-playbook /cord/build/ansible/corddev.yml -c local"
Zsolt Harasztiec7df102016-05-05 13:34:18 -070020 d.vm.provider "virtualbox" do |v|
21 v.memory = 2048
22 end
Andy Bavier8ce395f2016-10-14 12:51:30 -040023 d.vm.provider :libvirt do |v|
24 v.memory = 2048
Andy Bavier99c11d32016-09-14 17:21:20 -040025 end
Zsolt Harasztiec7df102016-05-05 13:34:18 -070026 end
27
28 config.vm.define "prod" do |d|
29 d.vm.box = "ubuntu/trusty64"
David K. Bainbridged506aa62016-06-22 16:06:39 -070030 d.vm.synced_folder '.', '/vagrant', disable: true
Zsolt Harasztiec7df102016-05-05 13:34:18 -070031 d.vm.hostname = "prod"
32 d.vm.network "private_network", ip: "10.100.198.201"
David K. Bainbridge6f2cbe72016-08-19 15:48:07 -070033 d.vm.network "private_network", ip: "0.0.0.0", virtualbox__intnet: "cord-test-network"
34 d.vm.provision :shell, path: "scripts/bootstrap_ansible.sh"
alshabibb6ae0862016-08-26 10:55:48 -070035 d.vm.provision :shell, inline: "PYTHONUNBUFFERED=1 ansible-playbook /cord/build/ansible/prod.yml -c local"
Zsolt Harasztiec7df102016-05-05 13:34:18 -070036 d.vm.provider "virtualbox" do |v|
David K. Bainbridge97b3f2f2016-06-16 18:08:49 -070037 v.memory = 2048
38 end
39 end
40
David K. Bainbridged506aa62016-06-22 16:06:39 -070041 config.vm.define "switch" do |s|
42 s.vm.box = "ubuntu/trusty64"
43 s.vm.hostname = "fakeswitch"
44 s.vm.network "private_network", ip: "10.100.198.253"
45 s.vm.network "private_network",
46 type: "dhcp",
47 virtualbox__intnet: "cord-test-network",
48 mac: "cc37ab000001"
49 s.vm.provision :shell, path: "scripts/bootstrap_ansible.sh"
alshabibb6ae0862016-08-26 10:55:48 -070050 s.vm.provision :shell, inline: "PYTHONUNBUFFERED=1 ansible-playbook /cord/build/ansible/fakeswitch.yml -c local"
David K. Bainbridged506aa62016-06-22 16:06:39 -070051 s.vm.provider "virtualbox" do |v|
David K. Bainbridge97b3f2f2016-06-16 18:08:49 -070052 v.memory = 1048
David K. Bainbridged506aa62016-06-22 16:06:39 -070053 v.name = "fakeswitch"
54 end
55 end
56
alshabibcb8e09b2016-09-06 11:41:29 -070057 config.vm.define "testbox" do |d|
58 d.vm.box = "fgrehm/trusty64-lxc"
59 d.ssh.forward_agent = true
60 d.vm.hostname = "testbox"
61 d.vm.network "private_network", ip: "10.0.3.100", lxc__bridge_name: 'lxcbr0'
62 d.vm.provision :shell, path: "scripts/bootstrap_ansible.sh"
63 d.vm.provision :shell, inline: "PYTHONUNBUFFERED=1 ansible-playbook /cord/build/ansible/corddev.yml -c local"
64 config.vm.provider :lxc do |lxc|
65 # Same effect as 'customize ["modifyvm", :id, "--memory", "1024"]' for VirtualBox
66 lxc.customize 'cgroup.memory.limit_in_bytes', '2048M'
alshabib270d7662016-09-06 14:09:18 -070067 lxc.customize 'aa_profile', 'unconfined'
68 lxc.customize 'cgroup.devices.allow', 'b 7:* rwm'
69 lxc.customize 'cgroup.devices.allow', 'c 10:237 rwm'
alshabibcb8e09b2016-09-06 11:41:29 -070070 end
David K. Bainbridgea0a36e92016-10-13 18:05:33 -070071 end
alshabibcb8e09b2016-09-06 11:41:29 -070072
David K. Bainbridged506aa62016-06-22 16:06:39 -070073 (1..3).each do |i|
74 # Defining VM properties
75 config.vm.define "compute_node#{i}" do |c|
76 c.vm.box = "clink15/pxe"
77 c.vm.synced_folder '.', '/vagrant', disable: true
78 c.vm.communicator = "none"
79 c.vm.hostname = "computenode"
80 c.vm.network "private_network",
81 adapter: "1",
82 type: "dhcp",
83 auto_config: false,
84 virtualbox__intnet: "cord-test-network"
85 c.vm.provider "virtualbox" do |v|
86 v.name = "compute_node#{i}"
87 v.memory = 1048
88 v.gui = "true"
89 end
Zsolt Harasztiec7df102016-05-05 13:34:18 -070090 end
91 end
92
Andy Bavier99c11d32016-09-14 17:21:20 -040093 # Libvirt compute node
94 # Not able to merge with virtualbox config for compute nodes above
95 # Issue is that here no box and no private network are specified
96 config.vm.define "compute_node" do |c|
97 c.vm.synced_folder '.', '/vagrant', disable: true
98 c.vm.communicator = "none"
99 c.vm.hostname = "computenode"
100 c.vm.network "public_network",
101 adapter: 1,
102 auto_config: false,
103 dev: "mgmtbr",
104 mode: "bridge",
105 type: "bridge"
Andy Bavierb5796fb2016-10-20 12:06:47 -0400106 c.vm.network "private_network",
107 adapter: 2,
108 ip: "10.6.1.2"
Andy Bavier99c11d32016-09-14 17:21:20 -0400109 c.vm.provider :libvirt do |domain|
110 domain.memory = 8192
111 domain.cpus = 4
112 domain.machine_virtual_size = 100
113 domain.storage :file, :size => '100G', :type => 'qcow2'
114 domain.boot 'network'
115 domain.boot 'hd'
116 domain.nested = true
117 end
118 end
119
Zsolt Harasztiec7df102016-05-05 13:34:18 -0700120 if Vagrant.has_plugin?("vagrant-cachier")
121 config.cache.scope = :box
122 end
123
124end