-
Notifications
You must be signed in to change notification settings - Fork 108
Vagrantfile example: Multi machine, essential options only. (documentation removed)
Jonathan Senkerik edited this page Mar 5, 2020
·
3 revisions
Multimachines are a bit tricky to configure, so here is a simple example to create two different VM's with different settings.
- The nodes object has an entry for each node.
- In this example, there is two nodes (names). "vm-multi1" & "vm-multi2"
- Each node can have it's own settings (cfg).
- In this example, the box, number of vcpus, memory and storage size.
nodes = {
"vm-multi1" => ["hashicorp/precise64", 1, 1024, 21 ],
"vm-multi2" => ["generic/centos7", 2, 2048, 22 ],
}
Vagrant.configure(2) do |config|
nodes.each do | (name, cfg) |
box, numvcpus, memory, storage = cfg
config.vm.define name do |machine|
machine.vm.box = box
machine.vm.hostname = name
machine.vm.synced_folder('.', '/Vagrantfiles', type: 'rsync')
machine.vm.provider :vmware_esxi do |esxi|
esxi.esxi_hostname = 'esxi'
esxi.esxi_username = 'root'
esxi.esxi_password = 'file:'
esxi.esxi_virtual_network = "VM Network"
esxi.guest_numvcpus = numvcpus
esxi.guest_memsize = memory
esxi.guest_storage = storage
#esxi.clone_from_vm = box
esxi.local_allow_overwrite = 'True'
end
end
end
end