Getting wrong IP address from Ubuntu 20.04 VM (autoinstall)

Hi,
working hard to build Ubuntu 20.04 VM template (vmware-iso) using autoinstall.
The autoinstall indeed works nice (installation proceeds and Ubuntu is being installed). The problem is with DHCP and IP address obtained by Packer.

During the install process Ubuntu does sth like this:

  • obtain IP address through DHCP (lets say 10.0.0.10)
  • pushes the IP to VMware via its tools API so Packer reads it (==> vsphere-iso: IP address: 10.0.0.10)
  • releases the IP address (DHCPRELEASE) - still during installation process
  • obtain new IP address through DHCP (which is different from the first one lets say 10.0.0.20)
  • finnish installation and reboots (without DHCPRELEASE)
  • boots new system and got second IP from DHCP (because lease still exists) so it has 10.0.0.20, but Packer “thinks” it has 10.0.0.10.
  • Packer wait forever for SSH on 10.0.0.10 and times out (because it’s on 10.0.0.20).

Anyone has same problem?
I saw Debian does the same (got 2 IP addresses during install) but it doesn’t push it to VMware tools API so Packer doesn’t know it before it reboots and starts open-vm-tools.

Any idea how to fix that?

Regards
Dawid