arista.eos.eos_vrf_global module – Resource module to configure VRF definitions.

Note

This module is part of the arista.eos collection (version 10.1.1).

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 arista.eos.

To use it in a playbook, specify: arista.eos.eos_vrf_global.

New in arista.eos 10.0.0

Synopsis

  • This module provides declarative management of VRF definitions on Arista EOS platforms.

Parameters

Parameter

Comments

config

list / elements=dictionary

A list of dictionaries containing device configurations for VRF definitions.

description

string

A description for the VRF.

name

string / required

Name of the VRF Instance.

rd

string

BGP Route Distinguisher (RD).

running_config

string

This option is used only with state parsed.

The value of this option should be the output received from the EOS 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"

  • "purged"

Notes

Note

  • Tested against Arista EOS 4.23.0F

  • This module works with connection network_cli. See the EOS Platform Options.

Examples

# Using merged
#
# Before state:
# -------------
#
# test#show running-config | section ^vrf

- name: Merge provided configuration with device configuration
  arista.eos.eos_vrf_global:
    config:
      - name: VRF4
        description: VRF4 Description
        rd: "3:4"
    state: merged

# Task Output:
# ------------
#
# before: []
#
# commands:
# - vrf instance VRF4
# - description VRF4 Description
# - rd 3:4
#
# after:
# - name: VRF4
#   description: VRF4 Description
#   rd: "3:4"
#
# After state:
# ------------
#
# test#show running-config | section ^vrf
# vrf instance VRF4
#  description "VRF4 Description"
#  rd "3:4"

# Using replaced
#
# Before state:
# -------------
#
# test#show running-config | section ^vrf
# vrf instance VRF4
#  description "VRF4 Description"
#  rd "3:4"

- name: Replace the provided configuration with the existing running configuration
  arista.eos.eos_vrf_global:
    config:
      - name: VRF7
        description: VRF7 description
        rd: "67:9"
    state: replaced

# Task Output:
# ------------
#
# before:
# - name: VRF4
#   description: VRF4 Description
#   rd: "3:4"
#
# commands:
# - vrf instance VRF7
# - description VRF7 description
# - rd 6:9
#
# after:
#   - name: VRF4
#     description: VRF4 Description
#     rd: "3:4"
#   - name: VRF7
#     description: VRF7 description
#     rd: "6:9"
#
# After state:
# ------------
#
# test#show running-config | section ^vrf
# vrf instance VRF4
#  description VRF4 Description
#  rd 3:4
# !
# vrf instance VRF7
#  description VRF7 description
#  rd 6:9
#  !
# !

# Using overridden
#
# Before state:
# -------------
#
# test#show running-config | section ^vrf
# vrf instance VRF4
#  description VRF4 Description
#  rd 3:4
# !
# vrf instance VRF7
#  description VRF7 description
#  rd 6:9
#  !
# !

- name: Override the provided configuration with the existing running configuration
  arista.eos.eos_vrf_global:
    state: overridden
    config:
      - name: VRF6
        description: VRF6 Description
        rd: "9:8"

# Task Output:
# ------------
#
# before:
# - name: VRF4
#   description: VRF4 Description
#   rd: "3:4"
# - name: VRF7
#   description: VRF7 description
#   rd: "6:9"
#
# commands:
# - vrf instance VRF4
# - no description VRF4 Description
# - no rd 3:4
# - vrf instance VRF7
# - no description VRF7 description
# - no rd 67:9
# - vrf instance VRF6
# - description VRF6 Description
# - rd 9:8
#
# after:
# - name: VRF4
# - name: VRF6
#   description: VRF6 Description
#   rd: "9:8"
# - name: VRF7
#
# After state:
# -------------
# test#show running-config | section ^vrf
# vrf instance VRF4
# vrf instance VRF6
#  description VRF6 Description
#  rd 9:8
# vrf instance VRF7

# Using deleted
#
# Before state:
# -------------
#
# test#show running-config | section ^vrf
# vrf instance VRF4
# vrf instance VRF6
#  description VRF6 Description
#  rd 9:8
# vrf instance VRF7

- name: Delete the provided configuration
  arista.eos.eos_vrf_global:
    config:
    state: deleted

# Task Output:
# ------------
#
# before:
# - name: VRF4
# - name: VRF6
#   description: VRF6 Description
#   rd: "9:8"
# - name: VRF7

# commands:
# - vrf instance VRF4
# - vrf instance VRF6
# - no description VRF6 Description
# - no rd 9:8
# - vrf instance VRF7
#
# after:
# - name: VRF4
# - name: VRF6
# - name: VRF7
#
# After state:
# ------------
#
# test#show running-config | section ^vrf
# vrf instance VRF4
# vrf instance VRF6
# vrf instance VRF7

# Using purged
#
# Before state:
# -------------
#
# test#show running-config | section ^vrf
# vrf instance VRF4
# vrf instance VRF6
# vrf instance VRF7

- name: Purge all the configuration from the device
  arista.eos.eos_vrf_global:
    state: purged

# Task Output:
# ------------
#
# before:
# - name: VRF4
# - name: VRF6
# - name: VRF7
#
# commands:
# - no vrf instance VRF4
# - no vrf instance VRF6
# - no vrf instance VRF7
#
# after: []
#
# After state:
# -------------
# test#show running-config | section ^vrf
# -

# Using rendered
#
- name: Render provided configuration with device configuration
  arista.eos.eos_vrf_global:
    config:
      - name: VRF4
        description: VRF4 Description
        rd: "3:4"
    state: rendered

# Task Output:
# ------------
#
# rendered:
# - vrf instance VRF4
# - description VRF4 Description
# - rd 3:4

# Using gathered
#
# Before state:
# -------------
#
# test#show running-config | section ^vrf
# vrf instance VRF4
#  description "VRF4 Description"
#  rd "3:4"

- name: Gather existing running configuration
  arista.eos.eos_vrf_global:
    state: gathered

# Task Output:
# ------------
#
# gathered:
# - name: VRF4
#   description: VRF4 Description
#   rd: "3:4"

# Using parsed
#
# File: parsed.cfg
# ----------------
#
# vrf instance test
#  description "This is test VRF"
#  rd "testing"
#  !
# !
# vrf my_vrf
#  description "this is sample vrf for feature testing"
#  rd "2:3"
#  !
# !

- name: Parse the provided configuration
  arista.eos.eos_vrf_global:
    running_config: "{{ lookup('file', 'parsed.cfg') }}"
    state: parsed

# Task Output:
# ------------
#
# parsed:
# - description: This is test VRF
#   name: test
#   rd: testing
# - description: this is sample vrf for feature testing
#   name: my_vrf
#   rd: '2:3'

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: ["The configuration returned will always be in the same format of the parameters above.\n"]

before

list / elements=string

The configuration prior to the module execution.

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

Sample: ["The configuration returned will always be in the same format of the parameters above.\n"]

commands

list / elements=string

The set of commands pushed to the remote device.

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

Sample: ["vrf instance test", "description \"This is test VRF\"", "rd 3:4"]

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 instance test", "description \"This is test VRF\"", "rd 3:4"]

Authors

  • Ruchi Pakhle (@Ruchip16)