cisco.ios.ios_evpn_global module – Resource module to configure L2VPN EVPN.
Note
This module is part of the cisco.ios collection (version 9.2.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.ios.
To use it in a playbook, specify: cisco.ios.ios_evpn_global.
New in cisco.ios 5.3.0
Synopsis
- This module provides declarative management of L2VPN EVPN on Cisco IOS network devices. 
Aliases: evpn_global
Parameters
| Parameter | Comments | 
|---|---|
| A dictionary of L2VPN Ethernet Virtual Private Network (EVPN) configuration | |
| Default gateway parameters | |
| Advertise Default Gateway MAC/IP routes Choices: 
 | |
| Suppress flooding of broadcast, multicast, and/or unknown unicast packets | |
| Suppress flooding of Address Resolution and Neighbor Discovery Protocol packets | |
| Disable flooding suppression Choices: 
 | |
| IP parameters | |
| IP local learning | |
| Disable IP local learning Choices: 
 | |
| Method for replicating BUM traffic Choices: 
 | |
| Route Target VPN Extended Communities | |
| Automatically set a route-target | |
| Set vni-based route-target Choices: 
 | |
| EVPN router ID | |
| This option is used only with state parsed. The value of this option should be the output received from the IOS device by executing the command sh running-config nve | section ^l2vpn evpn$. The state parsed reads the configuration from  | |
| The state the configuration should be left in Choices: 
 | 
Notes
Note
- Tested against Cisco IOS-XE device with Version 17.13.01 on Cat9k on CML. 
- This module works with connection - network_cli. See https://docs.ansible.com/ansible/latest/network/user_guide/platform_ios.html
Examples
# Using merged
# Before state:
# -------------
#
# Leaf-01#show running-config nve | section ^l2vpn evpn$
# l2vpn evpn
#  replication-type static
#  router-id Loopback1
#  default-gateway advertise
- name: Merge provided configuration with device configuration
  cisco.ios.ios_evpn_global:
    config:
      replication_type: ingress
      route_target:
        auto:
          vni: true
      default_gateway:
        advertise: false
      ip:
        local_learning:
          disable: true
      flooding_suppression:
        address_resolution:
          disable: false
    state: merged
# Task Output
# -----------
#
# before:
# - replication_type: static
#   router_id: Loopback1
#   default_gateway:
#     advertise: true
# commands:
# - l2vpn evpn
#   no default-gateway advertise
#   replication-type ingress
#   route-target auto vni
#   ip local-learning disable
# after:
# - replication_type: ingress
#   router_id: Loopback1
#   route_target:
#     auto:
#       vni: true
#   ip:
#     local_learning:
#       disable: true
# After state:
# ------------
#
# Leaf-01#show running-config nve | section ^l2vpn evpn$
# l2vpn evpn
#  replication-type ingress
#  router-id Loopback1
#  ip local-learning disable
#  route-target auto vni
# Using replaced
# Before state:
# -------------
#
# Leaf-01#show running-config nve | section ^l2vpn evpn$
# l2vpn evpn
#  replication-type ingress
#  router-id Loopback1
#  ip local-learning disable
#  route-target auto vni
- name: Replaces device configuration for EVPN global with provided configuration
  cisco.ios.ios_evpn_global:
    config:
      replication_type: static
      router_id: Loopback2
      default_gateway:
        advertise: true
      flooding_suppression:
        address_resolution:
          disable: true
    state: replaced
# Task Output
# -----------
#
# before:
# - replication_type: ingress
#   router_id: Loopback1
#   route_target:
#     auto:
#       vni: true
#   ip:
#     local_learning:
#       disable: true
# commands:
# - l2vpn evpn
# - default-gateway advertise
# - flooding-suppression address-resolution disable
# - no ip local-learning disable
# - replication-type static
# - no route-target auto vni
# - router-id Loopback2
# after:
# - replication_type: ingress
#   router_id: Loopback2
#   default_gateway:
#     advertise: true
#   flooding_suppression:
#     address_resolution:
#      disable: true
# After state:
# ------------
#
# Leaf-01#show running-config nve | section ^l2vpn evpn$
# l2vpn evpn
#  replication-type static
#  flooding-suppression address-resolution disable
#  router-id Loopback2
#  default-gateway advertise
# Using Deleted
# Before state:
# -------------
#
# Leaf-01#show running-config nve | section ^l2vpn evpn$
# l2vpn evpn
#  replication-type static
#  flooding-suppression address-resolution disable
#  router-id Loopback2
#  default-gateway advertise
- name: Delete EVPN global
  cisco.ios.ios_evpn_global:
    config:
    state: deleted
# before:
# - replication_type: ingress
#   router_id: Loopback2
#   default_gateway:
#     advertise: true
#   flooding_suppression:
#     address_resolution:
#      disable: true
# commands:
# - no l2vpn evpn
# after:
#
# After state:
# -------------
#
# Leaf-01#show running-config nve | section ^l2vpn evpn$
#
# Using gathered
# Before state:
# -------------
#
# Leaf-01#show running-config nve | section ^l2vpn evpn$
# l2vpn evpn
#  replication-type ingress
#  router-id Loopback1
#  ip local-learning disable
#  route-target auto vni
- name: Gather facts of l2vpn evpn
  cisco.ios.ios_evpn_global:
    config:
    state: gathered
# Task Output:
# ------------
#
# gathered:
# - replication_type: ingress
#   route_target:
#     auto:
#       vni: true
#   router_id: Loopback1
#   ip:
#     local_learning:
#       disable: true
# Using rendered
- name: Render the commands for provided configuration
  cisco.ios.ios_evpn_global:
    config:
      replication_type: static
      route_target:
        auto:
          vni: true
    state: rendered
# Task Output:
# ------------
#
# rendered:
# - l2vpn evpn
# - replication-type static
# - route-target auto vni
# Using parsed
# File: parsed.cfg
# ----------------
#
# l2vpn evpn
#  replication-type ingress
#  router-id Loopback1
#  default-gateway advertise
#  route-target auto vni
- name: Parse the provided configuration
  cisco.ios.ios_evpn_global:
    running_config: "{{ lookup('file', 'parsed.cfg') }}"
    state: parsed
# Task Output:
# ------------
#
# parsed:
# - replication_type: ingress
#   route_target:
#     auto:
#       vni: true
#   router_id: Loopback1
#   default_gateway:
#     advertise: true
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 as per module argspec. Returned: when state is  Sample:  | |
| The provided configuration in the task rendered in device-native format (offline). Returned: when state is  Sample:  | 
