Vmware-vmx builder consumes new DHCP address each run

I’d like to fix this by setting a reservation in Vmware DHCP server, but I can’t see how to set the mac address for the vmware-vmx builder. it seems to be an option in the vsphere-iso builder

I have not tested this exact case, but you can use the vmx_data stanza in den builders block to manipulate such things (I am using it for setting an annotation and the network at boot):

82|       "vmx_data": {
83|         "annotation"              : "{{ user `vm_annotation` }}",
84|         "ethernet0.networkName"   : "{{ user `vm_network` }}",
85|         "ethernet0.startConnected": "TRUE"
86|       },

So referring to this documentation
you could try to set the Mac using

"vmx_data": {
  "ethernet0.address" : "00:50:56:XX:YY:ZZ" 
  "ethernet0.addressType" : "static"

Give it a try. If it’s not working, I will try it on my own the next days.

TYVM! That was exactly what I was looking for.

I’m curious if anyone else experienced the problem where packer is trying to ssh to the wrong vmware workstation NAT IP address? I’m asking because it was working for several days and then it started some time after I switched from using the vmware-iso builder to using the vmware-vmx builder. It seems to work once, then subsequent executions fail. I’m able to work-around it once by deleting the vmware leases and restarting the vmware dhcp server,but that’s really awkward. This hardcode MAC + vmware reservation is better. I think I can check it in and share it. Still, it’s strange that I have to mess with addresses in one builder and not the other