community.vmware icon indicating copy to clipboard operation
community.vmware copied to clipboard

Managing DVS portgroups always show changes

Open karlism opened this issue 9 months ago • 3 comments

SUMMARY

Changed status is always true for tasks that manage DVS portgroups.

ISSUE TYPE
  • Bug Report
COMPONENT NAME

community.vmware.vmware_dvs_portgroup

ANSIBLE VERSION
ansible [core 2.14.3]
  config file = /home/username/.ansible.cfg
  configured module search path = ['/home/username/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/local/lib/python3.10/site-packages/ansible
  ansible collection location = /home/username/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/local/bin/ansible
  python version = 3.10.12 (main, Jun 19 2023, 16:27:15) [Clang 13.0.0 ] (/usr/local/bin/python3.10)
  jinja version = 3.1.2
  libyaml = True
COLLECTION VERSION
$ ansible-galaxy collection list community.vmware 

# /usr/local/lib/python3.10/site-packages/ansible_collections
Collection       Version
---------------- -------
community.vmware 3.4.0  

# /home/username/.ansible/collections/ansible_collections
Collection       Version
---------------- -------
community.vmware 3.9.0  
CONFIGURATION
COLOR_VERBOSE(/home/username/.ansible.cfg) = cyan
CONFIG_FILE() = /home/username/.ansible.cfg
DEFAULT_HASH_BEHAVIOUR(/home/username/.ansible.cfg) = merge
DEFAULT_HOST_LIST(/home/username/.ansible.cfg) = ['/home/username/ansible/library/netbox/netbox.py']
DEFAULT_VAULT_PASSWORD_FILE(env: ANSIBLE_VAULT_PASSWORD_FILE) = /home/username/.ansible/vault_pass
INTERPRETER_PYTHON(/home/username/.ansible.cfg) = auto_silent
OS / ENVIRONMENT

OpenBSD 7.3 amd64

STEPS TO REPRODUCE
---
- hosts: "localhost"
  gather_facts: false

  tasks:
    - community.vmware.vmware_dvs_portgroup: &module_settings
        hostname: "{{ vcenter_hostname }}"
        username: "{{ vcenter_username }}"
        password: "{{ vcenter_password }}"
        validate_certs: "{{ vcenter_validate_certs }}"
        portgroup_name: "666-EXAMPLE"
        switch_name: "DEV_DVS"
        vlan_id: "666"
        port_binding: "static"
        state: present

    - community.vmware.vmware_dvs_portgroup:
        <<: *module_settings
EXPECTED RESULTS

First run of DVS portgroup configuration task should have changed status, but the second one should not as nothing has been changed.

ACTUAL RESULTS

Second run of the DVS portgroup configuration task shouldn't have any changes reported:

ansible-playbook dvs_portgroup.yml

PLAY [localhost] **********************************************************************

TASK [community.vmware.vmware_dvs_portgroup] ******************************************
changed: [localhost]

TASK [community.vmware.vmware_dvs_portgroup] ******************************************
changed: [localhost]

PLAY RECAP ****************************************************************************
localhost                  : ok=2    changed=2    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0

karlism avatar Sep 14 '23 11:09 karlism