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

nxos_vlans result always returns "changed": true #908

Open
Raimond56 opened this issue Nov 28, 2024 · 0 comments
Open

nxos_vlans result always returns "changed": true #908

Raimond56 opened this issue Nov 28, 2024 · 0 comments

Comments

@Raimond56
Copy link

Raimond56 commented Nov 28, 2024

I couldn't find any information on it elsewhere.

SUMMARY

When running cisco.nxos.nxos_vlans to create new vlan and then run the playbook again it always returns result as "changed" where it should return "OK" instead.

ISSUE TYPE
  • Bug Report
COMPONENT NAME

cisco.nxos.nxos_vlans

ANSIBLE VERSION
ansible [core 2.17.4]
  config file = /home/user/folder1/ansible.cfg
  configured module search path = ['/home/user/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /home/user/.local/lib/python3.10/site-packages/ansible
  ansible collection location = /home/user/.ansible/collections:/usr/share/ansible/collections
  executable location = /home/user/.local/bin/ansible
  python version = 3.10.12 (main, Nov  6 2024, 20:22:13) [GCC 11.4.0] (/usr/bin/python3)
  jinja version = 3.0.3
  libyaml = True
COLLECTION VERSION
Collection Version
---------- -------
cisco.nxos 9.2.1

CONFIGURATION
CONFIG_FILE() = /home/user/folder1/ansible.cfg
DEFAULT_HOST_LIST(/home/user/folder1/ansible.cfg) = ['/home/user/folder1/hosts']
DEFAULT_VAULT_PASSWORD_FILE(/home/user/folder1/ansible.cfg) = /home/user/.ssh/vaultpw

OS / ENVIRONMENT

Targeted device information:
Software
BIOS: version 01.08
NXOS: version 10.1(1)
BIOS compile time: 05/06/2022
NXOS image file is: bootflash:///nxos.10.1.1.bin
NXOS compile time: 2/14/2021 15:00:00 [02/15/2021 01:41:40]

Hardware
cisco Nexus9000 C93180YC-FX3 Chassis
Intel(R) Xeon(R) CPU D-1526 @ 1.80GHz with 16332572 kB of memory.
Processor Board ID FDO28021CCG
Device name: lab-n9k-0
bootflash: 115805708 kB

STEPS TO REPRODUCE

Create new vlan with playbook and run playbook twice

- name: Testing playbook for nexus
  hosts: n9k_lab
  gather_facts: false

  tasks:
    - name: Create new vlan and add vn-segment
      cisco.nxos.nxos_vlans:
        config:
          - vlan_id: 50
            mapped_vni: 5050
EXPECTED RESULTS

After running playbook second time and vlan already exists I expect result to be OK
PLAY RECAP **********************************************************************************************************************************************************************************************************************************
n9k_lab : ok=1 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0

ACTUAL RESULTS

When running playbook again when vlan is already in place, always getting changed. See below.
It seems that after and before are different the module automatically adds "mode":"ce" to after list

PLAY [Testing playbook for nexus] *************************************************************************************************************************************************************************************************************

TASK [Create new vlan and add vn-segment] ***************************************************************************************************************************************************************************************************
task path: /home/user/folder1/nxos_testing.yaml:11
Loading collection ansible.netcommon from /home/user/.ansible/collections/ansible_collections/ansible/netcommon
Loading collection ansible.netcommon from /home/user/.ansible/collections/ansible_collections/ansible/netcommon
Loading collection ansible.utils from /home/user/.ansible/collections/ansible_collections/ansible/utils
Loading collection ansible.utils from /home/user/.ansible/collections/ansible_collections/ansible/utils
<10.255.255.240> Using network group action cisco.nxos.nxos for cisco.nxos.nxos_vlans
<10.255.255.241> Using network group action cisco.nxos.nxos for cisco.nxos.nxos_vlans
<10.255.255.240> attempting to start connection
<10.255.255.240> using connection plugin ansible.netcommon.network_cli
Found ansible-connection at path /home/user/.local/bin/ansible-connection
<10.255.255.241> attempting to start connection
<10.255.255.241> using connection plugin ansible.netcommon.network_cli
Found ansible-connection at path /home/user/.local/bin/ansible-connection
<10.255.255.240> local domain socket does not exist, starting it
<10.255.255.240> control socket path is /home/user/.ansible/pc/95ea4b5be0
<10.255.255.240> Loading collection ansible.builtin from
<10.255.255.240> Loading collection ansible.netcommon from /home/user/.ansible/collections/ansible_collections/ansible/netcommon
<10.255.255.240> Loading collection ansible.utils from /home/user/.ansible/collections/ansible_collections/ansible/utils
<10.255.255.240> Loading collection cisco.nxos from /home/user/.ansible/collections/ansible_collections/cisco/nxos
<10.255.255.240> local domain socket listeners started successfully
<10.255.255.240> loaded cliconf plugin ansible_collections.cisco.nxos.plugins.cliconf.nxos from path /home/user/.ansible/collections/ansible_collections/cisco/nxos/plugins/cliconf/nxos.py for network_os cisco.nxos.nxos
<10.255.255.240> ssh type is set to paramiko
<10.255.255.240> Loading collection ansible.builtin from
<10.255.255.240> local domain socket path is /home/user/.ansible/pc/95ea4b5be0
<10.255.255.240> ANSIBLE_NETWORK_IMPORT_MODULES: enabled
<10.255.255.241> local domain socket does not exist, starting it
<10.255.255.241> control socket path is /home/user/.ansible/pc/d8a14fcd4c
<10.255.255.241> Loading collection ansible.builtin from
<10.255.255.241> Loading collection ansible.netcommon from /home/user/.ansible/collections/ansible_collections/ansible/netcommon
<10.255.255.241> Loading collection ansible.utils from /home/user/.ansible/collections/ansible_collections/ansible/utils
<10.255.255.241> Loading collection cisco.nxos from /home/user/.ansible/collections/ansible_collections/cisco/nxos
<10.255.255.241> local domain socket listeners started successfully
<10.255.255.241> loaded cliconf plugin ansible_collections.cisco.nxos.plugins.cliconf.nxos from path /home/user/.ansible/collections/ansible_collections/cisco/nxos/plugins/cliconf/nxos.py for network_os cisco.nxos.nxos
<10.255.255.241> ssh type is set to paramiko
<10.255.255.241> Loading collection ansible.builtin from
<10.255.255.241> local domain socket path is /home/user/.ansible/pc/d8a14fcd4c
<10.255.255.241> ANSIBLE_NETWORK_IMPORT_MODULES: enabled
<10.255.255.240> ANSIBLE_NETWORK_IMPORT_MODULES: found cisco.nxos.nxos_vlans  at /home/user/.ansible/collections/ansible_collections/cisco/nxos/plugins/modules/nxos_vlans.py
<10.255.255.240> ANSIBLE_NETWORK_IMPORT_MODULES: running cisco.nxos.nxos_vlans
<10.255.255.241> ANSIBLE_NETWORK_IMPORT_MODULES: found cisco.nxos.nxos_vlans  at /home/user/.ansible/collections/ansible_collections/cisco/nxos/plugins/modules/nxos_vlans.py
<10.255.255.241> ANSIBLE_NETWORK_IMPORT_MODULES: running cisco.nxos.nxos_vlans
<10.255.255.240> ANSIBLE_NETWORK_IMPORT_MODULES: complete
<10.255.255.241> ANSIBLE_NETWORK_IMPORT_MODULES: complete
changed: [n9k_lab] => {
    "after": [
        {
            "enabled": true,
            "mode": "ce",
            "name": "default",
            "state": "active",
            "vlan_id": 1
        },
        {
            "enabled": true,
            "mode": "ce",
            "state": "active",
            "vlan_id": 5
        },
        {
            "enabled": true,
            "mode": "ce",
            "state": "active",
            "vlan_id": 50
        }
    ],
    "before": [
        {
            "enabled": true,
            "name": "default",
            "state": "active",
            "vlan_id": 1
        },
        {
            "enabled": true,
            "state": "active",
            "vlan_id": 5
        },
        {
            "enabled": true,
            "state": "active",
            "vlan_id": 50
        }
    ],
    "changed": true,
    "commands": [
        "vlan 50",
        "vn-segment 5050"
    ],
    "invocation": {
        "module_args": {
            "config": [
                {
                    "enabled": null,
                    "mapped_vni": 5050,
                    "name": null,
                    "state": null,
                    "vlan_id": 50
                }
            ],
            "running_config": null,
            "state": "merged"
        }
    }
}

PLAY RECAP **********************************************************************************************************************************************************************************************************************************
n9k_lab                 : ok=0    changed=1    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0

Is this bug? I think it should show OK if no new vlan was added.

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

1 participant