-
Notifications
You must be signed in to change notification settings - Fork 13
/
Vagrantfile
104 lines (92 loc) · 3.77 KB
/
Vagrantfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
# -*- mode: ruby -*-
# vi: set ft=ruby :
require 'securerandom'
# remove the 'client' entry to below to save on host resources
nodes = {
'controller' => [1, 200],
'compute' => [1, 201],
'cinder' => [1, 211],
'quantum' => [1, 202],
'client' => [1, 100],
}
# This is some magic to help avoid network collisions.
# If however, it still collides, or if you need to vagrant up machines one at a time, comment out this line and uncomment the one below it
#third_octet = SecureRandom.random_number(200)
third_octet = 80
Vagrant.configure("2") do |config|
# We assume virtualbox, if using Fusion, you'll want to change this as needed
config.vm.box = "precise64"
config.vm.box_url = "http://files.vagrantup.com/precise64.box"
config.vm.provider "vmware_fusion" do |v, override|
override.vm.box = "precise64"
override.vm.box_url = "http://grahamc.com/vagrant/ubuntu-12.04.2-server-amd64-vmware-fusion.box"
override.vm.synced_folder ".", "/vagrant", type: "nfs"
# Fusion Performance Hacks
v.vmx["logging"] = "FALSE"
v.vmx["MemTrimRate"] = "0"
v.vmx["MemAllowAutoScaleDown"] = "FALSE"
v.vmx["mainMem.backing"] = "swap"
v.vmx["sched.mem.pshare.enable"] = "FALSE"
v.vmx["snapshot.disabled"] = "TRUE"
v.vmx["isolation.tools.unity.disable"] = "TRUE"
v.vmx["unity.allowCompostingInGuest"] = "FALSE"
v.vmx["unity.enableLaunchMenu"] = "FALSE"
v.vmx["unity.showBadges"] = "FALSE"
v.vmx["unity.showBorders"] = "FALSE"
v.vmx["unity.wasCapable"] = "FALSE"
end
nodes.each do |prefix, (count, ip_start)|
count.times do |i|
hostname = "%s" % [prefix, (i+1)]
config.vm.define "#{hostname}" do |box|
box.vm.hostname = "#{hostname}.book"
box.vm.network :private_network, ip: "172.16.#{third_octet}.#{ip_start+i}", :netmask => "255.255.0.0"
box.vm.network :private_network, ip: "10.10.#{third_octet}.#{ip_start+i}", :netmask => "255.255.0.0"
box.vm.network :private_network, ip: "192.168.#{third_octet}.#{ip_start+i}", :netmask => "255.255.255.0"
# Run the Shell Provisioning Script file
box.vm.provision :shell, :path => "#{prefix}.sh"
# If using VMware Fusion
box.vm.provider :vmware_fusion do |v|
# Default
v.vmx["memsize"] = 1024
if prefix == "compute"
v.vmx["memsize"] = 3128
v.vmx["numvcpus"] = 2
elsif prefix == "controller"
v.vmx["memsize"] = 2048
elsif prefix == "client" or prefix == "proxy"
v.vmx["memsize"] = 512
end
end
# If using VMware Workstation
box.vm.provider :vmware_workstation do |v|
# Default
v.vmx["memsize"] = 1024
if prefix == "compute"
v.vmx["memsize"] = 3128
v.vmx["numvcpus"] = 2
elsif prefix == "controller"
v.vmx["memsize"] = 2048
elsif prefix == "client" or prefix == "proxy"
v.vmx["memsize"] = 512
end
end
# If using VirtualBox
box.vm.provider :virtualbox do |vbox|
# Defaults
vbox.customize ["modifyvm", :id, "--memory", 1024]
vbox.customize ["modifyvm", :id, "--cpus", 1]
if prefix == "compute"
vbox.customize ["modifyvm", :id, "--memory", 3128]
vbox.customize ["modifyvm", :id, "--cpus", 2]
vbox.customize ["modifyvm", :id, "--nicpromisc4", "allow-all"]
elsif prefix == "client" or prefix == "proxy"
vbox.customize ["modifyvm", :id, "--memory", 512]
elsif prefix == "quantum"
vbox.customize ["modifyvm", :id, "--nicpromisc4", "allow-all"]
end
end
end
end
end
end