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 |
| 22 | end |
| 23 | |
| 24 | config.vm.define "prod" do |d| |
| 25 | d.vm.box = "ubuntu/trusty64" |
David K. Bainbridge | d506aa6 | 2016-06-22 16:06:39 -0700 | [diff] [blame] | 26 | d.vm.synced_folder '.', '/vagrant', disable: true |
Zsolt Haraszti | ec7df10 | 2016-05-05 13:34:18 -0700 | [diff] [blame] | 27 | d.vm.hostname = "prod" |
| 28 | d.vm.network "private_network", ip: "10.100.198.201" |
David K. Bainbridge | 6f2cbe7 | 2016-08-19 15:48:07 -0700 | [diff] [blame] | 29 | d.vm.network "private_network", ip: "0.0.0.0", virtualbox__intnet: "cord-test-network" |
| 30 | d.vm.provision :shell, path: "scripts/bootstrap_ansible.sh" |
alshabib | b6ae086 | 2016-08-26 10:55:48 -0700 | [diff] [blame] | 31 | 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] | 32 | d.vm.provider "virtualbox" do |v| |
David K. Bainbridge | 97b3f2f | 2016-06-16 18:08:49 -0700 | [diff] [blame] | 33 | v.memory = 2048 |
| 34 | end |
| 35 | end |
| 36 | |
David K. Bainbridge | d506aa6 | 2016-06-22 16:06:39 -0700 | [diff] [blame] | 37 | config.vm.define "switch" do |s| |
| 38 | s.vm.box = "ubuntu/trusty64" |
| 39 | s.vm.hostname = "fakeswitch" |
| 40 | s.vm.network "private_network", ip: "10.100.198.253" |
| 41 | s.vm.network "private_network", |
| 42 | type: "dhcp", |
| 43 | virtualbox__intnet: "cord-test-network", |
| 44 | mac: "cc37ab000001" |
| 45 | s.vm.provision :shell, path: "scripts/bootstrap_ansible.sh" |
alshabib | b6ae086 | 2016-08-26 10:55:48 -0700 | [diff] [blame] | 46 | 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] | 47 | s.vm.provider "virtualbox" do |v| |
David K. Bainbridge | 97b3f2f | 2016-06-16 18:08:49 -0700 | [diff] [blame] | 48 | v.memory = 1048 |
David K. Bainbridge | d506aa6 | 2016-06-22 16:06:39 -0700 | [diff] [blame] | 49 | v.name = "fakeswitch" |
| 50 | end |
| 51 | end |
| 52 | |
alshabib | 26309c3 | 2016-09-02 18:04:16 -0700 | [diff] [blame] | 53 | config.vm.define "testbox" do |d| |
alshabib | f72cab0 | 2016-09-02 18:42:19 -0700 | [diff] [blame^] | 54 | d.vm.box = "fgrehm/trusty64-lxc" |
alshabib | 26309c3 | 2016-09-02 18:04:16 -0700 | [diff] [blame] | 55 | d.ssh.forward_agent = true |
| 56 | d.vm.hostname = "testbox" |
alshabib | a97ccaf | 2016-09-02 18:33:47 -0700 | [diff] [blame] | 57 | d.vm.network "private_network", ip: "10.0.3.100", lxc__bridge_name: 'lxcbr0' |
alshabib | 26309c3 | 2016-09-02 18:04:16 -0700 | [diff] [blame] | 58 | d.vm.provision :shell, path: "scripts/bootstrap_ansible.sh" |
| 59 | d.vm.provision :shell, inline: "PYTHONUNBUFFERED=1 ansible-playbook /cord/build/ansible/corddev.yml -c local" |
| 60 | config.vm.provider :lxc do |lxc| |
| 61 | # Same effect as 'customize ["modifyvm", :id, "--memory", "1024"]' for VirtualBox |
| 62 | lxc.customize 'cgroup.memory.limit_in_bytes', '2048M' |
| 63 | end |
| 64 | end |
| 65 | |
David K. Bainbridge | d506aa6 | 2016-06-22 16:06:39 -0700 | [diff] [blame] | 66 | (1..3).each do |i| |
| 67 | # Defining VM properties |
| 68 | config.vm.define "compute_node#{i}" do |c| |
| 69 | c.vm.box = "clink15/pxe" |
| 70 | c.vm.synced_folder '.', '/vagrant', disable: true |
| 71 | c.vm.communicator = "none" |
| 72 | c.vm.hostname = "computenode" |
| 73 | c.vm.network "private_network", |
| 74 | adapter: "1", |
| 75 | type: "dhcp", |
| 76 | auto_config: false, |
| 77 | virtualbox__intnet: "cord-test-network" |
| 78 | c.vm.provider "virtualbox" do |v| |
| 79 | v.name = "compute_node#{i}" |
| 80 | v.memory = 1048 |
| 81 | v.gui = "true" |
| 82 | end |
Zsolt Haraszti | ec7df10 | 2016-05-05 13:34:18 -0700 | [diff] [blame] | 83 | end |
| 84 | end |
| 85 | |
| 86 | if Vagrant.has_plugin?("vagrant-cachier") |
| 87 | config.cache.scope = :box |
| 88 | end |
| 89 | |
| 90 | end |