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

config

list / elements=dictionary

A list of device configurations for VRF.

address_families

list / elements=dictionary

Enable address family and enter its config mode - AFI/SAFI configuration

afi

string

Address Family Identifier (AFI)

Choices:

  • "ipv4"

  • "ipv6"

bgp

dictionary

Commands pertaining to BGP configuration.

next_hop

dictionary

Next-hop for the routes of a VRF in the backbone.

loopback

integer

Loopback interface for next-hop

export

dictionary

VRF export

ipv4

dictionary

Address family based VRF export

multicast

dictionary

Export prefixes to IPv4 Multicast table

map

string

Route-map name

prefix

integer

Upper limit on export prefixes without hogging memory

unicast

dictionary

Export prefixes to IPv4 Unicast table

allow_evpn

boolean

Allow EVPN routes into global table

Choices:

  • false

  • true

map

string

Route-map name

prefix

integer

Upper limit on export prefixes without hogging memory

map

string

Route-map name

import_config

dictionary

VRF import

ipv4

dictionary

Address family based VRF import

multicast

dictionary

Import prefixes from IPv4 Multicast table

map

string

Route-map name

prefix

integer

Upper limit on import prefixes without hogging memory

unicast

dictionary

Import prefixes from IPv4 Unicast table

allow_evpn

boolean

allow Global->VRF routes into EVPN

Choices:

  • false

  • true

limit

integer

Upper limit on import prefixes without hogging memory

map

string

Route-map based VRF import

map

string

Route-map name

inter_as_hybrid

dictionary

Inter AS hybrid mode

csc

dictionary

Carrier Supporting Carrier

next_hop

string

Next-hop for the routes of a VRF in the backbone.

next_hop

string

Next-hop for the routes of a VRF in the backbone.

mdt

dictionary

Backbone Multicast Distribution Tree

auto_discovery

dictionary

BGP auto-discovery for MVPN

ingress_replication

dictionary

BGP auto-discovery for Ingress-Replication

inter_as

dictionary

Enable Inter-AS BGP auto-discovery

mdt_hello_enable

boolean

Enable PIM Hellos over MDT interface

Choices:

  • false

  • true

mdt_hello_enable

boolean

Enable PIM Hellos over MDT interface

Choices:

  • false

  • true

pim

dictionary

BGP auto-discovery for PIM

inter_as

dictionary

Enable Inter-AS BGP auto-discovery

mdt_hello_enable

boolean

Enable PIM Hellos over MDT interface

Choices:

  • false

  • true

pim_tlv_announce

dictionary

Announce PIM TLV for data MDT

mdt_hello_enable

boolean

Enable PIM Hellos over MDT interface

Choices:

  • false

  • true

mdt_hello_enable

boolean

Enable PIM Hellos over MDT interface

Choices:

  • false

  • true

pim_tlv_announce

dictionary

Announce PIM TLV for data MDT

mdt_hello_enable

boolean

Enable PIM Hellos over MDT interface

Choices:

  • false

  • true

receiver_site

boolean

BGP receiver only site for MVPN

Choices:

  • false

  • true

data

dictionary

MDT data trees

ingress_replication

dictionary

Use Ingress-Replication to create the data MDT

immediate_switch

boolean

Switch immediately to Data MDT tree

Choices:

  • false

  • true

list

dictionary

Access-list

access_list_name

string

IP Named Extended Access list

access_list_number

integer

Access-list number

number

integer

Number of data MDT

list

dictionary

Access-list

access_list_name

string

IP Named Extended Access list

access_list_number

integer

Access-list number

threshold

integer

MDT switching threshold

default

dictionary

Default MDT configuration

ingress_replication

boolean

Use Ingress-Replication for the default MDT

Choices:

  • false

  • true

direct

boolean

Direct MDT’s

Choices:

  • false

  • true

log_reuse

boolean

Event logging for data MDT reuse

Choices:

  • false

  • true

mode

dictionary

The type of encapsulation

gre

boolean

GRE encapsulation

Choices:

  • false

  • true

mtu

integer

The MTU

overlay

dictionary

MDT overlay Protocol

bgp

dictionary

BGP Overlay signalling

shared_tree_prune_delay

integer

Delay before shared tree is pruned at C-RP PE

source_tree_prune_delay

integer

Delay before source tree is pruned at C-S PE

use_bgp

dictionary

Use BGP for MDT overlay signaling

spt_only

boolean

Enable SPT-only ASM mode

Choices:

  • false

  • true

partitioned

dictionary

Partitioned Multicast Distribution Tree

ingress_replication

boolean

Use Ingress-Replication for the partitioned MDT

Choices:

  • false

  • true

strict_rpf

dictionary

Enable strict RPF check

interface

boolean

Interface based strict RPF check

Choices:

  • false

  • true

protection

dictionary

Configure local repair

local_prefixes

boolean

Enable protection for local prefixes

Choices:

  • false

  • true

route_replicate

dictionary

Replicate (import) routes from another topology (and another VRF)

from_config

dictionary

Replicate routes from another VRF

multicast

dictionary

Multicast SAFI

all

dictionary

All routes

route_map

string

Route-map reference

bgp

dictionary

Border Gateway Protocol (BGP)

as_number

integer

Autonomous System Number

route_map

string

Route-map reference

eigrp

dictionary

Enhanced Interior Gateway Routing Protocol (EIGRP)

as_number

integer

Autonomous System Number

route_map

string

Route-map reference

isis

dictionary

Intermediate System-to-Intermediate System (ISIS)

iso_tag

string

ISO routing area tag

route_map

string

Route-map reference

mobile

dictionary

Mobile routes

route_map

string

Route-map reference

odr

dictionary

On-Demand Stub routes

route_map

string

Route-map reference

ospf

dictionary

Open Shortest Path First (OSPF)

process_id

integer

OSPF process ID

route_map

string

Route-map reference

rip

dictionary

Routing Information Protocol (RIP)

route_map

string

Route-map reference

static

dictionary

Static routes

route_map

string

Route-map reference

topology

dictionary

Topology name

base

dictionary

Base topology

all

dictionary

All routes

route_map

string

Route-map reference

bgp

dictionary

Border Gateway Protocol (BGP)

as_number

integer

Autonomous System Number

route_map

string

Route-map reference

eigrp

dictionary

Enhanced Interior Gateway Routing Protocol (EIGRP)

as_number

integer

Autonomous System Number

route_map

string

Route-map reference

isis

dictionary

Intermediate System-to-Intermediate System (ISIS)

iso_tag

string

ISO routing area tag

route_map

string

Route-map reference

mobile

dictionary

Mobile routes

route_map

string

Route-map reference

odr

dictionary

On-Demand Stub routes

route_map

string

Route-map reference

ospf

dictionary

Open Shortest Path First (OSPF)

process_id

integer

OSPF process ID

route_map

string

Route-map reference

rip

dictionary

Routing Information Protocol (RIP)

route_map

string

Route-map reference

static

dictionary

Static routes

route_map

string

Route-map reference

unicast

dictionary

Unicast SAFI

all

dictionary

All routes

route_map

string

Route-map reference

bgp

dictionary

Border Gateway Protocol (BGP)

as_number

integer

Autonomous System Number

route_map

string

Route-map reference

connected

dictionary

Connected routes

route_map

string

Route-map reference

eigrp

dictionary

Enhanced Interior Gateway Routing Protocol (EIGRP)

as_number

integer

Autonomous System Number

route_map

string

Route-map reference

isis

dictionary

Intermediate System-to-Intermediate System (ISIS)

iso_tag

string

ISO routing area tag

route_map

string

Route-map reference

mobile

dictionary

Mobile routes

route_map

string

Route-map reference

odr

dictionary

On-Demand Stub routes

route_map

string

Route-map reference

ospf

dictionary

Open Shortest Path First (OSPF)

process_id

integer

OSPF process ID

route_map

string

Route-map reference

rip

dictionary

Routing Information Protocol (RIP)

route_map

string

Route-map reference

static

dictionary

Static routes

route_map

string

Route-map reference

vrf

dictionary

Specify a source VRF

global

dictionary

global VRF

