forked from uksysadmin/openstack-client
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Vagrantfile
93 lines (79 loc) · 3.17 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
# -*- mode: ruby -*-
# vi: set ft=ruby :
nodes = {
'openstack-client' => [1, 199],
}
Vagrant.configure("2") do |config|
# Virtualbox
config.vm.box = "bunchc/trusty-x64"
config.vm.synced_folder ".", "/vagrant", type: "nfs"
# VMware Fusion / Workstation
config.vm.provider :vmware_fusion or config.vm.provider :vmware_workstation do |vmware, override|
override.vm.box = "bunchc/trusty-x64"
if Vagrant::Util::Platform.windows?
override.vm.synced_folder ".", "/vagrant", type: "smb"
else
override.vm.synced_folder ".", "/vagrant", type: "nfs"
end
# Fusion Performance Hacks
vmware.vmx["logging"] = "FALSE"
vmware.vmx["MemTrimRate"] = "0"
vmware.vmx["MemAllowAutoScaleDown"] = "FALSE"
vmware.vmx["mainMem.backing"] = "swap"
vmware.vmx["sched.mem.pshare.enable"] = "FALSE"
vmware.vmx["snapshot.disabled"] = "TRUE"
vmware.vmx["isolation.tools.unity.disable"] = "TRUE"
vmware.vmx["unity.allowCompostingInGuest"] = "FALSE"
vmware.vmx["unity.enableLaunchMenu"] = "FALSE"
vmware.vmx["unity.showBadges"] = "FALSE"
vmware.vmx["unity.showBorders"] = "FALSE"
vmware.vmx["unity.wasCapable"] = "FALSE"
vmware.vmx["vhv.enable"] = "TRUE"
end
#Default is 2200..something, but port 2200 is used by forescout NAC agent.
config.vm.usable_port_range= 2800..2900
unless Vagrant::Util::Platform.windows?
if Vagrant.has_plugin?("vagrant-cachier")
config.cache.scope = :box
config.cache.enable :apt
config.cache.synced_folder_opts = {
type: :nfs,
mount_options: ['rw', 'vers=3', 'tcp', 'nolock']
}
else
puts "[-] WARN: This would be much faster if you ran vagrant plugin install vagrant-cachier first"
end
end
nodes.each do |prefix, (count, ip_start)|
count.times do |i|
if prefix == "compute"
hostname = "%s-%02d" % [prefix, (i+1)]
else
hostname = "%s" % [prefix, (i+1)]
end
config.vm.define "#{hostname}" do |box|
box.vm.hostname = "#{hostname}.cook.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.255.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 or Workstation
box.vm.provider :vmware_fusion or box.vm.provider :vmware_workstation do |v|
v.vmx["memsize"] = 1024
end
# Otherwise using VirtualBox
box.vm.provider :virtualbox do |vbox|
# Things will fail if running Windows + VirtualBox without vbguest
if Vagrant::Util::Platform.windows?
unless Vagrant.has_plugin?("vagrant-vbguest")
raise 'Please install vagrant-vbguest. Running this environment under Windows will fail otherwise. Install with: vagrant plugin install vagrant-vbguest'
end
end
# Defaults
vbox.customize ["modifyvm", :id, "--memory", 1024]
vbox.customize ["modifyvm", :id, "--cpus", 1]
end
end
end
end
end