forked from OpenStackCookbook/OpenStackCookbook
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathVagrantfile
70 lines (60 loc) · 2.51 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
# -*- mode: ruby -*-
# vi: set ft=ruby :
nodes = {
'proxy' => [1, 110],
'controller' => [1, 200],
'network' => [1, 202],
'compute' => [1, 201],
'swift' => [1, 210],
'cinder' => [1, 211],
}
Vagrant.configure("2") do |config|
config.vm.box = "precise64"
config.vm.box_url = "http://files.vagrantup.com/precise64.box"
#Default is 2200..something, but port 2200 is used by forescout NAC agent.
config.vm.usable_port_range= 2800..2900
# Sync folder for proxy cache
# config.vm.synced_folder "apt-cacher-ng/", "/var/cache/apt-cacher-ng"
nodes.each do |prefix, (count, ip_start)|
count.times do |i|
#hostname = "%s-%02d" % [prefix, (i+1)]
hostname = "%s" % [prefix, (i+1)]
config.vm.define "#{hostname}" do |box|
box.vm.hostname = "#{hostname}.book"
box.vm.network :private_network, ip: "172.16.0.#{ip_start+i}", :netmask => "255.255.0.0"
box.vm.network :private_network, ip: "10.10.0.#{ip_start+i}", :netmask => "255.255.0.0"
box.vm.network :private_network, ip: "192.168.100.#{ip_start+i}", :netmask => "255.255.255.0"
box.vm.provision :shell, :path => "#{prefix}.sh"
# If using Fusion
box.vm.provider :vmware_fusion do |v|
v.vmx["memsize"] = 1024
if prefix == "compute"
v.vmx["memsize"] = 2048
elsif prefix == "proxy"
v.vmx["memsize"] = 512
end
end
# Otherwise 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 == "controller"
vbox.customize ["modifyvm", :id, "--memory", 2048]
elsif prefix == "network"
vbox.customize ["modifyvm", :id, "--memory", 1024]
vbox.customize ["modifyvm", :id, "--nicpromisc4", "allow-all"]
elsif prefix == "proxy"
vbox.customize ["modifyvm", :id, "--memory", 512]
elsif prefix == "swift"
vbox.customize ["modifyvm", :id, "--memory", 2048]
end
end
end
end
end
end