iosxr_interface – Manage Interface on Cisco IOS XR network devices
iosxr_interface – Manage Interface on Cisco IOS XR network devices
New in version 2.4.
Synopsis
- This module provides declarative management of Interfaces on Cisco IOS XR network devices.
Requirements
The below requirements are needed on the host that executes this module.
- ncclient >= 0.5.3 when using netconf
- lxml >= 4.1.1 when using netconf
Parameters
Parameter | Choices/Defaults | Comments | |
---|---|---|---|
active - added in 2.5 |
|
Whether the interface is | |
aggregate - |
List of Interface definitions. Include multiple interface configurations together, one each on a separate line | ||
delay - |
Default: 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 | |
description - |
Description of Interface being configured. | ||
duplex - |
|
Configures the interface duplex mode. Default is auto-negotiation when not configured. | |
enabled boolean |
|
Removes the shutdown configuration, which removes the forced administrative down on the interface, enabling it to move to an up or down state. | |
mtu - |
Sets the MTU value for the interface. Range is between 64 and 65535' | ||
name - / required |
Name of the interface to configure in | ||
provider - |
Deprecated Starting with Ansible 2.5 we recommend using For more information please see the Network Guide. A dict object containing connection details. | ||
host - / required |
Specifies the DNS host name or address for connecting to the remote device over the specified transport. The value of host is used as the destination address for the transport. | ||
password - |
Specifies the password to use to authenticate the connection to the remote device. This value is used to authenticate the SSH session. If the value is not specified in the task, the value of environment variable | ||
port - |
Default: 22 |
Specifies the port to use when building the connection to the remote device. | |
ssh_keyfile - |
Specifies the SSH key to use to authenticate the connection to the remote device. This value is the path to the key used to authenticate the SSH session. If the value is not specified in the task, the value of environment variable | ||
timeout - |
Default: 10 |
Specifies the timeout in seconds for communicating with the network device for either connecting or sending commands. If the timeout is exceeded before the operation is completed, the module will error. | |
username - |
Configures the username to use to authenticate the connection to the remote device. This value is used to authenticate the SSH session. If the value is not specified in the task, the value of environment variable | ||
rx_rate - |
Receiver rate in bits per second (bps). This is state check parameter only. Supports conditionals, see Conditionals in Networking Modules | ||
speed - |
|
Configure the speed for an interface. Default is auto-negotiation when not configured. | |
state - |
|
State of the Interface configuration, | |
tx_rate - |
Transmit rate in bits per second (bps). This is state check parameter only. Supports conditionals, see Conditionals in Networking Modules |
Notes
Note
- Tested against IOS XRv 6.1.2
- Preconfiguration of physical interfaces is not supported with
netconf
transport. - For more information on using Ansible to manage network devices see the Ansible Network Guide
- For more information on using Ansible to manage Cisco devices see the Cisco integration page.
Examples
- name: configure interface
iosxr_interface:
name: GigabitEthernet0/0/0/2
description: test-interface
speed: 100
duplex: half
mtu: 512
- name: remove interface
iosxr_interface:
name: GigabitEthernet0/0/0/2
state: absent
- name: make interface up
iosxr_interface:
name: GigabitEthernet0/0/0/2
enabled: True
- name: make interface down
iosxr_interface:
name: GigabitEthernet0/0/0/2
enabled: False
- name: Create interface using aggregate
iosxr_interface:
aggregate:
- name: GigabitEthernet0/0/0/3
- name: GigabitEthernet0/0/0/2
speed: 100
duplex: full
mtu: 512
state: present
- name: Create interface using aggregate along with additional params in aggregate
iosxr_interface:
aggregate:
- { name: GigabitEthernet0/0/0/3, description: test-interface 3 }
- { name: GigabitEthernet0/0/0/2, description: test-interface 2 }
speed: 100
duplex: full
mtu: 512
state: present
- name: Delete interface using aggregate
iosxr_interface:
aggregate:
- name: GigabitEthernet0/0/0/3
- name: GigabitEthernet0/0/0/2
state: absent
- name: Check intent arguments
iosxr_interface:
name: GigabitEthernet0/0/0/5
state: up
delay: 20
- name: Config + intent
iosxr_interface:
name: GigabitEthernet0/0/0/5
enabled: False
state: down
delay: 20
Return Values
Common return values are documented here, the following are the fields unique to this module:
Key | Returned | Description |
---|---|---|
commands list |
always (empty list when no commands to send) |
The list of configuration mode commands sent to device with transport
Sample: ['interface GigabitEthernet0/0/0/2', 'description test-interface', 'duplex half', 'mtu 512'] |
xml list added in 2.5 |
always (empty list when no xml rpc to send) |
NetConf rpc xml sent to device with transport
Sample: [' act GigabitEthernet0/0/0/0 test-interface-0 GigabitEthernet 512 100 half '] |
Status
- This module is not guaranteed to have a backwards compatible interface. [preview]
- This module is maintained by the Ansible Network Team. [network]
Red Hat Support
More information about Red Hat’s support of this module is available from this Red Hat Knowledge Base article.
Authors
- Ganesh Nalawade (@ganeshrn)
- Kedar Kekan (@kedarX)
© 2012–2018 Michael DeHaan
© 2018–2019 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/2.7/modules/iosxr_interface_module.html