Closed uutest74 closed 1 week ago
Files identified in the description:
If these files are inaccurate, please update the component name
section of the description or use the !component
bot command.
cc @Akasurde @Tomorrow9 @goneri @lparkes @nerzhul @pdellaert @pgbidkar @warthog9 click here for bot help
Files identified in the description:
plugins/modules/vmware_guest.py
](https://github.com/['ansible-collections/amazon.aws', 'ansible-collections/community.aws', 'ansible-collections/community.vmware']/blob/main/plugins/modules/vmware_guest.py)If these files are inaccurate, please update the component name
section of the description or use the !component
bot command.
I have verified the same in my environment. When I clone the VM, the NIC is modified, and causing a brief hiccup.
Also verified on vSphere 6.7 with ansible 2.10.8 and community.vmware 1.9.0, also ansible 2.11.0 and community.vmware 1.9.1-dev8.
Reconfigured test100.lab.shakey.org on esx1.lab.shakey.org in Datacenter. Modified: config.hardware.device(4000).backing.port.portKey: "212" -> "211"; config.hardware.device(4000).backing.port.connectionCookie: 865024454 -> 982707693; Added: Deleted:
I have this exact same issue. Always the portKey
and connectionCookie
are changed.
In my case every time I run the playbook the port key alternates between two values, but it is always changed.
Update: I've pinpointed the problem to the check on line 1985 of vmware_guest.py
: https://github.com/ansible-collections/community.vmware/blob/main/plugins/modules/vmware_guest.py#L1985-L1987
I added some debug logging to this section to figure out exactly what comparison was being made. I then ran my playbook and could see that the value of nic.device.deviceInfo.summary
was DVSwitch: d5 6e 22 50 dd f2 94 7b-a6 1f b2 c2 e6 aa 0f
but the value of network_name
was the name of the DVSwitch, in our case dvs-test-switch-01
.
This means the comparison fails, and nic.device.deviceInfo.summary
gets updated to match the contents of network_name
and nic_change_detected
gets set to True
, ultimately this causes an unnecessary config change to be made via self.configspec.deviceChange.append(nic)
on line 2084.
I'll continue investigating tomorrow to see if this can be solved.
I haven't made much progress, from what I can tell the name just isn't available from the network devices attached to the VM. I think we'd need to see if what looks like the DVSwitch UUID we do get back can be matched to the right UUID in a list of all DVSwitches, and use that to lookup the name to see if it is correct?
+1
Also verified on vSphere 7.0.2 with ansible 2.12.2 and community.vmware 2.1.0
Still appears to be present
@Akasurde any update?
I stumbled across this issue now too. With vSphere 6.5 it was working, on another vCenter with 7.0.3 it occurs. Ansible version 2.9.9 Collection version 2.5.0
Still the same: collection: 3.0.0 vsphere: 6.7 ansible-core: 2.13.5
Hi, total noob here, feel free to ignore.
I have what I belive is the same issue, but for me the problem went away when I used "state: poweredon" instead of "state: present" on the vmware_guest. I have no clue why this makes a differense, but it does for me.
vSphere: 7.0.3 Ansible: 2.10.8
Hi, total noob here, feel free to ignore.
I have what I belive is the same issue, but for me the problem went away when I used "state: poweredon" instead of "state: present" on the vmware_guest. I have no clue why this makes a differense, but it does for me.
vSphere: 7.0.3 Ansible: 2.10.8
It is not solution. Your playbook with state "powerdon" will check only VM powered on or exists, but won't check and reconfigure VM hardware if VM is already exists. https://docs.ansible.com/ansible/latest/collections/community/vmware/vmware_guest_module.html#parameter-state
I have the same issue.
Ansible: 2.15.0 community.vmware: 3.5.0 vSphere: 7.0.3
Any update?
It is obvious that this module is not idempotent in the part of the code responsible for the network. Unfortunately, there are currently few maintainers working on the collection and it will take a lot of time to correct this non-idempotent behavior.
If I can reproduce the problem and have time, I will look into this problem.
SUMMARY
vmware_guest task always in changed state because module change network of vm and it reconnects to distributed switch port
ISSUE TYPE
COMPONENT NAME
vmware_guest networks
ANSIBLE VERSION
CONFIGURATION
OS / ENVIRONMENT
CentOS Linux release 8.1.1911 (Core) Python 3.6.8 vCenter 6.5 ESXi 6.5
STEPS TO REPRODUCE
Any simple playbook with vm creation. For example:
start this playbook 2+ times
EXPECTED RESULTS
ACTUAL RESULTS
In vSphere i see reconfigure event every time i start playbook
Reconfigured test-ans on esxi-075 in vDC-01. Modified: config.hardware.device(4000).backing.port.portKey: "4828" -> "4823"; config.hardware.device(4000).backing.port.connectionCookie: 1926530792 -> 2069119207; Added: Deleted: