W3cubDocs

/Ansible

ios_interface - Manage Interface on Cisco IOS network devices

New in version 2.4.

Synopsis

  • This module provides declarative management of Interfaces on Cisco IOS network devices.

Options

parameter required default choices comments
aggregate
no
List of Interfaces definitions.
delay
no 10
Time in seconds to wait before checking for the operational state on remote device. This wait is applicable for operational state argument which are state with values up/down, tx_rate and rx_rate.
description
no
Description of Interface.
duplex
no auto
  • full
  • half
  • auto
Interface link status
enabled
no
Interface link status.
mtu
no
Maximum size of transmit packet.
name
yes
Name of the Interface.
neighbors
no
Check the operational state of given interface name for LLDP neighbor.
The following suboptions are available.
Dictionary object neighbors
parameter required default choices comments
host
no
LLDP neighbor host for given interface name.
port
no
LLDP neighbor port to which given interface name is connected.
rx_rate
no
Receiver rate in bits per second (bps).
speed
no
Interface link speed.
state
no present
  • present
  • absent
  • up
  • down
State of the Interface configuration, up means present and operationally up and down means present and operationally down
tx_rate
no
Transmit rate in bits per second (bps).

Examples

- name: configure interface
  ios_interface:
      name: GigabitEthernet0/2
      description: test-interface
      speed: 100
      duplex: half
      mtu: 512

- name: remove interface
  ios_interface:
    name: Loopback9
    state: absent

- name: make interface up
  ios_interface:
    name: GigabitEthernet0/2
    enabled: True

- name: make interface down
  ios_interface:
    name: GigabitEthernet0/2
    enabled: False

- name: Check intent arguments
  ios_interface:
    name: GigabitEthernet0/2
    state: up
    tx_rate: ge(0)
    rx_rate: le(0)

- name: Check neighbors intent arguments
  ios_interface:
    name: Gi0/0
    neighbors:
    - port: eth0
      host: netdev

- name: Config + intent
  ios_interface:
    name: GigabitEthernet0/2
    enabled: False
    state: down

- name: Add interface using aggregate
  ios_interface:
    aggregate:
    - { name: GigabitEthernet0/1, mtu: 256, description: test-interface-1 }
    - { name: GigabitEthernet0/2, mtu: 516, description: test-interface-2 }
    duplex: full
    speed: 100
    state: present

- name: Delete interface using aggregate
  ios_interface:
    aggregate:
    - name: Loopback9
    - name: Loopback10
    state: absent

Return Values

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

name description returned type sample
commands
The list of configuration mode commands to send to the device.
always, except for the platforms that use Netconf transport to manage the device. list ['interface GigabitEthernet0/2', 'description test-interface', 'duplex half', 'mtu 512']

Notes

Note

  • Tested against IOS 15.6

Status

This module is flagged as preview which means that it is not guaranteed to have a backwards compatible interface.

Maintenance Info

For more information about Red Hat’s this support of this module, please refer to this knowledge base article<https://access.redhat.com/articles/rhel-top-support-policies>

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

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