multicast

dictionary

Multicast SAFI

all

dictionary

All routes

route_map

string

Route-map reference

bgp

dictionary

Border Gateway Protocol (BGP)

as_number

integer

Autonomous System Number

route_map

string

Route-map reference

eigrp

dictionary

Enhanced Interior Gateway Routing Protocol (EIGRP)

as_number

integer

Autonomous System Number

route_map

string

Route-map reference

isis

dictionary

Intermediate System-to-Intermediate System (ISIS)

iso_tag

string

ISO routing area tag

route_map

string

Route-map reference

mobile

dictionary

Mobile routes

route_map

string

Route-map reference

odr

dictionary

On-Demand Stub routes

route_map

string

Route-map reference

ospf

dictionary

Open Shortest Path First (OSPF)

process_id

integer

OSPF process ID

route_map

string

Route-map reference

rip

dictionary

Routing Information Protocol (RIP)

route_map

string

Route-map reference

static

dictionary

Static routes

route_map

string

Route-map reference

topology

dictionary

Topology name

base

dictionary

Base topology

all

dictionary

All routes

route_map

string

Route-map reference

bgp

dictionary

Border Gateway Protocol (BGP)

as_number

integer

Autonomous System Number

route_map

string

Route-map reference

eigrp

dictionary

Enhanced Interior Gateway Routing Protocol (EIGRP)

as_number

integer

Autonomous System Number

route_map

string

Route-map reference

isis

dictionary

Intermediate System-to-Intermediate System (ISIS)

iso_tag

string

ISO routing area tag

route_map

string

Route-map reference

mobile

dictionary

Mobile routes

route_map

string

Route-map reference

odr

dictionary

On-Demand Stub routes

route_map

string

Route-map reference

ospf

dictionary

Open Shortest Path First (OSPF)

process_id

integer

OSPF process ID

route_map

string

Route-map reference

rip

dictionary

Routing Information Protocol (RIP)

route_map

string

Route-map reference

static

dictionary

Static routes

route_map

string

Route-map reference

unicast

dictionary

Unicast SAFI

all

dictionary

All routes

route_map

string

Route-map reference

bgp

dictionary

Border Gateway Protocol (BGP)

as_number

integer

Autonomous System Number

route_map

string

Route-map reference

connected

dictionary

Connected routes

route_map

string

Route-map reference

eigrp

dictionary

Enhanced Interior Gateway Routing Protocol (EIGRP)

as_number

integer

Autonomous System Number

route_map

string

Route-map reference

isis

dictionary

Intermediate System-to-Intermediate System (ISIS)

iso_tag

string

ISO routing area tag

route_map

string

Route-map reference

mobile

dictionary

Mobile routes

route_map

string

Route-map reference

odr

dictionary

On-Demand Stub routes

route_map

string

Route-map reference

ospf

dictionary

Open Shortest Path First (OSPF)

process_id

integer

OSPF process ID

route_map

string

Route-map reference

rip

dictionary

Routing Information Protocol (RIP)

route_map

string

Route-map reference

static

dictionary

Static routes

route_map

string

Route-map reference

multicast

dictionary

Multicast SAFI

all

dictionary

All routes

route_map

string

Route-map reference

bgp

dictionary

Border Gateway Protocol (BGP)

as_number

integer

Autonomous System Number

route_map

string

Route-map reference

eigrp

dictionary

Enhanced Interior Gateway Routing Protocol (EIGRP)

as_number

integer

Autonomous System Number

route_map

string

Route-map reference

isis

dictionary

Intermediate System-to-Intermediate System (ISIS)

iso_tag

string

ISO routing area tag

route_map

string

Route-map reference

mobile

dictionary

Mobile routes

route_map

string

Route-map reference

odr

dictionary

On-Demand Stub routes

route_map

string

Route-map reference

ospf

dictionary

Open Shortest Path First (OSPF)

process_id

integer

OSPF process ID

route_map

string

Route-map reference

rip

dictionary

Routing Information Protocol (RIP)

route_map

string

Route-map reference

static

dictionary

Static routes

route_map

string

Route-map reference

topology

dictionary

