Skip to content

nxos_interfaces no longer idempotent with enable and disable #974

@blairhoward

Description

@blairhoward
SUMMARY

Module nxos_interfaces enable and disable options no longer idempotent as it seems to not be recognizing if the shutdown (or no shutdown) is part of the default interface settings.

ISSUE TYPE
  • Bug Report
COMPONENT NAME

nxos_interfaces

ANSIBLE VERSION
ansible [core 2.18.7]
  config file = None
  configured module search path = ['/home/jenkins/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /home/jenkins/venv/default/lib/python3.12/site-packages/ansible
  ansible collection location = /home/jenkins/.ansible/collections:/usr/share/ansible/collections
  executable location = /home/jenkins/venv/default/bin/ansible
  python version = 3.12.3 (main, Jun 18 2025, 17:59:45) [GCC 13.3.0] (/home/jenkins/venv/default/bin/python3)
  jinja version = 3.1.6
  libyaml = True

COLLECTION VERSION
# /home/jenkins/.ansible/collections/ansible_collections
Collection Version
---------- -------
cisco.nxos 10.2.0

CONFIGURATION
CONFIG_FILE() = /home/jenkins/agent/workspace/cisco_lab/check_nxos_l2_vlans_interfaces/ansible.cfg
DEFAULT_GATHERING(/home/jenkins/agent/workspace/cisco_lab/check_nxos_l2_vlans_interfaces/ansible.cfg) = explicit
DEFAULT_JINJA2_EXTENSIONS(/home/jenkins/agent/workspace/cisco_lab/check_nxos_l2_vlans_interfaces/ansible.cfg) = jinja2.ext.loopcontrols,jinja2.ext.>
DEFAULT_NO_TARGET_SYSLOG(/home/jenkins/agent/workspace/cisco_lab/check_nxos_l2_vlans_interfaces/ansible.cfg) = True
DEFAULT_ROLES_PATH(/home/jenkins/agent/workspace/cisco_lab/check_nxos_l2_vlans_interfaces/ansible.cfg) = ['/home/jenkins/agent/workspace/cisco_lab/>
DEPRECATION_WARNINGS(/home/jenkins/agent/workspace/cisco_lab/check_nxos_l2_vlans_interfaces/ansible.cfg) = False
DISPLAY_SKIPPED_HOSTS(/home/jenkins/agent/workspace/cisco_lab/check_nxos_l2_vlans_interfaces/ansible.cfg) = False
DUPLICATE_YAML_DICT_KEY(/home/jenkins/agent/workspace/cisco_lab/check_nxos_l2_vlans_interfaces/ansible.cfg) = error
HOST_KEY_CHECKING(/home/jenkins/agent/workspace/cisco_lab/check_nxos_l2_vlans_interfaces/ansible.cfg) = False
PERSISTENT_COMMAND_TIMEOUT(/home/jenkins/agent/workspace/cisco_lab/check_nxos_l2_vlans_interfaces/ansible.cfg) = 30
PERSISTENT_CONNECT_TIMEOUT(/home/jenkins/agent/workspace/cisco_lab/check_nxos_l2_vlans_interfaces/ansible.cfg) = 60
RETRY_FILES_ENABLED(/home/jenkins/agent/workspace/cisco_lab/check_nxos_l2_vlans_interfaces/ansible.cfg) = False

OS / ENVIRONMENT

NXOS: version 9.3(6)

STEPS TO REPRODUCE
    - name: "ENABLE ETHERNET INTEFACES ON NXOS SWITCHES"
      cisco.nxos.nxos_interfaces:
        state: replaced
        config:
          - name: Ethernet1/1
            enabled: true
          - name: Ethernet1/2
            enabled: true


EXPECTED RESULTS

If interface is already enabled then the task should be idempotant and recognize the interface already has 'no shutdown' configured, even if it is part of the hidden default config

ACTUAL RESULTS

With NXOS 'no system default switchport shutdown' configured (which is the default), then the 'no shutdown' interface command is hidden as the default and the nxos_interfaces module is not recognizing it.

With NXOS 'system default switchport shutdown' configured, then the 'shutdown' interface command is hidden as default and the nxos_interfaces module is not recognizing it.

ok: [nxos2] => {
    "msg": [
        "interface Ethernet1/1",
        "no shutdown",
        "interface Ethernet1/2",
        "no shutdown",
    ]
}

Show run interface all command showing 'no shutdown' is already configured
nxos2# show run int e1/1 all | inc "shutdown"
  no shutdown

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions