cisco.nxos.nxos_vrf (7.0.0) — module

Manages global VRF configuration.

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

Authors: Jason Edelman (@jedelman8), Gabriele Gerbino (@GGabriele), Trishna Guha (@trishnaguha)

Install collection

Install with ansible-galaxy collection install cisco.nxos:==7.0.0


Add to requirements.yml

  collections:
    - name: cisco.nxos
      version: 7.0.0

Description

This module provides declarative management of VRFs on CISCO NXOS network devices.

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Ensure ntc VRF exists on switch
  cisco.nxos.nxos_vrf:
    name: ntc
    description: testing
    state: present
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Aggregate definition of VRFs
  cisco.nxos.nxos_vrf:
    aggregate:
      - name: test1
        description: Testing
        admin_state: down
      - name: test2
        interfaces: Ethernet1/2
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Aggregate definitions of VRFs with Purge
  cisco.nxos.nxos_vrf:
    aggregate:
      - name: ntc1
        description: purge test1
      - name: ntc2
        description: purge test2
    state: present
    purge: true
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Delete VRFs exist on switch
  cisco.nxos.nxos_vrf:
    aggregate:
      - name: ntc1
      - name: ntc2
    state: absent
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Assign interfaces to VRF declaratively
  cisco.nxos.nxos_vrf:
    name: test1
    interfaces:
      - Ethernet2/3
      - Ethernet2/5
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Check interfaces assigned to VRF
  cisco.nxos.nxos_vrf:
    name: test1
    associated_interfaces:
      - Ethernet2/3
      - Ethernet2/5
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: >-
    Ensure VRF is tagged with interface Ethernet2/5 only (Removes from
    Ethernet2/3)
  cisco.nxos.nxos_vrf:
    name: test1
    interfaces:
      - Ethernet2/5
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Delete VRF
  cisco.nxos.nxos_vrf:
    name: ntc
    state: absent

Inputs

    
rd:
    description:
    - VPN Route Distinguisher (RD). Valid values are a string in one of the route-distinguisher
      formats (ASN2:NN, ASN4:NN, or IPV4:NN); the keyword 'auto', or the keyword 'default'.
    type: str

vni:
    description:
    - Specify virtual network identifier. Valid values are Integer or keyword 'default'.
    type: str

name:
    aliases:
    - vrf
    description:
    - Name of VRF to be managed.
    type: str

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

purge:
    default: false
    description:
    - Purge VRFs not defined in the I(aggregate) parameter.
    type: bool

state:
    choices:
    - present
    - absent
    default: present
    description:
    - Manages desired state of the resource.
    type: str

aggregate:
    description: List of VRFs definitions.
    elements: dict
    suboptions:
      admin_state:
        choices:
        - up
        - down
        description:
        - Administrative state of the VRF.
        type: str
      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
      delay:
        description:
        - Time in seconds to wait before checking for the operational state on remote
          device. This wait is applicable for operational state arguments.
        type: int
      description:
        description:
        - Description of the VRF or keyword 'default'.
        type: str
      interfaces:
        description:
        - List of interfaces to check the VRF has been configured correctly or keyword
          'default'.
        elements: str
        type: list
      name:
        aliases:
        - vrf
        description:
        - Name of VRF to be managed.
        type: str
      rd:
        description:
        - VPN Route Distinguisher (RD). Valid values are a string in one of the route-distinguisher
          formats (ASN2:NN, ASN4:NN, or IPV4:NN); the keyword 'auto', or the keyword 'default'.
        type: str
      state:
        choices:
        - present
        - absent
        description:
        - Manages desired state of the resource.
        type: str
      vni:
        description:
        - Specify virtual network identifier. Valid values are Integer or keyword 'default'.
        type: str
    type: list

interfaces:
    description:
    - List of interfaces to check the VRF has been configured correctly or keyword 'default'.
    elements: str
    type: list

admin_state:
    choices:
    - up
    - down
    default: up
    description:
    - Administrative state of the VRF.
    type: str

description:
    description:
    - Description of the VRF or keyword 'default'.
    type: str

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: commands sent to the device
  returned: always
  sample:
  - vrf context ntc
  - no shutdown
  - interface Ethernet1/2
  - no switchport
  - vrf member test2
  type: list