vagrant-vmware-esxi 1.1.7 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +20 -7
- data/example_box/Vagrantfile +3 -1
- data/example_box/Vagrantfile-multimachine +1 -1
- data/lib/vagrant-vmware-esxi/action/createvm.rb +48 -29
- data/lib/vagrant-vmware-esxi/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '0269af4374c1d658023f26ddfae4e1a053ca787c'
|
4
|
+
data.tar.gz: 4781afa7b1c5e2aca3266435da76fb36f7d39488
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f6a21947c2f23be0a15109090112cd84d22c6ae18b8a2e3334fba8e659947acfcb13c5dd582da3c09f33bde4d2e668e63778b1589bd21abaf1081a1159ca936e
|
7
|
+
data.tar.gz: 0b701c40c221893d32381197c51d7b2d8a8fd32075dc3ecee13350304db64446407fb0364a29e1384accf53d93ecfebbc41cbf8eb4b5c6ce68b18cbcda0cbf57
|
data/README.md
CHANGED
@@ -23,11 +23,12 @@ Features and Compatibility
|
|
23
23
|
|
24
24
|
Requirements
|
25
25
|
------------
|
26
|
-
1. This
|
26
|
+
1. This is a vagrant plugin, so you need vagrant installed... :-)
|
27
|
+
2. This plugin requires ovftool from VMware. Download from VMware website.
|
27
28
|
>https://www.vmware.com/support/developer/ovf/
|
28
|
-
|
29
|
+
3. You MUST enable ssh access on your ESXi hypervisor.
|
29
30
|
* Google 'How to enable ssh access on esxi'
|
30
|
-
|
31
|
+
4. The boxes must have open-vm-tools or vmware-tools installed to properly transition to the "running" state.
|
31
32
|
|
32
33
|
Why this plugin?
|
33
34
|
----------------
|
@@ -114,7 +115,11 @@ Vagrant.configure("2") do |config|
|
|
114
115
|
# HIGHLY RECOMMENDED! Virtual Network
|
115
116
|
# You should specify a Virtual Network!
|
116
117
|
# The default is to use the first found!
|
117
|
-
|
118
|
+
# You can specify up to 4 virtual networks using an array
|
119
|
+
# format. Note that Vagrant only looks at the first
|
120
|
+
# interface for an IP address.
|
121
|
+
#esxi.virtual_network = "vmnet_example"
|
122
|
+
#esxi.virtual_network = ["vmnet1","vmnet2","vmnet3","vmnet4"]
|
118
123
|
|
119
124
|
# OPTIONAL. Specify a Disk Store
|
120
125
|
# The Default is to use the least used Disk Store.
|
@@ -123,7 +128,8 @@ Vagrant.configure("2") do |config|
|
|
123
128
|
# OPTIONAL. Guest VM name to be created/used.
|
124
129
|
# The Default will be automatically generated
|
125
130
|
# and will be based on the vmname_prefix,
|
126
|
-
# hostname, username, path
|
131
|
+
# hostname, username, path. Otherwise you
|
132
|
+
# can set a fixed guest VM name here.
|
127
133
|
#esxi.vmname = "Custom-Guest-VM_Name"
|
128
134
|
|
129
135
|
# OPTIONAL. When automatically naming VMs, use
|
@@ -144,8 +150,9 @@ Vagrant.configure("2") do |config|
|
|
144
150
|
# The default is to create VMs in the "root". You can
|
145
151
|
# specify a resource pool here to partition memory and
|
146
152
|
# cpu usage away from other systems on your esxi host.
|
147
|
-
# The resource pool must already exist and
|
148
|
-
#
|
153
|
+
# The resource pool must already exist and have the
|
154
|
+
# proper permissions set.
|
155
|
+
# Vagrant will NOT create a Resource pool it for you.
|
149
156
|
#esxi.resource_pool = "/Vagrant"
|
150
157
|
|
151
158
|
# DANGEROUS! Allow Overwrite
|
@@ -185,3 +192,9 @@ Known issues with vmware_esxi
|
|
185
192
|
* In general I find NFS synced folders pretty "flakey" anyways...
|
186
193
|
* Multi machines may not provision one VM if the boxes are different.
|
187
194
|
* I found this problem with libvirt also, so I'm assuming it's a vagrant problem...
|
195
|
+
|
196
|
+
|
197
|
+
Feedback please!
|
198
|
+
----------------
|
199
|
+
* To help improve this plugin, I'm requesting that you provide some feedback.
|
200
|
+
* https://goo.gl/forms/tY14mE77HJvhNvjj1
|
data/example_box/Vagrantfile
CHANGED
@@ -67,7 +67,9 @@ Vagrant.configure("2") do |config|
|
|
67
67
|
# HIGHLY RECOMMENDED! Virtual Network
|
68
68
|
# You should specify a Virtual Network!
|
69
69
|
# The default is to use the first found!
|
70
|
-
|
70
|
+
# You can specify up to 4 virtual networks using an array format.
|
71
|
+
#esxi.virtual_network = "vmnet_example"
|
72
|
+
#esxi.virtual_network = ["vmnet1","vmnet2","vmnet3","vmnet4"]
|
71
73
|
|
72
74
|
# OPTIONAL. Specify a Disk Store
|
73
75
|
# The Default is to use the least used Disk Store.
|
@@ -25,7 +25,7 @@ Vagrant.configure("2") do |config|
|
|
25
25
|
esxi.esxi_password = nil
|
26
26
|
#esxi.esxi_private_keys = []
|
27
27
|
#esxi.esxi_hostport = 22
|
28
|
-
esxi.virtual_network = "vmnet_example"
|
28
|
+
#esxi.virtual_network = "vmnet_example"
|
29
29
|
#esxi.vm_disk_store = "DS_001"
|
30
30
|
#esxi.vmname_prefix = "V-"
|
31
31
|
#esxi.memsize = "2048"
|
@@ -131,25 +131,30 @@ module VagrantPlugins
|
|
131
131
|
"#{r.stderr}"
|
132
132
|
end
|
133
133
|
|
134
|
+
guestvm_network = []
|
135
|
+
counter = 0
|
134
136
|
if config.virtual_network.nil?
|
135
|
-
guestvm_network = availnetworks.first
|
136
|
-
|
137
|
-
|
137
|
+
guestvm_network[0] = availnetworks.first
|
138
|
+
env[:ui].info I18n.t('vagrant_vmware_esxi.vagrant_vmware_esxi_message',
|
139
|
+
message: 'WARNING : '\
|
140
|
+
"config.virtual_network not "\
|
141
|
+
"set, using #{availnetworks.first}")
|
138
142
|
else
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
143
|
+
networkID = 0
|
144
|
+
for aVirtNet in Array(config.virtual_network) do
|
145
|
+
if availnetworks.include? aVirtNet
|
146
|
+
guestvm_network << aVirtNet
|
147
|
+
else
|
148
|
+
guestvm_network << availnetworks.first
|
149
|
+
env[:ui].info I18n.t('vagrant_vmware_esxi.vagrant_vmware_esxi_message',
|
150
|
+
message: 'WARNING : '\
|
151
|
+
"#{aVirtNet} not "\
|
152
|
+
"found, using #{availnetworks.first}")
|
153
|
+
end
|
154
|
+
networkID += 1
|
155
|
+
if networkID >= 4
|
156
|
+
break
|
157
|
+
end
|
153
158
|
end
|
154
159
|
end
|
155
160
|
|
@@ -176,14 +181,12 @@ module VagrantPlugins
|
|
176
181
|
new_vmx_contents << "memsize = \"#{desired_memsize}\"\n"
|
177
182
|
elsif line.match(/^numvcpus =/i) && (!desired_numvcpus.nil?)
|
178
183
|
new_vmx_contents << "numvcpus = \"#{desired_numvcpus}\"\n"
|
179
|
-
elsif line.match(/^
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
line.match(/^
|
185
|
-
line.match(/^ethernet0.generatedAddress = /i) ||
|
186
|
-
line.match(/^ethernet0.generatedAddressOffset = /i)
|
184
|
+
elsif line.match(/^ethernet[0-9].networkName =/i) ||
|
185
|
+
line.match(/^ethernet[0-9].addressType =/i) ||
|
186
|
+
line.match(/^ethernet[0-9].present =/i) ||
|
187
|
+
line.match(/^ethernet[0-9].address =/i) ||
|
188
|
+
line.match(/^ethernet[0-9].generatedAddress =/i) ||
|
189
|
+
line.match(/^ethernet[0-9].generatedAddressOffset =/i)
|
187
190
|
# Do nothing, delete these lines
|
188
191
|
else
|
189
192
|
new_vmx_contents << line
|
@@ -199,8 +202,24 @@ module VagrantPlugins
|
|
199
202
|
end
|
200
203
|
end
|
201
204
|
|
202
|
-
unless new_vmx_contents =~ %r{^ethernet0.networkName =}i
|
203
|
-
|
205
|
+
#unless new_vmx_contents =~ %r{^ethernet0.networkName =}i
|
206
|
+
# new_vmx_contents << "ethernet0.networkName = \"#{guestvm_network}\"\n"
|
207
|
+
#end
|
208
|
+
netOpts = ""
|
209
|
+
networkID = 0
|
210
|
+
for element in guestvm_network do
|
211
|
+
if (config.debug =~ %r{true}i) ||
|
212
|
+
(config.debug =~ %r{yes}i)
|
213
|
+
puts "guestvm_network[#{networkID}]: #{element}"
|
214
|
+
end
|
215
|
+
new_vmx_contents << "ethernet#{networkID}.networkName = \"net#{networkID}\"\n"
|
216
|
+
new_vmx_contents << "ethernet#{networkID}.present = \"TRUE\"\n"
|
217
|
+
new_vmx_contents << "ethernet#{networkID}.addressType = \"generated\"\n"
|
218
|
+
netOpts << " --net:\"net#{networkID}=#{element}\""
|
219
|
+
networkID += 1
|
220
|
+
if networkID >= 4
|
221
|
+
break
|
222
|
+
end
|
204
223
|
end
|
205
224
|
|
206
225
|
if config.custom_vmx_settings.is_a? Array
|
@@ -260,7 +279,7 @@ module VagrantPlugins
|
|
260
279
|
env[:ui].info I18n.t('vagrant_vmware_esxi.vagrant_vmware_esxi_message',
|
261
280
|
message: "Disk Store : #{guestvm_dsname}")
|
262
281
|
env[:ui].info I18n.t('vagrant_vmware_esxi.vagrant_vmware_esxi_message',
|
263
|
-
message: "NetworkName :
|
282
|
+
message: "NetworkName : #{guestvm_network[0..3]}")
|
264
283
|
unless overwrite_opts.nil?
|
265
284
|
env[:ui].info I18n.t('vagrant_vmware_esxi.vagrant_vmware_esxi_message',
|
266
285
|
message: 'Allow Overwrite : True')
|
@@ -277,7 +296,7 @@ module VagrantPlugins
|
|
277
296
|
' install from http://www.vmware.com.'
|
278
297
|
end
|
279
298
|
ovf_cmd = "ovftool --noSSLVerify #{overwrite_opts} "\
|
280
|
-
"
|
299
|
+
"#{netOpts} -dm=thin --powerOn "\
|
281
300
|
"-ds=\"#{guestvm_dsname}\" --name=\"#{guestvm_vmname}\" "\
|
282
301
|
"\"#{new_vmx_file}\" vi://#{config.esxi_username}:"\
|
283
302
|
"#{config.esxi_password}@#{config.esxi_hostname}"\
|