iosxr_interfaces – Manage interface attributes on Cisco IOS-XR network devices¶
New in version 2.9.
Parameters¶
Notes¶
Note
Tested against Cisco IOS-XRv Version 6.1.3 on VIRL.
This module works with connection
network_cli
. See the IOS-XR Platform Options.
Examples¶
---
# Using merged
# Before state:
# -------------
#
# viosxr#show running-config interface
# interface GigabitEthernet0/0/0/1
# shutdown
# !
# interface GigabitEthernet0/0/0/2
# vrf custB
# ipv4 address 178.18.169.23 255.255.255.0
# dot1q native vlan 30
# !
# interface GigabitEthernet0/0/0/3
# description Replaced by Ansible Team
# mtu 2000
# vrf custB
# ipv4 address 10.10.0.2 255.255.255.0
# dot1q native vlan 1021
# !
- name: Configure Ethernet interfaces
iosxr_interfaces:
config:
- name: GigabitEthernet0/0/0/2
description: 'Configured by Ansible'
enabled: True
- name: GigabitEthernet0/0/0/3
description: 'Configured by Ansible Network'
enabled: False
duplex: full
state: merged
# After state:
# ------------
#
# viosxr#show running-config interface
# interface GigabitEthernet0/0/0/1
# shutdown
# !
# interface GigabitEthernet0/0/0/2
# description Configured and Merged by Ansible Network
# vrf custB
# ipv4 address 178.18.169.23 255.255.255.0
# dot1q native vlan 30
# !
# interface GigabitEthernet0/0/0/3
# description Configured and Merged by Ansible Network
# mtu 2600
# vrf custB
# ipv4 address 10.10.0.2 255.255.255.0
# duplex full
# shutdown
# dot1q native vlan 1021
# !
# Using replaced
# Before state:
# ------------
#
# viosxr#show running-config interface
# interface GigabitEthernet0/0/0/1
# description Configured by Ansible
# shutdown
# !
# interface GigabitEthernet0/0/0/2
# description Test
# vrf custB
# ipv4 address 178.18.169.23 255.255.255.0
# dot1q native vlan 30
# !
# interface GigabitEthernet0/0/0/3
# vrf custB
# ipv4 address 10.10.0.2 255.255.255.0
# dot1q native vlan 1021
# !
- name: Configure following interfaces and replace their existing config
iosxr_interfaces:
config:
- name: GigabitEthernet0/0/0/2
description: Configured by Ansible
enabled: True
mtu: 2000
- name: GigabitEthernet0/0/0/3
description: 'Configured by Ansible Network'
enabled: False
duplex: auto
state: replaced
# After state:
# ------------
#
# viosxr#show running-config interface
# interface GigabitEthernet0/0/0/1
# description Configured by Ansible
# shutdown
# !
# interface GigabitEthernet0/0/0/2
# description Configured and Replaced by Ansible
# mtu 2000
# vrf custB
# ipv4 address 178.18.169.23 255.255.255.0
# dot1q native vlan 30
# !
# interface GigabitEthernet0/0/0/3
# description Configured and Replaced by Ansible Network
# vrf custB
# ipv4 address 10.10.0.2 255.255.255.0
# duplex half
# shutdown
# dot1q native vlan 1021
# !
# Using overridden
# Before state:
# ------------
#
# viosxr#show running-config interface
# interface GigabitEthernet0/0/0/1
# shutdown
# !
# interface GigabitEthernet0/0/0/2
# description Configured by Ansible
# vrf custB
# ipv4 address 178.18.169.23 255.255.255.0
# dot1q native vlan 30
# !
# interface GigabitEthernet0/0/0/3
# description Configured by Ansible
# mtu 2600
# vrf custB
# ipv4 address 10.10.0.2 255.255.255.0
# duplex full
# shutdown
# dot1q native vlan 1021
# !
- name: Override interfaces
iosxr_interfaces:
config:
- name: GigabitEthernet0/0/0/2
description: 'Configured by Ansible'
enabled: True
duplex: auto
- name: GigabitEthernet0/0/0/3
description: 'Configured by Ansible Network'
enabled: False
speed: 1000
state: overridden
# After state:
# ------------
#
# viosxr#show running-config interface
# interface GigabitEthernet0/0/0/1
# shutdown
# !
# interface GigabitEthernet0/0/0/2
# description Configured and Overridden by Ansible Network
# vrf custB
# ipv4 address 178.18.169.23 255.255.255.0
# speed 1000
# dot1q native vlan 30
# !
# interface GigabitEthernet0/0/0/3
# description Configured and Overridden by Ansible Network
# mtu 2000
# vrf custB
# ipv4 address 10.10.0.2 255.255.255.0
# duplex full
# shutdown
# dot1q native vlan 1021
# !
# Using deleted
# Before state:
# ------------
#
# viosxr#show running-config interface
# interface GigabitEthernet0/0/0/1
# shutdown
# !
# interface GigabitEthernet0/0/0/2
# description Configured and Overridden by Ansible Network
# vrf custB
# ipv4 address 178.18.169.23 255.255.255.0
# speed 1000
# dot1q native vlan 30
# !
# interface GigabitEthernet0/0/0/3
# description Configured and Overridden by Ansible Network
# mtu 2000
# vrf custB
# ipv4 address 10.10.0.2 255.255.255.0
# duplex full
# shutdown
# dot1q native vlan 1021
# !
- name: Delete IOSXR interfaces as in given arguments
iosxr_interfaces:
config:
- name: GigabitEthernet0/0/0/2
- name: GigabitEthernet0/0/0/3
state: deleted
# After state:
# ------------
#
# viosxr#show running-config interface
# interface GigabitEthernet0/0/0/1
# shutdown
# !
# interface GigabitEthernet0/0/0/2
# vrf custB
# ipv4 address 178.18.169.23 255.255.255.0
# dot1q native vlan 30
# !
# interface GigabitEthernet0/0/0/3
# vrf custB
# ipv4 address 10.10.0.2 255.255.255.0
# dot1q native vlan 1021
# !
Return Values¶
Common return values are documented here, the following are the fields unique to this module:
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¶
Sumit Jaiswal (@justjais)
Hint
If you notice any issues in this documentation, you can edit this document to improve it.