Ansible module “vmware_portgroup” incorrectly returns “changed”, even when arguments unchanged.

The Ansible module “vmware_portgroup” will incorrectly return a “changed” condition, even when the arguments are unchanged.

The vmware_portgroup module does run correctly and changes the ESXi portgroup settings as needed, but it always reports a “changed” state.

For example:

  • name: Create portgroup Internal Network on vSwitch0

vmware_portgroup:

hostname: ‘{{ inventory_hostname }}’

username: ‘{{ vcenter_username }}’

password: ‘{{ vcenter_password }}’

esxi_hostname: ‘{{ inventory_hostname }}’

validate_certs: no

portgroup_name: ‘Internal Network’

switch_name: ‘vSwitch0’

state: present

delegate_to: localhost

If you run the task a second time, Ansible will report a “changed” state.

Ansible version: 2.7.5 (from CentOS 7.x epel repository)

yum package ansible.noarch 2.6.3-1.el7

Linux: CentOS 7.5.1804