cisco.ios.ios_vrf_address_family module – Resource module to configure VRF definitions.
Note
This module is part of the cisco.ios collection (version 9.1.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.ios
.
To use it in a playbook, specify: cisco.ios.ios_vrf_address_family
.
New in cisco.ios 7.0.0
Synopsis
This module provides declarative management of VRF definitions on Cisco IOS.
Parameters
Parameter |
Comments |
---|---|
A list of device configurations for VRF. |
|
Enable address family and enter its config mode - AFI/SAFI configuration |
|
Address Family Identifier (AFI) Choices:
|
|
Commands pertaining to BGP configuration. |
|
Next-hop for the routes of a VRF in the backbone. |
|
Loopback interface for next-hop |
|
VRF export |
|
Address family based VRF export |
|
Export prefixes to IPv4 Multicast table |
|
Route-map name |
|
Upper limit on export prefixes without hogging memory |
|
Export prefixes to IPv4 Unicast table |
|
Allow EVPN routes into global table Choices:
|
|
Route-map name |
|
Upper limit on export prefixes without hogging memory |
|
Route-map name |
|
VRF import |
|
Address family based VRF import |
|
Import prefixes from IPv4 Multicast table |
|
Route-map name |
|
Upper limit on import prefixes without hogging memory |
|
Import prefixes from IPv4 Unicast table |
|
allow Global->VRF routes into EVPN Choices:
|
|
Upper limit on import prefixes without hogging memory |
|
Route-map based VRF import |
|
Route-map name |
|
Inter AS hybrid mode |
|
Carrier Supporting Carrier |
|
Next-hop for the routes of a VRF in the backbone. |
|
Next-hop for the routes of a VRF in the backbone. |
|
Backbone Multicast Distribution Tree |
|
BGP auto-discovery for MVPN |
|
BGP auto-discovery for Ingress-Replication |
|
Enable Inter-AS BGP auto-discovery |
|
Enable PIM Hellos over MDT interface Choices:
|
|
Enable PIM Hellos over MDT interface Choices:
|
|
BGP auto-discovery for PIM |
|
Enable Inter-AS BGP auto-discovery |
|
Enable PIM Hellos over MDT interface Choices:
|
|
Announce PIM TLV for data MDT |
|
Enable PIM Hellos over MDT interface Choices:
|
|
Enable PIM Hellos over MDT interface Choices:
|
|
Announce PIM TLV for data MDT |
|
Enable PIM Hellos over MDT interface Choices:
|
|
BGP receiver only site for MVPN Choices:
|
|
MDT data trees |
|
Use Ingress-Replication to create the data MDT |
|
Switch immediately to Data MDT tree Choices:
|
|
Access-list |
|
IP Named Extended Access list |
|
Access-list number |
|
Number of data MDT |
|
Access-list |
|
IP Named Extended Access list |
|
Access-list number |
|
MDT switching threshold |
|
Default MDT configuration |
|
Use Ingress-Replication for the default MDT Choices:
|
|
Direct MDT’s Choices:
|
|
Event logging for data MDT reuse Choices:
|
|
The type of encapsulation |
|
GRE encapsulation Choices:
|
|
The MTU |
|
MDT overlay Protocol |
|
BGP Overlay signalling |
|
Delay before shared tree is pruned at C-RP PE |
|
Delay before source tree is pruned at C-S PE |
|
Use BGP for MDT overlay signaling |
|
Enable SPT-only ASM mode Choices:
|
|
Partitioned Multicast Distribution Tree |
|
Use Ingress-Replication for the partitioned MDT Choices:
|
|
Enable strict RPF check |
|
Interface based strict RPF check Choices:
|
|
Configure local repair |
|
Enable protection for local prefixes Choices:
|
|
Replicate (import) routes from another topology (and another VRF) |
|
Replicate routes from another VRF |
|
Multicast SAFI |
|
All routes |
|
Route-map reference |
|
Border Gateway Protocol (BGP) |
|
Autonomous System Number |
|
Route-map reference |
|
Enhanced Interior Gateway Routing Protocol (EIGRP) |
|
Autonomous System Number |
|
Route-map reference |
|
Intermediate System-to-Intermediate System (ISIS) |
|
ISO routing area tag |
|
Route-map reference |
|
Mobile routes |
|
Route-map reference |
|
On-Demand Stub routes |
|
Route-map reference |
|
Open Shortest Path First (OSPF) |
|
OSPF process ID |
|
Route-map reference |
|
Routing Information Protocol (RIP) |
|
Route-map reference |
|
Static routes |
|
Route-map reference |
|
Topology name |
|
Base topology |
|
All routes |
|
Route-map reference |
|
Border Gateway Protocol (BGP) |
|
Autonomous System Number |
|
Route-map reference |
|
Enhanced Interior Gateway Routing Protocol (EIGRP) |
|
Autonomous System Number |
|
Route-map reference |
|
Intermediate System-to-Intermediate System (ISIS) |
|
ISO routing area tag |
|
Route-map reference |
|
Mobile routes |
|
Route-map reference |
|
On-Demand Stub routes |
|
Route-map reference |
|
Open Shortest Path First (OSPF) |
|
OSPF process ID |
|
Route-map reference |
|
Routing Information Protocol (RIP) |
|
Route-map reference |
|
Static routes |
|
Route-map reference |
|
Unicast SAFI |
|
All routes |
|
Route-map reference |
|
Border Gateway Protocol (BGP) |
|
Autonomous System Number |
|
Route-map reference |
|
Connected routes |
|
Route-map reference |
|
Enhanced Interior Gateway Routing Protocol (EIGRP) |
|
Autonomous System Number |
|
Route-map reference |
|
Intermediate System-to-Intermediate System (ISIS) |
|
ISO routing area tag |
|
Route-map reference |
|
Mobile routes |
|
Route-map reference |
|
On-Demand Stub routes |
|
Route-map reference |
|
Open Shortest Path First (OSPF) |
|
OSPF process ID |
|
Route-map reference |
|
Routing Information Protocol (RIP) |
|
Route-map reference |
|
Static routes |
|
Route-map reference |
|
Specify a source VRF |
|
global VRF |
|
Multicast SAFI |
|
All routes |
|
Route-map reference |
|
Border Gateway Protocol (BGP) |
|
Autonomous System Number |
|
Route-map reference |
|
Enhanced Interior Gateway Routing Protocol (EIGRP) |
|
Autonomous System Number |
|
Route-map reference |
|
Intermediate System-to-Intermediate System (ISIS) |
|
ISO routing area tag |
|
Route-map reference |
|
Mobile routes |
|
Route-map reference |
|
On-Demand Stub routes |
|
Route-map reference |
|
Open Shortest Path First (OSPF) |
|
OSPF process ID |
|
Route-map reference |
|
Routing Information Protocol (RIP) |
|
Route-map reference |
|
Static routes |
|
Route-map reference |
|
Topology name |
|
Base topology |
|
All routes |
|
Route-map reference |
|
Border Gateway Protocol (BGP) |
|
Autonomous System Number |
|
Route-map reference |
|
Enhanced Interior Gateway Routing Protocol (EIGRP) |
|
Autonomous System Number |
|
Route-map reference |
|
Intermediate System-to-Intermediate System (ISIS) |
|
ISO routing area tag |
|
Route-map reference |
|
Mobile routes |
|
Route-map reference |
|
On-Demand Stub routes |
|
Route-map reference |
|
Open Shortest Path First (OSPF) |
|
OSPF process ID |
|
Route-map reference |
|
Routing Information Protocol (RIP) |
|
Route-map reference |
|
Static routes |
|
Route-map reference |
|
Unicast SAFI |
|
All routes |
|
Route-map reference |
|
Border Gateway Protocol (BGP) |
|
Autonomous System Number |
|
Route-map reference |
|
Connected routes |
|
Route-map reference |
|
Enhanced Interior Gateway Routing Protocol (EIGRP) |
|
Autonomous System Number |
|
Route-map reference |
|
Intermediate System-to-Intermediate System (ISIS) |
|
ISO routing area tag |
|
Route-map reference |
|
Mobile routes |
|
Route-map reference |
|
On-Demand Stub routes |
|
Route-map reference |
|
Open Shortest Path First (OSPF) |
|
OSPF process ID |
|
Route-map reference |
|
Routing Information Protocol (RIP) |
|
Route-map reference |
|
Static routes |
|
Route-map reference |
|
Multicast SAFI |
|
All routes |
|
Route-map reference |
|
Border Gateway Protocol (BGP) |
|
Autonomous System Number |
|
Route-map reference |
|
Enhanced Interior Gateway Routing Protocol (EIGRP) |
|
Autonomous System Number |
|
Route-map reference |
|
Intermediate System-to-Intermediate System (ISIS) |
|
ISO routing area tag |
|
Route-map reference |
|
Mobile routes |
|
Route-map reference |
|
On-Demand Stub routes |
|
Route-map reference |
|
Open Shortest Path First (OSPF) |
|
OSPF process ID |
|
Route-map reference |
|
Routing Information Protocol (RIP) |
|
Route-map reference |
|
Static routes |
|
Route-map reference |
|
Topology name |
|
Base topology |
|
All routes |
|
Route-map reference |
|
Border Gateway Protocol (BGP) |
|
Autonomous System Number |
|
Route-map reference |
|
Enhanced Interior Gateway Routing Protocol (EIGRP) |
|
Autonomous System Number |
|
Route-map reference |
|
Intermediate System-to-Intermediate System (ISIS) |
|
ISO routing area tag |
|
Route-map reference |
|
Mobile routes |
|
Route-map reference |
|
On-Demand Stub routes |
|
Route-map reference |
|
Open Shortest Path First (OSPF) |
|
OSPF process ID |
|
Route-map reference |
|
Routing Information Protocol (RIP) |
|
Route-map reference |
|
Static routes |
|
Route-map reference |
|
Source VRF name |
|
Unicast SAFI |
|
All routes |
|
Route-map reference |
|
Border Gateway Protocol (BGP) |
|
Autonomous System Number |
|
Route-map reference |
|
Connected routes |
|
Route-map reference |
|
Enhanced Interior Gateway Routing Protocol (EIGRP) |
|
Autonomous System Number |
|
Route-map reference |
|
Intermediate System-to-Intermediate System (ISIS) |
|
ISO routing area tag |
|
Route-map reference |
|
Mobile routes |
|
Route-map reference |
|
On-Demand Stub routes |
|
Route-map reference |
|
Open Shortest Path First (OSPF) |
|
OSPF process ID |
|
Route-map reference |
|
Routing Information Protocol (RIP) |
|
Route-map reference |
|
Static routes |
|
Route-map reference |
|
Route replication recursion policy |
|
Recurse in destination topology Choices:
|
|
Specify Target VPN Extended Communities. |
|
Both export and import Target-VPN community |
|
Export Target-VPN community. |
|
Export Target-VPN community. |
|
Address Family modifier Choices:
|
|
Name of the VRF. |
|
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 show running-config vrf. 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 IOSXE version 17.3 on CML.
This module works with connection
network_cli
. See https://docs.ansible.com/ansible/latest/network/user_guide/platform_ios.html
Examples
# Using merged
#
# Before state:
# -------------
#
# RP/0/0/CPU0:ios#show running-config | section ^vrf
# vrf defnition test
#
- name: Merge provided configuration with device configuration
cisco.ios.ios_vrf_address_family:
config:
- name: test1
address_families:
- afi: "ipv4"
safi: "unicast"
bgp:
next_hop:
loopback: 40
export:
ipv4:
multicast:
map: "single"
prefix: 345
unicast:
allow_evpn: true
map: "test-map"
prefix: 67
map: "testing-map"
import_config:
ipv4:
multicast:
map: "import-map"
prefix: 89
unicast:
allow_evpn: true
limit: 12
map: "ran-map"
map: "import-map"
state: merged
# Task Output:
# ------------
#
# before: []
#
# commands:
# - vrf definition test1
# - address-family ipv4 unicast
# - bgp next-hop loopback 40
# - export map "testing-map"
# - export ipv4 multicast 345 map "single"
# - export ipv4 unicast 67 map "test-map" allow-evpn
# - import map "import-map"
# - import ipv4 multicast 89 map "import-map"
# - import ipv4 unicast 12 map "ran-map" allow-evpn
#
# after:
# - name: test1
# address_families:
# - afi: "ipv4"
# safi: "unicast"
# bgp:
# next_hop:
# loopback: 40
# export:
# ipv4:
# multicast:
# map: "single"
# prefix: 345
# unicast:
# allow_evpn: true
# map: "test-map"
# prefix: 67
# map: "testing-map"
# import_config:
# ipv4:
# multicast:
# map: "import-map"
# prefix: 89
# unicast:
# allow_evpn: true
# limit: 12
# map: "ran-map"
# map: "import-map"
#
# After state:
# ------------
#
# RP/0/0/CPU0:ios#show running-config | section ^vrf
# vrf definition test1
# address-family ipv4 unicast
# bgp next-hop loopback 40
# export map "testing-map"
# export ipv4 multicast 345 map "single"
# export ipv4 unicast 67 map "test-map" allow-evpn
# import map "import-map"
# import ipv4 multicast 89 map "import-map"
# import ipv4 unicast 12 map "ran-map" allow-evpn
# Using replaced
#
# Before state:
# -------------
#
# RP/0/0/CPU0:ios#show running-config | section ^vrf
# vrf definition test1
# address-family ipv4 unicast
# bgp next-hop loopback 40
# export map "testing-map"
# export ipv4 multicast 345 map "single"
# export ipv4 unicast 67 map "test-map" allow-evpn
# import map "import-map"
# import ipv4 multicast 89 map "import-map"
# import ipv4 unicast 12 map "ran-map" allow-evpn
- name: Replace the provided configuration with the existing running configuration
cisco.ios.ios_vrf_address_family:
config:
- name: test1
address_families:
- afi: "ipv4"
safi: "unicast"
bgp:
next_hop:
loopback: 40
export:
ipv4:
multicast:
map: "single"
prefix: 345
unicast:
allow_evpn: true
map: "test-map"
prefix: 67
map: "testing-map"
import_config:
ipv4:
multicast:
map: "import-map"
prefix: 89
unicast:
allow_evpn: true
limit: 12
map: "ran-map"
map: "import-map"
state: replaced
# Task Output:
# ------------
#
# before:
# - name: test1
# address_families:
# - afi: "ipv4"
# safi: "unicast"
# bgp:
# next_hop:
# loopback: 40
# export:
# ipv4:
# multicast:
# map: "single"
# prefix: 345
# unicast:
# allow_evpn: true
# map: "test-map"
# prefix: 67
# map: "testing-map"
# import_config:
# ipv4:
# multicast:
# map: "import-map"
# prefix: 89
# unicast:
# allow_evpn: true
# limit: 12
# map: "ran-map"
# map: "import-map"
#
# commands:
# - vrf definition test1
# - address-family ipv4 unicast
# - bgp next-hop loopback 40
# - export map "testing-map"
# - export ipv4 multicast 345 map "single"
# - export ipv4 unicast 67 map "test-map" allow-evpn
# - import map "import-map"
# - import ipv4 multicast 89 map "import-map"
# - import ipv4 unicast 12 map "ran-map" allow-evpn
#
# after:
# - name: VRF1
# address_families:
# - afi: "ipv4"
# safi: "unicast"
# bgp:
# next_hop:
# loopback: 23
# export:
# ipv4:
# multicast:
# map: "single"
# prefix: 33
# unicast:
# allow_evpn: true
# map: "test-map1"
# prefix: 7
# map: "testing-map"
# import_config:
# ipv4:
# multicast:
# map: "import-map1"
# prefix: 89
# unicast:
# allow_evpn: true
# limit: 12
# map: "ran-map"
# map: "import-map"
#
# After state:
# ------------
#
# RP/0/RP0/CPU0:ios(config)#show running-config vrf
# vrf definition VRF1
# address-family ipv4 unicast
# bgp next-hop loopback 23
# export map "testing-map"
# export ipv4 multicast 345 map "single"
# export ipv4 unicast 67 map "test-map1" allow-evpn
# import map "import-map"
# import ipv4 multicast 89 map "import-map1"
# import ipv4 unicast 12 map "ran-map" allow-evpn
# Using overridden
#
# Before state:
# -------------
#
# RP/0/RP0/CPU0:ios(config)#show running-config | section ^vrf
# vrf definition test1
# address-family ipv4 unicast
# bgp next-hop loopback 40
# export map "testing-map"
# export ipv4 multicast 345 map "single"
# export ipv4 unicast 67 map "test-map" allow-evpn
# import map "import-map"
# import ipv4 multicast 89 map "import-map"
# import ipv4 unicast 12 map "ran-map" allow-evpn
- name: Override the provided configuration with the existing running configuration
cisco.ios.ios_vrf_address_family:
state: overridden
config:
- name: VRF7
address_families:
- afi: "ipv4"
safi: "unicast"
bgp:
next_hop:
loopback: 89
export:
ipv4:
multicast:
map: "single"
prefix: 345
unicast:
allow_evpn: true
map: "test-map"
prefix: 67
map: "testing-map"
import_config:
ipv4:
multicast:
map: "import-map"
prefix: 89
unicast:
allow_evpn: true
limit: 12
map: "ran-map"
map: "import-map"
# Task Output:
# ------------
#
# before:
# - name: test1
# address_families:
# - afi: "ipv4"
# safi: "unicast"
# bgp:
# next_hop:
# loopback: 40
# export:
# ipv4:
# multicast:
# map: "single"
# prefix: 345
# unicast:
# allow_evpn: true
# map: "test-map"
# prefix: 67
# map: "testing-map"
# import_config:
# ipv4:
# multicast:
# map: "import-map"
# prefix: 89
# unicast:
# allow_evpn: true
# limit: 12
# map: "ran-map"
# map: "import-map"
#
# commands:
# - vrf definition VRF7
# - address-family ipv4 unicast
# - bgp next-hop loopback 89
# - export map "testing-map"
# - export ipv4 multicast 345 map "single"
# - export ipv4 unicast 67 map "test-map" allow-evpn
# - import map "import-map"
# - import ipv4 multicast 89 map "import-map"
# - import ipv4 unicast 12 map "ran-map" allow-evpn
#
# After state:
# -------------
# RP/0/RP0/CPU0:ios(config)#show running-config vrf
# vrf definition VRF4
# vrf definition VRF7
# address-family ipv4 unicast
# bgp next-hop loopback 89
# export map "testing-map"
# export ipv4 multicast 345 map "single"
# export ipv4 unicast 67 map "test-map" allow-evpn
# import map "import-map"
# import ipv4 multicast 89 map "import-map1"
# import ipv4 unicast 12 map "ran-map" allow-evpn
# Using deleted
#
# Before state:
# -------------
#
# RP/0/RP0/CPU0:ios(config)#show running-config | section ^vrf
# vrf definition VRF4
# vrf definition VRF6
# address-family ipv4 unicast
# bgp next-hop loopback 40
# import map "import-map"
# import ipv4 multicast 89 map "import-map"
# import ipv4 unicast 12 map "ran-map" allow-evpn
# export map "testing-map"
# export ipv4 multicast 345 map "single"
# export ipv4 unicast 67 map "test-map" allow-evpn
# vrf definition VRF7
- name: Delete the provided configuration
cisco.ios.ios_vrf_address_family:
config:
state: deleted
# Task Output:
# ------------
#
# before:
# - name: VRF4
# - name: VRF6
# address_families:
# - afi: "ipv4"
# safi: "unicast"
# bgp:
# next_hop:
# loopback: 23
# import_config:
# ipv4:
# multicast:
# map: "import-map"
# prefix: 89
# unicast:
# map: "ran-map"
# limit: 12
# allow_evpn: true
# map: "import-map"
# export:
# ipv4:
# multicast:
# map: "single"
# prefix: 345
# unicast:
# map: "test-map"
# prefix: 67
# allow_evpn: true
# map: "testing-map"
# - name: VRF7
# commands:
# - vrf definition VRF4
# - vrf definition VRF6
# - no address-family ipv4 unicast
# - vrf definition VRF7
#
# after:
# - name: VRF4
# - name: VRF6
# - name: VRF7
#
# After state:
# ------------
#
# RP/0/RP0/CPU0:ios(config)#show running-config | section ^vrf
# vrf definition VRF4
# vrf definition VRF6
# vrf definition VRF7
# Using rendered
#
- name: Render provided configuration with device configuration
cisco.ios.ios_vrf_address_family:
config:
- name: test
address_families:
- afi: "ipv4"
safi: "unicast"
bgp:
next_hop:
loopback: 23
import_config:
ipv4:
multicast:
map: "import-map"
prefix: 89
unicast:
map: "ran-map"
limit: 12
allow_evpn: true
map: "import-map"
export:
ipv4:
multicast:
map: "single"
prefix: 345
unicast:
map: "test-map"
prefix: 67
allow_evpn: true
map: "testing-map"
state: rendered
# Task Output:
# ------------
#
# rendered:
# - vrf definition test
# - address-family ipv4 unicast
# - bgp next-hop loopback 23
# - import map "import-map"
# - import ipv4 multicast 89 map "import-map"
# - import ipv4 unicast 12 map "ran-map" allow-evpn
# - export map "testing-map"
# - export ipv4 multicast 345 map "single"
# - export ipv4 unicast 67 map "test-map" allow-evpn
# Using gathered
#
# Before state:
# -------------
#
# RP/0/RP0/CPU0:ios(config)#show running-config | section ^vrf
# vrf definition test1
# address-family ipv4 unicast
# bgp next-hop loopback 40
# import map "import-map"
# import ipv4 multicast 89 map "import-map"
# import ipv4 unicast 12 map "ran-map" allow-evpn
# export map "testing-map"
# export ipv4 multicast 345 map "single"
# export ipv4 unicast 67 map "test-map" allow-evpn
- name: Gather existing running configuration
cisco.ios.ios_vrf_address_family:
state: gathered
# Task Output:
# ------------
#
# gathered:
# - name: test1
# address_families:
# - afi: "ipv4"
# safi: "unicast"
# bgp:
# next_hop:
# loopback: 40
# export:
# ipv4:
# multicast:
# map: "single"
# prefix: 345
# unicast:
# allow_evpn: true
# map: "test-map"
# prefix: 67
# map: "testing-map"
# import_config:
# ipv4:
# multicast:
# map: "import-map"
# prefix: 89
# unicast:
# allow_evpn: true
# limit: 12
# map: "ran-map"
# map: "import-map"
# Using parsed
#
# File: parsed.cfg
# ----------------
#
# vrf definition test
# address-family ipv4 unicast
# bgp next-hop loopback 23
# import map "import-map"
# import ipv4 multicast 89 map "import-map"
# import ipv4 unicast 12 map "ran-map" allow-evpn
# export map "testing-map"
# export ipv4 multicast 345 map "single"
# export ipv4 unicast 67 map "test-map" allow-evpn
- name: Parse the provided configuration
cisco.ios.ios_vrf_address_family:
running_config: "{{ lookup('file', 'parsed.cfg') }}"
state: parsed
# Task Output:
# ------------
#
# parsed:
# - address_families:
# - afi: ipv4
# bgp:
# next_hop:
# loopback: 40
# export:
# ipv4:
# multicast:
# map: "single"
# prefix: 345
# unicast:
# allow_evpn: true
# map: "test-map"
# prefix: 67
# map: "testing-map"
# import_config:
# ipv4:
# multicast:
# map: "import-map"
# prefix: 89
# unicast:
# allow_evpn: true
# limit: 12
# map: "ran-map"
# safi: unicast
# name: test
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: |