.. _cisco.iosxr.iosxr_vrf_global_module: **************************** cisco.iosxr.iosxr_vrf_global **************************** **Manages global VRF configuration.** Version added: 9.0.0 .. contents:: :local: :depth: 1 Synopsis -------- - This module manages VRF configurations on Cisco IOS-XR devices. - It enables playbooks to handle either individual VRFs or the complete VRF collection. - It also permits removing non-explicitly stated VRF definitions from the setup. Parameters ---------- .. raw:: html
Parameter Choices/Defaults Comments
config
list / elements=dictionary
A dictionary of options for VRF configurations.
description
string
A description for the VRF.
evpn_route_sync
integer
EVPN Instance VPN ID used to synchronize the VRF route(s).
fallback_vrf
string
Fallback VRF name
mhost
dictionary
Multicast host stack options
afi
string
    Choices:
  • ipv4
  • ipv6
Address Family Identifier (AFI)
default_interface
string
Default interface for multicast.
name
string / required
Name of the VRF.
rd
string
VPN Route Distinguisher (RD).
remote_route_filtering
dictionary
Enable/Disable remote route filtering per VRF
disable
boolean
    Choices:
  • no
  • yes
Disable remote route filtering per VRF
vpn
dictionary
VPN ID for the VRF
id
string
VPN ID for the VRF.
running_config
string
This option is used only with state parsed.
The value of this option should be the output received from the IOS-XR device by executing the command show running-config vrf.
The state parsed reads the configuration from running_config option and transforms it into Ansible structured data as per the resource module's argspec and the value is then returned in the parsed key within the result.
state
string
    Choices:
  • parsed
  • gathered
  • deleted
  • merged ←
  • replaced
  • rendered
  • overridden
  • purged
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 config option to platform specific CLI commands which will be returned in the rendered key within the result. For state rendered active connection to remote host is not required.
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 running_config option and transforms it into JSON format as per the resource module parameters and the value is returned in the parsed key within the result. The value of running_config option should be the same format as the output of command show running-config vrf. connection to remote host is not required.
The state purged removes all the VRF configurations from the target device. Use caution with this state.
The state deleted only removes the VRF attributes that this module manages and does not negate the VRF completely. Thereby, preserving address-family related configurations under VRF context.
Refer to examples for more details.