Topology name

base

dictionary

Base topology

all

dictionary

All routes

route_map

string

Route-map reference

bgp

dictionary

Border Gateway Protocol (BGP)

as_number

integer

Autonomous System Number

route_map

string

Route-map reference

eigrp

dictionary

Enhanced Interior Gateway Routing Protocol (EIGRP)

as_number

integer

Autonomous System Number

route_map

string

Route-map reference

isis

dictionary

Intermediate System-to-Intermediate System (ISIS)

iso_tag

string

ISO routing area tag

route_map

string

Route-map reference

mobile

dictionary

Mobile routes

route_map

string

Route-map reference

odr

dictionary

On-Demand Stub routes

route_map

string

Route-map reference

ospf

dictionary

Open Shortest Path First (OSPF)

process_id

integer

OSPF process ID

route_map

string

Route-map reference

rip

dictionary

Routing Information Protocol (RIP)

route_map

string

Route-map reference

static

dictionary

Static routes

route_map

string

Route-map reference

name

string

Source VRF name

unicast

dictionary

Unicast SAFI

all

dictionary

All routes

route_map

string

Route-map reference

bgp

dictionary

Border Gateway Protocol (BGP)

as_number

integer

Autonomous System Number

route_map

string

Route-map reference

connected

dictionary

Connected routes

route_map

string

Route-map reference

eigrp

dictionary

Enhanced Interior Gateway Routing Protocol (EIGRP)

as_number

integer

Autonomous System Number

route_map

string

Route-map reference

isis

dictionary

Intermediate System-to-Intermediate System (ISIS)

iso_tag

string

ISO routing area tag

route_map

string

Route-map reference

mobile

dictionary

Mobile routes

route_map

string

Route-map reference

odr

dictionary

On-Demand Stub routes

route_map

string

Route-map reference

ospf

dictionary

Open Shortest Path First (OSPF)

process_id

integer

OSPF process ID

route_map

string

Route-map reference

rip

dictionary

Routing Information Protocol (RIP)

route_map

string

Route-map reference

static

dictionary

Static routes

route_map

string

Route-map reference

recursion_policy

dictionary

Route replication recursion policy

destination

boolean

Recurse in destination topology

Choices:

  • false

  • true

route_target

dictionary

Specify Target VPN Extended Communities.

both

string

Both export and import Target-VPN community

export

string

Export Target-VPN community.

import_config

string

Export Target-VPN community.

safi

string

Address Family modifier

Choices:

  • "multicast"

  • "unicast"

name

string / required

Name of 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 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

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.

Choices:

  • "parsed"

  • "gathered"

  • "deleted"

  • "merged" ← (default)

  • "replaced"

  • "rendered"

  • "overridden"

Notes

Note

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

after

list / elements=string

The resulting configuration after module execution.

Returned: when changed

Sample: ["This output will always be in the same format as the module argspec.\n"]

before

list / elements=string

The configuration prior to the module execution.

Returned: when state is merged, replaced, overridden, deleted or purged

Sample: ["This output will always be in the same format as the module argspec.\n"]

commands

list / elements=string

The set of commands pushed to the remote device.

Returned: when state is merged, replaced, overridden, deleted

Sample: ["vrf definition test1", "address-family ipv4 unicast", "bgp next-hop loopback 40", "export map \"testing-map\"", "export ipv4 multicast 345 map \"testmap\""]

gathered

list / elements=string

Facts about the network resource gathered from the remote device as structured data.

Returned: when state is gathered

Sample: ["This output will always be in the same format as the module argspec.\n"]

parsed

list / elements=string

The device native config provided in running_config option parsed into structured data as per module argspec.

Returned: when state is parsed

Sample: ["This output will always be in the same format as the module argspec.\n"]

rendered

list / elements=string

The provided configuration in the task rendered in device-native format (offline).

Returned: when state is rendered

Sample: ["vrf definition test1", "address-family ipv4 unicast", "bgp next-hop loopback 40", "import map \"testing-map\"", "export ipv4 multicast 345 map \"testmap\""]

Authors

  • Ruchi Pakhle (@Ruchip16)