cisco.ios.ios_vrf (8.0.0) — module

Module to configure VRF definitions.

| "added in version" 1.0.0 of cisco.ios"

Authors: Peter Sprygada (@privateip)

Install collection

Install with ansible-galaxy collection install cisco.ios:==8.0.0


Add to requirements.yml

  collections:
    - name: cisco.ios
      version: 8.0.0

Description

This module provides declarative management of VRF definitions on Cisco IOS devices. It allows playbooks to manage individual or the entire VRF collection. It also supports purging VRF definitions from the configuration that are not explicitly defined.

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Configure a vrf named management
  cisco.ios.ios_vrf:
    name: management
    description: oob mgmt vrf
    interfaces:
      - Management1
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Remove a vrf named test
  cisco.ios.ios_vrf:
    name: test
    state: absent
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Configure set of VRFs and purge any others
  cisco.ios.ios_vrf:
    vrfs:
      - red
      - blue
      - green
    purge: true
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Creates a list of import RTs for the VRF with the same parameters
  cisco.ios.ios_vrf:
    name: test_import
    rd: 1:100
    route_import:
      - 1:100
      - 3:100
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name:
    Creates a list of import RTs in address-family configuration submode for the
    VRF with the same parameters
  cisco.ios.ios_vrf:
    name: test_import_ipv4
    rd: 1:100
    route_import_ipv4:
      - 1:100
      - 3:100
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name:
    Creates a list of import RTs in address-family configuration submode for the
    VRF with the same parameters
  cisco.ios.ios_vrf:
    name: test_import_ipv6
    rd: 1:100
    route_import_ipv6:
      - 1:100
      - 3:100
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Creates a list of export RTs for the VRF with the same parameters
  cisco.ios.ios_vrf:
    name: test_export
    rd: 1:100
    route_export:
      - 1:100
      - 3:100
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name:
    Creates a list of export RTs in address-family configuration submode for the
    VRF with the same parameters
  cisco.ios.ios_vrf:
    name: test_export_ipv4
    rd: 1:100
    route_export_ipv4:
      - 1:100
      - 3:100
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name:
    Creates a list of export RTs in address-family configuration submode for the
    VRF with the same parameters
  cisco.ios.ios_vrf:
    name: test_export_ipv6
    rd: 1:100
    route_export_ipv6:
      - 1:100
      - 3:100
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name:
    Creates a list of import and export route targets for the VRF with the same
    parameters
  cisco.ios.ios_vrf:
    name: test_both
    rd: 1:100
    route_both:
      - 1:100
      - 3:100
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name:
    Creates a list of import and export route targets in address-family configuration
    submode for the VRF with the same parameters
  cisco.ios.ios_vrf:
    name: test_both_ipv4
    rd: 1:100
    route_both_ipv4:
      - 1:100
      - 3:100
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name:
    Creates a list of import and export route targets in address-family configuration
    submode for the VRF with the same parameters
  cisco.ios.ios_vrf:
    name: test_both_ipv6
    rd: 1:100
    route_both_ipv6:
      - 1:100
      - 3:100

Inputs

    
rd:
    description:
    - The router-distinguisher value uniquely identifies the VRF to routing processes
      on the remote IOS system.  The RD value takes the form of C(A:B) where C(A) and
      C(B) are both numeric values.
    type: str

name:
    description:
    - The name of the VRF definition to be managed on the remote IOS device.  The VRF
      definition name is an ASCII string name used to uniquely identify the VRF.  This
      argument is mutually exclusive with the C(vrfs) argument
    type: str

vrfs:
    description:
    - The set of VRF definition objects to be configured on the remote IOS device.  Ths
      list entries can either be the VRF name or a hash of VRF definitions and attributes.  This
      argument is mutually exclusive with the C(name) argument.
    elements: raw
    type: list

delay:
    default: 10
    description:
    - Time in seconds to wait before checking for the operational state on remote device.
    type: int

purge:
    default: false
    description:
    - Instructs the module to consider the VRF definition absolute.  It will remove any
      previously configured VRFs on the device.
    type: bool