Notes ----- .. note:: - Tested against Cisco IOS-XR Version 9.0.0 - This module works with connection ``network_cli``. - See `the IOS_XR Platform Options `_. - The module examples uses callback plugin (stdout_callback = yaml) to generate task output in yaml format. Examples -------- .. code-block:: yaml # Using merged # # Before state: # ------------- # # RP/0/0/CPU0:iosxr-02#show running-config vrf # Fri Feb 9 07:02:35.789 UTC # ! # vrf test # - name: Merge provided configuration with device configuration cisco.iosxr.iosxr_vrf_global: config: - name: VRF4 description: VRF4 Description evpn_route_sync: 793 fallback_vrf: "test-vrf" remote_route_filtering: disable: "true" rd: "3:4" mhost: afi: "ipv4" default_interface: "Loopback0" vpn: id: "2:3" state: merged # Task Output: # ------------ # # before: [] # # commands: # - vrf VRF4 # - description VRF4 Description # - evpn-route-sync 793 # - fallback-vrf test-vrf # - mhost ipv4 default-interface Loopback0 # - rd 3:4 # - remote-route-filtering disable # - vpn id 2:3 # # after: # - name: VRF4 # description: VRF4 Description # evpn_route_sync: 793 # fallback_vrf: "test-vrf" # mhost: # afi: "ipv4" # default_interface: "Loopback0" # rd: "3:4" # remote_route_filtering: # disable: "true" # vpn: # id: "2:3" # # After state: # ------------ # # RP/0/0/CPU0:iosxr-02#show running-config vrf # Sat Feb 20 03:49:43.618 UTC # vrf VRF4 # description "VRF4 Description" # mhost ipv4 default-interface Loopback0 # evpn-route-sync 793 # vpn id 2:3 # fallback-vrf "test-vrf" # remote-route-filtering disable # rd "3:4" # Using replaced # # Before state: # ------------- # # RP/0/0/CPU0:iosxr-02#show running-config vrf # Sat Feb 20 03:49:43.618 UTC # vrf VRF4 # description "VRF4 Description" # mhost ipv4 default-interface Loopback0 # evpn-route-sync 793 # vpn id 2:3 # fallback-vrf "test-vrf" # remote-route-filtering disable # rd "3:4" - name: Replace the provided configuration with the existing running configuration cisco.iosxr.iosxr_vrf_global: config: - name: VRF7 description: VRF7 description evpn_route_sync: 398 fallback_vrf: "replaced-vrf" remote_route_filtering: disable: "true" rd: "67:9" mhost: afi: "ipv4" default_interface: "Loopback0" vpn: id: "4:5" state: replaced # Task Output: # ------------ # # before: # - name: VRF4 # description: VRF4 Description # evpn_route_sync: 793 # fallback_vrf: "test-vrf" # mhost: # afi: "ipv4" # default_interface: "Loopback0" # rd: "3:4" # remote_route_filtering: # disable: "true" # vpn: # id: "2:3" # # commands: # - vrf VRF4 # - no vpn id 2:3 # - vrf VRF7 # - description VRF7 description # - evpn-route-sync 398 # - fallback-vrf replaced-vrf # - mhost ipv4 default-interface Loopback0 # - rd 6:9 # - remote-route-filtering disable # - vpn id 4:5 # # after: # - name: VRF4 # description: VRF4 Description # evpn_route_sync: 793 # fallback_vrf: "test-vrf" # mhost: # afi: "ipv4" # default_interface: "Loopback0" # rd: "3:4" # remote_route_filtering: # disable: "true" # - name: VRF7 # description: VRF7 description # evpn_route_sync: 398 # fallback_vrf: "replaced-vrf" # remote_route_filtering: # disable: true # rd: "67:9" # mhost: # afi: "ipv4" # default_interface: "Loopback0" # vpn: # id: "4:5" # # After state: # ------------ # # RP/0/RP0/CPU0:ios(config)#show running-config vrf # Sun Mar 10 16:48:53.204 UTC # vrf VRF4 # mhost ipv4 default-interface Loopback0 # evpn-route-sync 793 # description VRF4 Description # fallback-vrf test-vrf # remote-route-filtering disable # rd 3:4 # ! # vrf VRF7 # mhost ipv4 default-interface Loopback0 # evpn-route-sync 398 # description VRF7 description # vpn id 4:5 # fallback-vrf replaced-vrf # remote-route-filtering disable # rd 67:9 # ! # ! # Using overridden # # Before state: # ------------- # # RP/0/RP0/CPU0:ios(config)#show running-config vrf # Sun Mar 10 16:48:53.204 UTC # vrf VRF4 # mhost ipv4 default-interface Loopback0 # evpn-route-sync 793 # description VRF4 Description # fallback-vrf test-vrf # remote-route-filtering disable # rd 3:4 # ! # ! # vrf VRF7 # mhost ipv4 default-interface Loopback0 # evpn-route-sync 398 # description VRF7 description # vpn id 4:5 # fallback-vrf replaced-vrf # remote-route-filtering disable # rd 67:9 # ! # ! - name: Override the provided configuration with the existing running configuration cisco.iosxr.iosxr_vrf_global: state: overridden config: - name: VRF6 description: VRF6 Description evpn_route_sync: 101 fallback_vrf: "overridden-vrf" remote_route_filtering: disable: "true" rd: "9:8" mhost: afi: "ipv4" default_interface: "Loopback0" vpn: id: "23:3" # Task Output: # ------------ # # before: # - name: VRF4 # description: VRF4 Description # evpn_route_sync: 793 # fallback_vrf: "test-vrf" # mhost: # afi: "ipv4" # default_interface: "Loopback0" # rd: "3:4" # remote_route_filtering: # disable: "true" # - name: VRF7 # description: VRF7 description # evpn_route_sync: 398 # fallback_vrf: "replaced-vrf" # remote_route_filtering: # disable: true # rd: "67:9" # mhost: # afi: "ipv4" # default_interface: "Loopback0" # vpn: # id: "4:5" # # commands: # - vrf VRF4 # - no description VRF4 Description # - no evpn-route-sync 793 # - no fallback-vrf test-vrf # - no mhost ipv4 default-interface Loopback0 # - no rd 3:4 # - no remote-route-filtering disable # - vrf VRF7 # - no description VRF7 description # - no evpn-route-sync 398 # - no fallback-vrf replaced-vrf # - no mhost ipv4 default-interface Loopback0 # - no rd 67:9 # - no remote-route-filtering disable # - no vpn id 4:5 # - vrf VRF6 # - description VRF6 Description # - evpn-route-sync 101 # - fallback-vrf overridden-vrf # - mhost ipv4 default-interface Loopback0 # - rd 9:8 # - remote-route-filtering disable # - vpn id 23:3 # # after: # - name: VRF4 # - name: VRF6 # description: VRF6 Description # evpn_route_sync: 101 # fallback_vrf: "overridden-vrf" # remote_route_filtering: # disable: "true" # rd: "9:8" # mhost: # afi: "ipv4" # default_interface: "Loopback0" # vpn: # id: "23:3" # - name: VRF7 # # After state: # ------------- # RP/0/RP0/CPU0:ios(config)#show running-config vrf # Sun Mar 10 16:54:53.007 UTC # vrf VRF4 # vrf VRF6 # mhost ipv4 default-interface Loopback0 # evpn-route-sync 101 # description VRF6 Description # vpn id 23:3 # fallback-vrf overridden-vrf # remote-route-filtering disable # rd 9:8 # vrf VRF7 # Using deleted # # Before state: # ------------- # # RP/0/RP0/CPU0:ios(config)#show running-config vrf # Sun Mar 10 16:54:53.007 UTC # vrf VRF4 # vrf VRF6 # mhost ipv4 default-interface Loopback0 # evpn-route-sync 101 # description VRF6 Description # vpn id 23:3 # fallback-vrf overridden-vrf # remote-route-filtering disable # rd 9:8 # vrf VRF7 - name: Delete the provided configuration cisco.iosxr.iosxr_vrf_global: config: state: deleted # Task Output: # ------------ # # before: # - name: VRF4 # - name: VRF6 # description: VRF6 Description # evpn_route_sync: 101 # fallback_vrf: "overridden-vrf" # remote_route_filtering: # disable: "true" # rd: "9:8" # mhost: # afi: "ipv4" # default_interface: "Loopback0" # vpn: # id: "23:3" # - name: VRF7 # commands: # - vrf VRF4 # - vrf VRF6 # - no description VRF6 Description # - no evpn-route-sync 101 # - no fallback-vrf overridden-vrf # - no mhost ipv4 default-interface Loopback0 # - no rd 9:8 # - no remote-route-filtering disable # - no vpn id 23:3 # - vrf VRF7 # # after: # - name: VRF4 # - name: VRF6 # - name: VRF7 # # After state: # ------------ # # RP/0/RP0/CPU0:ios(config)#show running-config vrf # Sun Mar 10 17:02:38.981 UTC # vrf VRF4 # vrf VRF6 # vrf VRF7 # Using purged # # Before state: # ------------- # # RP/0/RP0/CPU0:ios(config)#show running-config vrf # vrf VRF4 # vrf VRF6 # vrf VRF7 - name: Purge all the configuration from the device cisco.iosxr.iosxr_vrf_global: state: purged # Task Output: # ------------ # # before: # - name: VRF4 # - name: VRF6 # - name: VRF7 # # commands: # - no vrf VRF4 # - no vrf VRF6 # - no vrf VRF7 # # after: [] # # After state: # ------------- # RP/0/RP0/CPU0:ios(config)#show running-config vrf # Sun Mar 10 17:02:38.981 UTC # - # Using rendered # - name: Render provided configuration with device configuration cisco.iosxr.iosxr_vrf_global: config: - name: VRF4 description: VRF4 Description evpn_route_sync: 793 fallback_vrf: "test-vrf" remote_route_filtering: disable: "true" rd: "3:4" mhost: afi: "ipv4" default_interface: "Loopback0" vpn: id: "2:3" state: rendered # Task Output: # ------------ # # rendered: # - vrf VRF4 # - description VRF4 Description # - evpn-route-sync 793 # - fallback-vrf test-vrf # - mhost ipv4 default-interface Loopback0 # - rd 3:4 # - remote-route-filtering disable # - vpn id 2:3 # Using gathered # # Before state: # ------------- # # RP/0/RP0/CPU0:ios(config)#show running-config vrf # Sun Mar 10 17:02:38.981 UTC # vrf VRF4 # description "VRF4 Description" # mhost ipv4 default-interface Loopback0 # evpn-route-sync 793 # vpn id 2:3 # fallback-vrf "test-vrf" # remote-route-filtering disable # rd "3:4" - name: Gather existing running configuration cisco.iosxr.iosxr_vrf_global: state: gathered # Task Output: # ------------ # # gathered: # - name: VRF4 # description: VRF4 Description # evpn_route_sync: 793 # fallback_vrf: "test-vrf" # mhost: # afi: "ipv4" # default_interface: "Loopback0" # rd: "3:4" # remote_route_filtering: # disable: "true" # vpn: # id: "2:3" # Using parsed # # File: parsed.cfg # ---------------- # # vrf test # description "This is test VRF" # mhost ipv4 default-interface Loopback0 # evpn-route-sync 456 # vpn id 56 # fallback-vrf "test-vrf" # remote-route-filtering disable # rd "testing" # ! # ! # vrf my_vrf # mhost ipv4 default-interface Loopback0 # evpn-route-sync 235 # description "this is sample vrf for feature testing" # fallback-vrf "parsed-vrf" # rd "2:3" # remote-route-filtering disable # vpn id 23 # ! # ! - name: Parse the provided configuration cisco.iosxr.iosxr_vrf_global: running_config: "{{ lookup('file', 'parsed.cfg') }}" state: parsed # Task Output: # ------------ # # parsed: # - description: This is test VRF # evpn_route_sync: 456 # fallback_vrf: test-vrf # mhost: # afi: ipv4 # default_interface: Loopback0 # name: test # rd: testing # remote_route_filtering: # disable: true # vpn: # id: '56' # - description: this is sample vrf for feature testing # evpn_route_sync: 235 # fallback_vrf: parsed-vrf # mhost: # afi: ipv4 # default_interface: Loopback0 # name: my_vrf # rd: '2:3' # remote_route_filtering: # disable: true # vpn: # id: '23' Return Values ------------- Common return values are documented `here `_, the following are the fields unique to this module: .. raw:: html
Key Returned Description
after
dictionary
when changed
The resulting configuration model invocation.

Sample:
The configuration returned will always be in the same format of the parameters above.
before
dictionary
always
The configuration prior to the model invocation.

Sample:
The configuration returned will always be in the same format of the parameters above.
commands
list
always
The set of commands pushed to the remote device.

Sample:
['vrf VRF7', 'description VRF7 description', {'rd': 4029}, 'fallback-vrf replaced-vrf']
gathered
list
when state is gathered
Facts about the network resource gathered from the remote device as structured data.

Sample:
This output will always be in the same format as the module argspec.
parsed
list
when state is parsed
The device native config provided in running_config option parsed into structured data as per module argspec.

Sample:
This output will always be in the same format as the module argspec.
rendered
list
when state is rendered
The provided configuration in the task rendered in device-native format (offline).

Sample:
['vrf VRF4', 'description VRF4 Description', 'evpn-route-sync 793', 'fallback-vrf parsed-vrf']


Status ------ Authors ~~~~~~~ - Ruchi Pakhle (@Ruchip16)