-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathVagrantFile
40 lines (36 loc) · 2.61 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
# Works with vagrant 1.8.6 and virtual box 5.1.14
pocd_nodes = [
{ :host => "cm-571-template", :ip => "10.10.45.9", :box => "boxcutter/centos67", :version => "2.0.14", :ram => 512, :cpu => 2, :gui => false},
{ :host => "cm-571-template2", :ip => "10.10.45.10", :box => "boxcutter/centos67", :version => "2.0.14", :ram => 512, :cpu => 2, :gui => false},
{ :host => "cm-571-template3", :ip => "10.10.45.11", :box => "boxcutter/centos67", :version => "2.0.14", :ram => 512, :cpu => 2, :gui => false}
]
pocd_node = { :host => "cm-571-template", :ip => "10.10.45.9", :box => "boxcutter/centos67", :version => "2.0.14", :ram => 512, :cpu => 2, :gui => false}
varDomain = "poc-d.internal"
varRepository = "./REPOSITORY/"
Vagrant.configure("2") do |config| # Config variable here represents the vagrant system
config.hostmanager.enabled = true # Enables host manager
config.hostmanager.manage_host = true # Enables managing host file of machine vagrant is running on
config.hostmanager.manage_guest = true # Enables managing the host files on the guest machines
config.hostmanager.ignore_private_ip = false
config.hostmanager.include_offline = true
pocd_nodes.each do |pocd_node| # While loop that runs config for each pocd_node from pocd_nodes array
config.vm.define pocd_node[:host] do |pocd_config| # cm-571-template is name of node and pocd_config is a variable we can utilize to configure this specific virtual machine
pocd_config.vm.box = pocd_node[:box] # This variable points to an image file
pocd_config.vm.network "private_network", ip: pocd_node[:ip], :netmask => "255.255.255.0" # sets up network adapter (internal)
pocd_config.vm.hostname = "#{pocd_node[:host]}.#{varDomain}"
pocd_config.hostmanager.aliases = "#{pocd_node[:host]}" # Add this alias into the hosts file of THIS virtual machine in the loop
pocd_config.vm.box_version = pocd_node[:version]# Points to a specific verions of box cutter vm
pocd_config.vm.provider :virtualbox do |v| # go to provider, in this case virtual box
v.name = pocd_node[:host].to_s # makes the name in virtual box pretty
v.gui = pocd_node[:gui] # enable the providers gui
v.customize ["modifyvm", :id, "--memory", pocd_node[:ram].to_s ] # Manually set the ram the ram
v.customize ["modifyvm", :id, "--cpus", pocd_node[:cpu].to_s ] # Manually set the number of CPUs
end
pocd_config.vm.synced_folder varRepository, "/repository", # Sets synced folder for repository
id: "repository",
owner: "vagrant",
group: "vagrant"
pocd_config.vm.provision :shell, :path => "java/provision_for_java.sh" # Sets path for java directory to find provision script
end
end
end