|
1 | 1 | #
|
2 | 2 | # Multi machine, essential options Vagrant file example. (documentation removed)
|
3 | 3 | #
|
| 4 | +nodes = { |
| 5 | + "vm-multi1" => ["hashicorp/precise64", 1, 1024, 21 ], |
| 6 | + "vm-multi2" => ["generic/centos7", 2, 2048, 22 ], |
| 7 | +} |
4 | 8 |
|
5 |
| -nodes = [ |
6 |
| - { hostname: 'VM-multi1', box: 'hashicorp/precise64' }, |
7 |
| - { hostname: 'VM-multi2', box: 'hashicorp/precise64' } |
8 |
| -] |
| 9 | +Vagrant.configure(2) do |config| |
| 10 | + nodes.each do | (name, cfg) | |
| 11 | + box, numvcpus, memory, storage = cfg |
9 | 12 |
|
10 |
| -Vagrant.configure('2') do |config| |
11 |
| - nodes.each do |node| |
12 |
| - config.vm.define node[:hostname] do |node_config| |
13 |
| - node_config.vm.hostname = node[:hostname] |
14 |
| - node_config.vm.box = node[:box] |
15 |
| - node_config.vm.synced_folder('.', '/Vagrantfiles', type: 'rsync') |
16 |
| - end |
17 |
| - end |
| 13 | + config.vm.define name do |machine| |
| 14 | + machine.vm.box = box |
| 15 | + machine.vm.hostname = name |
| 16 | + machine.vm.synced_folder('.', '/Vagrantfiles', type: 'rsync') |
18 | 17 |
|
19 |
| - config.vm.provider :vmware_esxi do |esxi| |
20 |
| - # |
21 |
| - # Provider settings |
22 |
| - # |
23 |
| - esxi.esxi_hostname = 'esxi' |
24 |
| - esxi.esxi_username = 'root' |
25 |
| - esxi.esxi_password = 'file:' |
26 |
| - #esxi.esxi_hostport = 22 |
27 |
| - #esxi.esxi_virtual_network = 'vmnet_example' |
28 |
| - #esxi.esxi_disk_store = 'DS_001' |
29 |
| - #esxi.esxi_resource_pool = '/Vagrant' |
30 |
| - #esxi.guest_memsize = '2048' |
31 |
| - #esxi.guest_numvcpus = '2' |
| 18 | + machine.vm.provider :vmware_esxi do |esxi| |
| 19 | + esxi.esxi_hostname = 'esxi' |
| 20 | + esxi.esxi_username = 'root' |
| 21 | + esxi.esxi_password = 'file:' |
| 22 | + esxi.esxi_virtual_network = "VM Network" |
| 23 | + esxi.guest_numvcpus = numvcpus |
| 24 | + esxi.guest_memsize = memory |
| 25 | + esxi.guest_storage = storage |
| 26 | + #esxi.clone_from_vm = box |
| 27 | + esxi.local_allow_overwrite = 'True' |
| 28 | + |
| 29 | + end |
| 30 | + end |
32 | 31 | end
|
33 | 32 | end
|
0 commit comments