Zsolt Haraszti | ec7df10 | 2016-05-05 13:34:18 -0700 | [diff] [blame] | 1 | # -*- mode: ruby -*- |
| 2 | # vi: set ft=ruby : |
| 3 | |
| 4 | Vagrant.configure(2) do |config| |
| 5 | |
| 6 | if (/cygwin|mswin|mingw|bccwin|wince|emx/ =~ RUBY_PLATFORM) != nil |
alshabib | b6ae086 | 2016-08-26 10:55:48 -0700 | [diff] [blame] | 7 | config.vm.synced_folder "..", "/cord", mount_options: ["dmode=700,fmode=600"] |
Zsolt Haraszti | ec7df10 | 2016-05-05 13:34:18 -0700 | [diff] [blame] | 8 | else |
alshabib | b6ae086 | 2016-08-26 10:55:48 -0700 | [diff] [blame] | 9 | config.vm.synced_folder "..", "/cord" |
Zsolt Haraszti | ec7df10 | 2016-05-05 13:34:18 -0700 | [diff] [blame] | 10 | end |
| 11 | |
| 12 | config.vm.define "corddev" do |d| |
Zsolt Haraszti | 5b5a42a | 2016-05-12 22:19:57 -0700 | [diff] [blame] | 13 | d.ssh.forward_agent = true |
Zsolt Haraszti | ec7df10 | 2016-05-05 13:34:18 -0700 | [diff] [blame] | 14 | d.vm.box = "ubuntu/trusty64" |
| 15 | d.vm.hostname = "corddev" |
| 16 | d.vm.network "private_network", ip: "10.100.198.200" |
| 17 | d.vm.provision :shell, path: "scripts/bootstrap_ansible.sh" |
alshabib | b6ae086 | 2016-08-26 10:55:48 -0700 | [diff] [blame] | 18 | d.vm.provision :shell, inline: "PYTHONUNBUFFERED=1 ansible-playbook /cord/build/ansible/corddev.yml -c local" |
Zsolt Haraszti | ec7df10 | 2016-05-05 13:34:18 -0700 | [diff] [blame] | 19 | d.vm.provider "virtualbox" do |v| |
| 20 | v.memory = 2048 |
| 21 | end |
Andy Bavier | 99c11d3 | 2016-09-14 17:21:20 -0400 | [diff] [blame] | 22 | d.vm.provider :libvirt do |domain| |
| 23 | d.vm.synced_folder '../', '/cord', type: 'rsync', rsync__args: ["--verbose", "--archive", "--delete", "-z"] |
| 24 | d.vm.synced_folder '.', '/vagrant', type: 'rsync', disabled: true |
| 25 | domain.memory = 2048 |
| 26 | end |
Zsolt Haraszti | ec7df10 | 2016-05-05 13:34:18 -0700 | [diff] [blame] | 27 | end |
| 28 | |
| 29 | config.vm.define "prod" do |d| |
| 30 | d.vm.box = "ubuntu/trusty64" |
David K. Bainbridge | d506aa6 | 2016-06-22 16:06:39 -0700 | [diff] [blame] | 31 | d.vm.synced_folder '.', '/vagrant', disable: true |
Zsolt Haraszti | ec7df10 | 2016-05-05 13:34:18 -0700 | [diff] [blame] | 32 | d.vm.hostname = "prod" |
| 33 | d.vm.network "private_network", ip: "10.100.198.201" |
David K. Bainbridge | 6f2cbe7 | 2016-08-19 15:48:07 -0700 | [diff] [blame] | 34 | d.vm.network "private_network", ip: "0.0.0.0", virtualbox__intnet: "cord-test-network" |
| 35 | d.vm.provision :shell, path: "scripts/bootstrap_ansible.sh" |
alshabib | b6ae086 | 2016-08-26 10:55:48 -0700 | [diff] [blame] | 36 | d.vm.provision :shell, inline: "PYTHONUNBUFFERED=1 ansible-playbook /cord/build/ansible/prod.yml -c local" |
Zsolt Haraszti | ec7df10 | 2016-05-05 13:34:18 -0700 | [diff] [blame] | 37 | d.vm.provider "virtualbox" do |v| |
David K. Bainbridge | 97b3f2f | 2016-06-16 18:08:49 -0700 | [diff] [blame] | 38 | v.memory = 2048 |
| 39 | end |
| 40 | end |
| 41 | |
David K. Bainbridge | d506aa6 | 2016-06-22 16:06:39 -0700 | [diff] [blame] | 42 | config.vm.define "switch" do |s| |
| 43 | s.vm.box = "ubuntu/trusty64" |
| 44 | s.vm.hostname = "fakeswitch" |
| 45 | s.vm.network "private_network", ip: "10.100.198.253" |
| 46 | s.vm.network "private_network", |
| 47 | type: "dhcp", |
| 48 | virtualbox__intnet: "cord-test-network", |
| 49 | mac: "cc37ab000001" |
| 50 | s.vm.provision :shell, path: "scripts/bootstrap_ansible.sh" |
alshabib | b6ae086 | 2016-08-26 10:55:48 -0700 | [diff] [blame] | 51 | s.vm.provision :shell, inline: "PYTHONUNBUFFERED=1 ansible-playbook /cord/build/ansible/fakeswitch.yml -c local" |
David K. Bainbridge | d506aa6 | 2016-06-22 16:06:39 -0700 | [diff] [blame] | 52 | s.vm.provider "virtualbox" do |v| |
David K. Bainbridge | 97b3f2f | 2016-06-16 18:08:49 -0700 | [diff] [blame] | 53 | v.memory = 1048 |
David K. Bainbridge | d506aa6 | 2016-06-22 16:06:39 -0700 | [diff] [blame] | 54 | v.name = "fakeswitch" |
| 55 | end |
| 56 | end |
| 57 | |
alshabib | cb8e09b | 2016-09-06 11:41:29 -0700 | [diff] [blame] | 58 | config.vm.define "testbox" do |d| |
| 59 | d.vm.box = "fgrehm/trusty64-lxc" |
| 60 | d.ssh.forward_agent = true |
| 61 | d.vm.hostname = "testbox" |
| 62 | d.vm.network "private_network", ip: "10.0.3.100", lxc__bridge_name: 'lxcbr0' |
| 63 | d.vm.provision :shell, path: "scripts/bootstrap_ansible.sh" |
| 64 | d.vm.provision :shell, inline: "PYTHONUNBUFFERED=1 ansible-playbook /cord/build/ansible/corddev.yml -c local" |
| 65 | config.vm.provider :lxc do |lxc| |
| 66 | # Same effect as 'customize ["modifyvm", :id, "--memory", "1024"]' for VirtualBox |
| 67 | lxc.customize 'cgroup.memory.limit_in_bytes', '2048M' |
alshabib | 270d766 | 2016-09-06 14:09:18 -0700 | [diff] [blame] | 68 | lxc.customize 'aa_profile', 'unconfined' |
| 69 | lxc.customize 'cgroup.devices.allow', 'b 7:* rwm' |
| 70 | lxc.customize 'cgroup.devices.allow', 'c 10:237 rwm' |
alshabib | cb8e09b | 2016-09-06 11:41:29 -0700 | [diff] [blame] | 71 | end |
| 72 | end |
| 73 | |
David K. Bainbridge | d506aa6 | 2016-06-22 16:06:39 -0700 | [diff] [blame] | 74 | (1..3).each do |i| |
| 75 | # Defining VM properties |
| 76 | config.vm.define "compute_node#{i}" do |c| |
| 77 | c.vm.box = "clink15/pxe" |
| 78 | c.vm.synced_folder '.', '/vagrant', disable: true |
| 79 | c.vm.communicator = "none" |
| 80 | c.vm.hostname = "computenode" |
| 81 | c.vm.network "private_network", |
| 82 | adapter: "1", |
| 83 | type: "dhcp", |
| 84 | auto_config: false, |
| 85 | virtualbox__intnet: "cord-test-network" |
| 86 | c.vm.provider "virtualbox" do |v| |
| 87 | v.name = "compute_node#{i}" |
| 88 | v.memory = 1048 |
| 89 | v.gui = "true" |
| 90 | end |
Zsolt Haraszti | ec7df10 | 2016-05-05 13:34:18 -0700 | [diff] [blame] | 91 | end |
| 92 | end |
| 93 | |
Andy Bavier | 99c11d3 | 2016-09-14 17:21:20 -0400 | [diff] [blame] | 94 | # Libvirt compute node |
| 95 | # Not able to merge with virtualbox config for compute nodes above |
| 96 | # Issue is that here no box and no private network are specified |
| 97 | config.vm.define "compute_node" do |c| |
| 98 | c.vm.synced_folder '.', '/vagrant', disable: true |
| 99 | c.vm.communicator = "none" |
| 100 | c.vm.hostname = "computenode" |
| 101 | c.vm.network "public_network", |
| 102 | adapter: 1, |
| 103 | auto_config: false, |
| 104 | dev: "mgmtbr", |
| 105 | mode: "bridge", |
| 106 | type: "bridge" |
| 107 | c.vm.provider :libvirt do |domain| |
| 108 | domain.memory = 8192 |
| 109 | domain.cpus = 4 |
| 110 | domain.machine_virtual_size = 100 |
| 111 | domain.storage :file, :size => '100G', :type => 'qcow2' |
| 112 | domain.boot 'network' |
| 113 | domain.boot 'hd' |
| 114 | domain.nested = true |
| 115 | end |
| 116 | end |
| 117 | |
Zsolt Haraszti | ec7df10 | 2016-05-05 13:34:18 -0700 | [diff] [blame] | 118 | if Vagrant.has_plugin?("vagrant-cachier") |
| 119 | config.cache.scope = :box |
| 120 | end |
| 121 | |
| 122 | end |