state:
    choices:
    - present
    - absent
    default: present
    description:
    - Configures the state of the VRF definition as it relates to the device operational
      configuration.  When set to I(present), the VRF should be configured in the device
      active configuration and when set to I(absent) the VRF should not be in the device
      active configuration
    type: str

interfaces:
    description:
    - Identifies the set of interfaces that should be configured in the VRF.  Interfaces
      must be routed interfaces in order to be placed into a VRF.
    elements: str
    type: list

route_both:
    description:
    - Adds an export and import list of extended route target communities to the VRF.
    elements: str
    type: list

description:
    description:
    - Provides a short description of the VRF definition in the current active configuration.  The
      VRF definition value accepts alphanumeric characters used to provide additional
      information about the VRF.
    type: str

route_export:
    description:
    - Adds an export list of extended route target communities to the VRF.
    elements: str
    type: list

route_import:
    description:
    - Adds an import list of extended route target communities to the VRF.
    elements: str
    type: list

address_family:
    description:
    - The list of address families with MDT parameters to be configured on the remote
      IOS device.
    elements: dict
    suboptions:
      afi:
        choices:
        - ipv4
        - ipv6
        description: Address family identifier.
        type: str
      mdt:
        description: MDT parameters.
        suboptions:
          auto_discovery:
            description: Auto-discovery parameters.
            suboptions:
              vxlan:
                description: Vxlan parameters.
                suboptions:
                  enable:
                    description: Enable VXLAN.
                    type: bool
                  inter_as:
                    description: Enable inter-as.
                    type: bool
                type: dict
            type: dict
          data:
            description: Parameters for data option.
            suboptions:
              threshold:
                description: Threshold value.
                type: int
              vxlan_mcast_group:
                description: VXLAN multicast group value.
                type: str
            type: dict
          default:
            description: Parameters for default option.
            suboptions:
              vxlan_mcast_group:
                description: VXLAN multicast group value.
                type: str
            type: dict
          overlay:
            description: Parameters for overlay option.
            suboptions:
              use_bgp:
                description: parameters for BGP option.
                suboptions:
                  enable:
                    description: Enable use BGP.
                    type: bool
                  spt_only:
                    description: Enable SPT only.
                    type: bool
                type: dict
            type: dict
        type: dict
    type: list

route_both_ipv4:
    description:
    - Adds an export and import list of extended route target communities in address-family
      configuration submode to the VRF.
    elements: str
    type: list

route_both_ipv6:
    description:
    - Adds an export and import list of extended route target communities in address-family
      configuration submode to the VRF.
    elements: str
    type: list

route_export_ipv4:
    description:
    - Adds an export list of extended route target communities in address-family configuration
      submode to the VRF.
    elements: str
    type: list

route_export_ipv6:
    description:
    - Adds an export list of extended route target communities in address-family configuration
      submode to the VRF.
    elements: str
    type: list

route_import_ipv4:
    description:
    - Adds an import list of extended route target communities in address-family configuration
      submode to the VRF.
    elements: str
    type: list

route_import_ipv6:
    description:
    - Adds an import list of extended route target communities in address-family configuration
      submode to the VRF.
    elements: str
    type: list

associated_interfaces:
    description:
    - This is a intent option and checks the operational state of the for given vrf C(name)
      for associated interfaces. If the value in the C(associated_interfaces) does not
      match with the operational state of vrf interfaces on device it will result in failure.
    elements: str
    type: list

Outputs

commands:
  description: The list of configuration mode commands to send to the device
  returned: always
  sample:
  - vrf definition ansible
  - description management vrf
  - rd: 1:100
  type: list
delta:
  description: The time elapsed to perform all operations
  returned: always
  sample: '0:00:10.469466'
  type: str
end:
  description: The time the job ended
  returned: always
  sample: '2016-11-16 10:38:25.595612'
  type: str
start:
  description: The time the job started
  returned: always
  sample: '2016-11-16 10:38:15.126146'
  type: str