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

要在 playbook 中使用它,请指定: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 一起使用。

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

状态 parsedrunning_config 选项读取配置,并按照资源模块的 argspec 将其转换为 Ansible 结构化数据,然后该值将在结果内的 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

字典

模块执行后的结果配置。

返回: 当更改时

示例: "此 输出 将始终 模块 argspec 格式相同。\n"

before

字典

模块执行前的配置。

返回:statemergedreplacedoverriddendeleted

示例: "此 输出 将始终 模块 argspec 格式相同。\n"

commands

列表 / 元素=字符串

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

返回:statemergedreplacedoverriddendeleted

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

gathered

列表 / 元素=字符串

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

返回:stategathered

示例: ["此 输出 将始终 模块 argspec 格式相同。\n"]

parsed

列表 / 元素=字符串

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

返回:stateparsed

示例: ["此 输出 将始终 模块 argspec 格式相同。\n"]

rendered

列表 / 元素=字符串

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

返回:staterendered

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

作者

  • Padmini Priyadarshini Sivaraj (@PadminiSivaraj)