vagrant-vmware-esxi 2.0.6 → 2.0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +31 -36
- data/lib/vagrant-vmware-esxi/action.rb +17 -9
- data/lib/vagrant-vmware-esxi/action/halt.rb +1 -0
- data/lib/vagrant-vmware-esxi/action/resume.rb +1 -0
- data/lib/vagrant-vmware-esxi/action/shutdown.rb +55 -0
- data/lib/vagrant-vmware-esxi/action/snapshot_restore.rb +1 -0
- data/lib/vagrant-vmware-esxi/version.rb +1 -1
- data/vagrant-vmware-esxi.gemspec +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 343c96c9a16c7657eecc7386265446c25d30918d
|
4
|
+
data.tar.gz: 8eb77a209ec5b5707d655210e420abaa14482795
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b9f8620e0c93b40a8f8892c823c7818cdd533578547adc9f6eeaa24a3edac91432303eb73d233fd97ffa0c736334dab49bee381f55b79e5afc50c3bb307577c8
|
7
|
+
data.tar.gz: dacca0c01725ff30f9174604016ea739b797485d7b4989011cfca602b91282dde14b39fa8dfae0acab0b5f6b8a3c4631374f0415dac58a7c16980bb0d35d8ca0
|
data/README.md
CHANGED
@@ -35,7 +35,7 @@ Features and Compatibility
|
|
35
35
|
Requirements
|
36
36
|
------------
|
37
37
|
1. This is a vagrant plugin, so you need vagrant installed... :-)
|
38
|
-
2. This plugin requires ovftool from VMware. Download from VMware website.
|
38
|
+
2. This plugin requires ovftool from VMware. Download from VMware website. NOTE: ovftool installer for windows doesn't put ovftool.exe in your path. You can manually set your path, or install ovftool in the \HashiCorp\Vagrant\bin directory.
|
39
39
|
>https://www.vmware.com/support/developer/ovf/
|
40
40
|
3. You MUST enable ssh access on your ESXi hypervisor.
|
41
41
|
* Google 'How to enable ssh access on esxi'
|
@@ -52,6 +52,7 @@ How to install
|
|
52
52
|
Download and install Vagrant on your local system using instructions from https://vagrantup.com/downloads.html.
|
53
53
|
```
|
54
54
|
vagrant plugin install vagrant-vmware-esxi
|
55
|
+
vagrant plugin list
|
55
56
|
vagrant version
|
56
57
|
```
|
57
58
|
How to use and configure a Vagrantfile
|
@@ -59,7 +60,7 @@ How to use and configure a Vagrantfile
|
|
59
60
|
|
60
61
|
1. cd SOMEDIR
|
61
62
|
1. `vagrant init`
|
62
|
-
1. `vi Vagrantfile` #
|
63
|
+
1. `vi Vagrantfile` # Replace the contents of Vagrantfile with the following example. Specify parameters to access your ESXi host, guest and local preferences.
|
63
64
|
```ruby
|
64
65
|
#
|
65
66
|
# Fully documented Vagrantfile available
|
@@ -72,7 +73,7 @@ Vagrant.configure('2') do |config|
|
|
72
73
|
# https://www.vmware.com/support/developer/ovf/
|
73
74
|
#
|
74
75
|
# If your box is stuck at 'Powered On', then most likely
|
75
|
-
# the
|
76
|
+
# the box/vm doesn't have the vmware tools installed.
|
76
77
|
#
|
77
78
|
# Here are some of the MANY examples....
|
78
79
|
config.vm.box = 'generic/centos7'
|
@@ -93,12 +94,16 @@ Vagrant.configure('2') do |config|
|
|
93
94
|
config.vm.synced_folder('.', '/vagrant', type: 'rsync')
|
94
95
|
config.vm.synced_folder('.', '/vagrant', type: 'nfs', disabled: true)
|
95
96
|
|
96
|
-
# Vagrant can
|
97
|
-
# public_network or private_network to manually set a static IP and
|
98
|
-
# netmask. ESXi doesn't use the concept of public or private
|
99
|
-
# both are valid here. The primary network interface is considered the
|
100
|
-
# "vagrant management" interface and cannot be changed
|
101
|
-
# so you can specify 3 entries here!
|
97
|
+
# Vagrant can configure additional network interfaces using a static IP or
|
98
|
+
# DHCP. Use public_network or private_network to manually set a static IP and
|
99
|
+
# optionally netmask. ESXi doesn't use the concept of public or private
|
100
|
+
# networks so both are valid here. The primary network interface is considered the
|
101
|
+
# "vagrant management" interface and cannot be changed and this plugin
|
102
|
+
# supports 4 NICS, so you can specify 3 entries here!
|
103
|
+
#
|
104
|
+
# https://www.vagrantup.com/docs/networking/public_network.html
|
105
|
+
# https://www.vagrantup.com/docs/networking/private_network.html
|
106
|
+
#
|
102
107
|
# *** Invalid settings could cause 'vagrant up' to fail ***
|
103
108
|
#config.vm.network 'private_network', ip: '192.168.10.170', netmask: '255.255.255.0'
|
104
109
|
#config.vm.network 'private_network', ip: '192.168.11.170'
|
@@ -127,11 +132,11 @@ Vagrant.configure('2') do |config|
|
|
127
132
|
# SSH port.
|
128
133
|
#esxi.esxi_hostport = 22
|
129
134
|
|
130
|
-
# HIGHLY RECOMMENDED! Virtual Network
|
131
|
-
# You should specify
|
135
|
+
# HIGHLY RECOMMENDED! ESXi Virtual Network
|
136
|
+
# You should specify an ESXi Virtual Network! If it's not specified, the
|
132
137
|
# default is to use the first found. You can specify up to 4 virtual
|
133
138
|
# networks using an array format.
|
134
|
-
#esxi.esxi_virtual_network = ['
|
139
|
+
#esxi.esxi_virtual_network = ['VM Network','VM Network2','VM Network3','VM Network4']
|
135
140
|
|
136
141
|
# OPTIONAL. Specify a Disk Store
|
137
142
|
#esxi.esxi_disk_store = 'DS_001'
|
@@ -174,7 +179,7 @@ Vagrant.configure('2') do |config|
|
|
174
179
|
#esxi.guest_disk_type = 'thick'
|
175
180
|
|
176
181
|
# OPTIONAL. Create additional storage for guests.
|
177
|
-
# You can specify an array of
|
182
|
+
# You can specify an array of up to 13 virtual disk sizes (in GB) that you
|
178
183
|
# would like the provider to create once the guest has been created.
|
179
184
|
#esxi.guest_storage = [10,20]
|
180
185
|
|
@@ -212,27 +217,6 @@ Vagrant.configure('2') do |config|
|
|
212
217
|
end
|
213
218
|
```
|
214
219
|
|
215
|
-
Upgrading from vagrant-vmware-esxi 1.x.x
|
216
|
-
----------------------------------------
|
217
|
-
The following Vagrantfile parameters have been renamed for clarity. The plugin still recognizes these legacy parameters, however it's recommended to migrate to the 2.x parameters.
|
218
|
-
* esxi_private_keys --> esxi_password = "key:"
|
219
|
-
* vm_disk_store --> esxi_disk_store
|
220
|
-
* virtual_network --> esxi_virtual_network
|
221
|
-
* resource_pool --> esxi_resource_pool
|
222
|
-
* vmname --> guest_name
|
223
|
-
* vmname_prefix --> guest_name_prefix
|
224
|
-
* ssh_username --> guest_username
|
225
|
-
* memsize --> guest_memsize
|
226
|
-
* numvcpus --> guest_numvcpus
|
227
|
-
* vm_disk_type --> guest_disk_type
|
228
|
-
* nic_type --> guest_nic_type
|
229
|
-
* mac_address --> guest_mac_address
|
230
|
-
* guestos --> guest_guestos
|
231
|
-
* virtualhw_version --> guest_virtualhw_version
|
232
|
-
* custom_vmx_settings --> guest_custom_vmx_settings
|
233
|
-
* lax --> local_lax
|
234
|
-
* allow_overwrite --> local_allow_overwrite
|
235
|
-
|
236
220
|
|
237
221
|
Basic usage
|
238
222
|
-----------
|
@@ -243,6 +227,7 @@ Basic usage
|
|
243
227
|
* `vagrant status`
|
244
228
|
* `vagrant suspend`
|
245
229
|
* `vagrant resume`
|
230
|
+
* `vagrant ssh-config`
|
246
231
|
* `vagrant snapshot push`
|
247
232
|
* `vagrant snapshot list`
|
248
233
|
* `vagrant snapshot-info`
|
@@ -251,18 +236,28 @@ Basic usage
|
|
251
236
|
* `vagrant provision`
|
252
237
|
|
253
238
|
|
239
|
+
|
240
|
+
Upgrading from vagrant-vmware-esxi 1.x.x
|
241
|
+
----------------------------------------
|
242
|
+
See wiki for more information.
|
243
|
+
>https://github.com/josenk/vagrant-vmware-esxi/wiki/Upgrading-from-vagrant-vmware-esxi-1.x.x
|
244
|
+
|
245
|
+
|
254
246
|
Known issues with vmware_esxi
|
255
247
|
-----------------------------
|
256
248
|
* The boxes must have open-vm-tools or vmware-tools installed to properly transition to the 'running' state.
|
257
249
|
* Invalid settings (bad IP address, netmask, MAC address, guest_custom_vmx_settings) could cause 'vagrant up' to fail. Review vSphere console and/or ESXi logs to help debug why it failed.
|
258
250
|
* Cleanup doesn't always destroy a VM that has been partially built. Use the local_allow_overwrite = 'True' option if you need to force a rebuild, or you can delete the vm using the VSphere client.
|
259
251
|
* ovftool installer for windows doesn't put ovftool.exe in your path. You can manually set your path, or install ovftool in the \HashiCorp\Vagrant\bin directory.
|
260
|
-
*
|
261
|
-
* V2.0.1 - 2.0.5 is not compatible with Windows (to support ed25519 ssh keys, net-ssh requires libsodium but it's not compatible with Windows).
|
252
|
+
* Vagrant NFS synced folders is not reliable on multi-homed clients (your vagrant pc/laptop/host). There is no 100% reliable way to know which IP is the correct, most reliable, most desirable, etc...
|
253
|
+
* V2.0.1 - 2.0.5 is not compatible with Windows (to support ed25519 ssh keys, net-ssh requires libsodium but it's not compatible with Windows). ed25519 support has been removed for now. It will be added back when net-ssh 5.x goes out of beta.
|
254
|
+
* Cygwin & gitbash have console issues. Ruby module io/console does not have support. https://github.com/ruby/io-console/issues/2
|
262
255
|
|
263
256
|
|
264
257
|
Version History
|
265
258
|
---------------
|
259
|
+
* 2.0.7 Fix, Doesn't wait for running when executing "vagrant reload"
|
260
|
+
Fix, "vagrant halt" will now attempt a graceful shutdown before doing a hard power off.
|
266
261
|
* 2.0.6 Fix Windows compatibility by not supporting ed25519 ssh keys. When net-ssh 5.x is released AND vagrant allows it's use, I will support ed25519 again.
|
267
262
|
Fix, encode '/' in esxi passwords.
|
268
263
|
Fix, Get local IP address for NFS syncd folders. Filter out localhost 127.0.0.0/8.
|
@@ -23,8 +23,18 @@ module VagrantPlugins
|
|
23
23
|
def self.action_halt
|
24
24
|
Vagrant::Action::Builder.new.tap do |b|
|
25
25
|
b.use SetESXiPassword
|
26
|
-
b.use ReadState
|
27
|
-
|
26
|
+
b.use Call, ReadState do |env1, b1|
|
27
|
+
if env1[:machine_state].to_s == 'running'
|
28
|
+
b1.use Shutdown
|
29
|
+
b1.use Call, WaitForState, :powered_off, 30 do |env1, b2|
|
30
|
+
unless env1[:result] == 'True'
|
31
|
+
b2.use Halt
|
32
|
+
end
|
33
|
+
end
|
34
|
+
else
|
35
|
+
b1.use Halt
|
36
|
+
end
|
37
|
+
end
|
28
38
|
end
|
29
39
|
end
|
30
40
|
|
@@ -41,6 +51,7 @@ module VagrantPlugins
|
|
41
51
|
b.use SetESXiPassword
|
42
52
|
b.use ReadState
|
43
53
|
b.use Resume
|
54
|
+
b.use WaitForState, :running, 240
|
44
55
|
end
|
45
56
|
end
|
46
57
|
|
@@ -78,17 +89,13 @@ module VagrantPlugins
|
|
78
89
|
def self.action_snapshot_restore
|
79
90
|
Vagrant::Action::Builder.new.tap do |b|
|
80
91
|
b.use SetESXiPassword
|
81
|
-
b.use
|
92
|
+
b.use Halt
|
82
93
|
b.use Call, WaitForState, :powered_off, 240 do |env1, b1|
|
83
94
|
if env1[:result] == 'True'
|
84
95
|
b1.use SnapshotRestore
|
85
96
|
b1.use ReadState
|
86
97
|
b1.use Boot
|
87
|
-
b1.use
|
88
|
-
if env1[:result] == 'True'
|
89
|
-
#
|
90
|
-
end
|
91
|
-
end
|
98
|
+
b1.use WaitForState, :running, 240
|
92
99
|
end
|
93
100
|
end
|
94
101
|
end
|
@@ -107,7 +114,7 @@ module VagrantPlugins
|
|
107
114
|
b.use SetESXiPassword
|
108
115
|
b.use Call, ReadState do |env1, b1|
|
109
116
|
unless env1[:machine_state] == 'powered_off'
|
110
|
-
b1.use
|
117
|
+
b1.use Halt
|
111
118
|
end
|
112
119
|
b1.use ReadState
|
113
120
|
b1.use Destroy
|
@@ -178,6 +185,7 @@ module VagrantPlugins
|
|
178
185
|
autoload :SetNetworkIP, action_root.join('set_network_ip')
|
179
186
|
autoload :Boot, action_root.join('boot')
|
180
187
|
autoload :Halt, action_root.join('halt')
|
188
|
+
autoload :Shutdown, action_root.join('shutdown')
|
181
189
|
autoload :Destroy, action_root.join('destroy')
|
182
190
|
autoload :Suspend, action_root.join('suspend')
|
183
191
|
autoload :Resume, action_root.join('resume')
|
@@ -0,0 +1,55 @@
|
|
1
|
+
require 'log4r'
|
2
|
+
require 'net/ssh'
|
3
|
+
|
4
|
+
module VagrantPlugins
|
5
|
+
module ESXi
|
6
|
+
module Action
|
7
|
+
# This action will start a graceful shutdown on the vm
|
8
|
+
class Shutdown
|
9
|
+
def initialize(app, _env)
|
10
|
+
@app = app
|
11
|
+
@logger = Log4r::Logger.new('vagrant_vmware_esxi::action::shutdown')
|
12
|
+
end
|
13
|
+
|
14
|
+
def call(env)
|
15
|
+
shutdown(env)
|
16
|
+
@app.call(env)
|
17
|
+
end
|
18
|
+
|
19
|
+
def shutdown(env)
|
20
|
+
@logger.info('vagrant-vmware-esxi, shutdown: start...')
|
21
|
+
|
22
|
+
# Get config.
|
23
|
+
machine = env[:machine]
|
24
|
+
config = env[:machine].provider_config
|
25
|
+
|
26
|
+
if env[:machine_state].to_s == 'powered_off'
|
27
|
+
env[:ui].info I18n.t('vagrant_vmware_esxi.already_powered_off')
|
28
|
+
elsif env[:machine_state].to_s == 'not_created'
|
29
|
+
env[:ui].info I18n.t('vagrant_vmware_esxi.already_destroyed')
|
30
|
+
else
|
31
|
+
env[:ui].info I18n.t('vagrant_vmware_esxi.vagrant_vmware_esxi_message',
|
32
|
+
message: "Starting graceful shutdown...")
|
33
|
+
Net::SSH.start(config.esxi_hostname, config.esxi_username,
|
34
|
+
password: $esxi_password,
|
35
|
+
port: config.esxi_hostport,
|
36
|
+
keys: config.local_private_keys,
|
37
|
+
timeout: 20,
|
38
|
+
number_of_password_prompts: 0,
|
39
|
+
non_interactive: true
|
40
|
+
) do |ssh|
|
41
|
+
|
42
|
+
r = ssh.exec!("vim-cmd vmsvc/power.shutdown #{machine.id}")
|
43
|
+
config.saved_ipaddress = nil
|
44
|
+
|
45
|
+
if r.exitstatus != 0
|
46
|
+
raise Errors::ESXiError,
|
47
|
+
message: "Unable to shutdown the VM:\n #{r}"
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
@@ -51,6 +51,7 @@ module VagrantPlugins
|
|
51
51
|
"grep -A1 '.*Snapshot Name : #{env[:snapshot_name]}$' | "\
|
52
52
|
"grep 'Snapshot Id'|awk '{print $NF}'` suppressPowerOn")
|
53
53
|
|
54
|
+
config.saved_ipaddress = nil
|
54
55
|
if r.exitstatus != 0
|
55
56
|
raise Errors::ESXiError,
|
56
57
|
message: "Unable to restore snapshots of the VM:\n"\
|
data/vagrant-vmware-esxi.gemspec
CHANGED
@@ -3,7 +3,7 @@ require File.expand_path('../lib/vagrant-vmware-esxi/version', __FILE__)
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = 'vagrant-vmware-esxi'
|
5
5
|
s.version = VagrantPlugins::ESXi::VERSION
|
6
|
-
s.date = '2018-
|
6
|
+
s.date = '2018-03-21'
|
7
7
|
s.summary = 'Vagrant ESXi provider plugin'
|
8
8
|
s.description = 'A Vagrant plugin that adds a VMware ESXi provider support'
|
9
9
|
s.authors = ['Jonathan Senkerik']
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vagrant-vmware-esxi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jonathan Senkerik
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-03-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: i18n
|
@@ -92,6 +92,7 @@ files:
|
|
92
92
|
- lib/vagrant-vmware-esxi/action/read_state.rb
|
93
93
|
- lib/vagrant-vmware-esxi/action/resume.rb
|
94
94
|
- lib/vagrant-vmware-esxi/action/set_network_ip.rb
|
95
|
+
- lib/vagrant-vmware-esxi/action/shutdown.rb
|
95
96
|
- lib/vagrant-vmware-esxi/action/snapshot_delete.rb
|
96
97
|
- lib/vagrant-vmware-esxi/action/snapshot_info.rb
|
97
98
|
- lib/vagrant-vmware-esxi/action/snapshot_list.rb
|