cisco.ios.ios_evpn_global 模块 – 配置 L2VPN EVPN 的资源模块。

注意

此模块是 cisco.ios 集合 (版本 9.0.3) 的一部分。

如果您使用的是 ansible 包,则可能已安装此集合。它不包含在 ansible-core 中。要检查它是否已安装,请运行 ansible-galaxy collection list

要安装它,请使用:ansible-galaxy collection install cisco.ios

要在剧本中使用它,请指定:cisco.ios.ios_evpn_global

cisco.ios 5.3.0 中的新增功能

概要

  • 此模块提供对 Cisco IOS 网络设备上 L2VPN EVPN 的声明式管理。

别名:evpn_global

参数

参数

注释

config

字典

L2VPN 以太网虚拟专用网络 (EVPN) 配置的字典

default_gateway

字典

默认网关参数

advertise

布尔值

通告默认网关 MAC/IP 路由

选项

  • false

  • true

flooding_suppression

字典

抑制广播、多播和/或未知单播数据包的泛洪

address_resolution

字典

抑制地址解析和邻居发现协议数据包的泛洪

disable

布尔值

禁用泛洪抑制

选项

  • false

  • true

ip

字典

IP 参数

local_learning

字典

IP 本地学习

disable

布尔值

禁用 IP 本地学习

选项

  • false

  • true

replication_type

字符串

复制 BUM 流量的 方法

选项

  • "ingress"

  • "static"

route_target

字典

路由目标 VPN 扩展社区

auto

字典

自动设置路由目标

vni

布尔值

设置基于 vni 的路由目标

选项

  • false

  • true

router_id

字符串

EVPN 路由器 ID

running_config

字符串

此选项仅与状态 *parsed* 一起使用。

此选项的值应为通过执行命令 **sh running-config nve | section ^l2vpn evpn$** 从 IOS 设备接收到的输出。

状态 *parsed* 从 running_config 选项读取配置并将其转换为 Ansible 结构化数据,然后根据资源模块的 argspec 将值返回到结果中的 *parsed* 密钥中。

state

字符串

配置应保留到的状态

选项

  • "merged" ← (默认)

  • "replaced"

  • "overridden"

  • "deleted"

  • "gathered"

  • "rendered"

  • "parsed"

备注

注意

示例

# 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

返回值

常见的返回值已在 此处 记录,以下是此模块特有的字段

描述

after

字典

模块执行后的结果配置。

返回:发生更改时

示例: "This output will always be in the same format as the module argspec.\n"

before

字典

模块执行之前的配置。

返回:当 *state* 为 mergedreplacedoverriddendeleted

示例: "This output will always be in the same format as the module argspec.\n"

commands

列表 / 元素=字符串

推送到远程设备的命令集。

返回:当 *state* 为 mergedreplacedoverriddendeleted

示例: ["l2vpn evpn", "replication-type ingress", "router_id Loopback1"]

gathered

列表 / 元素=字符串

从远程设备收集的关于网络资源的事实,作为结构化数据。

返回:当 *state* 为 gathered

示例: ["This output will always be in the same format as the module argspec.\n"]

已解析

列表 / 元素=字符串

根据模块argspec,将running_config选项中提供的设备原生配置解析为结构化数据。

返回:stateparsed

示例: ["This output will always be in the same format as the module argspec.\n"]

已渲染

列表 / 元素=字符串

在任务中提供的配置以设备原生格式(离线)呈现。

返回:staterendered

示例: ["l2vpn evpn", "replication-type static", "route-target auto vni"]

作者

  • Padmini Priyadarshini Sivaraj (@PadminiSivaraj)