vagrant-vmware-esxi 1.3.2 → 1.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 75fa2ace89bcc2c6659e8631c3d411f51bf61805
4
- data.tar.gz: '08d7be8b3342fcf22e379669760d6cf1e384bd6a'
3
+ metadata.gz: '097f1326323d37d401b5243a7bc5287f8310ba62'
4
+ data.tar.gz: 8790e1347a0576d9f5f14deb698dc91de89f576e
5
5
  SHA512:
6
- metadata.gz: 33db21964f748b8379b336226cd710c85cbc9df4ba3be95d283743fa3ff7bc1513242868eee2d7665b4517765c57dd654aea3386ee83f6f6688c4371f57b0522
7
- data.tar.gz: cadbb1dce75523116f6020cc931a637156e9cf0f61526d424fd2df73cd3a922c6b4cb079ac816ef48727ff883d772d22aca0c27e384b6a607a9290092b9cffa8
6
+ metadata.gz: 7651298f91f3cbc1c301b416ef7ea88f9f40d23f7fd8ad23b65304fbff3978f6d3b8c97406f6cfef5c9182f525512f2f93f67c632ed04b6187cd71ae5d1e8a5a
7
+ data.tar.gz: 07bc3b59e29a6cf450be897ff1e1468cfdcc64edcba5ed3a8d77aa94bbd4d8d1bacf41bfa007cb00a938330914ccf00c96d58dd6b6fef33879080a00e32f540c
data/Gemfile CHANGED
@@ -4,7 +4,8 @@ source 'https://rubygems.org'
4
4
  gemspec
5
5
 
6
6
  group :development do
7
- gem 'vagrant', git: 'https://github.com/mitchellh/vagrant.git'
7
+ #gem 'vagrant', git: 'https://github.com/mitchellh/vagrant.git'
8
+ gem 'vagrant', git: 'https://github.com/hashicorp/vagrant.git'
8
9
  #gem 'vagrant-vmware-esxi', path: '.'
9
10
  end
10
11
 
data/README.md CHANGED
@@ -19,7 +19,9 @@ Features and Compatibility
19
19
  * snapshots.
20
20
  * rsync & NFS using built-in Vagrant synced folders.
21
21
  * Provision using built-in Vagrant provisioner.
22
- * package
22
+ * package your vm's into boxes.
23
+ * Set MAC addresses on network interfaces.
24
+ * Use Vagrants Set IP addresses on network interfaces feature. (private_network, public_network)
23
25
 
24
26
  Requirements
25
27
  ------------
@@ -29,46 +31,67 @@ Requirements
29
31
  3. You MUST enable ssh access on your ESXi hypervisor.
30
32
  * Google 'How to enable ssh access on esxi'
31
33
  4. The boxes must have open-vm-tools or vmware-tools installed to properly transition to the "running" state.
34
+ 5. You should know how to use vagrant in general...
32
35
 
33
36
  Why this plugin?
34
37
  ----------------
35
38
  Not everyone has vCenter / vSphere... vCenter cost $$$. ESXi is free!
39
+ Using this plugin will allow you to use a central VMware ESXi host for your development needs. Using a centralized host will release the extra load on your local system (vs using KVM or Virtual Box).
36
40
 
37
41
  How to install
38
42
  --------------
43
+ Download and install Vagrant on your local system using instructions from https://vagrantup.com/downloads.html.
39
44
  ```
40
45
  vagrant plugin install vagrant-vmware-esxi
46
+ vagrant version
41
47
  ```
42
- How to configure
43
- ----------------
48
+ How to use and configure a Vagrantfile
49
+ --------------------------------------
44
50
 
45
51
  1. cd SOMEDIR
46
52
  1. `vagrant init`
