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

changing native_vlan in nxos_l2_interfaces using mode trunk removes mode trunk #694

Open
aj-cruz opened this issue Jun 11, 2023 · 0 comments
Assignees

Comments

@aj-cruz
Copy link

aj-cruz commented Jun 11, 2023

SUMMARY

If I have a trunk interface defined with a native vlan, then I set the native vlan to the default native vlan 1 and run the playbook, the interface mode trunk is removed.

ISSUE TYPE
  • Bug Report
COMPONENT NAME

nxos_l2_interface

ANSIBLE VERSION
ansible [core 2.15.0]
  config file = /home/aj/projects/ansible/ansible-nxos/ansible.cfg
  configured module search path = ['/home/aj/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /home/aj/.pyenv/versions/3.11.4/envs/ansible-nxos/lib/python3.11/site-packages/ansible
  ansible collection location = /home/aj/.ansible/collections:/usr/share/ansible/collections
  executable location = /home/aj/.pyenv/versions/ansible-nxos/bin/ansible
  python version = 3.11.4 (main, Jun 10 2023, 09:15:50) [GCC 11.3.0] (/home/aj/.pyenv/versions/3.11.4/envs/ansible-nxos/bin/python3.11)
  jinja version = 3.1.2
  libyaml = True
COLLECTION VERSION
# /home/aj/.ansible/collections/ansible_collections
Collection Version
---------- -------
cisco.nxos 4.4.0  
CONFIGURATION
CONFIG_FILE() = /home/aj/projects/ansible/ansible-nxos/ansible.cfg
HOST_KEY_CHECKING(/home/aj/projects/ansible/ansible-nxos/ansible.cfg) = False
PAGER(env: PAGER) = less
OS / ENVIRONMENT

WSL 2 on Windows 10: Ubuntu 22.04.6 LTS
NXOS (Nexus 9Kv): version 10.2(5) [Maintenance Release]

STEPS TO REPRODUCE
- name: Configure L2 Interface Properties
  cisco.nxos.nxos_l2_interfaces:
    config:
      - name: Ethernet1/5
        mode: trunk
        trunk:
          native_vlan: 10
    state: overridden

changed to:

- name: Configure L2 Interface Properties
  cisco.nxos.nxos_l2_interfaces:
    config:
      - name: Ethernet1/5
        mode: trunk
        trunk:
          native_vlan: 1
    state: overridden
EXPECTED RESULTS

Running the playbook the first time should produce this configuration:

interface Ethernet1/5
  switchport mode trunk
  switchport trunk native vlan 10

Subsequent run with native vlan set to 1 should produce this configuration:

interface Ethernet1/5
  switchport mode trunk
ACTUAL RESULTS

Subsequent run with native vlan changed to 1 produces this configuration:

interface Ethernet1/5

switchport mode trunk is removed.
Here is the verbose output:

changed: [CORE-1] => {
    "after": [
        {
            "name": "Vlan1"
        },
        {
            "name": "Ethernet1/1"
        },
        {
            "name": "Ethernet1/2"
        },
        {
            "name": "Ethernet1/3"
        },
        {
            "name": "Ethernet1/4"
        },
        {
            "name": "Ethernet1/5"
        },
        {
            "name": "Ethernet1/6"
        },
        {
            "name": "Ethernet1/7"
        },
        {
            "name": "Ethernet1/8"
        },
        {
            "name": "Ethernet1/9"
        },
        {
            "name": "Ethernet1/10"
        },
        {
            "name": "Ethernet1/11"
        },
        {
            "name": "Ethernet1/12"
        },
        {
            "name": "Ethernet1/13"
        },
        {
            "name": "Ethernet1/14"
        },
        {
            "name": "Ethernet1/15"
        },
        {
            "name": "Ethernet1/16"
        },
        {
            "name": "Ethernet1/17"
        },
        {
            "name": "Ethernet1/18"
        },
        {
            "name": "Ethernet1/19"
        },
        {
            "name": "Ethernet1/20"
        },
        {
            "name": "Ethernet1/21"
        },
        {
            "name": "Ethernet1/22"
        },
        {
            "name": "Ethernet1/23"
        },
        {
            "name": "Ethernet1/24"
        },
        {
            "name": "Ethernet1/25"
        },
        {
            "name": "Ethernet1/26"
        },
        {
            "name": "Ethernet1/27"
        },
        {
            "name": "Ethernet1/28"
        },
        {
            "name": "Ethernet1/29"
        },
        {
            "name": "Ethernet1/30"
        },
        {
            "name": "Ethernet1/31"
        },
        {
            "name": "Ethernet1/32"
        },
        {
            "name": "Ethernet1/33"
        },
        {
            "name": "Ethernet1/34"
        },
        {
            "name": "Ethernet1/35"
        },
        {
            "name": "Ethernet1/36"
        },
        {
            "name": "Ethernet1/37"
        },
        {
            "name": "Ethernet1/38"
        },
        {
            "name": "Ethernet1/39"
        },
        {
            "name": "Ethernet1/40"
        },
        {
            "name": "Ethernet1/41"
        },
        {
            "name": "Ethernet1/42"
        },
        {
            "name": "Ethernet1/43"
        },
        {
            "name": "Ethernet1/44"
        },
        {
            "name": "Ethernet1/45"
        },
        {
            "name": "Ethernet1/46"
        },
        {
            "name": "Ethernet1/47"
        },
        {
            "name": "Ethernet1/48"
        },
        {
            "name": "Ethernet1/49"
        },
        {
            "name": "Ethernet1/50"
        },
        {
            "name": "Ethernet1/51"
        },
        {
            "name": "Ethernet1/52"
        },
        {
            "name": "Ethernet1/53"
        },
        {
            "name": "Ethernet1/54"
        },
        {
            "name": "Ethernet1/55"
        },
        {
            "name": "Ethernet1/56"
        },
        {
            "name": "Ethernet1/57"
        },
        {
            "name": "Ethernet1/58"
        },
        {
            "name": "Ethernet1/59"
        },
        {
            "name": "Ethernet1/60"
        },
        {
            "name": "Ethernet1/61"
        },
        {
            "name": "Ethernet1/62"
        },
        {
            "name": "Ethernet1/63"
        },
        {
            "name": "Ethernet1/64"
        },
        {
            "name": "mgmt0"
        }
    ],
    "before": [
        {
            "name": "Vlan1"
        },
        {
            "name": "Ethernet1/1"
        },
        {
            "name": "Ethernet1/2"
        },
        {
            "name": "Ethernet1/3"
        },
        {
            "name": "Ethernet1/4"
        },
        {
            "mode": "trunk",
            "name": "Ethernet1/5",
            "trunk": {
                "native_vlan": 10
            }
        },
        {
            "name": "Ethernet1/6"
        },
        {
            "name": "Ethernet1/7"
        },
        {
            "name": "Ethernet1/8"
        },
        {
            "name": "Ethernet1/9"
        },
        {
            "name": "Ethernet1/10"
        },
        {
            "name": "Ethernet1/11"
        },
        {
            "name": "Ethernet1/12"
        },
        {
            "name": "Ethernet1/13"
        },
        {
            "name": "Ethernet1/14"
        },
        {
            "name": "Ethernet1/15"
        },
        {
            "name": "Ethernet1/16"
        },
        {
            "name": "Ethernet1/17"
        },
        {
            "name": "Ethernet1/18"
        },
        {
            "name": "Ethernet1/19"
        },
        {
            "name": "Ethernet1/20"
        },
        {
            "name": "Ethernet1/21"
        },
        {
            "name": "Ethernet1/22"
        },
        {
            "name": "Ethernet1/23"
        },
        {
            "name": "Ethernet1/24"
        },
        {
            "name": "Ethernet1/25"
        },
        {
            "name": "Ethernet1/26"
        },
        {
            "name": "Ethernet1/27"
        },
        {
            "name": "Ethernet1/28"
        },
        {
            "name": "Ethernet1/29"
        },
        {
            "name": "Ethernet1/30"
        },
        {
            "name": "Ethernet1/31"
        },
        {
            "name": "Ethernet1/32"
        },
        {
            "name": "Ethernet1/33"
        },
        {
            "name": "Ethernet1/34"
        },
        {
            "name": "Ethernet1/35"
        },
        {
            "name": "Ethernet1/36"
        },
        {
            "name": "Ethernet1/37"
        },
        {
            "name": "Ethernet1/38"
        },
        {
            "name": "Ethernet1/39"
        },
        {
            "name": "Ethernet1/40"
        },
        {
            "name": "Ethernet1/41"
        },
        {
            "name": "Ethernet1/42"
        },
        {
            "name": "Ethernet1/43"
        },
        {
            "name": "Ethernet1/44"
        },
        {
            "name": "Ethernet1/45"
        },
        {
            "name": "Ethernet1/46"
        },
        {
            "name": "Ethernet1/47"
        },
        {
            "name": "Ethernet1/48"
        },
        {
            "name": "Ethernet1/49"
        },
        {
            "name": "Ethernet1/50"
        },
        {
            "name": "Ethernet1/51"
        },
        {
            "name": "Ethernet1/52"
        },
        {
            "name": "Ethernet1/53"
        },
        {
            "name": "Ethernet1/54"
        },
        {
            "name": "Ethernet1/55"
        },
        {
            "name": "Ethernet1/56"
        },
        {
            "name": "Ethernet1/57"
        },
        {
            "name": "Ethernet1/58"
        },
        {
            "name": "Ethernet1/59"
        },
        {
            "name": "Ethernet1/60"
        },
        {
            "name": "Ethernet1/61"
        },
        {
            "name": "Ethernet1/62"
        },
        {
            "name": "Ethernet1/63"
        },
        {
            "name": "Ethernet1/64"
        },
        {
            "name": "mgmt0"
        }
    ],
    "changed": true,
    "commands": [
        "interface Ethernet1/5",
        "no switchport mode",
        "no switchport trunk native vlan",
        "interface Ethernet1/5",
        "switchport trunk native vlan 1"
    ],
    "invocation": {
        "module_args": {
            "config": [
                {
                    "access": null,
                    "mode": "trunk",
                    "name": "Ethernet1/5",
                    "trunk": {
                        "allowed_vlans": "",
                        "native_vlan": 1
                    }
                }
            ],
            "running_config": null,
            "state": "overridden"
        }
    }
}
@KB-perByte KB-perByte self-assigned this Jun 14, 2023
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

2 participants