ansible.builtin.ios_vrf (v2.9.24) — module

Manage the collection of VRF definitions on Cisco IOS devices

| "added in version" 2.3 of ansible.builtin"

Authors: Peter Sprygada (@privateip)

preview | supported by network

Install Ansible via pip

Install with pip install ansible==2.9.24

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
  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
  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
  ios_vrf:
    vrfs:
      - red
      - blue
      - green
    purge: yes
  • 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
  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
  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
  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
  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
  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
  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
  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
  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
  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.

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

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.

delay:
    default: 10
    description:
    - Time in seconds to wait before checking for the operational state on remote device.
    version_added: '2.4'
    version_added_collection: ansible.builtin

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

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.

route_both:
    description:
    - Adds an export and import list of extended route target communities to the VRF.
    version_added: '2.5'
    version_added_collection: ansible.builtin

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.

route_export:
    description:
    - Adds an export list of extended route target communities to the VRF.
    version_added: '2.5'
    version_added_collection: ansible.builtin

route_import:
    description:
    - Adds an import list of extended route target communities to the VRF.
    version_added: '2.5'
    version_added_collection: ansible.builtin

route_both_ipv4:
    description:
    - Adds an export and import list of extended route target communities in address-family
      configuration submode to the VRF.
    version_added: '2.7'
    version_added_collection: ansible.builtin

route_both_ipv6:
    description:
    - Adds an export and import list of extended route target communities in address-family
      configuration submode to the VRF.
    version_added: '2.7'
    version_added_collection: ansible.builtin

route_export_ipv4:
    description:
    - Adds an export list of extended route target communities in address-family configuration
      submode to the VRF.
    version_added: '2.7'
    version_added_collection: ansible.builtin

route_export_ipv6:
    description:
    - Adds an export list of extended route target communities in address-family configuration
      submode to the VRF.
    version_added: '2.7'
    version_added_collection: ansible.builtin

route_import_ipv4:
    description:
    - Adds an import list of extended route target communities in address-family configuration
      submode to the VRF.
    version_added: '2.7'
    version_added_collection: ansible.builtin

route_import_ipv6:
    description:
    - Adds an import list of extended route target communities in address-family configuration
      submode to the VRF.
    version_added: '2.7'
    version_added_collection: ansible.builtin

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.
    version_added: '2.5'
    version_added_collection: ansible.builtin

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