ansible.builtin.nxos_interface (v2.3.3.0-1) — module

Manages physical attributes of interfaces.

| "added in version" 2.1 of ansible.builtin"

Authors: Jason Edelman (@jedelman8)

preview | supported by community

Install Ansible via pip

Install with pip install ansible==2.3.3.0.post1

Description

Manages physical attributes of interfaces of NX-OS switches.

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Ensure an interface is a Layer 3 port and that it has the proper description
  nxos_interface:
    interface: Ethernet1/1
    description: 'Configured by Ansible'
    mode: layer3
    host: 68.170.147.165
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Admin down an interface
  nxos_interface:
    interface: Ethernet2/1
    host: 68.170.147.165
    admin_state: down
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Remove all loopback interfaces
  nxos_interface:
    interface: loopback
    state: absent
    host: 68.170.147.165
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Remove all logical interfaces
  nxos_interface:
    interface_type: "{{ item }} "
    state: absent
    host: "{{ inventory_hostname }}"
  with_items:
    - loopback
    - portchannel
    - svi
    - nve
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Admin up all ethernet interfaces
  nxos_interface:
    interface: ethernet
    host: 68.170.147.165
    admin_state: up
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Admin down ALL interfaces (physical and logical)
  nxos_interface:
    interface: all
    host: 68.170.147.165
    admin_state: down

Inputs

    
mode:
    choices:
    - layer2
    - layer3
    default: null
    description:
    - Manage Layer 2 or Layer 3 state of the interface.
    required: false

state:
    choices:
    - present
    - absent
    - default
    default: present
    description:
    - Specify desired state of the resource.
    required: true

interface:
    default: null
    description:
    - Full name of interface, i.e. Ethernet1/1, port-channel10.
    required: true

ip_forward:
    choices:
    - enable
    - disable
    default: null
    description:
    - Enable/Disable ip forward feature on SVIs.
    required: false
    version_added: '2.2'
    version_added_collection: ansible.builtin

admin_state:
    choices:
    - up
    - down
    default: up
    description:
    - Administrative state of the interface.
    required: false

description:
    default: null
    description:
    - Interface description.
    required: false

interface_type:
    choices:
    - loopback
    - portchannel
    - svi
    - nve
    default: null
    description:
    - Interface type to be unconfigured from the device.
    required: false
    version_added: '2.2'
    version_added_collection: ansible.builtin

fabric_forwarding_anycast_gateway:
    choices:
    - 'true'
    - 'false'
    default: null
    description:
    - Associate SVI with anycast gateway under VLAN configuration mode.
    required: false
    version_added: '2.2'
    version_added_collection: ansible.builtin

Outputs

changed:
  description: check to see if a change was made on the device
  returned: always
  sample: true
  type: boolean
end_state:
  description: k/v pairs of switchport after module execution
  returned: always
  sample:
    admin_state: down
    description: None
    interface: port-channel101
    ip_forward: enable
    mode: layer2
    type: portchannel
  type: dict
existing:
  description: k/v pairs of existing switchport
  returned: always
  sample:
    admin_state: up
    description: None
    interface: port-channel101
    ip_forward: enable
    mode: layer2
    type: portchannel
  type: dict
proposed:
  description: k/v pairs of parameters passed into module
  returned: always
  sample:
    admin_state: down
  type: dict
updates:
  description: command list sent to the device
  returned: always
  sample:
  - interface port-channel101
  - shutdown
  type: list