Do not modify the IP of the virtual card in the OS after adding the machine to the inventory

VM is added to the cluster inventory, then powered on and validated by VMTools. Then it is turned off and the IP is changed but the task does not change the IP generates status OK. We use vmware_guest module in version 4.8 for compatibility with ansible-core. The password change task is not working either.

---
- name: Startup VM RHEL
  hosts: localhost
  connection: localhost

  vars_files:
    - vars/vars_rhel.yml
    - vars/vars_vmware.yml
    
  pre_tasks:
   
    - name: Get VM network settings
      set_fact:
        vm_network_settings: "{{ vms | selectattr('name', 'equalto', vm_restored) | list | first }}"

  tasks:
    - name: Process Datastore and vm
      block:

      - name: Gather info VM
        community.vmware.vmware_guest_info:
          datacenter: "{{ vmware_datacenter }}"
          name: "{{ vm_restored }}"
        register: info_vm

      - ansible.builtin.set_fact:
          macaddres_vm_restored: "{{ info_vm | community.general.json_query('instance.hw_eth0.macaddress') }}"

      - name: Change network for VM
        community.vmware.vmware_guest_network:
          mac_address: "{{ macaddres_vm_restored }}"
          name: "{{ vm_restored }}"
          network_name: "{{ vm_network_settings.name_net }}" 

      - name: Ensure VM is powered on
        community.vmware.vmware_guest_powerstate:
          name: "{{ vm_restored }}"
          state: powered-on
      
      - name: Wait for 1 minute after power on
        ansible.builtin.pause:
          minutes: 1

      - name: Ensure VM is powered off
        community.vmware.vmware_guest_powerstate:
          name: "{{ vm_restored }}"
          state: powered-off

      - name: Custom password VM
        community.vmware.vmware_guest:
          state: present
          name: "{{ vm_restored }}"
          cluster: "{{ vmware_cluster }}"
          customization:
            password: "{{ passwd_new }}"
          wait_for_customization: true
          wait_for_customization_timeout: 600
 

      - name: Custom IP to VM
        community.vmware.vmware_guest:
          state: present
          name: "{{ vm_restored }}"
          cluster: "{{ vmware_cluster }}"
          networks:
            - name: "{{ vm_network_settings.name_net }}"
              dvswitch_name: "{{ vm_network_settings.dvswitch_name_dr }}"
              device_type: vmxnet3
              ip: "{{ vm_network_settings.ip_dr }}"
              gateway: "{{ vm_network_settings.gateway_dr }}"
              netmask: "{{ vm_network_settings.netmask_dr }}"
              dns_servers:
                - "{{ dns1_dr }}"
                - "{{ dns2_dr }}"
              start_connected: true
              connected: true
              type: static
          customization:
            password: "{{ passwd_new }}"
          wait_for_ip_address: yes
          wait_for_customization: true
          wait_for_customization_timeout: 600
        ignore_errors: true

Log:

