Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

networks field in vmware_guest module is not idempotent #1499

Open
cfiehe opened this issue Oct 11, 2022 · 2 comments
Open

networks field in vmware_guest module is not idempotent #1499

cfiehe opened this issue Oct 11, 2022 · 2 comments

Comments

@cfiehe
Copy link
Contributor

cfiehe commented Oct 11, 2022

SUMMARY

As already stated in ansible/ansible#38605 the networks field in the vmware_guest module is not idempotent. Ansible always reports a change even when the virtual machine is already in the target state.

ISSUE TYPE
  • Bug Report
COMPONENT NAME

vmware_guest

ANSIBLE VERSION
ansible [core 2.13.4]
  config file = None
  configured module search path = ['/home/ansible/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /home/ansible/.local/lib/python3.10/site-packages/ansible
  ansible collection location = /home/ansible/.ansible/collections:/usr/share/ansible/collections
  executable location = /home/ansible/.local/bin/ansible
  python version = 3.10.6 (main, Aug 10 2022, 11:40:04) [GCC 11.3.0]
  jinja version = 3.0.3
  libyaml = True

COLLECTION VERSION
download_url: https://galaxy.ansible.com/download/community-vmware-3.0.0.tar.gz
format_version: 1.0.0
name: vmware
namespace: community
server: https://galaxy.ansible.com/api/
signatures: []
version: 3.0.0
version_url: https://galaxy.ansible.com/api/v2/collections/community/vmware/versions/3.0.0/
CONFIGURATION

None.

OS / ENVIRONMENT

vSphere 7.0.3

STEPS TO REPRODUCE

Create a virtual machine, that uses the networks fields:

- name: guest | Ensure virtual machine
  community.vmware.vmware_guest:
    hostname: vc4.edsb.mycompany.com
    username: ${VCENTER_USERNAME}
    password: ${VCENTER_PASSWORD}
    name: molecule-test.lx.mycompany.com
    datacenter: edSB
    cluster: TEST
    folder: /edSB/vm/LOC
    state: powered-on
    template: ubuntu-jammy
    networks:
      - name: DS-VLAN 302 Deploy
        device_type: vmxnet3
        connected: true
        start_connected: true
        type: dhcp

Let Ansible create the virtual machine and re-execute the play without any modifications.

EXPECTED RESULTS

Ansible should not report any changes for this virtual machine.

ACTUAL RESULTS

Ansible reports a change very time when the play is executed.

TASK [vsphere : guest | Ensure virtual machine] ********************************
task path: /home/ansible/automation/components/ansible_roles/vsphere/tasks/guest.yml:2
<localhost> ESTABLISH LOCAL CONNECTION FOR USER: ansible
<localhost> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /tmp/.ansible/tmp `"&& mkdir "` echo /tmp/.ansible/tmp/ansible-tmp-1665516584.4475188-2757112-203316196835379 `" && echo ansible-tmp-1665516584.4475188-2757112-203316196835379="` echo /tmp/.ansible/tmp/ansible-tmp-1665516584.4475188-2757112-203316196835379 `" ) && sleep 0'
Using module file /home/ansible/.cache/molecule/vsphere/default/collections/ansible_collections/community/vmware/plugins/modules/vmware_guest.py
<localhost> PUT /tmp/.ansible/tmp/ansible-local-2757054wdygv27e/tmpp5y8siwh TO /tmp/.ansible/tmp/ansible-tmp-1665516584.4475188-2757112-203316196835379/AnsiballZ_vmware_guest.py
<localhost> EXEC /bin/sh -c 'chmod u+x /tmp/.ansible/tmp/ansible-tmp-1665516584.4475188-2757112-203316196835379/ /tmp/.ansible/tmp/ansible-tmp-1665516584.4475188-2757112-203316196835379/AnsiballZ_vmware_guest.py && sleep 0'
<localhost> EXEC /bin/sh -c 'ftp_proxy=http://int-proxy.mycompany.com:3128/ http_proxy=http://int-proxy.mycompany.com:3128/ https_proxy=http://int-proxy.mycompany.com:3128/ no_proxy=.mycompany.com,127.0.0.0/8,localhost /usr/bin/python3 /tmp/.ansible/tmp/ansible-tmp-1665516584.4475188-2757112-203316196835379/AnsiballZ_vmware_guest.py && sleep 0'
<localhost> EXEC /bin/sh -c 'rm -f -r /tmp/.ansible/tmp/ansible-tmp-1665516584.4475188-2757112-203316196835379/ > /dev/null 2>&1 && sleep 0'
changed: [localhost] => {
    "changed": true,
    "instance": {
        "advanced_settings": {
            "cpuid.coresPerSocket": "2",
            "ethernet0.pciSlotNumber": "192",
            "guestOS.detailed.data": "architecture='X86' bitness='64' distroName='Ubuntu 22.04.1 LTS' distroVersion='22.04' familyName='Linux' kernelVersion='5.15.0-46-generic' prettyName='Ubuntu 22.04.1 LTS'",
            "guestinfo.appInfo": "{\n\"version\":\"1\", \n\"updateCounter\":\"1\", \n\"publishTime\":\"2022-10-11T15:12:31.450Z\", \n\"applications\":[\n{\"a\":\"kworker/0:2\",\"v\":\"\"},\n{\"a\":\"kworker/0:0-events\",\"v\":\"\"},\n{\"a\":\"snapd\",\"v\":\"\"},\n{\"a\":\"kworker/u2:1-events_power_efficient\",\"v\":\"\"},\n{\"a\":\"sshd: /usr/sbin/sshd -D [listener] 0 of 10-100 startups\",\"v\":\"\"},\n{\"a\":\"python3\",\"v\":\"\"},\n{\"a\":\"agetty\",\"v\":\"\"},\n{\"a\":\"ModemManager\",\"v\":\"\"},\n{\"a\":\"udisksd\",\"v\":\"\"},\n{\"a\":\"systemd-logind\",\"v\":\"\"},\n{\"a\":\"rsyslogd\",\"v\":\"\"},\n{\"a\":\"polkitd\",\"v\":\"\"},\n{\"a\":\"python3\",\"v\":\"\"},\n{\"a\":\"@dbus-daemon\",\"v\":\"\"},\n{\"a\":\"cron\",\"v\":\"\"},\n{\"a\":\"systemd-resolved\",\"v\":\"\"},\n{\"a\":\"systemd-networkd\",\"v\":\"\"},\n{\"a\":\"vmtoolsd\",\"v\":\"\"},\n{\"a\":\"VGAuthService\",\"v\":\"\"},\n{\"a\":\"systemd-timesyncd\",\"v\":\"\"},\n{\"a\":\"ext4-rsv-conver\",\"v\":\"\"},\n{\"a\":\"jbd2/sda2-8\",\"v\":\"\"},\n{\"a\":\"systemd-udevd\",\"v\":\"\"},\n{\"a\":\"ipmi-msghandler\",\"v\":\"\"},\n{\"a\":\"systemd-journald\",\"v\":\"\"},\n{\"a\":\"xfsaild/dm-0\",\"v\":\"\"},\n{\"a\":\"xfs-cil/dm-0\",\"v\":\"\"},\n{\"a\":\"xfs-log/dm-0\",\"v\":\"\"},\n{\"a\":\"xfs-inodegc/dm-\",\"v\":\"\"},\n{\"a\":\"xfs-blockgc/dm-\",\"v\":\"\"},\n{\"a\":\"xfs-reclaim/dm-\",\"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\":\"raid5wq\",\"v\":\"\"},\n{\"a\":\"kdmflush\",\"v\":\"\"},\n{\"a\":\"card0-crtc7\",\"v\":\"\"},\n{\"a\":\"card0-crtc6\",\"v\":\"\"},\n{\"a\":\"card0-crtc5\",\"v\":\"\"},\n{\"a\":\"card0-crtc4\",\"v\":\"\"},\n{\"a\":\"card0-crtc3\",\"v\":\"\"},\n{\"a\":\"card0-crtc2\",\"v\":\"\"},\n{\"a\":\"card0-crtc1\",\"v\":\"\"},\n{\"a\":\"card0-crtc0\",\"v\":\"\"},\n{\"a\":\"irq/16-vmwgfx\",\"v\":\"\"},\n{\"a\":\"ttm_swap\",\"v\":\"\"},\n{\"a\":\"vmw_pvscsi_wq_2\",\"v\":\"\"},\n{\"a\":\"scsi_tmf_2\",\"v\":\"\"},\n{\"a\":\"scsi_eh_2\",\"v\":\"\"},\n{\"a\":\"cryptd\",\"v\":\"\"},\n{\"a\":\"charger_manager\",\"v\":\"\"},\n{\"a\":\"kworker/u3:0\",\"v\":\"\"},\n{\"a\":\"zswap-shrink\",\"v\":\"\"},\n{\"a\":\"kstrp\",\"v\":\"\"},\n{\"a\":\"ipv6_addrconf\",\"v\":\"\"},\n{\"a\":\"mld\",\"v\":\"\"},\n{\"a\":\"vfio-irqfd-clea\",\"v\":\"\"},\n{\"a\":\"scsi_tmf_1\",\"v\":\"\"},\n{\"a\":\"scsi_eh_1\",\"v\":\"\"},\n{\"a\":\"scsi_tmf_0\",\"v\":\"\"},\n{\"a\":\"scsi_eh_0\",\"v\":\"\"},\n{\"a\":\"kworker/u2:2-events_power_efficient\",\"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\":\"ecryptfs-kthrea\",\"v\":\"\"},\n{\"a\":\"kswapd0\",\"v\":\"\"},\n{\"a\":\"kworker/0:1H-kblockd\",\"v\":\"\"},\n{\"a\":\"watchdogd\",\"v\":\"\"},\n{\"a\":\"devfreq_wq\",\"v\":\"\"},\n{\"a\":\"edac-poller\",\"v\":\"\"},\n{\"a\":\"md\",\"v\":\"\"},\n{\"a\":\"ata_sff\",\"v\":\"\"},\n{\"a\":\"tpm_dev_wq\",\"v\":\"\"},\n{\"a\":\"blkcg_punt_bio\",\"v\":\"\"},\n{\"a\":\"kblockd\",\"v\":\"\"},\n{\"a\":\"kintegrityd\",\"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\":\"inet_frag_wq\",\"v\":\"\"},\n{\"a\":\"kdevtmpfs\",\"v\":\"\"},\n{\"a\":\"cpuhp/0\",\"v\":\"\"},\n{\"a\":\"idle_inject/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\":\"netns\",\"v\":\"\"},\n{\"a\":\"rcu_par_gp\",\"v\":\"\"},\n{\"a\":\"rcu_gp\",\"v\":\"\"},\n{\"a\":\"kthreadd\",\"v\":\"\"},\n{\"a\":\"init\",\"v\":\"\"}]}",
            "guestinfo.vmtools.buildNumber": "18557794",
            "guestinfo.vmtools.description": "open-vm-tools 11.3.5 build 18557794",
            "guestinfo.vmtools.versionNumber": "11365",
            "guestinfo.vmtools.versionString": "11.3.5",
            "hpet0.present": "TRUE",
            "migrate.hostLog": "molecule-test.lx.mycompany.com-3ff2a1a6.hlog",
            "migrate.hostLogState": "none",
            "migrate.migrationId": "4352516520074878081",
            "monitor.phys_bits_used": "43",
            "numa.autosize.cookie": "10001",
            "numa.autosize.vcpu.maxPerVirtualNode": "1",
            "nvram": "molecule-test.lx.mycompany.com.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",
            "sched.cpu.latencySensitivity": "normal",
            "sched.swap.derivedName": "/vmfs/volumes/5ff82b1f-02182ab5-63ac-0025b50a002c/molecule-test.lx.mycompany.com/molecule-test.lx.mycompany.com-30145e48.vswp",
            "scsi0.pciSlotNumber": "160",
            "scsi0.sasWWID": "50 05 05 6e 17 72 08 90",
            "scsi0:0.redo": "",
            "softPowerOff": "FALSE",
            "svga.guestBackedPrimaryAware": "TRUE",
            "svga.present": "TRUE",
            "tools.guest.desktop.autolock": "FALSE",
            "vmci0.pciSlotNumber": "32",
            "vmotion.checkpointFBSize": "4194304",
            "vmotion.checkpointSVGAPrimarySize": "4194304",
            "vmware.tools.internalversion": "11365",
            "vmware.tools.requiredversion": "11365"
        },
        "annotation": "Maintainer: Linux Operations Center <[email protected]>\nVersion: v22.08\nCreated: 2022-08-16 12:16 UTC\nBuilt by: HashiCorp Packer 1.8.3",
        "current_snapshot": null,
        "customvalues": {},
        "guest_consolidation_needed": false,
        "guest_question": null,
        "guest_tools_status": "guestToolsRunning",
        "guest_tools_version": "11365",
        "hw_cluster": "TEST",
        "hw_cores_per_socket": 2,
        "hw_datastores": [
            "STRWZ-B_Test_1"
        ],
        "hw_esxi_host": "vs37.ncc.mycompany.com",
        "hw_eth0": {
            "addresstype": "assigned",
            "ipaddresses": [
                "192.168.1.198",
                "fe80::250:56ff:fe87:7a8f"
            ],
            "label": "Network adapter 1",
            "macaddress": "00:50:56:87:7a:8f",
            "macaddress_dash": "00-50-56-87-7a-8f",
            "portgroup_key": "dvportgroup-850290",
            "portgroup_portkey": "1348",
            "summary": "DVSwitch: 17 29 07 50 88 57 23 7c-f5 9a 3a ad ce fd 7c 44"
        },
        "hw_files": [
            "[STRWZ-B_Test_1] molecule-test.lx.mycompany.com/molecule-test.lx.mycompany.com.vmx",
            "[STRWZ-B_Test_1] molecule-test.lx.mycompany.com/molecule-test.lx.mycompany.com.nvram",
            "[STRWZ-B_Test_1] molecule-test.lx.mycompany.com/molecule-test.lx.mycompany.com.vmsd",
            "[STRWZ-B_Test_1] molecule-test.lx.mycompany.com/vmware-2.log",
            "[STRWZ-B_Test_1] molecule-test.lx.mycompany.com/vmware-1.log",
            "[STRWZ-B_Test_1] molecule-test.lx.mycompany.com/vmware.log",
            "[STRWZ-B_Test_1] molecule-test.lx.mycompany.com/molecule-test.lx.mycompany.com.vmdk"
        ],
        "hw_folder": "/edSB/vm/LOC",
        "hw_guest_full_name": "Ubuntu Linux (64-bit)",
        "hw_guest_ha_state": true,
        "hw_guest_id": "ubuntu64Guest",
        "hw_interfaces": [
            "eth0"
        ],
        "hw_is_template": false,
        "hw_memtotal_mb": 2048,
        "hw_name": "molecule-test.lx.mycompany.com",
        "hw_power_status": "poweredOn",
        "hw_processor_count": 1,
        "hw_product_uuid": "4207ad1e-1772-0897-e87b-c3d37d7d9349",
        "hw_version": "vmx-15",
        "instance_uuid": "50075fc3-c5c2-4a20-fac4-a5d75621c65a",
        "ipv4": "192.168.1.198",
        "ipv6": null,
        "module_hw": true,
        "moid": "vm-3383891",
        "snapshots": [],
        "tpm_info": {
            "provider_id": null,
            "tpm_present": false
        },
        "vimref": "vim.VirtualMachine:vm-3383891",
        "vnc": {}
    },
    "invocation": {
        "module_args": {
            "advanced_settings": [],
            "annotation": null,
            "cdrom": [],
            "cluster": "TEST",
            "convert": null,
            "customization": {
                "autologon": null,
                "autologoncount": null,
                "dns_servers": [
                    "8.8.8.8",
                    "9.9.9.9"
                ],
                "dns_suffix": [
                    "lx.mycompany.com",
                    "mycompany.com"
                ],
                "domain": "lx.mycompany.com",
                "domainadmin": null,
                "domainadminpassword": null,
                "existing_vm": null,
                "fullname": null,
                "hostname": null,
                "hwclockUTC": null,
                "joindomain": null,
                "joinworkgroup": null,
                "orgname": null,
                "password": null,
                "productid": null,
                "runonce": null,
                "timezone": null
            },
            "customization_spec": null,
            "customvalues": [],
            "datacenter": "edSB",
            "datastore": null,
            "delete_from_inventory": false,
            "disk": [],
            "esxi_hostname": null,
            "folder": "/edSB/vm/LOC",
            "force": false,
            "guest_id": null,
            "hardware": {
                "boot_firmware": "efi",
                "cpu_limit": null,
                "cpu_reservation": null,
                "hotadd_cpu": null,
                "hotadd_memory": null,
                "hotremove_cpu": null,
                "iommu": null,
                "max_connections": null,
                "mem_limit": null,
                "mem_reservation": null,
                "memory_mb": null,
                "memory_reservation_lock": null,
                "nested_virt": null,
                "num_cpu_cores_per_socket": null,
                "num_cpus": null,
                "scsi": null,
                "secure_boot": true,
                "version": null,
                "virt_based_security": null
            },
            "hostname": "vc4.edsb.mycompany.com",
            "is_template": false,
            "linked_clone": false,
            "name": "molecule-test.lx.mycompany.com",
            "name_match": "first",
            "networks": [
                {
                    "connected": true,
                    "device_type": "vmxnet3",
                    "name": "DS-VLAN 302 Deploy",
                    "start_connected": true,
                    "type": "dhcp"
                }
            ],
            "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": "present",
            "state_change_timeout": 0,
            "template": "ubuntu-jammy",
            "use_instance_uuid": false,
            "username": "svc-ansible",
            "uuid": null,
            "validate_certs": false,
            "vapp_properties": [],
            "wait_for_customization": false,
            "wait_for_customization_timeout": 3600,
            "wait_for_ip_address": false,
            "wait_for_ip_address_timeout": 300
        }
    }
}

After some investigations I have found out that the portgroup_portkey toogles in every run. In my case the value changes between 1348 and 1350. The next run gives:

changed: [localhost] => {
    "changed": true,
    "instance": {
        "advanced_settings": {
            "cpuid.coresPerSocket": "2",
            "ethernet0.pciSlotNumber": "192",
            "guestOS.detailed.data": "architecture='X86' bitness='64' distroName='Ubuntu 22.04.1 LTS' distroVersion='22.04' familyName='Linux' kernelVersion='5.15.0-46-generic' prettyName='Ubuntu 22.04.1 LTS'",
            "guestinfo.appInfo": "{\n\"version\":\"1\", \n\"updateCounter\":\"1\", \n\"publishTime\":\"2022-10-11T15:12:31.450Z\", \n\"applications\":[\n{\"a\":\"kworker/0:2\",\"v\":\"\"},\n{\"a\":\"kworker/0:0-events\",\"v\":\"\"},\n{\"a\":\"snapd\",\"v\":\"\"},\n{\"a\":\"kworker/u2:1-events_power_efficient\",\"v\":\"\"},\n{\"a\":\"sshd: /usr/sbin/sshd -D [listener] 0 of 10-100 startups\",\"v\":\"\"},\n{\"a\":\"python3\",\"v\":\"\"},\n{\"a\":\"agetty\",\"v\":\"\"},\n{\"a\":\"ModemManager\",\"v\":\"\"},\n{\"a\":\"udisksd\",\"v\":\"\"},\n{\"a\":\"systemd-logind\",\"v\":\"\"},\n{\"a\":\"rsyslogd\",\"v\":\"\"},\n{\"a\":\"polkitd\",\"v\":\"\"},\n{\"a\":\"python3\",\"v\":\"\"},\n{\"a\":\"@dbus-daemon\",\"v\":\"\"},\n{\"a\":\"cron\",\"v\":\"\"},\n{\"a\":\"systemd-resolved\",\"v\":\"\"},\n{\"a\":\"systemd-networkd\",\"v\":\"\"},\n{\"a\":\"vmtoolsd\",\"v\":\"\"},\n{\"a\":\"VGAuthService\",\"v\":\"\"},\n{\"a\":\"systemd-timesyncd\",\"v\":\"\"},\n{\"a\":\"ext4-rsv-conver\",\"v\":\"\"},\n{\"a\":\"jbd2/sda2-8\",\"v\":\"\"},\n{\"a\":\"systemd-udevd\",\"v\":\"\"},\n{\"a\":\"ipmi-msghandler\",\"v\":\"\"},\n{\"a\":\"systemd-journald\",\"v\":\"\"},\n{\"a\":\"xfsaild/dm-0\",\"v\":\"\"},\n{\"a\":\"xfs-cil/dm-0\",\"v\":\"\"},\n{\"a\":\"xfs-log/dm-0\",\"v\":\"\"},\n{\"a\":\"xfs-inodegc/dm-\",\"v\":\"\"},\n{\"a\":\"xfs-blockgc/dm-\",\"v\":\"\"},\n{\"a\":\"xfs-reclaim/dm-\",\"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\":\"raid5wq\",\"v\":\"\"},\n{\"a\":\"kdmflush\",\"v\":\"\"},\n{\"a\":\"card0-crtc7\",\"v\":\"\"},\n{\"a\":\"card0-crtc6\",\"v\":\"\"},\n{\"a\":\"card0-crtc5\",\"v\":\"\"},\n{\"a\":\"card0-crtc4\",\"v\":\"\"},\n{\"a\":\"card0-crtc3\",\"v\":\"\"},\n{\"a\":\"card0-crtc2\",\"v\":\"\"},\n{\"a\":\"card0-crtc1\",\"v\":\"\"},\n{\"a\":\"card0-crtc0\",\"v\":\"\"},\n{\"a\":\"irq/16-vmwgfx\",\"v\":\"\"},\n{\"a\":\"ttm_swap\",\"v\":\"\"},\n{\"a\":\"vmw_pvscsi_wq_2\",\"v\":\"\"},\n{\"a\":\"scsi_tmf_2\",\"v\":\"\"},\n{\"a\":\"scsi_eh_2\",\"v\":\"\"},\n{\"a\":\"cryptd\",\"v\":\"\"},\n{\"a\":\"charger_manager\",\"v\":\"\"},\n{\"a\":\"kworker/u3:0\",\"v\":\"\"},\n{\"a\":\"zswap-shrink\",\"v\":\"\"},\n{\"a\":\"kstrp\",\"v\":\"\"},\n{\"a\":\"ipv6_addrconf\",\"v\":\"\"},\n{\"a\":\"mld\",\"v\":\"\"},\n{\"a\":\"vfio-irqfd-clea\",\"v\":\"\"},\n{\"a\":\"scsi_tmf_1\",\"v\":\"\"},\n{\"a\":\"scsi_eh_1\",\"v\":\"\"},\n{\"a\":\"scsi_tmf_0\",\"v\":\"\"},\n{\"a\":\"scsi_eh_0\",\"v\":\"\"},\n{\"a\":\"kworker/u2:2-events_power_efficient\",\"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\":\"ecryptfs-kthrea\",\"v\":\"\"},\n{\"a\":\"kswapd0\",\"v\":\"\"},\n{\"a\":\"kworker/0:1H-kblockd\",\"v\":\"\"},\n{\"a\":\"watchdogd\",\"v\":\"\"},\n{\"a\":\"devfreq_wq\",\"v\":\"\"},\n{\"a\":\"edac-poller\",\"v\":\"\"},\n{\"a\":\"md\",\"v\":\"\"},\n{\"a\":\"ata_sff\",\"v\":\"\"},\n{\"a\":\"tpm_dev_wq\",\"v\":\"\"},\n{\"a\":\"blkcg_punt_bio\",\"v\":\"\"},\n{\"a\":\"kblockd\",\"v\":\"\"},\n{\"a\":\"kintegrityd\",\"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\":\"inet_frag_wq\",\"v\":\"\"},\n{\"a\":\"kdevtmpfs\",\"v\":\"\"},\n{\"a\":\"cpuhp/0\",\"v\":\"\"},\n{\"a\":\"idle_inject/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\":\"netns\",\"v\":\"\"},\n{\"a\":\"rcu_par_gp\",\"v\":\"\"},\n{\"a\":\"rcu_gp\",\"v\":\"\"},\n{\"a\":\"kthreadd\",\"v\":\"\"},\n{\"a\":\"init\",\"v\":\"\"}]}",
            "guestinfo.vmtools.buildNumber": "18557794",
            "guestinfo.vmtools.description": "open-vm-tools 11.3.5 build 18557794",
            "guestinfo.vmtools.versionNumber": "11365",
            "guestinfo.vmtools.versionString": "11.3.5",
            "hpet0.present": "TRUE",
            "migrate.hostLog": "molecule-test.lx.mycompany.com-3ff2a1a6.hlog",
            "migrate.hostLogState": "none",
            "migrate.migrationId": "4352516520074878081",
            "monitor.phys_bits_used": "43",
            "numa.autosize.cookie": "10001",
            "numa.autosize.vcpu.maxPerVirtualNode": "1",
            "nvram": "molecule-test.lx.mycompany.com.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",
            "sched.cpu.latencySensitivity": "normal",
            "sched.swap.derivedName": "/vmfs/volumes/5ff82b1f-02182ab5-63ac-0025b50a002c/molecule-test.lx.mycompany.com/molecule-test.lx.mycompany.com-30145e48.vswp",
            "scsi0.pciSlotNumber": "160",
            "scsi0.sasWWID": "50 05 05 6e 17 72 08 90",
            "scsi0:0.redo": "",
            "softPowerOff": "FALSE",
            "svga.guestBackedPrimaryAware": "TRUE",
            "svga.present": "TRUE",
            "tools.guest.desktop.autolock": "FALSE",
            "vmci0.pciSlotNumber": "32",
            "vmotion.checkpointFBSize": "4194304",
            "vmotion.checkpointSVGAPrimarySize": "4194304",
            "vmware.tools.internalversion": "11365",
            "vmware.tools.requiredversion": "11365"
        },
        "annotation": "Maintainer: Linux Operations Center <[email protected]>\nVersion: v22.08\nCreated: 2022-08-16 12:16 UTC\nBuilt by: HashiCorp Packer 1.8.3",
        "current_snapshot": null,
        "customvalues": {},
        "guest_consolidation_needed": false,
        "guest_question": null,
        "guest_tools_status": "guestToolsRunning",
        "guest_tools_version": "11365",
        "hw_cluster": "TEST",
        "hw_cores_per_socket": 2,
        "hw_datastores": [
            "STRWZ-B_Test_1"
        ],
        "hw_esxi_host": "vs37.ncc.mycompany.com",
        "hw_eth0": {
            "addresstype": "assigned",
            "ipaddresses": [
                "192.168.1.198",
                "fe80::250:56ff:fe87:7a8f"
            ],
            "label": "Network adapter 1",
            "macaddress": "00:50:56:87:7a:8f",
            "macaddress_dash": "00-50-56-87-7a-8f",
            "portgroup_key": "dvportgroup-850290",
            "portgroup_portkey": "1350",
            "summary": "DVSwitch: 17 29 07 50 88 57 23 7c-f5 9a 3a ad ce fd 7c 44"
        },
        "hw_files": [
            "[STRWZ-B_Test_1] molecule-test.lx.mycompany.com/molecule-test.lx.mycompany.com.vmx",
            "[STRWZ-B_Test_1] molecule-test.lx.mycompany.com/molecule-test.lx.mycompany.com.nvram",
            "[STRWZ-B_Test_1] molecule-test.lx.mycompany.com/molecule-test.lx.mycompany.com.vmsd",
            "[STRWZ-B_Test_1] molecule-test.lx.mycompany.com/vmware-2.log",
            "[STRWZ-B_Test_1] molecule-test.lx.mycompany.com/vmware-1.log",
            "[STRWZ-B_Test_1] molecule-test.lx.mycompany.com/vmware.log",
            "[STRWZ-B_Test_1] molecule-test.lx.mycompany.com/molecule-test.lx.mycompany.com.vmdk"
        ],
        "hw_folder": "/edSB/vm/LOC",
        "hw_guest_full_name": "Ubuntu Linux (64-bit)",
        "hw_guest_ha_state": true,
        "hw_guest_id": "ubuntu64Guest",
        "hw_interfaces": [
            "eth0"
        ],
        "hw_is_template": false,
        "hw_memtotal_mb": 2048,
        "hw_name": "molecule-test.lx.mycompany.com",
        "hw_power_status": "poweredOn",
        "hw_processor_count": 1,
        "hw_product_uuid": "4207ad1e-1772-0897-e87b-c3d37d7d9349",
        "hw_version": "vmx-15",
        "instance_uuid": "50075fc3-c5c2-4a20-fac4-a5d75621c65a",
        "ipv4": "192.168.1.198",
        "ipv6": null,
        "module_hw": true,
        "moid": "vm-3383891",
        "snapshots": [],
        "tpm_info": {
            "provider_id": null,
            "tpm_present": false
        },
        "vimref": "vim.VirtualMachine:vm-3383891",
        "vnc": {}
    },
    "invocation": {
        "module_args": {
            "advanced_settings": [],
            "annotation": null,
            "cdrom": [],
            "cluster": "TEST",
            "convert": null,
            "customization": {
                "autologon": null,
                "autologoncount": null,
                "dns_servers": [
                    "8.8.8.8",
                    "9.9.9.9"
                ],
                "dns_suffix": [
                    "lx.mycompany.com",
                    "mycompany.com"
                ],
                "domain": "lx.mycompany.com",
                "domainadmin": null,
                "domainadminpassword": null,
                "existing_vm": null,
                "fullname": null,
                "hostname": null,
                "hwclockUTC": null,
                "joindomain": null,
                "joinworkgroup": null,
                "orgname": null,
                "password": null,
                "productid": null,
                "runonce": null,
                "timezone": null
            },
            "customization_spec": null,
            "customvalues": [],
            "datacenter": "edSB",
            "datastore": null,
            "delete_from_inventory": false,
            "disk": [],
            "esxi_hostname": null,
            "folder": "/edSB/vm/LOC",
            "force": false,
            "guest_id": null,
            "hardware": {
                "boot_firmware": "efi",
                "cpu_limit": null,
                "cpu_reservation": null,
                "hotadd_cpu": null,
                "hotadd_memory": null,
                "hotremove_cpu": null,
                "iommu": null,
                "max_connections": null,
                "mem_limit": null,
                "mem_reservation": null,
                "memory_mb": null,
                "memory_reservation_lock": null,
                "nested_virt": null,
                "num_cpu_cores_per_socket": null,
                "num_cpus": null,
                "scsi": null,
                "secure_boot": true,
                "version": null,
                "virt_based_security": null
            },
            "hostname": "vc4.edsb.mycompany.com",
            "is_template": false,
            "linked_clone": false,
            "name": "molecule-test.lx.mycompany.com",
            "name_match": "first",
            "networks": [
                {
                    "connected": true,
                    "device_type": "vmxnet3",
                    "name": "DS-VLAN 302 Deploy",
                    "start_connected": true,
                    "type": "dhcp"
                }
            ],
            "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": "present",
            "state_change_timeout": 0,
            "template": "ubuntu-jammy",
            "use_instance_uuid": false,
            "username": "svc-ansible",
            "uuid": null,
            "validate_certs": false,
            "vapp_properties": [],
            "wait_for_customization": false,
            "wait_for_customization_timeout": 3600,
            "wait_for_ip_address": false,
            "wait_for_ip_address_timeout": 300
        }
    }
}

To summarize the change:

        "hw_eth0": {
            "addresstype": "assigned",
            "ipaddresses": [
                "192.168.1.198",
                "fe80::250:56ff:fe87:7a8f"
            ],
            "label": "Network adapter 1",
            "macaddress": "00:50:56:87:7a:8f",
            "macaddress_dash": "00-50-56-87-7a-8f",
            "portgroup_key": "dvportgroup-850290",
            "portgroup_portkey": "1348",
            "summary": "DVSwitch: 17 29 07 50 88 57 23 7c-f5 9a 3a ad ce fd 7c 44"
        },
->
        "hw_eth0": {
            "addresstype": "assigned",
            "ipaddresses": [
                "192.168.1.198",
                "fe80::250:56ff:fe87:7a8f"
            ],
            "label": "Network adapter 1",
            "macaddress": "00:50:56:87:7a:8f",
            "macaddress_dash": "00-50-56-87-7a-8f",
            "portgroup_key": "dvportgroup-850290",
            "portgroup_portkey": "1350",
            "summary": "DVSwitch: 17 29 07 50 88 57 23 7c-f5 9a 3a ad ce fd 7c 44"
        },

As already stated in this post ansible/ansible#38605 (comment) the issue is caused by this code fragment in vmware_guest.py (line 1826-1828):

if nic.device.deviceInfo.summary != network_name:
   nic.device.deviceInfo.summary = network_name
   nic_change_detected = True

The comparison does not succeed because the two values are not equal:

nic.device.deviceInfo.summary = "DVSwitch: 17 29 07 50 88 57 23 7c-f5 9a 3a ad ce fd 7c 44"
network_name = "DS-VLAN 302 Deploy"

Any ideas, how we can solve the issue?

@cfiehe
Copy link
Contributor Author

cfiehe commented Oct 11, 2022

The issue is gone, when those three lines are removed. But I am not sure, if this change has any side-effects.

@okopop
Copy link

okopop commented Oct 24, 2022

Seems like the same issue as #498 "vmware_guest always change network port on dvs"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants