Vagrant.configure("2") do |config|
# Hostmanager updates hosts files of all the machines with all hostnames and IP addresses.
config.hostmanager.enabled = true
config.hostmanager.manage_guest = true
config.hostmanager.include_offline = true
config.vm.network :forwarded_port, guest: 22, host: 2222, host_ip: "0.0.0.0", id: "ssh", auto_correct: true
hosts = {
"vm1" => "10.55.13.8",
"vm2" => "10.55.13.9",
"vm3" => "10.55.13.10",
"vm4" => "10.55.13.11",
"vm5" => "10.55.13.12",
"vm6" => "10.55.13.13"
}
(hosts).each do |name, ip|
config.vm.define "#{name}" do |node|
node.vm.box = "rhel6-base"
node.vm.network "private_network", ip: "#{ip}",
virtualbox__intnet: "NatNetwork"
config.vm.network "public_network", bridge: "eno2"
node.vm.hostname = "#{name}"
node.vm.provider :virtualbox do |vb|
vb.customize ["modifyvm", :id, "--memory", "1024"]
vb.customize ["modifyvm", :id, "--cpus", "2"]
end
end
end
end