Windows 2016 vsphere packer template getting stuck

I am getting stuck on Waiting for IP when trying to setup a windows 2016 template in vsphere

any idea?
{
“variables”: {
“vsphere_server”: “”,
“vsphere_user”: “”,
“vsphere_password”: “”,
“vsphere_template_name”: “”,
“vsphere_folder”: “”,
“vsphere_dc_name”: “”,
“vsphere_compute_cluster”: “”,
“vsphere_host”: “”,
“vsphere_portgroup_name”: “”,
“vsphere_datastore”: “”,
“winadmin_password”: “”,
“cpu_num”: “”,
“mem_size”: “”,
“disk_size”: “”,
“os_iso_path”: “”,
“vmtools_iso_path”:""
},
“sensitive-variables”: [“vsphere_password”, “winadmin_password”],
“builders”: [
{
“type”: “vsphere-iso”,
“vcenter_server”: “{{user vsphere_server}}”,
“username”: “{{user vsphere_user}}”,
“password”: “{{user vsphere_password}}”,
“insecure_connection”: “true”,
“vm_name”: “{{user vsphere_template_name}}”,
“folder”: “{{user vsphere_folder}}”,
“datacenter”: “{{user vsphere_dc_name}}”,
“cluster”: “{{user vsphere_compute_cluster}}”,
“host”: “{{user vsphere_host}}”,
“network”: “{{user vsphere_portgroup_name}}”,
“datastore”: “{{user vsphere_datastore}}”,
“convert_to_template”: “true”,
“guest_os_type”: “windows9Server64Guest”,
“communicator”: “winrm”,
“winrm_username”: “Administrator”,
“winrm_password”: “{{user winadmin_password}}”,
“CPUs”: “{{user cpu_num}}”,
“RAM”: “{{user mem_size}}”,
“RAM_reserve_all”: true,
“firmware”: “bios”,
“disk_controller_type”: “lsilogic-sas”,
“boot_order”: “disk,cdrom”,
“disk_size”: “{{user disk_size}}”,
“disk_thin_provisioned”: true,
“network_card”: “vmxnet3”,
“iso_paths”: [
“{{user os_iso_path}}”,
“{{user vmtools_iso_path}}”
],
“floppy_files”: [
“setup/autounattend.xml”,
“setup/setup.ps1”,
“setup/vmtools.cmd”
]
}
],

“provisioners”: [
{
“type”: “windows-shell”,
“inline”: [“dir c:\”]
}
]

Hi,

just curious, VMware Tools are installed on your machine when you got stuck at waiting for IP?

Martin

did not even get to that stage.

Check the VM on vCenter side, whether VM Tools are running. I think that when VM Tools are not running Packer has no way how to get IP for WinRM to connect.

vmtools not running. The os is not even running but vm is on

What’s the value of vsphere_portgroup_name? In the VMware console can you see the network card and is it connected at boot (with an configured network [using DHCP, I guess])?

Do you see OS being installed? As basic prerequisites I think you need to have:

  • VM Tools running
  • DHCP server in subnet where you deploy your template or static IP address assigned
  • access to the template IP from machine where your Packer is running

Hopefully I didn’t forgot anything.

no I do not see os being installed. I have my variables file and all is correct. in the VM I see the iso mounted but does not say connected. vlan is fine. the other wunning vms are using same vlan. yes I have dhcp on this subnet

vCenter user permissions or any error in the task log?

permission not an issue. I am using administrator@vsphere.local. The vm was created in the folder. Problem is I am stuck at a flashing prompt on the vm console

Screen Shot 2020-03-25 at 7.05.05 AM

also I dont see a floppy being mounted. here is the vm config

I was seeing similar issue, if I remember it right I’ve removed some values from json, but don’t know what it was. Below is part of my working json file.

“builders”: [
{
“type”: “vsphere-iso”,

"vcenter_server": "{{user `vsphere-server`}}",
"username": "{{user `vsphere-user`}}",
"password": "{{user `vsphere-password`}}",
"insecure_connection": "true",

"datacenter": "{{user `vsphere-datacenter`}}",
"cluster": "{{user `vsphere-cluster`}}",
"network": "{{user `vsphere-network`}}",
"datastore": "{{user `vsphere-datastore`}}",
"folder": "{{user `vsphere-folder`}}",

"convert_to_template": "true",

"communicator": "winrm",
"winrm_username": "Administrator",
"winrm_password": "{{user `winadmin-password`}}",

"vm_name": "{{user `vm-name`}}",
"notes": "Build via Packer",

"guest_os_type": "windows9Server64Guest",

"CPUs": "{{user `vm-cpu-num`}}",

“CPU_limit”: -1,
“boot_order”: “disk,cdrom”,
“RAM”: “{{user vm-mem-size}}”,
“RAM_reserve_all”: true,
“firmware”: “bios”,

"disk_controller_type":  "lsilogic-sas",
"disk_size": "{{user `vm-disk-size`}}",
"disk_thin_provisioned": true,

"network_card": "vmxnet3",

“iso_checksum_type”:“sha256”,
“iso_checksum”:“17f8c922e49c55804db7a1b9c41a87209a17b99241643e4c87854ba47ea03165”,
“iso_urls”:"/templates/Svr_Std_2016_64Bit.iso",

"floppy_files": [
    "autounattend.xml"
    ]
  }
],

do i nee dthe iso checksum?

not sure, didn’t tested without it

ok looks like I got the iso name mistype. I got windows installed now but vmware tools not installed. How do I get that installed with packer?

Here is a complete example for your case:

ok now its getting stuck on WAiting for WinRM to become available. Screen Shot 2020-03-25 at 11.45.21 AM

Is telnet for port 5985 working?

yes its listening. one other thing is vmware tools is installed. but mouse is not working on the web console