47
- 1. `vi Vagrantfile` # setup access your ESXi host and to set some preferences.
53
+ 1. `vi Vagrantfile` # See below to setup access your ESXi host and to set some preferences.
48
54
  ```ruby
49
55
  Vagrant.configure("2") do |config|
50
56
 
51
57
  # Box, Select any box created for VMware that is compatible with
52
- # the ovftool. To get maximum compatiblity You should download
53
- # and install the latest version for your OS.
58
+ # the ovftool. To get maximum compatibility You should download
59
+ # and install the latest version of ovftool for your OS.
54
60
  # https://www.vmware.com/support/developer/ovf/
55
61
  #
56
62
  # If your box is stuck at "Powered On", then most likely
57
63
  # the system doesn't have the vmware tools installed.
58
64
  #
59
65
  # Here are some of the MANY examples....
60
- config.vm.box = 'hashicorp/precise64'
66
+ config.vm.box = 'generic/centos7'
67
+ #config.vm.box = 'generic/centos6'
68
+ #config.vm.box = 'generic/fedora26'
69
+ #config.vm.box = 'generic/freebsd11'
70
+ #config.vm.box = 'generic/ubuntu1710'
71
+ #config.vm.box = 'generic/debian9'
72
+ #config.vm.box = 'hashicorp/precise64'
61
73
  #config.vm.box = 'steveant/CentOS-7.0-1406-Minimal-x64'
74
+ #config.vm.box = 'geerlingguy/centos7'
62
75
  #config.vm.box = 'geerlingguy/ubuntu1604'
63
76
  #config.vm.box = 'laravel/homestead'
64
- #config.vm.box = 'bento/ubuntu-14.04'
65
- #config.vm.box = 'generic/centos7'
66
- #config.vm.box = 'generic/fedora26'
67
- #config.vm.box = 'generic/alpine36'
77
+ #config.vm.box = "puphpet/debian75-x64"
78
+
68
79
 
80
+ # Use rsync and NFS synced folders. (or disable them)
81
+ config.vm.synced_folder('.', '/vagrant', type: 'rsync')
82
+ config.vm.synced_folder('.', '/vagrant', type: 'nfs', disabled: true)
69
83
 
70
- # Supports type rsync and NFS.
71
- config.vm.synced_folder('.', '/Vagrantfiles', type: 'rsync')
84
+ # Vagrant can set a static IP for the additional network interfaces. Use
85
+ # public_network or private_network to manually set a static IP and
86
+ # netmask. ESXi doesn't use the concept of public or private networks so
87
+ # both are valid here. "bridge" will be ignored. Netmask is optional if
88
+ # you are using standard Class A/B/C networks. The primary network
89
+ # interface is considered the management interface and cannot be changed,
90
+ # so you can specify 3 entries here!
91
+ # *** Invalid settings could cause "vagrant up" to fail ***
92
+ #config.vm.network "private_network", ip: "192.168.10.170", netmask: "255.255.255.0"
93
+ #config.vm.network "private_network", ip: "192.168.11.170"
94
+ #config.vm.network "public_network", ip: "192.168.12.170"
72
95
 
73
96
  #
74
97
  # Provider (esxi) settings
@@ -98,7 +121,7 @@ Vagrant.configure("2") do |config|
98
121
  # you can specify any filename after the colon ":".
99
122
  #
100
123
  # 3) "env:" or "env:my_secret_env_var"
101
- # This will read the esxi password via a environment
124
+ # This will read the esxi password via an environment
102
125
  # variable. The default is $esxi_password, but you can
103
126
  # specify any environment variable after the colon ":".
104
127
  #
@@ -116,7 +139,7 @@ Vagrant.configure("2") do |config|
116
139
  # The ssh connections to esxi will try the ssh private
117
140
  # keys. However the ovftool does NOT! To make
118
141
  # vagrant fully password-less, you will need to use other
119
- # options. (set the passord, use "env:" or "file:")
142
+ # options. (set the password, use "env:" or "file:")
120
143
  #
121
144
  # 5) esxi.esxi_password = "my_esxi_password"
122
145
  # Enter your esxi passowrd in clear text here... This is the
@@ -142,21 +165,41 @@ Vagrant.configure("2") do |config|
142
165
  # default is to use the first found. You can specify up to 4 virtual
143
166
  # networks using an array format. Note that Vagrant only looks at the
144
167
  # first interface for a valid IP address. BTW: This does not configure
145
- # IP addresses. This specifies which ESXi virtual network to use for
168
+ # IP addresses. This specifies which "ESXi virtual network" is used for
146
169
  # each network interface in your VM. For most OS's DHCP is the default,
147
- # so, you will need a DHCP server for each virtual network.
148
- #esxi.virtual_network = "vmnet_example"
170
+ # so, you will need a DHCP server for each virtual network. To set a
171
+ # static IP, see above "config.vm.network".
149
172
  #esxi.virtual_network = ["vmnet1","vmnet2","vmnet3","vmnet4"]
150
173
 
174
+ # OPTIONAL & RISKY. Specify up to 4 MAC addresses
175
+ # The default is ovftool to automatically generate a MAC address.
176
+ # You can specify an array of MAC addresses using upper or lower case,
177
+ # separated by colons ":". I highly recommend using vmware's OUI
178
+ # of "00:50:56" or "00:0c:29". I consider this option a risk
179
+ # because you may reuse a Vagrantfile without realizing you are
180
+ # duplicating the MAC address.
181
+ # *** Invalid settings could cause "vagrant up" to fail ***
182
+ #esxi.mac_address = ["00:50:56:aa:bb:cc", "00:50:56:01:01:01","00:50:56:02:02:02","00:50:56:BE:AF:01" ]
183
+
184
+ # OPTIONAL & RISKY. Specify a nic_type
185
+ # The default is to have the virtual nic hw type automatically
186
+ # determined by the ovftool. However, you can override it by specifying
187
+ # it here. This is a global setting. (all 4 virtual networks will be set)
188
+ # The validated list of nic_types are "e1000", "e1000e", "vmxnet",
189
+ # "vmxnet2", "vmxnet3", "Vlance", and "Flexible". I consider this
190
+ # risky because I don't validate if the specified nic_type is
191
+ # compatible with your OS version.
192
+ # *** Invalid settings could cause "vagrant up" to fail ***
193
+ #esxi.nic_type = 'e1000'
194
+
151
195
  # OPTIONAL. Specify a Disk Store
152
196
  # If it's not specified, the Default is to use the least used Disk Store.
153
197
  #esxi.vm_disk_store = "DS_001"
154
198
 
155
- # OPTIONAL. Guest VM name to be created/used.
156
- # The Default will be automatically generated
157
- # and will be based on the vmname_prefix,
158
- # hostname, username, path. Otherwise you
159
- # can set a fixed guest VM name here.
199
+ # OPTIONAL. Guest VM name to use.
200
+ # The Default will be automatically generated. It will be based on
201
+ # the vmname_prefix (see below), your hostname & username and path.
202
+ # Otherwise you can set a fixed guest VM name here.
160
203
  #esxi.vmname = "Custom-Guest-VM_Name"
161
204
 
162
205
  # OPTIONAL. When automatically naming VMs, use
@@ -216,15 +259,15 @@ Basic usage
216
259
  Known issues with vmware_esxi
217
260
  -----------------------------
218
261
  * The boxes must have open-vm-tools or vmware-tools installed to properly transition to the "running" state.
219
- * Cleanup doesn't always destroy a VM that has been partially built. Use the allow_overwrite = 'True' option if you need to force a rebuild.
262
+ * Invalid settings (bad IP address, netmask, MAC address) could cause 'vagrant up' to fail. Review your ESXi logs to help debug why it failed.
263
+ * Cleanup doesn't always destroy a VM that has been partially built. Use the allow_overwrite = 'True' option if you need to force a rebuild, or delete the vm using the VSphere client.
220
264
  * 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.
221
- * Built-in Vagrant synced folders using NFS fails if you try to re-provision.
222
- * In general I find NFS synced folders pretty "flaky" anyways...
223
- * Multi machines may not provision one VM if the boxes are different.
224
- * I found this problem with libvirt also, so I'm assuming it's a vagrant problem...
265
+ * In general I find NFS synced folders a little "flaky"...
266
+
225
267
 
226
268
  Version History
227
269
  ---------------
270
+ * 1.4.0 Add support to set MAC and IP addresses for network interfaces.
228
271
  * 1.3.2 Fix, Don't timeout ssh connection when ovftool takes a long time to upload image.
229
272
  * 1.3.0 Add support to get esxi password from env, from a file or prompt.
230
273
  * 1.2.1 Encode special characters in password.
@@ -1,26 +1,43 @@
1
1
  Vagrant.configure("2") do |config|
2
2
 
3
- # Select any box created for VMware that is compatible with
4
- # the ovftool. To get maximum compatiblity You should download
5
- # and install the latest version for your OS.
3
+ # Box, Select any box created for VMware that is compatible with
4
+ # the ovftool. To get maximum compatibility You should download
5
+ # and install the latest version of ovftool for your OS.
6
6
  # https://www.vmware.com/support/developer/ovf/
7
7
  #
8
8
  # If your box is stuck at "Powered On", then most likely
9
9
  # the system doesn't have the vmware tools installed.
10
10
  #
11
- # Here are some of the MANY box examples....
12
- config.vm.box = 'hashicorp/precise64'
11
+ # Here are some of the MANY examples....
12
+ config.vm.box = 'generic/centos7'
13
+ #config.vm.box = 'generic/centos6'
14
+ #config.vm.box = 'generic/fedora26'
15
+ #config.vm.box = 'generic/freebsd11'
16
+ #config.vm.box = 'generic/ubuntu1710'
17
+ #config.vm.box = 'generic/debian9'
18
+ #config.vm.box = 'hashicorp/precise64'
13
19
  #config.vm.box = 'steveant/CentOS-7.0-1406-Minimal-x64'
20
+ #config.vm.box = 'geerlingguy/centos7'
14
21
  #config.vm.box = 'geerlingguy/ubuntu1604'
15
22
  #config.vm.box = 'laravel/homestead'
16
- #config.vm.box = 'bento/ubuntu-14.04'
17
- #config.vm.box = 'generic/centos7'
18
- #config.vm.box = 'generic/fedora26'
19
- #config.vm.box = 'generic/alpine36'
23
+ #config.vm.box = "puphpet/debian75-x64"
20
24
 
21
25
 
22
- # Synced folders supports type rsync and NFS.
23
- config.vm.synced_folder('.', '/Vagrantfiles', type: 'rsync')
26
+ # Use rsync and NFS synced folders. (or disable them)
27
+ config.vm.synced_folder('.', '/vagrant', type: 'rsync')
28
+ config.vm.synced_folder('.', '/vagrant', type: 'nfs', disabled: true)
29
+
30
+ # Vagrant can set a static IP for the additional network interfaces. Use
31
+ # public_network or private_network to manually set a static IP and
32
+ # netmask. ESXi doesn't use the concept of public or private networks so
33
+ # both are valid here. "bridge" will be ignored. Netmask is optional if
34
+ # you are using standard Class A/B/C networks. The primary network
35
+ # interface is considered the management interface and cannot be changed,
36
+ # so you can specify 3 entries here!
37
+ # *** Invalid settings could cause "vagrant up" to fail ***
38
+ #config.vm.network "private_network", ip: "192.168.10.170", netmask: "255.255.255.0"
39
+ #config.vm.network "private_network", ip: "192.168.11.170"
40
+ #config.vm.network "public_network", ip: "192.168.12.170"
24
41
 
25
42
  #
26
43
  # Provider (esxi) settings
@@ -40,45 +57,45 @@ Vagrant.configure("2") do |config|
40
57
  # IMPORTANT! ESXi password.
41
58
  # *** NOTES about esxi_password & ssh keys!! ***
42
59
  #
43
- # 1) esxi.esxi_password = "my_esxi_password"
44
- # Enter your esxi passowrd in clear text here...
45
- #
46
- # 2) "key:" or "" or "key:~/.ssh/some_ssh_private_key"
47
- # Use ssh keys. The default is to use the system private keys,
48
- # or you specify a custom private key after the colon ":".
49
- #
50
- # From your command line, you should be able to run
51
- # following command without an error and be able to get to
52
- # the esxi command prompt.
53
- #
54
- # $ ssh root@ESXi_IP_ADDRESS
55
- #
56
- # The ssh connections to esxi will try the ssh private
57
- # keys. However the ovftool does NOT! To make
58
- # vagrant fully password-less, you will need to use other
59
- # options. (set the passord, use "env:" or "file:")
60
- #
61
- # 3) "prompt:"
60
+ # 1) "prompt:"
62
61
  # This will prompt you for the esxi password each time you
63
- # run a vagrant command.
62
+ # run a vagrant command. This is the default.
64
63
  #
65
- # 4) "file:" or "file:my_secret_file"
64
+ # 2) "file:" or "file:my_secret_file"
66
65
  # This will read a plain text file containing the esxi
67
66
  # password. The default filename is ~/.esxi_password, or
68
67
  # you can specify any filename after the colon ":".
69
68
  #
70
- # 5) "env:" or "env:my_secret_env_var"
71
- # This will read the esxi password via a environment
69
+ # 3) "env:" or "env:my_secret_env_var"
70
+ # This will read the esxi password via an environment
72
71
  # variable. The default is $esxi_password, but you can
73
72
  # specify any environment variable after the colon ":".
74
73
  #
75
74
  # $ export esxi_password="my_secret_password"
76
75
  #
76
+ # 4) "key:" or key:~/.ssh/some_ssh_private_key"
77
+ # Use ssh keys. The default is to use the system private keys,
78
+ # or you specify a custom private key after the colon ":".
79
+ #
80
+ # To test connectivity. From your command line, you should be able to
81
+ # run following command without an error and get an esxi prompt.
77
82
  #
78
- # IMPORTANT! Set the ESXi password.
83
+ # $ ssh root@ESXi_IP_ADDRESS
84
+ #
85
+ # The ssh connections to esxi will try the ssh private
86
+ # keys. However the ovftool does NOT! To make
87
+ # vagrant fully password-less, you will need to use other
88
+ # options. (set the password, use "env:" or "file:")
89
+ #
90
+ # 5) esxi.esxi_password = "my_esxi_password"
91
+ # Enter your esxi passowrd in clear text here... This is the
92
+ # least secure method because you may share this Vagrant file without
93
+ # realizing the password is in clear text.
94
+ #
95
+ # IMPORTANT! Set the ESXi password or authentication method..
79
96
  esxi.esxi_password = "prompt:"
80
97
 
81
- # ESXi ssh keys. (This will be depreciated!!!)
98
+ # ESXi ssh keys. (This is depreciated!!!)
82
99
  # The Default is to use system default ssh keys, However
83
100
  # you can specify an array of keys here...
84
101
  #
@@ -86,7 +103,7 @@ Vagrant.configure("2") do |config|
86
103
  #esxi.esxi_private_keys = []
87
104
 
88
105
  # SSH port.
89
- # Default port 22
106
+ # Default port 22.
90
107
  #esxi.esxi_hostport = 22
91
108
 
92
109
  # HIGHLY RECOMMENDED! Virtual Network
@@ -94,20 +111,41 @@ Vagrant.configure("2") do |config|
94
111
  # default is to use the first found. You can specify up to 4 virtual
95
112
  # networks using an array format. Note that Vagrant only looks at the
96
113
  # first interface for a valid IP address. BTW: This does not configure
97
- # IP addresses. This specifies which ESXi virtual network to use for
114
+ # IP addresses. This specifies which "ESXi virtual network" is used for
98
115
  # each network interface in your VM. For most OS's DHCP is the default,
99
- # so, you will need a DHCP server for each virtual network.
100
- #esxi.virtual_network = "vmnet_example"
116
+ # so, you will need a DHCP server for each virtual network. To set a
117
+ # static IP, see above "config.vm.network".
101
118
  #esxi.virtual_network = ["vmnet1","vmnet2","vmnet3","vmnet4"]
102
119
 
120
+ # OPTIONAL & RISKY. Specify up to 4 MAC addresses
121
+ # The default is ovftool to automatically generate a MAC address.
122
+ # You can specify an array of MAC addresses using upper or lower case,
123
+ # separated by colons ":". I highly recommend using vmware's OUI
124
+ # of "00:50:56" or "00:0c:29". I consider this option a risk
125
+ # because you may reuse a Vagrantfile without realizing you are
126
+ # duplicating the MAC address.
127
+ # *** Invalid settings could cause "vagrant up" to fail ***
128
+ #esxi.mac_address = ["00:50:56:aa:bb:cc", "00:50:56:01:01:01","00:50:56:02:02:02","00:50:56:BE:AF:01" ]
129
+
130
+ # OPTIONAL & RISKY. Specify a nic_type
131
+ # The default is to have the virtual nic hw type automatically
132
+ # determined by the ovftool. However, you can override it by specifying
133
+ # it here. This is a global setting. (all 4 virtual networks will be set)
134
+ # The validated list of nic_types are "e1000", "e1000e", "vmxnet",
135
+ # "vmxnet2", "vmxnet3", "Vlance", and "Flexible". I consider this
136
+ # risky because I don't validate if the specified nic_type is
137
+ # compatible with your OS version.
138
+ # *** Invalid settings could cause "vagrant up" to fail ***
139
+ #esxi.nic_type = 'e1000'
140
+
103
141
  # OPTIONAL. Specify a Disk Store
104
- # The Default is to use the least used Disk Store.
142
+ # If it's not specified, the Default is to use the least used Disk Store.
105
143
  #esxi.vm_disk_store = "DS_001"
106
144
 
107
- # OPTIONAL. Guest VM name to be created/used.
108
- # The Default will be automatically generated
109
- # and will be based on the vmname_prefix,
110
- # hostname, username, path...
145
+ # OPTIONAL. Guest VM name to use.
146
+ # The Default will be automatically generated. It will be based on
147
+ # the vmname_prefix (see below), your hostname & username and path.
148
+ # Otherwise you can set a fixed guest VM name here.
111
149
  #esxi.vmname = "Custom-Guest-VM_Name"
112
150
 
113
151
  # OPTIONAL. When automatically naming VMs, use
@@ -120,19 +158,22 @@ Vagrant.configure("2") do |config|
120
158
  #esxi.memsize = "2048"
121
159
 
122
160
  # OPTIONAL. Virtual CPUs override
123
- # The default is to use the number of virt cpus specified
161
+ # The default is to use the number of virtual cpus specified
124
162
  # in the vmx file, however you can specify a new value here.
125
163
  #esxi.numvcpus = "2"
126
164
 
127
165
  # OPTIONAL. Resource Pool
128
- # The default is to create VMs in the "root". You can
129
- # specify a resource pool here to partition memory and
130
- # cpu usage away from other systems on your esxi host.
131
- # The resource pool must already exist and be configured.
132
- # Vagrant will NOT create it for you.
166
+ # If unspecified, the default is to create VMs in the "root". You can
167
+ # specify a resource pool here to partition memory and cpu usage away
168
+ # from other systems on your esxi host. The resource pool must
169
+ # already exist and have the proper permissions set.
170
+ #
171
+ # Vagrant will NOT create a Resource pool it for you.
133
172
  #esxi.resource_pool = "/Vagrant"
134
173
 
135
174
  # DANGEROUS! Allow Overwrite
175
+ # If unspecified, the default is to produce an error if overwriting
176
+ # vm's and packages.
136
177
  # Set this to 'True' will overwrite existing VMs (with the same name)
137
178
  # when you run vagrant up. ie, if the vmname already exists,
138
179
  # it will be destroyed, then over written... This is helpful
@@ -23,9 +23,9 @@ Vagrant.configure("2") do |config|
23
23
  esxi.esxi_hostname = "esxi"
24
24
  esxi.esxi_username = "root"
25
25
  esxi.esxi_password = "file:"
26
- #esxi.esxi_private_keys = []
27
26
  #esxi.esxi_hostport = 22
28
27
  #esxi.virtual_network = "vmnet_example"
28
+ #esxi.nic_type = 'e1000'
29
29
  #esxi.vm_disk_store = "DS_001"
30
30
  #esxi.vmname_prefix = "V-"
31
31
  #esxi.memsize = "2048"
@@ -83,7 +83,13 @@ module VagrantPlugins
83
83
  b.use Call, WaitForState, :powered_off, 240 do |env1, b1|
84
84
  if env1[:result] == 'True'
85
85
  b1.use SnapshotRestore
86
- b1.use action_up
86
+ b1.use ReadState
87
+ b1.use Boot
88
+ b1.use Call, WaitForState, :running, 240 do |env1, b2|
89
+ if env1[:result] == 'True'
90
+ #
91
+ end
92
+ end
87
93
  end
88
94
  end
89
95
  end
@@ -135,6 +141,7 @@ module VagrantPlugins
135
141
  b.use Boot
136
142
  b.use Call, WaitForState, :running, 240 do |env1, b1|
137
143
  if env1[:result] == 'True'
144
+ b1.use SetNetworkIP
138
145
  b1.use action_provision
139
146
  end
140
147
  end
@@ -169,6 +176,7 @@ module VagrantPlugins
169
176
  autoload :CreateVM, action_root.join('createvm')
170
177
  autoload :ReadState, action_root.join('read_state')
171
178
  autoload :ReadSSHInfo, action_root.join('read_ssh_info')
179
+ autoload :SetNetworkIP, action_root.join('set_network_ip')
172
180
  autoload :Boot, action_root.join('boot')
173
181
  autoload :Halt, action_root.join('halt')
174
182
  autoload :Destroy, action_root.join('destroy')
@@ -38,7 +38,7 @@ module VagrantPlugins
38
38
  password: $esxi_password,
39
39
  port: config.esxi_hostport,
40
40
  keys: config.esxi_private_keys,
41
- timeout: 10,
41
+ timeout: 20,
42
42
  number_of_password_prompts: 0,
43
43
  non_interactive: true
44
44
  ) do |ssh|
@@ -47,7 +47,8 @@ module VagrantPlugins
47
47
  if r.exitstatus != 0
48
48
  raise Errors::ESXiError,
49
49
  message: "Unable to power on VM:\n"\
50
- " #{r}"
50
+ " #{r}"\
51
+ ' Review ESXi logs for additional information!'
51
52
  end
52
53
  env[:ui].info I18n.t('vagrant_vmware_esxi.vagrant_vmware_esxi_message',
53
54
  message: 'VM has been Powered On...')
@@ -68,7 +68,7 @@ module VagrantPlugins
68
68
  password: $esxi_password,
69
69
  port: config.esxi_hostport,
70
70
  keys: config.esxi_private_keys,
71
- timeout: 10,
71
+ timeout: 20,
72
72
  number_of_password_prompts: 0,
73
73
  non_interactive: true
74
74
  ) do |ssh|
@@ -208,7 +208,7 @@ module VagrantPlugins
208
208
  networkID = 0
209
209
  for element in @guestvm_network do
210
210
  if (config.debug =~ %r{true}i)
211
- puts "@guestvm_network[#{networkID}]: #{element}"
211
+ puts "guestvm_network[#{networkID}]: #{element}"
212
212
  end
213
213
  new_vmx_contents << "ethernet#{networkID}.networkName = \"net#{networkID}\"\n"
214
214
  new_vmx_contents << "ethernet#{networkID}.present = \"TRUE\"\n"
@@ -220,13 +220,6 @@ module VagrantPlugins
220
220
  end
221
221
  end
222
222
 
223
- # append custom_vmx_settings if exists
224
- if config.custom_vmx_settings.is_a? Array
225
- env[:machine].provider_config.custom_vmx_settings.each do |k, v|
226
- new_vmx_contents << "#{k} = \"#{v}\"\n"
227
- end
228
- end
229
-
230
223
  # Write new vmx file
231
224
  filename_only = File.basename vmx_file, '.vmx'
232
225
  path_only = File.dirname vmx_file
@@ -257,6 +250,46 @@ module VagrantPlugins
257
250
  overwrite_opts = nil
258
251
  end
259
252
 
253
+ # Validate mac addresses
254
+ unless config.mac_address.nil?
255
+ new_mac_address = []
256
+ 0.upto(@guestvm_network.count - 1) do |index|
257
+ unless config.mac_address[index].nil?
258
+ mac_address = config.mac_address[index].gsub(/-/,':').downcase
259
+ if mac_address =~ /^([0-9a-fA-F]{2}[:-]){5}[0-9a-fA-F]{2}$/i
260
+ new_mac_address[index] = mac_address
261
+ elsif mac_address == ''
262
+ new_mac_address[index] = ''
263
+ else
264
+ new_mac_address[index] = "invalid"
265
+ end
266
+ end
267
+ end
268
+ config.mac_address = new_mac_address
269
+ end
270
+
271
+ # Validate nic types
272
+ unless config.nic_type.nil?
273
+ if config.nic_type =~ /Vlance/i
274
+ config.nic_type = 'Vlance'
275
+ elsif config.nic_type =~ /Flexible/i
276
+ config.nic_type = 'Flexible'
277
+ elsif config.nic_type =~ /e1000$/i
278
+ config.nic_type = 'e1000'
279
+ elsif config.nic_type =~ /e1000e$/i
280
+ config.nic_type = 'e1000e'
281
+ elsif config.nic_type =~ /vmxnet$/i
282
+ config.nic_type = 'vmxnet'
283
+ elsif config.nic_type =~ /vmxnet2$/i
284
+ config.nic_type = 'vmxnet2'
285
+ elsif config.nic_type =~ /vmxnet3$/i
286
+ config.nic_type = 'vmxnet3'
287
+ else
288
+ config.nic_type = 'e1000'
289
+ end
290
+ end
291
+
292
+
260
293
  #
261
294
  # Display build summary
262
295
  numvcpus = new_vmx_contents.match(/^numvcpus =.*/i)
@@ -269,6 +302,10 @@ module VagrantPlugins
269
302
  message: "ESXi host : #{config.esxi_hostname}")
270
303
  env[:ui].info I18n.t('vagrant_vmware_esxi.vagrant_vmware_esxi_message',
271
304
  message: "VM Name : #{guestvm_vmname}")
305
+ env[:ui].info I18n.t('vagrant_vmware_esxi.vagrant_vmware_esxi_message',
306
+ message: "Box : #{env[:machine].box.name}")
307
+ env[:ui].info I18n.t('vagrant_vmware_esxi.vagrant_vmware_esxi_message',
308
+ message: "Box Ver : #{env[:machine].box.version}")
272
309
  env[:ui].info I18n.t('vagrant_vmware_esxi.vagrant_vmware_esxi_message',
273
310
  message: "CPUS :#{numvcpus}")
274
311
  env[:ui].info I18n.t('vagrant_vmware_esxi.vagrant_vmware_esxi_message',
@@ -278,7 +315,15 @@ module VagrantPlugins
278
315
  env[:ui].info I18n.t('vagrant_vmware_esxi.vagrant_vmware_esxi_message',
279
316
  message: "Disk Store : #{@guestvm_dsname}")
280
317
  env[:ui].info I18n.t('vagrant_vmware_esxi.vagrant_vmware_esxi_message',
281
- message: "NetworkName : #{@guestvm_network[0..3]}")
318
+ message: "Virtual Network : #{@guestvm_network[0..3]}")
319
+ unless config.mac_address[0].eql? ''
320
+ env[:ui].info I18n.t('vagrant_vmware_esxi.vagrant_vmware_esxi_message',
321
+ message: "Mac Address : #{config.mac_address}")
322
+ end
323
+ unless config.nic_type.nil?
324
+ env[:ui].info I18n.t('vagrant_vmware_esxi.vagrant_vmware_esxi_message',
325
+ message: "Nic Type : #{config.nic_type}")
326
+ end
282
327
  unless overwrite_opts.nil?
283
328
  env[:ui].info I18n.t('vagrant_vmware_esxi.vagrant_vmware_esxi_message',
284
329
  message: 'Allow Overwrite : True')
@@ -296,7 +341,7 @@ module VagrantPlugins
296
341
  ' install from http://www.vmware.com.'
297
342
  end
298
343
  ovf_cmd = "ovftool --noSSLVerify #{overwrite_opts} "\
299
- "#{netOpts} -dm=thin --powerOn "\
344
+ "#{netOpts} -dm=thin "\
300
345
  "-ds=\"#{@guestvm_dsname}\" --name=\"#{guestvm_vmname}\" "\
301
346
  "\"#{new_vmx_file}\" vi://#{config.esxi_username}:"\
302
347
  "#{$encoded_esxi_password}@#{config.esxi_hostname}"\
@@ -329,7 +374,7 @@ module VagrantPlugins
329
374
  password: $esxi_password,
330
375
  port: config.esxi_hostport,
331
376
  keys: config.esxi_private_keys,
332
- timeout: 10,
377
+ timeout: 20,
333
378
  number_of_password_prompts: 0,
334
379
  non_interactive: true
335
380
  ) do |ssh|
@@ -339,12 +384,127 @@ module VagrantPlugins
339
384
  vmid = r
340
385
  if (vmid == '') || (r.exitstatus != 0)
341
386
  raise Errors::ESXiError,
342
- message: "Unable to register / start #{guestvm_vmname}"
387
+ message: "Unable to register #{guestvm_vmname}"
343
388
  end
344
389
 
345
390
  env[:machine].id = vmid.to_i
346
391
  env[:ui].info I18n.t('vagrant_vmware_esxi.vagrant_vmware_esxi_message',
347
392
  message: "VMID: #{env[:machine].id}")
393
+
394
+ #
395
+ # -=-=-=-=-=-=-
396
+ # Destination (on esxi host) vmx file
397
+ dst_vmx = ssh.exec!("vim-cmd vmsvc/get.config #{env[:machine].id} |\
398
+ grep vmPathName|awk '{print $NF}'|sed 's/[\"|,]//g'")
399
+
400
+ dst_vmx_dir = ssh.exec!("vim-cmd vmsvc/get.config #{env[:machine].id} |"\
401
+ 'grep vmPathName|grep -oE "\[.*\]"')
402
+
403
+ dst_vmx_file = "/vmfs/volumes/"
404
+ dst_vmx_file << dst_vmx_dir.gsub('[','').gsub(']','').strip + "/"
405
+ dst_vmx_file << dst_vmx
406
+
407
+ # Get vmx file in memory
408
+ esxi_orig_vmx_file = ssh.exec!("cat #{dst_vmx_file} 2>/dev/null")
409
+ if (config.debug =~ %r{vmx}i)
410
+ puts "orig vmx: #{esxi_orig_vmx_file}"
411
+ end
412
+ if esxi_orig_vmx_file.exitstatus != 0
413
+ raise Errors::ESXiError,
414
+ message: "Unable to read #{dst_vmx_file}"
415
+ end
416
+
417
+ # read each line in vmx to configure mac and nic type.
418
+ new_vmx_contents = ''
419
+ vmx_need_change_flag = false
420
+ esxi_orig_vmx_file.each_line do |line|
421
+ if line.match(/^ethernet[0-9]/i)
422
+ nicindex = line[8].to_i
423
+ if line.match(/^ethernet[0-9].networkName = /i)
424
+ new_vmx_contents << line
425
+ elsif line.match(/^ethernet0.virtualDev = /i)
426
+ # Update nic_type if it's set, otherwise, save eth0 nic_type
427
+ # for the remaining nics. (ovftool doesn't set it...)
428
+ if config.nic_type.nil?
429
+ config.nic_type = line.gsub(/ethernet0.virtualDev = /i, '').gsub('"', '').strip
430
+ new_vmx_contents << line
431
+ else
432
+ new_vmx_contents << line.gsub(/ = .*$/, " = \"#{config.nic_type}\"\n")
433
+ vmx_need_change_flag = true
434
+ end
435
+ elsif (line.match(/^ethernet[0-9].addressType = /i) &&
436
+ !config.mac_address[nicindex].nil?)
437
+ # Update MAC address if it's set
438
+ mac_address = config.mac_address[nicindex]
439
+ if mac_address =~ /^([0-9a-fA-F]{2}[:-]){5}[0-9a-fA-F]{2}$/i
440
+ new_vmx_contents << line.gsub(/ = .*$/, " = \"static\"")
441
+ new_vmx_contents << line.gsub(/Type = .*$/, " = \"#{mac_address}\"")
442
+ vmx_need_change_flag = true
443
+ elsif mac_address == ''
444
+ new_vmx_contents << line
445
+ else
446
+ env[:ui].info I18n.t('vagrant_vmware_esxi.vagrant_vmware_esxi_message',
447
+ message: "Ignored invalid mac address at index: #{nicindex}")
448
+ new_vmx_contents << line
449
+ end
450
+ end
451
+ else
452
+ new_vmx_contents << line
453
+ end
454
+ end
455
+
456
+ # For all nics, configure nic_type and enable nics
457
+ if config.nic_type.nil?
458
+ config.nic_type = "e1000"
459
+ end
460
+ if config.virtual_network.is_a? Array
461
+ number_of_adapters = config.virtual_network.count
462
+ else
463
+ number_of_adapters = 1
464
+ end
465
+
466
+ 1.upto(number_of_adapters) do |index|
467
+ nic_index = index - 1
468
+ unless new_vmx_contents =~ /ethernet#{nic_index}.virtualDev = \"#{config.nic_type}\"/i
469
+ new_vmx_contents << "ethernet#{nic_index}.virtualDev = \"#{config.nic_type}\"\n"
470
+ vmx_need_change_flag = true
471
+ end
472
+ unless new_vmx_contents =~ /ethernet#{nic_index}.present = \"TRUE\"/i
473
+ new_vmx_contents << "ethernet#{nic_index}.present = \"TRUE\"\n"
474
+ vmx_need_change_flag = true
475
+ end
476
+ end
477
+
478
+ # append custom_vmx_settings if exists
479
+ if config.custom_vmx_settings.is_a? Array
480
+ env[:machine].provider_config.custom_vmx_settings.each do |k, v|
481
+ new_vmx_contents << "#{k} = \"#{v}\"\n"
482
+ vmx_need_change_flag = true
483
+ end
484
+ end
485
+
486
+ # If there was changes, update esxi
487
+ if vmx_need_change_flag == true
488
+ if (config.debug =~ %r{vmx}i)
489
+ puts "new vmx: #{new_vmx_contents}"
490
+ end
491
+ r = ''
492
+ ssh.open_channel do |channel|
493
+ channel.exec("cat >#{dst_vmx_file}") do |ch, success|
494
+ raise Errors::ESXiError,
495
+ message: "Unable to update vmx file.\n"\
496
+ " #{r}" unless success
497
+
498
+ channel.send_data(new_vmx_contents)
499
+ channel.eof!
500
+ end
501
+ end
502
+ ssh.loop
503
+ else
504
+ if (config.debug =~ %r{vmx}i)
505
+ puts "no changes requried to vmx file"
506
+ end
507
+ end
348
508
  end
349
509
  end
350
510
  end
@@ -37,7 +37,7 @@ module VagrantPlugins
37
37
  password: $esxi_password,
38
38
  port: config.esxi_hostport,
39
39
  keys: config.esxi_private_keys,
40
- timeout: 10,
40
+ timeout: 20,
41
41
  number_of_password_prompts: 0,
42
42
  non_interactive: true
43
43
  ) do |ssh|
@@ -45,7 +45,7 @@ module VagrantPlugins
45
45
  r = ssh.exec!("vim-cmd vmsvc/destroy #{machine.id}")
46
46
  if r.exitstatus != 0
47
47
  raise Errors::ESXiError,
48
- message => "Unable to destroy the VM:\n"\
48
+ message: "Unable to destroy the VM:\n"\
49
49
  " #{r}"
50
50
  end
51
51
  env[:ui].info I18n.t('vagrant_vmware_esxi.vagrant_vmware_esxi_message',
@@ -29,9 +29,6 @@ module VagrantPlugins
29
29
  # Set global variable $esxi_password
30
30
  #
31
31
  if $esxi_password.nil?
32
- if (config.debug =~ %r{password}i)
33
- puts "$esxi_password is unset..."
34
- end
35
32
  if (config.esxi_password =~ %r{^prompt:}i)
36
33
  #
37
34
  # Prompt for password
@@ -98,11 +95,6 @@ module VagrantPlugins
98
95
  $esxi_password = config.esxi_password
99
96
  end
100
97
  end
101
- if (config.debug =~ %r{password}i)
102
- puts "pw (set_esxi_password): #{$esxi_password}"
103
- puts "esxi_private_keys: #{config.esxi_private_keys}"
104
- end
105
-
106
98
 
107
99
  #
108
100
  # Encode special characters in PW
@@ -128,7 +120,7 @@ module VagrantPlugins
128
120
  password: $esxi_password,
129
121
  port: config.esxi_hostport,
130
122
  keys: config.esxi_private_keys,
131
- timeout: 10,
123
+ timeout: 20,
132
124
  number_of_password_prompts: 0,
133
125
  non_interactive: true
134
126
  ) do |ssh|
@@ -32,7 +32,7 @@ module VagrantPlugins
32
32
  password: $esxi_password,
33
33
  port: config.esxi_hostport,
34
34
  keys: config.esxi_private_keys,
35
- timeout: 10,
35
+ timeout: 20,
36
36
  number_of_password_prompts: 0,
37
37
  non_interactive: true
38
38
  ) do |ssh|
@@ -25,6 +25,12 @@ module VagrantPlugins
25
25
 
26
26
  return nil if machine.id.nil?
27
27
 
28
+ if (env[:machine_state].to_s == 'not_created' ||
29
+ env[:machine_state].to_s == 'powered_off' ||
30
+ env[:machine_state].to_s == 'suspended')
31
+ return nil
32
+ end
33
+
28
34
  @logger.info("vagrant-vmware-esxi, read_ssh_info: machine id: #{machine.id}")
29
35
  @logger.info('vagrant-vmware-esxi, read_ssh_info: current state:'\
30
36
  " #{env[:machine_state]}")
@@ -34,7 +40,7 @@ module VagrantPlugins
34
40
  password: $esxi_password,
35
41
  port: config.esxi_hostport,
36
42
  keys: config.esxi_private_keys,
37
- timeout: 10,
43
+ timeout: 20,
38
44
  number_of_password_prompts: 0,
39
45
  non_interactive: true
40
46
  ) do |ssh|
@@ -43,16 +49,35 @@ module VagrantPlugins
43
49
  'read_ssh_info-net_ssh')
44
50
 
45
51
  # ugly, but it works...
46
- ssh_execute_cmd = "vim-cmd vmsvc/get.guest #{machine.id} |"
47
- ssh_execute_cmd << 'grep -i "^ ipAddress"|'
52
+ # Try to get first interface. This is the prefered method
53
+ # when you have multiple network interfaces
54
+ ssh_execute_cmd = "vim-cmd vmsvc/get.guest #{machine.id} 2>/dev/null |"
55
+ ssh_execute_cmd << 'grep -A 5 "deviceConfigId = 4000" |tail -1|'
48
56
  ssh_execute_cmd << 'grep -oE "((1?[0-9][0-9]?|2[0-4][0-9]|25[0-5])\.){3}(1?[0-9][0-9]?|2[0-4][0-9]|25[0-5])"'
49
57
  r = ssh.exec!(ssh_execute_cmd)
50
-
51
58
  ipaddress = r.strip
52
- @logger.info('vagrant-vmware-esxi, read_ssh_info: ipaddress: '\
53
- "#{ipaddress}")
54
59
 
55
- return nil if (ipaddress == '') || (r.exitstatus != 0)
60
+ # Some OS's don't like above method, so use IP from summary (after 60 seconds uptime)
61
+ ssh_execute_cmd = "vim-cmd vmsvc/get.guest #{machine.id} 2>/dev/null |"
62
+ ssh_execute_cmd << 'grep "^ ipAddress = "|head -1|'
63
+ ssh_execute_cmd << 'grep -oE "((1?[0-9][0-9]?|2[0-4][0-9]|25[0-5])\.){3}(1?[0-9][0-9]?|2[0-4][0-9]|25[0-5])"'
64
+ r2 = ssh.exec!(ssh_execute_cmd)
65
+
66
+ ssh_execute_cmd = "vim-cmd vmsvc/get.summary #{machine.id} 2>/dev/null |"
67
+ ssh_execute_cmd << 'grep "uptimeSeconds ="|sed "s/^.*= //g"|sed s/,//g'
68
+ uptime = ssh.exec!(ssh_execute_cmd)
69
+
70
+ if ( r.length == 0 && uptime.to_i > 60)
71
+ ipaddress = r2.strip
72
+ else
73
+ ipaddress = r.strip
74
+ end
75
+
76
+ if (config.debug =~ %r{ip}i)
77
+ puts "ip1: |#{r.strip}| ip2: |#{r2.strip}| ipaddress: #{ipaddress}"
78
+ end
79
+
80
+ return nil if (ipaddress == '')
56
81
 
57
82
  return {
58
83
  host: ipaddress,
@@ -45,7 +45,7 @@ module VagrantPlugins
45
45
  password: $esxi_password,
46
46
  port: config.esxi_hostport,
47
47
  keys: config.esxi_private_keys,
48
- timeout: 10,
48
+ timeout: 20,
49
49
  number_of_password_prompts: 0,
50
50
  non_interactive: true
51
51
  ) do |ssh|
@@ -42,7 +42,7 @@ module VagrantPlugins
42
42
  password: $esxi_password,
43
43
  port: config.esxi_hostport,
44
44
  keys: config.esxi_private_keys,
45
- timeout: 10,
45
+ timeout: 20,
46
46
  number_of_password_prompts: 0,
47
47
  non_interactive: true,
48
48
  keepalive: true,
@@ -0,0 +1,121 @@
1
+ require 'log4r'
2
+ require 'vagrant/util/network_ip'
3
+ require "vagrant/util/scoped_hash_override"
4
+
5
+ module VagrantPlugins
6
+ module ESXi
7
+ module Action
8
+ # This action set the IP address (do the config.vm_network settings...)
9
+ class SetNetworkIP
10
+ include Vagrant::Util::NetworkIP
11
+ include Vagrant::Util::ScopedHashOverride
12
+
13
+ def initialize(app, env)
14
+ @app = app
15
+ @logger = Log4r::Logger.new('vagrant_vmware_esxi::action::set_network_ip')
16
+ end
17
+
18
+ def call(env)
19
+ set_network_ip(env)
20
+ @app.call(env)
21
+ end
22
+
23
+ def set_network_ip(env)
24
+ @logger.info('vagrant-vmware-esxi, set_network_ip: start...')
25
+
26
+ # Get config.
27
+ @env = env
28
+ machine = env[:machine]
29
+ config = env[:machine].provider_config
30
+
31
+ # Number of nics configured
32
+ if config.virtual_network.is_a? Array
33
+ number_of_adapters = config.virtual_network.count
34
+ else
35
+ number_of_adapters = 1
36
+ end
37
+
38
+ #
39
+ # Make an array of vm.network settings (from Vagrantfile).
40
+ # One index for each network interface. I'll use private_network and
41
+ # public_network as both valid. Since it would be a TERRIBLE idea
42
+ # to modify ESXi virtual network configurations, I'll just set the IP
43
+ # using static or DHCP. Everything else will be ignored...
44
+ #
45
+ vm_network = []
46
+ env[:machine].config.vm.networks.each do |type, options|
47
+ # We only handle private and public networks
48
+ next if type != :private_network && type != :public_network
49
+ next if vm_network.count >= number_of_adapters
50
+ vm_network << options
51
+ end
52
+
53
+
54
+ if (config.debug =~ %r{true}i)
55
+ puts "num adapters: #{number_of_adapters}, vm.network.count: #{vm_network.count}"
56
+ end
57
+
58
+ networks_to_configure = []
59
+ if (number_of_adapters > 1 && vm_network.count > 0)
60
+ 1.upto(number_of_adapters - 1) do |index|
61
+ if !vm_network[index - 1].nil?
62
+ options = vm_network[index - 1]
63
+ next if options[:auto_config] === false
64
+ if options[:ip]
65
+ ip_class = options[:ip].gsub(/\..*$/,'').to_i
66
+ if ip_class < 127
67
+ class_netmask = "255.0.0.0"
68
+ elsif ip_class > 127 and ip_class < 192
69
+ class_netmask = "255.255.0.0"
70
+ elsif ip_class >= 192 and ip_class <= 223
71
+ class_netmask = "255.255.255.0"
72
+ end
73
+
74
+ # if netmask is not specified or is invalid, use, class defaults
75
+ unless options[:netmask]
76
+ netmask = class_netmask
77
+ else
78
+ netmask = options[:netmask]
79
+ end
80
+ unless netmask =~ /^(((128|192|224|240|248|252|254)\.0\.0\.0)|(255\.(0|128|192|224|240|248|252|254)\.0\.0)|(255\.255\.(0|128|192|224|240|248|252|254)\.0)|(255\.255\.255\.(0|128|192|224|240|248|252|254)))$/i
81
+ env[:ui].info I18n.t('vagrant_vmware_esxi.vagrant_vmware_esxi_message',
82
+ message: "WARNING: Invalid netmask specified, using Class mask (#{class_netmask})")
83
+ netmask = class_netmask
84
+ end
85
+ network = {
86
+ interface: index,
87
+ type: :static,
88
+ use_dhcp_assigned_default_route: options[:use_dhcp_assigned_default_route],
89
+ mac_address: options[:mac],
90
+ ip: options[:ip],
91
+ netmask: netmask,
92
+ gateway: options[:gateway]
93
+ }
94
+ ip_msg = options[:ip]
95
+ else
96
+ network = {
97
+ interface: index,
98
+ type: :dhcp,
99
+ use_dhcp_assigned_default_route: options[:use_dhcp_assigned_default_route],
100
+ mac_address: options[:mac]
101
+ }
102
+ ip_msg = 'dhcp'
103
+ netmask = ''
104
+ end
105
+ networks_to_configure << network
106
+ env[:ui].info I18n.t('vagrant_vmware_esxi.vagrant_vmware_esxi_message',
107
+ message: "Configuring: #{ip_msg} / #{netmask} on #{config.virtual_network[index]}")
108
+ end
109
+ end
110
+
111
+ #
112
+ # Save network configuration for provisioner to do changes.
113
+ #
114
+ env[:machine].guest.capability(
115
+ :configure_networks, networks_to_configure)
116
+ end
117
+ end
118
+ end
119
+ end
120
+ end
121
+ end
@@ -38,9 +38,11 @@ module VagrantPlugins
38
38
  password: $esxi_password,
39
39
  port: config.esxi_hostport,
40
40
  keys: config.esxi_private_keys,
41
- timeout: 10,
41
+ timeout: 20,
42
42
  number_of_password_prompts: 0,
43
- non_interactive: true
43
+ non_interactive: true,
44
+ keepalive: true,
45
+ keepalive_interval: 30
44
46
  ) do |ssh|
45
47
 
46
48
  r = ssh.exec!(
@@ -35,7 +35,7 @@ module VagrantPlugins
35
35
  password: $esxi_password,
36
36
  port: config.esxi_hostport,
37
37
  keys: config.esxi_private_keys,
38
- timeout: 10,
38
+ timeout: 20,
39
39
  number_of_password_prompts: 0,
40
40
  non_interactive: true
41
41
  ) do |ssh|
@@ -35,7 +35,7 @@ module VagrantPlugins
35
35
  password: $esxi_password,
36
36
  port: config.esxi_hostport,
37
37
  keys: config.esxi_private_keys,
38
- timeout: 10,
38
+ timeout: 20,
39
39
  number_of_password_prompts: 0,
40
40
  non_interactive: true
41
41
  ) do |ssh|
@@ -38,9 +38,11 @@ module VagrantPlugins
38
38
  password: $esxi_password,
39
39
  port: config.esxi_hostport,
40
40
  keys: config.esxi_private_keys,
41
- timeout: 10,
41
+ timeout: 20,
42
42
  number_of_password_prompts: 0,
43
- non_interactive: true
43
+ non_interactive: true,
44
+ keepalive: true,
45
+ keepalive_interval: 30
44
46
  ) do |ssh|
45
47
 
46
48
  r = ssh.exec!(
@@ -38,7 +38,7 @@ module VagrantPlugins
38
38
  password: $esxi_password,
39
39
  port: config.esxi_hostport,
40
40
  keys: config.esxi_private_keys,
41
- timeout: 10,
41
+ timeout: 20,
42
42
  number_of_password_prompts: 0,
43
43
  non_interactive: true,
44
44
  keepalive: true,
@@ -41,7 +41,7 @@ module VagrantPlugins
41
41
  password: $esxi_password,
42
42
  port: config.esxi_hostport,
43
43
  keys: config.esxi_private_keys,
44
- timeout: 10,
44
+ timeout: 20,
45
45
  number_of_password_prompts: 0,
46
46
  non_interactive: true,
47
47
  keepalive: true,
@@ -15,6 +15,8 @@ module VagrantPlugins
15
15
  attr_accessor :vmname_prefix
16
16
  attr_accessor :vm_disk_store
17
17
  attr_accessor :virtual_network
18
+ attr_accessor :nic_type
19
+ attr_accessor :mac_address
18
20
  attr_accessor :resource_pool
19
21
  attr_accessor :memsize
20
22
  attr_accessor :numvcpus
@@ -34,6 +36,8 @@ module VagrantPlugins
34
36
  @vmname_prefix = 'V-'
35
37
  @vm_disk_store = nil
36
38
  @virtual_network = nil
39
+ @nic_type = nil
40
+ @mac_address = ["","","",""]
37
41
  @resource_pool = nil
38
42
  @memsize = UNSET_VALUE
39
43
  @numvcpus = UNSET_VALUE
@@ -1,6 +1,6 @@
1
1
  # VERSION
2
2
  module VagrantPlugins
3
3
  module ESXi
4
- VERSION = '1.3.2'
4
+ VERSION = '1.4.0'
5
5
  end
6
6
  end
@@ -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 = '2017-09-01'
6
+ s.date = '2018-01-17'
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: 1.3.2
4
+ version: 1.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jonathan Senkerik
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-09-01 00:00:00.000000000 Z
11
+ date: 2018-01-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: i18n
@@ -132,6 +132,7 @@ files:
132
132
  - lib/vagrant-vmware-esxi/action/read_ssh_info.rb
133
133
  - lib/vagrant-vmware-esxi/action/read_state.rb
134
134
  - lib/vagrant-vmware-esxi/action/resume.rb
135
+ - lib/vagrant-vmware-esxi/action/set_network_ip.rb
135
136
  - lib/vagrant-vmware-esxi/action/snapshot_delete.rb
136
137
  - lib/vagrant-vmware-esxi/action/snapshot_info.rb
137
138
  - lib/vagrant-vmware-esxi/action/snapshot_list.rb