Clone created form template with vmware_guest gets same IP

I create an ubuntu 18.04 clone vm from an template using ansible and vmware_guest.

All is fine except that all the machines that I create get the same IP address as the first one. The mac address is different but I think is something related to the machine-id https://unix.stackexchange.com/questions/402999/it-is-ok-to-change-etc-machine-id

I am not sure how to solve this at creation as I need the ip address to add it to an inventory yml in the same playbook.

Daniel

Have you used the “networks” parameter within the vmware_guest module? It lets you set the guest VM IP address/netmask, and other common networking settings:

  - name: Create a virtual machine on given ESXi hostname
    vmware_guest:
      hostname: "{{ vcenter_hostname }}"
      username: "{{ vcenter_username }}"
      password: "{{ vcenter_password }}"
    networks:
    - name: VM Network
      mac: aa:bb:dd:aa:00:14
      ip: 10.10.10.100
      netmask: 255.255.255.0
      device_type: vmxnet3