TASK [Custom IP to VM] *********************************************************
task path: /runner/project/CU01-vmware_&_vms/02-startup_vm_rhel.yml:29
<localhost> ESTABLISH LOCAL CONNECTION FOR USER: root
<localhost> EXEC /bin/sh -c 'echo ~root && sleep 0'
<localhost> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /home/runner/.ansible/tmp `"&& mkdir "` echo /home/runner/.ansible/tmp/ansible-tmp-1732635959.2182753-77-60125859962174 `" && echo ansible-tmp-1732635959.2182753-77-60125859962174="` echo /home/runner/.ansible/tmp/ansible-tmp-1732635959.2182753-77-60125859962174 `" ) && sleep 0'
Using module file /usr/share/ansible/collections/ansible_collections/community/vmware/plugins/modules/vmware_guest.py
<localhost> PUT /home/runner/.ansible/tmp/ansible-local-211bfdazh8/tmpec62lzui TO /home/runner/.ansible/tmp/ansible-tmp-1732635959.2182753-77-60125859962174/AnsiballZ_vmware_guest.py
<localhost> EXEC /bin/sh -c 'chmod u+x /home/runner/.ansible/tmp/ansible-tmp-1732635959.2182753-77-60125859962174/ /home/runner/.ansible/tmp/ansible-tmp-1732635959.2182753-77-60125859962174/AnsiballZ_vmware_guest.py && sleep 0'
<localhost> EXEC /bin/sh -c '/usr/bin/python3.9 /home/runner/.ansible/tmp/ansible-tmp-1732635959.2182753-77-60125859962174/AnsiballZ_vmware_guest.py && sleep 0'
<localhost> EXEC /bin/sh -c 'rm -f -r /home/runner/.ansible/tmp/ansible-tmp-1732635959.2182753-77-60125859962174/ > /dev/null 2>&1 && sleep 0'
changed: [localhost] => {
    "changed": true,
    "instance": {
        "advanced_settings": {
            "cpuid.coresPerSocket": "2",
            "ctkEnabled": "TRUE",
            "ethernet0.pciSlotNumber": "192",
            "guestInfo.detailed.data": "architecture='X86' bitness='64' cpeString='cpe:/o:redhat:enterprise_linux:8::baseos' distroAddlVersion='8.10 (Ootpa)' distroName='Red Hat Enterprise Linux' distroVersion='8.10' familyName='Linux' kernelVersion='4.18.0-513.11.1.el8_9.x86_64' prettyName='Red Hat Enterprise Linux 8.10 (Ootpa)'",
            "guestOS.detailed.data": "bitness='64' distroName='Red Hat Enterprise Linux' distroVersion='8.4' familyName='Linux' kernelVersion='4.18.0-305.12.1.el8_4.x86_64' prettyName='Red Hat Enterprise Linux 8.4 (Ootpa)'",
            "guestinfo.appInfo": "{\\n\\"version\\":\\"1\\", \\n\\"updateCounter\\":\\"1057\\", \\n\\"publishTime\\":\\"2024-11-24T22:45:55.835Z\\", \\n\\"applications\\":[\\n{\\"a\\":\\"kworker/6:2H\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"kworker/4:2H\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"kworker/3:4-ata_sff\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"kworker/7:3-events\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"kworker/7:0-mm_percpu_wq\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"kworker/3:1-mm_percpu_wq\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"kworker/4:3-events\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"kworker/3:3-xfs-sync/dm-0\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"kworker/4:1-events\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"kworker/u256:0-events_unbound\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"kworker/3:2-mm_percpu_wq\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"kworker/2:1-events\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"kworker/6:2-events\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"kworker/5:0-events_freezable\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"kworker/5:3-cgroup_destroy\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"kworker/u256:1-xfs-cil/dm-0\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"kworker/2:3-events\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"kworker/6:1-events\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"kworker/0:1-events\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"kworker/0:3-events\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"kworker/1:0-mm_percpu_wq\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"kworker/1:3-events\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"kworker/u256:2-writeback\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"wdavdaemon\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"nessus-agent-module\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"nessusd\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"chronyd\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"rhsmcertd\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"telemetryd_v2\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"polkitd\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"dsmcad\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"./LSAgent\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"sendmail: Queue runner@01:00:00 for /var/spool/clientmqueue\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"sendmail: accepting connections\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"agetty\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"systemd\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"crond\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"platform-python\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"sshd\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"snmpd\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"rsyslogd\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"LSAgent\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"ruby\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"nessus-service\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"sudo\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"NetworkManager\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"dbus-daemon\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"smartd\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"systemd-logind\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"vmtoolsd\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"VGAuthService\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"irqbalance\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"sedispatch\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"auditd\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"xfsaild/dm-6\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"xfs-log/dm-6\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"xfs-blockgc/dm-\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"xfs-reclaim/dm-\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"xfs-cil/dm-6\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"xfs-conv/dm-6\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"xfs-buf/dm-6\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"xfsaild/dm-7\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"xfs-log/dm-7\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"xfs-cil/dm-7\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"xfs-conv/dm-7\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"xfs-buf/dm-7\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"xfsaild/dm-5\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"xfs-log/dm-5\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"xfs-cil/dm-5\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"xfs-conv/dm-5\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"xfs-buf/dm-5\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"xfsaild/dm-4\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"xfs-log/dm-4\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"xfs-cil/dm-4\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"xfsaild/dm-9\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"xfs-conv/dm-4\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"xfs-log/dm-9\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"xfs-buf/dm-4\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"xfs-cil/dm-9\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"xfs-conv/dm-9\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"xfs-buf/dm-9\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"xfsaild/dm-10\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"xfs-log/dm-10\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"xfs-cil/dm-10\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"xfs-conv/dm-10\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"xfs-buf/dm-10\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"xfsaild/dm-11\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"xfs-log/dm-11\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"xfsaild/dm-8\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"xfs-log/dm-8\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"xfs-cil/dm-11\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"xfs-conv/dm-11\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"xfs-buf/dm-11\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"xfs-cil/dm-8\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"xfs-conv/dm-8\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"xfs-buf/dm-8\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"kdmflush/253:11\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"kdmflush/253:10\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"kdmflush/253:9\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"kdmflush/253:8\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"kdmflush/253:7\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"kdmflush/253:6\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"kdmflush/253:5\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"kdmflush/253:4\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"kdmflush/253:3\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"xfsaild/sda1\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"xfs-log/sda1\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"xfs-blockgc/sda\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"xfs-reclaim/sda\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"xfs-cil/sda1\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"xfs-conv/sda1\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"xfs-buf/sda1\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"systemd-udevd\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"systemd-journald\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"xfsaild/dm-2\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"xfs-log/dm-2\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"xfs-cil/dm-2\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"xfs-conv/dm-2\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"xfs-buf/dm-2\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"xfsaild/dm-0\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"xfs-log/dm-0\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"xfs-cil/dm-0\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"xfs-conv/dm-0\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"xfs-buf/dm-0\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"xfs_mru_cache\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"xfsalloc\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"kdmflush/253:2\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"kdmflush/253:1\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"kdmflush/253:0\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"ttm\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"irq/16-vmwgfx\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"scsi_tmf_2\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"scsi_eh_2\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"scsi_tmf_1\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"scsi_eh_1\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"ata_sff\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"vmw_pvscsi_wq_0\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"scsi_tmf_0\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"scsi_eh_0\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"kworker/5:1H-kblockd\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"kworker/2:1H-kblockd\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"kworker/6:1H-kblockd\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"kworker/4:1H-kblockd\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"kworker/3:1H-kblockd\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"kworker/7:1H-kblockd\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"zswap-shrink\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"kstrp\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"ipv6_addrconf\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"kworker/1:1H-kblockd\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"kaluad\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"kmpath_rdacd\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"acpi_thermal_pm\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"irq/55-pciehp\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"irq/54-pciehp\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"irq/53-pciehp\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"irq/52-pciehp\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"irq/51-pciehp\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"irq/50-pciehp\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"irq/49-pciehp\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"irq/48-pciehp\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"irq/47-pciehp\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"irq/46-pciehp\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"irq/45-pciehp\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"irq/44-pciehp\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"irq/43-pciehp\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"irq/42-pciehp\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"irq/41-pciehp\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"irq/40-pciehp\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"irq/39-pciehp\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"irq/38-pciehp\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"irq/37-pciehp\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"irq/36-pciehp\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"irq/35-pciehp\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"irq/34-pciehp\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"irq/33-pciehp\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"irq/32-pciehp\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"irq/31-pciehp\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"irq/30-pciehp\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"irq/29-pciehp\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"irq/28-pciehp\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"irq/27-pciehp\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"irq/26-pciehp\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"irq/25-pciehp\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"irq/24-pciehp\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"kthrotld\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"kswapd0\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"kworker/0:1H-kblockd\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"watchdogd\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"edac-poller\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"md\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"tpm_dev_wq\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"blkcg_punt_bio\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"kblockd\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"kintegrityd\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"crypto\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"khugepaged\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"ksmd\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"kcompactd0\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"writeback\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"oom_reaper\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"khungtaskd\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"kauditd\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"netns\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"kdevtmpfs\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"kworker/7:0H-events_highpri\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"ksoftirqd/7\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"migration/7\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"watchdog/7\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"cpuhp/7\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"ksoftirqd/6\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"migration/6\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"watchdog/6\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"cpuhp/6\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"kworker/5:0H-events_highpri\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"ksoftirqd/5\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"migration/5\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"watchdog/5\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"cpuhp/5\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"ksoftirqd/4\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"migration/4\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"watchdog/4\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"cpuhp/4\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"kworker/3:0H-events_highpri\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"ksoftirqd/3\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"migration/3\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"watchdog/3\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"cpuhp/3\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"kworker/2:0H-events_highpri\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"ksoftirqd/2\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"migration/2\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"watchdog/2\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"cpuhp/2\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"kworker/1:0H-events_highpri\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"ksoftirqd/1\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"migration/1\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"watchdog/1\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"cpuhp/1\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"cpuhp/0\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"watchdog/0\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"migration/0\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"rcu_sched\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"ksoftirqd/0\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"rcu_tasks_trace\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"rcu_tasks_rude_\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"mm_percpu_wq\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"kworker/0:0H-events_highpri\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"slub_flushwq\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"rcu_par_gp\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"rcu_gp\\",\\"v\\":\\"\\"},\\n{\\"a\\":\\"kthreadd\\",\\"v\\":\\"\\"}]}",
            "guestinfo.vmtools.buildNumber": "21855600",
            "guestinfo.vmtools.description": "open-vm-tools 12.2.5 build 21855600",
            "guestinfo.vmtools.versionNumber": "12357",
            "guestinfo.vmtools.versionString": "12.2.5",
            "guestinfo.vmware.components.available": "none",
            "hpet0.present": "TRUE",
            "migrate.hostLog": "SRVACCSOMA01-1623669b.hlog",
            "migrate.hostLogState": "none",
            "migrate.migrationId": "3705695124338870756",
            "monitor.phys_bits_used": "42",
            "namespaceMgr.dbFile": "SRVACCSOMA01.db",
            "numa.autosize.cookie": "40001",
            "numa.autosize.vcpu.maxPerVirtualNode": "4",
            "nvram": "SRVACCSOMA01.nvram",
            "pciBridge0.pciSlotNumber": "17",
            "pciBridge0.present": "TRUE",
            "pciBridge4.functions": "8",
            "pciBridge4.pciSlotNumber": "21",
            "pciBridge4.present": "TRUE",
            "pciBridge4.virtualDev": "pcieRootPort",
            "pciBridge5.functions": "8",
            "pciBridge5.pciSlotNumber": "22",
            "pciBridge5.present": "TRUE",
            "pciBridge5.virtualDev": "pcieRootPort",
            "pciBridge6.functions": "8",
            "pciBridge6.pciSlotNumber": "23",
            "pciBridge6.present": "TRUE",
            "pciBridge6.virtualDev": "pcieRootPort",
            "pciBridge7.functions": "8",
            "pciBridge7.pciSlotNumber": "24",
            "pciBridge7.present": "TRUE",
            "pciBridge7.virtualDev": "pcieRootPort",
            "replay.supported": "false",
            "sched.cpu.latencySensitivity": "normal",
            "sched.swap.derivedName": "/vmfs/volumes/6745e927-b46c7705-e81e-84160c3d6c86/SRVACCSOMA01/SRVACCSOMA01-ec77f8d8.vswp",
            "scsi0.pciSlotNumber": "160",
            "scsi0.sasWWID": "50 05 05 6b cc cd cd 40",
            "scsi0:0.ctkEnabled": "TRUE",
            "scsi0:0.redo": "",
            "scsi0:1.ctkEnabled": "TRUE",
            "scsi0:1.redo": "",
            "softPowerOff": "FALSE",
            "svga.guestBackedPrimaryAware": "TRUE",
            "svga.present": "TRUE",
            "tools.guest.desktop.autolock": "FALSE",
            "tools.remindInstall": "FALSE",
            "virtualHW.productCompatibility": "hosted",
            "viv.moid": "afce2547-dd37-4111-95a8-19d722068594:vm-31529:Vf7mHRqYd6fM+23RiGzJjLMEtnTuDRzbtuLEoGAZxUs=",
            "vmci0.pciSlotNumber": "32",
            "vmotion.checkpointFBSize": "8388608",
            "vmotion.checkpointSVGAPrimarySize": "8388608",
            "vmware.tools.internalversion": "12357",
            "vmware.tools.requiredversion": "12448",
            "vmxstats.filename": "SRVACCSOMA01.scoreboard"
        },
        "annotation": "",
        "current_snapshot": null,
        "customvalues": {},
        "guest_consolidation_needed": false,
        "guest_question": null,
        "guest_tools_status": "guestToolsNotRunning",
        "guest_tools_version": "12357",
        "hw_cluster": "Cluster DR",
        "hw_cores_per_socket": 2,
        "hw_datastores": [
            "ds_restore_lun_03cd"
        ],
        "hw_esxi_host": "vm-dr-03.bcch.local",
        "hw_eth0": {
            "addresstype": "assigned",
            "ipaddresses": null,
            "label": "Network adapter 1",
            "macaddress": "00:50:56:bb:4e:78",
            "macaddress_dash": "00-50-56-bb-4e-78",
            "portgroup_key": "dvportgroup-697",
            "portgroup_portkey": "24",
            "summary": "DVSwitch: d5 ec 3b 50 48 cc 1b 4f-b0 45 8e 44 b0 38 db 41"
        },
        "hw_files": [
            "[ds_restore_lun_03cd] SRVACCSOMA01/SRVACCSOMA01.vmx",
            "[ds_restore_lun_03cd] SRVACCSOMA01/SRVACCSOMA01.nvram",
            "[ds_restore_lun_03cd] SRVACCSOMA01/SRVACCSOMA01.vmsd",
            "[ds_restore_lun_03cd] SRVACCSOMA01/vmware-0.log",
            "[ds_restore_lun_03cd] SRVACCSOMA01/vmware-19.log",
            "[ds_restore_lun_03cd] SRVACCSOMA01/vmware-18.log",
            "[ds_restore_lun_03cd] SRVACCSOMA01/vmware-17.log",
            "[ds_restore_lun_03cd] SRVACCSOMA01/vmware-16.log",
            "[ds_restore_lun_03cd] SRVACCSOMA01/vmware.log",
            "[ds_restore_lun_03cd] SRVACCSOMA01/vmware-25.log",
            "[ds_restore_lun_03cd] SRVACCSOMA01/vmware-24.log",
            "[ds_restore_lun_03cd] SRVACCSOMA01/vmware-23.log",
            "[ds_restore_lun_03cd] SRVACCSOMA01/vmware-22.log",
            "[ds_restore_lun_03cd] SRVACCSOMA01/vmware-21.log",
            "[ds_restore_lun_03cd] SRVACCSOMA01/vmware-20.log",
            "[ds_restore_lun_03cd] SRVACCSOMA01/SRVACCSOMA01.vmdk",
            "[ds_restore_lun_03cd] SRVACCSOMA01/SRVACCSOMA01_1.vmdk"
        ],
        "hw_folder": "/VM-DR/vm/ActivacionDR",
        "hw_guest_full_name": "Red Hat Enterprise Linux 8 (64-bit)",
        "hw_guest_ha_state": true,
        "hw_guest_id": "rhel8_64Guest",
        "hw_interfaces": [
            "eth0"
        ],
        "hw_is_template": false,
        "hw_memtotal_mb": 98304,
        "hw_name": "SRVACCSOMA01",
        "hw_power_status": "poweredOff",
        "hw_processor_count": 8,
        "hw_product_uuid": "423b495b-cccd-cd49-f9de-79413f47e88e",
        "hw_version": "vmx-11",
        "instance_uuid": "503b7da9-d41a-8506-6911-7bc4dcee5205",
        "ipv4": null,
        "ipv6": null,
        "module_hw": true,
        "moid": "vm-31529",
        "snapshots": [],
        "tpm_info": {
            "provider_id": null,
            "tpm_present": false
        },
        "vimref": "vim.VirtualMachine:vm-31529",
        "vnc": {}
    },
    "invocation": {
        "module_args": {
            "advanced_settings": [],
            "annotation": null,
            "cdrom": [],
            "cluster": "Cluster DR",
            "convert": null,
            "customization": {
                "autologon": null,
                "autologoncount": null,
                "dns_servers": null,
                "dns_suffix": null,
                "domain": null,
                "domainadmin": null,
                "domainadminpassword": null,
                "existing_vm": null,
                "fullname": null,
                "hostname": null,
                "hwclockUTC": null,
                "joindomain": null,
                "joinworkgroup": null,
                "orgname": null,
                "password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
                "productid": null,
                "runonce": null,
                "script_text": null,
                "timezone": null
            },
            "customization_spec": null,
            "customvalues": [],
            "datacenter": "ha-datacenter",
            "datastore": null,
            "delete_from_inventory": false,
            "disk": [],
            "encryption": {
                "encrypted_ft": null,
                "encrypted_vmotion": null
            },
            "esxi_hostname": null,
            "folder": null,
            "force": false,
            "guest_id": null,
            "hardware": {
                "boot_firmware": null,
                "cpu_limit": null,
                "cpu_reservation": null,
                "cpu_shares": null,
                "cpu_shares_level": null,
                "hotadd_cpu": null,
                "hotadd_memory": null,
                "hotremove_cpu": null,
                "iommu": null,
                "max_connections": null,
                "mem_limit": null,
                "mem_reservation": null,
                "mem_shares": null,
                "mem_shares_level": null,
                "memory_mb": null,
                "memory_reservation_lock": null,
                "nested_virt": null,
                "num_cpu_cores_per_socket": null,
                "num_cpus": null,
                "scsi": null,
                "secure_boot": null,
                "version": null,
                "virt_based_security": null,
                "vpmc_enabled": null
            },
            "hostname": "srvvcdr.bcch.local",
            "is_template": false,
            "linked_clone": false,
            "name": "SRVACCSOMA01",
            "name_match": "first",
            "networks": [
                {
                    "connected": true,
                    "device_type": "vmxnet3",
                    "dns_servers": [
                        "10.82.50.11",
                        "10.190.14.11"
                    ],
                    "dvswitch_name": "VLAN 10.82.32.96",
                    "gateway": "10.82.32.97",
                    "ip": "10.82.32.100",
                    "netmask": "255.255.255.0",
                    "start_connected": true,
                    "type": "static"
                }
            ],
            "nvdimm": {
                "label": null,
                "size_mb": 1024,
                "state": null
            },
            "password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
            "port": 443,
            "proxy_host": null,
            "proxy_port": null,
            "resource_pool": null,
            "snapshot_src": null,
            "state": "poweredoff",
            "state_change_timeout": 0,
            "template": null,
            "use_instance_uuid": false,
            "username": "administrator@vsphere.local",
            "uuid": null,
            "validate_certs": false,
            "vapp_properties": [],
            "wait_for_customization": true,
            "wait_for_customization_timeout": 600,
            "wait_for_ip_address": true,
            "wait_for_ip_address_timeout": 300
        }
    }
}
Read vars_file 'vars/vars_rhel.yml'
Read vars_file 'vars/vars_vmware.yml'

vmware_guest module relies on the Vmware’s Guest Customisation feature that, for a Linux guest, works using Perl within the OS. So the first thing I’d check is that Perl is installed in the VM.

2 Likes

Thank you very much, I will check that point first.

The vm has several perl libraries, one of them is this perl-libs-5.26.3-422.el8.x86_64. It must be in running? or some specific package? We are working with RHEL 8.10.

In another scenario, we are also doing the same exercise with a Windows Server 2022 and the same thing happens, it does not assign IP. Do we also have to validate some library?

The change must be executed with the machine on or off?

Is the package “perl” installed?
I’d check if the guest customisation feature works correctly by applying a customisation manually to a new machine deployed from a template.

Hi @matteoclc, thanks again for the comment!. Yes, the package is installed. I share you more context of the scenario:

It is similar to a DR, scan new disks, mount datastore with data, search for virtual machine vmx file and add to inventory. After all the above steps, the IP must be modified and change password root.

Creating a new virtual machine from a template and customizing it works, but that is not the scenario we are automating.

Happy Holidays!!

HI @eocampo

I recently worked on vmware.vmware_rest.vcenter_vm_guest_customization module – Applies a customization specification on the virtual machine — Ansible Community Documentation, so i am more familair with that module but it should be the same thing.

Heres some requirements and debugging tips:

# 1. Make sure perl is installed on the Linux systems. Make sure cloud-init is installed if using cloud-init
# 2. Custom script execution is disabled by default. To enable it, you can run as root: vmware-toolbox-cmd config set deployPkg enable-custom-scripts  true
# 3. VMware tools must be installed and recognized by vCenter before you can apply customization. See the example below for one approach to this.
# 4. On Linux (RHEL specifically), customization script logs can be found at /var/log/vmware-imc/toolsDeployPkg.log
# 5. Once the VM is started, the pending customization is applied. Even if that fails, the customization is then cleared. Meaning, you need to re-apply
#    the customization spec in order to try again. Simply rebooting the VM will not change anything.
2 Likes

Thank you, I will review the recommendations