W3cubDocs

/Ansible

nxos_interface - Manages physical attributes of interfaces.

New in version 2.1.

Synopsis

Manages physical attributes of interfaces of NX-OS switches.

Options

parameter required default choices comments
admin_state
no up
  • up
  • down
Administrative state of the interface.
description
no
Interface description.
fabric_forwarding_anycast_gateway
(added in 2.2)
no
  • true
  • false
Associate SVI with anycast gateway under VLAN configuration mode.
interface
yes
Full name of interface, i.e. Ethernet1/1, port-channel10.
interface_type
(added in 2.2)
no
  • loopback
  • portchannel
  • svi
  • nve
Interface type to be unconfigured from the device.
ip_forward
(added in 2.2)
no
  • enable
  • disable
Enable/Disable ip forward feature on SVIs.
mode
no
  • layer2
  • layer3
Manage Layer 2 or Layer 3 state of the interface.
state
yes present
  • present
  • absent
  • default
Specify desired state of the resource.

Examples

# 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
# Admin down an interface
- nxos_interface: interface=Ethernet2/1 host=68.170.147.165 admin_state=down
# Remove all loopback interfaces
- nxos_interface: interface=loopback state=absent host=68.170.147.165
# Remove all logical interfaces
- nxos_interface: interface_type={{ item }} state=absent host={{ inventory_hostname }}
  with_items:
    - loopback
    - portchannel
    - svi
    - nve
# Admin up all ethernet interfaces
- nxos_interface: interface=ethernet host=68.170.147.165 admin_state=up
# Admin down ALL interfaces (physical and logical)
- nxos_interface: interface=all host=68.170.147.165 admin_state=down

Return Values

Common return values are documented here Common Return Values, the following are the fields unique to this module:

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

Notes

Note

This module is also used to create logical interfaces such as svis and loopbacks.

Note

Be cautious of platform specific idiosyncrasies. For example, when you default a loopback interface, the admin state toggles on certain versions of NX-OS.

Note

The nxos_overlay_global anycast_gateway_mac attribute must be set before setting the fabric_forwarding_anycast_gateway property.

This is a Core Module

For more information on what this means please read Core Modules

For help in developing on modules, should you be so inclined, please read Community Information & Contributing, developing_test_pr and Developing Modules.

© 2012–2016 Michael DeHaan
© 2016 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/nxos_interface_module.html