cisco.iosxr.iosxr_vrf_interfaces module – Resource module to configure VRF interfaces.
Note
This module is part of the cisco.iosxr collection (version 10.3.0).
You might already have this collection installed if you are using the ansible
package.
It is not included in ansible-core
.
To check whether it is installed, run ansible-galaxy collection list
.
To install it, use: ansible-galaxy collection install cisco.iosxr
.
To use it in a playbook, specify: cisco.iosxr.iosxr_vrf_interfaces
.
New in cisco.iosxr 10.3.0
Synopsis
This module configures and manages the VRF configuration in interface on IOS XR platforms.
Aliases: vrf_interfaces
Parameters
Parameter |
Comments |
---|---|
A list of VRF interfaces options. |
|
Full name of the interface excluding any logical unit number, i.e. GigabitEthernet0/0/0/1. |
|
Vrf that is to be added to the interface. |
|
This option is used only with state parsed. The value of this option should be the output received from the IOS device by executing the command sh running-config interface. The state parsed reads the configuration from |
|
The state the configuration should be left in The states rendered, gathered and parsed does not perform any change on the device. The state rendered will transform the configuration in The state gathered will fetch the running configuration from device and transform it into structured data in the format as per the resource module argspec and the value is returned in the gathered key within the result. The state parsed reads the configuration from Choices:
|
Notes
Note
Tested against Cisco IOS-XR 7.2.2.
This module works with connection
network_cli
.
Examples
# Using merged
# Before state:
# -------------
#
# viosxr#show running-config interfaces
# interface MgmtEth0/RP0/CPU0/0
# ipv4 address dhcp
# !
# interface GigabitEthernet0/0/0/0
# description this is interface0
# cdp
# !
# interface GigabitEthernet0/0/0/1
# shutdown
# !
# interface GigabitEthernet0/0/0/2
# shutdown
# !
- name: Simple merge selective
cisco.iosxr.iosxr_vrf_interfaces:
state: merged
config:
- name: MgmtEth0/RP0/CPU0/0
- name: GigabitEthernet0/0/0/0
- name: GigabitEthernet0/0/0/1
vrf_name: vrf_C
- name: GigabitEthernet0/0/0/2
vrf_name: vrf_D
# Task Output
# -----------
#
# before:
# - name: MgmtEth0/RP0/CPU0/0
# - name: GigabitEthernet0/0/0/0
# - name: GigabitEthernet0/0/0/1
# - name: GigabitEthernet0/0/0/2
# commands:
# - interface GigabitEthernet0/0/0/1
# - vrf vrf_C
# - interface GigabitEthernet0/0/0/2
# - vrf vrf_D
# after:
# - name: MgmtEth0/RP0/CPU0/0
# - name: GigabitEthernet0/0/0/0
# - name: GigabitEthernet0/0/0/1
# vrf_name: vrf_C
# - name: GigabitEthernet0/0/0/2
# vrf_name: vrf_D
# After state:
# -------------
#
# viosxr#show running-config interfaces
# interface MgmtEth0/RP0/CPU0/0
# ipv4 address dhcp
# !
# interface GigabitEthernet0/0/0/0
# description this is interface0
# cdp
# !
# interface GigabitEthernet0/0/0/1
# vrf vrf_C
# shutdown
# !
# interface GigabitEthernet0/0/0/2
# vrf vrf_D
# shutdown
# !
# Using replaced
# Before state:
# -------------
#
# viosxr#show running-config interfaces
# interface MgmtEth0/RP0/CPU0/0
# ipv4 address dhcp
# !
# interface GigabitEthernet0/0/0/0
# description this is interface0
# cdp
# !
# interface GigabitEthernet0/0/0/1
# vrf vrf_C
# shutdown
# !
# interface GigabitEthernet0/0/0/2
# vrf vrf_D
# shutdown
# !
- name: Simple replaced selective
cisco.iosxr.iosxr_vrf_interfaces:
state: replaced
config:
- name: MgmtEth0/RP0/CPU0/0
- name: GigabitEthernet0/0/0/0
- name: GigabitEthernet0/0/0/1
vrf_name: vrf_E
- name: GigabitEthernet0/0/0/2
vrf_name: vrf_D
# Task Output
# -----------
#
# before:
# - name: MgmtEth0/RP0/CPU0/0
# - name: GigabitEthernet0/0/0/0
# - name: GigabitEthernet0/0/0/1
# vrf_name: vrf_C
# - name: GigabitEthernet0/0/0/2
# vrf_name: vrf_D
# commands:
# - interface GigabitEthernet0/0/0/1
# - vrf vrf_E
# after:
# - name: MgmtEth0/RP0/CPU0/0
# - name: GigabitEthernet0/0/0/0
# - name: GigabitEthernet0/0/0/1
# vrf_name: vrf_E
# - name: GigabitEthernet0/0/0/2
# vrf_name: vrf_D
# After state:
# -------------
#
# viosxr#show running-config interfaces
# interface MgmtEth0/RP0/CPU0/0
# ipv4 address dhcp
# !
# interface GigabitEthernet0/0/0/0
# description this is interface0
# cdp
# !
# interface GigabitEthernet0/0/0/1
# vrf vrf_E
# shutdown
# !
# interface GigabitEthernet0/0/0/2
# vrf vrf_D
# shutdown
# !
# Using overridden
# Before state:
# -------------
#
# viosxr#show running-config interfaces
# interface MgmtEth0/RP0/CPU0/0
# ipv4 address dhcp
# !
# interface GigabitEthernet0/0/0/0
# description this is interface0
# cdp
# !
# interface GigabitEthernet0/0/0/1
# vrf vrf_C
# shutdown
# !
# interface GigabitEthernet0/0/0/2
# vrf vrf_D
# shutdown
# !
- name: Simple overridden selective
cisco.iosxr.iosxr_vrf_interfaces:
state: overridden
config:
- name: MgmtEth0/RP0/CPU0/0
- name: GigabitEthernet0/0/0/0
- name: GigabitEthernet0/0/0/1
vrf_name: vrf_E
# Task Output
# -----------
#
# before:
# - name: MgmtEth0/RP0/CPU0/0
# - name: GigabitEthernet0/0/0/0
# - name: GigabitEthernet0/0/0/1
# vrf_name: vrf_C
# - name: GigabitEthernet0/0/0/2
# vrf_name: vrf_D
# commands:
# - interface GigabitEthernet0/0/0/1
# - vrf vrf_E
# - interface GigabitEthernet0/0/0/2
# - no vrf vrf_E
# after:
# - name: MgmtEth0/RP0/CPU0/0
# - name: GigabitEthernet0/0/0/0
# - name: GigabitEthernet0/0/0/1
# vrf_name: vrf_E
# - name: GigabitEthernet0/0/0/2
# After state:
# -------------
#
# viosxr#show running-config interfaces
# interface MgmtEth0/RP0/CPU0/0
# ipv4 address dhcp
# !
# interface GigabitEthernet0/0/0/0
# description this is interface0
# cdp
# !
# interface GigabitEthernet0/0/0/1
# vrf vrf_E
# shutdown
# !
# interface GigabitEthernet0/0/0/2
# shutdown
# !
# Using deleted
# Before state:
# -------------
#
# viosxr#show running-config interfaces
# interface MgmtEth0/RP0/CPU0/0
# ipv4 address dhcp
# !
# interface GigabitEthernet0/0/0/0
# description this is interface0
# cdp
# !
# interface GigabitEthernet0/0/0/1
# vrf vrf_E
# shutdown
# !
# interface GigabitEthernet0/0/0/2
# vrf vrf_D
# shutdown
# !
- name: Simple deleted selective
cisco.iosxr.iosxr_vrf_interfaces:
state: deleted
config:
- name: GigabitEthernet0/0/0/1
vrf_name: vrf_E
# Task Output
# -----------
#
# before:
# - name: MgmtEth0/RP0/CPU0/0
# - name: GigabitEthernet0/0/0/0
# - name: GigabitEthernet0/0/0/1
# vrf_name: vrf_E
# - name: GigabitEthernet0/0/0/2
# vrf_name: vrf_D
# commands:
# - interface GigabitEthernet0/0/0/1
# - no vrf vrf_E
# after:
# - name: MgmtEth0/RP0/CPU0/0
# - name: GigabitEthernet0/0/0/0
# - name: GigabitEthernet0/0/0/1
# - name: GigabitEthernet0/0/0/2
# vrf_name: vrf_D
# After state:
# -------------
#
# viosxr#show running-config interfaces
# interface MgmtEth0/RP0/CPU0/0
# ipv4 address dhcp
# !
# interface GigabitEthernet0/0/0/0
# description this is interface0
# cdp
# !
# interface GigabitEthernet0/0/0/1
# shutdown
# !
# interface GigabitEthernet0/0/0/2
# vrf vrf_D
# shutdown
# !
# Using gathered
# Before state:
# -------------
#
# viosxr#show running-config interfaces
# interface MgmtEth0/RP0/CPU0/0
# ipv4 address dhcp
# !
# interface GigabitEthernet0/0/0/0
# description this is interface0
# cdp
# !
# interface GigabitEthernet0/0/0/1
# vrf vrf_C
# shutdown
# !
# interface GigabitEthernet0/0/0/2
# vrf vrf_D
# shutdown
# !
- name: Simple gathered selective
cisco.iosxr.iosxr_vrf_interfaces:
state: gathered
# Task Output
# -----------
#
# gathered:
# - name: MgmtEth0/RP0/CPU0/0
# - name: GigabitEthernet0/0/0/0
# - name: GigabitEthernet0/0/0/1
# vrf_name: vrf_C
# - name: GigabitEthernet0/0/0/2
# vrf_name: vrf_D
# Using rendered
# Before state:
# -------------
#
# viosxr#show running-config interfaces
# interface MgmtEth0/RP0/CPU0/0
# ipv4 address dhcp
# !
# interface GigabitEthernet0/0/0/0
# description this is interface0
# cdp
# !
# interface GigabitEthernet0/0/0/1
# vrf vrf_C
# shutdown
# !
# interface GigabitEthernet0/0/0/2
# vrf vrf_D
# shutdown
# !
- name: Simple rendered selective
cisco.iosxr.iosxr_vrf_interfaces:
state: rendered
# Task Output
# -----------
#
# commands:
# - interface GigabitEthernet0/0/0/1
# - vrf vrf_C
# - interface GigabitEthernet0/0/0/2
# - vrf vrf_D
Return Values
Common return values are documented here, the following are the fields unique to this module:
Key |
Description |
---|---|
The resulting configuration after module execution. Returned: when changed Sample: |
|
The configuration prior to the module execution. Returned: when state is Sample: |
|
The set of commands pushed to the remote device. Returned: when state is Sample: |
|
Facts about the network resource gathered from the remote device as structured data. Returned: when state is Sample: |
|
The device native config provided in running_config option parsed into structured data as per module argspec. Returned: when state is Sample: |
|
The provided configuration in the task rendered in device-native format (offline). Returned: when state is Sample: |