简体   繁体   中英

packer vmware iso local and on esxi

I am curious to find out why packer is failing to get ssh access on an ESXi server. The build works just fine for vmware_fusion locally.

As JSON does not seem to display nicely directly here on SF - a link to a gist with the builder configuration: https://gist.github.com/geoHeil/5acf06cb0f3afadfa347d437c2695a7c

When running

packer build -var-file variables.json -only=vmwarevmwareRemote template.json

the kickstart file is loaded, configured and installed. However, in the case of ESXi as the builder the build seems to be stuck on waiting for SSH to become available.

I noticed in the logs that:

/var/log/auth.log
2017-02-08T17:33:20Z sshd[94210]: User 'root' running command 'esxcli --formatter csv network vm list\n'
2017-02-08T17:33:25Z sshd[94210]: User 'root' running command 'esxcli --formatter csv network vm list\n'

displays a lot of the same commands.

Executing this command manually shows

esxcli --formatter csv network vm list
Name,Networks,NumPorts,WorldID,
ubunu-test,"VM Network,",1,87986,
someOther,"VM Network,",1,84833,

What could be wrong here?

edit

packer version is latest 0.12.2, esxi 6.5

edit2

when applying the suggestion of setting a network the same problem persists. But now I see 2 commands in the logs

[root@vm-bd-dev:/var/log] tail -f auth.log
2017-02-09T09:05:56Z sshd[111376]: User 'root' running command 'esxcli --formatter csv network vm list\n'
2017-02-09T09:05:56Z sshd[111376]: User 'root' running command 'esxcli --formatter csv network vm port list -w 111433\n'

The second (new) one has the following output:

ActiveFilters,DVPortID,IPAddress,MACAddress,PortID,Portgroup,TeamUplink,UplinkPortID,vSwitch,
,,0.0.0.0,00:0c:29:47:d5:3d,33554450,VM Network,vmnic2,33554437,vSwitch0,

You probably need some more vmx_data settings for the network, something like:

"vmx_data": {
  "ethernet0.networkName": "VM Network",
  "ethernet0.present": "true",
  "ethernet0.virtualDev": "vmxnet3",
  "ethernet0.startConnected": "true",
  "ethernet0.addressType": "generated"
}

Switching the network interface to something not hard coded like

network --bootproto=dhcp --ipv6=auto --activate

solved the problem for me.

Apparently different interfaces (no eth0 ) were available on ESXi.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM