cisco.nxos.nxos_evpn_vnis module – EVPN VNIs resource module.
Note
This module is part of the cisco.nxos collection (version 14.0.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.nxos.
To use it in a playbook, specify: cisco.nxos.nxos_evpn_vnis.
New in cisco.nxos 13.1.0
Synopsis
This module manages the Layer 2 VNIs configured under the
evpnsection (vni <id> l2) on Cisco NX-OS devices, with their route distinguisher and route targets.It is the resource module counterpart of cisco.nxos.nxos_evpn_vni, which manages a single VNI per task.
Note
This module has a corresponding action plugin.
Aliases: evpn_vnis
Parameters
Parameter |
Comments |
|---|---|
A list of EVPN VNI configurations. |
|
Route distinguisher of the VNI, either |
|
Route targets to both import and export, Merged into route_target_import and route_target_export. |
|
Route targets to export, |
|
Route targets to import, |
|
The Layer 2 VNI identifier. Valid range is 1-16777214. |
|
This option is used only with state parsed. The value of this option should be the output received from the NX-OS device by executing the command show running-config | section ^evpn. The state parsed reads the configuration from |
|
The state the configuration should be left in. With deleted, the VNIs listed in config are removed, or all VNIs when config is not given. With overridden, VNIs that are not listed in config are removed. Choices:
|
Notes
Note
Tested against NX-OS 10.6(4) on N9K-C93180YC-FX.
Unsupported for Cisco MDS.
nv overlay evpnmust be enabled for theevpnsection to be available.route_target_bothis an input convenience. It is expanded into route_target_import and route_target_export before comparing with the device and is never returned bygatheredorparsed. If the device displaysroute-target both, it is parsed as an import and an export.Under merged, route targets are only added and the route distinguisher is only replaced, nothing is removed.
Under replaced and overridden, route targets and the route distinguisher of a listed VNI that are not in config are removed.
Layer 3 VNIs (
vni <id> l3undervrf context) are not managed by this module.This module works with connection
network_cliandhttpapi. See https://docs.ansible.com/ansible/latest/network/user_guide/platform_nxos.htmlThe parsed state reads configuration from
running_configand does not connect to the device.For information on using CLI and NX-API see the NXOS Platform Options guide https://docs.ansible.com/ansible/latest/network/user_guide/platform_nxos.html.
For more information on using Ansible to manage network devices see the Ansible Network Guide https://docs.ansible.com/ansible/latest/network/getting_started/index.html.
For more information on using Ansible to manage Cisco devices see the Cisco integration page https://www.ansible.com/integrations/networks/cisco.
Examples
# Using merged
# Before state:
# -------------
# nxos# show running-config | section ^evpn
# evpn
# vni 10100 l2
# rd auto
- name: Merge the provided configuration with the existing running configuration
cisco.nxos.nxos_evpn_vnis:
config:
- vni: 10100
route_target_both:
- auto
- vni: 10200
route_distinguisher: 65000:10200
route_target_import:
- 65000:10200
route_target_export:
- 65000:10200
state: merged
# Task output:
# ------------
# commands:
# - evpn
# - vni 10100 l2
# - route-target import auto
# - route-target export auto
# - vni 10200 l2
# - rd 65000:10200
# - route-target import 65000:10200
# - route-target export 65000:10200
# After state:
# ------------
# nxos# show running-config | section ^evpn
# evpn
# vni 10100 l2
# rd auto
# route-target import auto
# route-target export auto
# vni 10200 l2
# rd 65000:10200
# route-target import 65000:10200
# route-target export 65000:10200
# Using replaced
# Before state:
# -------------
# evpn
# vni 10100 l2
# rd auto
# route-target import auto
# route-target export auto
# vni 10200 l2
# rd 65000:10200
- name: Replace the configuration of the listed VNIs only
cisco.nxos.nxos_evpn_vnis:
config:
- vni: 10100
route_distinguisher: auto
route_target_import:
- 65000:10100
state: replaced
# Task output:
# ------------
# commands:
# - evpn
# - vni 10100 l2
# - no route-target import auto
# - no route-target export auto
# - route-target import 65000:10100
# Using overridden
# Before state:
# -------------
# evpn
# vni 10100 l2
# rd auto
# vni 10200 l2
# rd 65000:10200
- name: Override all VNIs with the provided configuration
cisco.nxos.nxos_evpn_vnis:
config:
- vni: 10100
route_distinguisher: auto
state: overridden
# Task output:
# ------------
# commands:
# - evpn
# - no vni 10200 l2
# Using deleted
# Before state:
# -------------
# evpn
# vni 10100 l2
# rd auto
# vni 10200 l2
# rd 65000:10200
- name: Delete the listed VNIs (omit config to delete all of them)
cisco.nxos.nxos_evpn_vnis:
config:
- vni: 10100
state: deleted
# Task output:
# ------------
# commands:
# - evpn
# - no vni 10100 l2
# Using rendered
- name: Render platform specific configuration lines (without connecting to the device)
cisco.nxos.nxos_evpn_vnis:
config:
- vni: 10100
route_distinguisher: auto
route_target_both:
- auto
state: rendered
# Task Output (redacted)
# -----------------------
# rendered:
# - evpn
# - vni 10100 l2
# - rd auto
# - route-target import auto
# - route-target export auto
# Using parsed
# parsed.cfg
# ------------
# evpn
# vni 10100 l2
# rd auto
# route-target import auto
# route-target export auto
- name: Parse the provided configuration
cisco.nxos.nxos_evpn_vnis:
running_config: "{{ lookup('file', 'parsed.cfg') }}"
state: parsed
# Task output (redacted)
# -----------------------
# parsed:
# - vni: 10100
# route_distinguisher: auto
# route_target_import:
# - auto
# route_target_export:
# - auto
# Using gathered
- name: Gather the VNI configuration from the device
cisco.nxos.nxos_evpn_vnis:
state: gathered
# Task output (redacted)
# -----------------------
# gathered:
# - vni: 10100
# route_distinguisher: auto
# route_target_import:
# - auto
# route_target_export:
# - auto
Return Values
Common return values are documented here, the following are the fields unique to this module:
Key |
Description |
|---|---|
The resulting configuration after module execution. Returned: when changed Sample: |
|
The configuration prior to the module execution. Returned: when state is Sample: |
|
The set of commands pushed to the remote device. Returned: when state is Sample: |
|
Facts about the network resource gathered from the remote device as structured data. Returned: when state is Sample: |
|
The device native config provided in running_config option, parsed into structured data. Returned: when state is Sample: |
|
The provided configuration rendered in device-native format (offline). Returned: when state is Sample: |