arista.eos.eos_ospfv2 模块 – OSPFv2 资源模块

注意

此模块是 arista.eos 集合(版本 10.0.1)的一部分。

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

要安装它,请使用:ansible-galaxy collection install arista.eos

要在剧本中使用它,请指定:arista.eos.eos_ospfv2

arista.eos 1.0.0 中的新功能

概要

  • 此模块配置和管理 Arista EOS 平台上的 ospfv2 属性。

参数

参数

注释

config

字典

ospfv2 的配置列表。

processes

列表 / 元素=字典

指定 ospfv2 进程的字典列表。

adjacency

字典

配置 OSPF 实例的邻接选项。

exchange_start

字典

配置 OSPF 实例的 exchange-start 选项。

threshold

整数

同时启动的对等体的数量。

areas

列表 / 元素=字典

指定 OSPF 区域的配置

area_id

字符串

指定以十进制或点分十进制表示的 32 位数字。

default_cost

整数

指定存根/NSSA 区域中默认汇总路由的成本。

filter

字典

指定传入汇总 LSA 的过滤器。

address

字符串

IP 地址。

prefix_list

字符串

指定要过滤传入 LSA 的列表。

subnet_address

字符串

带掩码长度的 IP 地址

subnet_mask

字符串

IP 子网掩码

not_so_stubby

字典

配置 NSSA 参数。

default_information_originate

字典

发起默认类型 7 LSA。

metric

整数

默认路由的指标。

metric_type

整数

默认路由的指标类型。

nssa_only

布尔值

限制此 NSSA 区域的默认通告。

选项

  • false

  • true

lsa

布尔值

lsa 参数

选项

  • false

  • true

no_summary

布尔值

过滤 nssa 区域中的所有 type-3 LSA。

选项

  • false

  • true

nssa_only

布尔值

禁用 Type-7 LSA p-bit 设置

选项

  • false

  • true

set

布尔值

设置配置直至 not-so-stubby

选项

  • false

  • true

nssa

字典

配置 NSSA 参数。

default_information_originate

字典

发起默认类型 7 LSA。

metric

整数

默认路由的指标。

metric_type

整数

默认路由的指标类型。

nssa_only

布尔值

限制此 NSSA 区域的默认通告。

选项

  • false

  • true

no_summary

布尔值

过滤 nssa 区域中的所有 type-3 LSA。

选项

  • false

  • true

nssa_only

布尔值

禁用 Type-7 LSA p-bit 设置

选项

  • false

  • true

set

布尔值

设置配置直至 nssa

选项

  • false

  • true

range

字典

配置路由汇总。

address

字符串

IP 地址。

advertise

布尔值

启用范围的通告。

选项

  • false

  • true

cost

整数

配置指标。

subnet_address

字符串

带掩码长度的 IP 地址

subnet_mask

字符串

IP 子网掩码

stub

字典

存根区域。

no_summary

布尔值

如果为 False,则过滤存根区域中的所有 type-3 LSA。

选项

  • false

  • true

set

布尔值

当为 true 时,仅设置存根配置。

选项

  • false

  • true

auto_cost

字典

设置自动成本。

reference_bandwidth

整数

参考带宽,单位为兆比特/秒。

bfd

字典

启用 BFD。

all_interfaces

布尔值

在所有接口上启用 BFD。

选项

  • false

  • true

default_information

字典

控制默认信息的分配。

always

布尔值

始终通告默认路由。

选项

  • false

  • true

metric

整数

默认路由的指标。

metric_type

整数

默认路由的指标类型。

originate

布尔值

分发默认路由。

选项

  • false

  • true

route_map

字符串

指定要使用的路由映射。

default_metric

整数

配置重新分配路由的默认指标

distance

字典

指定路由的管理距离。

external

整数

区域外部的路由

inter_area

整数

来自其他区域的路由

intra_area

整数

区域内的路由

distribute_list

字典

指定要过滤的路由列表。

prefix_list

字符串

要过滤的前缀列表

route_map

字符串

要过滤的路由映射

dn_bit_ignore

布尔值

如果为 true,则在非默认 VRF 中禁用 Type-3 LSA 的 dn-bit 检查。

选项

  • false

  • true

fips_restrictions

字符串

使用符合 FIPS 的算法

graceful_restart

字典

启用平滑重启模式。

grace_period

整数

指定等待平滑重启完成的最长时间。

set

布尔值

当为 true 时,仅设置 grace_fulrestart 配置。

选项

  • false

  • true

graceful_restart_helper

布尔值

如果为 true,则启用平滑重启助手。

选项

  • false

  • true

log_adjacency_changes

字典

配置 OSPFv2 邻居的链路状态更改和转换。

detail

布尔值

如果为 true,则配置交换机以记录所有链路状态更改。

选项

  • false

  • true

max_lsa

字典

指定达到最大 LSA 计数时交换机的行为。

count

整数

lsa 的最大计数。

ignore_count

整数

交换机在警告时可以暂时关闭的次数

ignore_time

整数

以分钟为单位的时间,在此时间内,交换机应在 max-lsa 警告时关闭

reset_time

整数

以分钟为单位的时间,在此之后,关闭计数器会重置。

threshold

整数

<count> 的百分比,应在此百分比发出警告。

warning

布尔值

仅在超出限制时给出警告消息

选项

  • false

  • true

max_metric

字典

设置最大指标。

router_lsa

字典

自发起的路由器 LSA 中的最大指标。

external_lsa

字典

使用最大指标值覆盖外部 LSA 指标。

max_metric_value

整数

为外部 LSA 设置最大指标值。

set

布尔值

设置 external-lsa 属性。

选项

  • false

  • true

include_stub

布尔值

为路由器 LSA 中的存根链路设置最大指标。

选项

  • false

  • true

on_startup

字典

在重新启动后临时设置最大指标。

wait_period

整数

启动后等待时间,以秒为单位。

set

布尔值

设置 router-lsa 属性。

选项

  • false

  • true

summary_lsa

字典

使用最大指标值覆盖汇总 LSA 指标。

max_metric_value

整数

为外部 LSA 设置最大指标值。

set

布尔值

设置 external-lsa 属性。

选项

  • false

  • true

maximum_paths

整数

ECMP 路由中下一跳的最大数量。

mpls_ldp

布尔值

mpls ldp 同步配置。

选项

  • false

  • true

networks

列表 / 元素=字典

配置网络的路由。

area

字符串

配置 OSPF 区域。

mask

字符串

网络通配符掩码。

network_address

字符串

网络地址。

prefix

字符串

前缀。

passive_interface

字典

包含接口,但没有主动运行 OSPF。

default

布尔值

如果为 true,则默认将所有接口设置为被动

选项

  • false

  • true

interface_list

字符串

接口范围。

point_to_point

布尔值

配置点对点特定功能。

选项

  • false

  • true

process_id

整数

OSPFV2 进程的 ID。

redistribute

列表 / 元素=字典

指定要重新分配的路由

isis_level

字符串

ISIS 级别。

route_map

字符串

指定要使用的路由映射。

路由

字符串

路由类型 (BGP、isis、connected 等)

重传阈值

整数

配置重传阈值。

rfc1583兼容性

布尔值

指定计算汇总路由指标的不同方法。

选项

  • false

  • true

路由器 ID

字符串

分配给运行 OSPFv2 路由器的 32 位数字。

关闭

布尔值

禁用 OSPF 实例。

选项

  • false

  • true

汇总地址

字典

汇总路由配置。

address

字符串

IP 汇总地址。

属性映射

字符串

设置汇总路由的属性。

mask

字符串

汇总掩码。

不通告

布尔值

不通告汇总路由。

选项

  • false

  • true

prefix

字符串

前缀。

标签

整数

设置标签。

计时器

列表 / 元素=字典

配置 OSPF 计时器。

lsa

字典

配置 OSPF LSA 计时器。

接收

字典

配置 OSPF LSA 接收计时器

最小间隔

整数

配置 OSPF LSA 到达计时器。

发送

字典

配置 OSPF LSA 传输计时器。

延迟

字典

配置 OSPF LSA 传输延迟。

初始

整数

以毫秒为单位延迟生成 LSA 的首次出现。

最大

整数

以毫秒为单位生成相同 LSA 的最大延迟。

最小

整数

以毫秒为单位生成相同 LSA 的最小延迟。

输出延迟

整数

配置输出延迟计时器。

步调

整数

配置 OSPF 数据包步调。

SPF

字典

配置 SPF 计时器

初始

整数

以毫秒为单位的初始 SPF 计划延迟。

最大

整数

两次 SPF 之间的最大等待时间(以毫秒为单位)。

最小

整数

两次 SPF 之间的最小保持时间(以毫秒为单位)

整数

秒。

节流

字典

配置节流计时器(仅适用于 eos 版本 < 4.23)。

属性

字符串

节流属性。

初始

整数

以毫秒为单位的初始计划延迟。

最大

整数

最大等待时间

最小

整数

最小保持时间

流量工程

布尔值

进入流量工程配置模式

选项

  • false

  • true

VRF

字符串

VRF 名称。

运行配置

字符串

此选项仅与状态已解析一起使用。

此选项的值应该是通过执行命令 show running-config | section ospf 从 EOS 设备收到的输出。

状态已解析running_config 选项读取配置,并按照资源模块的 argspec 将其转换为 Ansible 结构化数据,然后该值将返回到结果中的 已解析 键中。

状态

字符串

配置应保留的状态。

选项

  • "已删除"

  • "合并" ← (默认)

  • "已覆盖"

  • "已替换"

  • "已收集"

  • "已渲染"

  • "已解析"

注释

注意

  • 针对 Arista EOS 4.24.6F 进行了测试

  • 此模块与连接 network_cli 一起使用。请参阅 EOS 平台选项

示例

# Using merged

# Before state:
# -------------
# localhost#show running-config | section ospf
# localhost#

- name: Merge provided config into running config
  arista.eos.eos_ospfv2:
    config:
      - processes:
          - process_id: 1
            adjacency:
              exchange_start:
                threshold: 20045623
            areas:
              - filter:
                  address: "10.1.1.0/24"
                id: "0.0.0.2"
              - id: "0.0.0.50"
                range:
                  address: "172.20.0.0/16"
                  cost: 34
            default_information:
              metric: 100
              metric_type: 1
              originate: true
            distance:
              intra_area: 85
            max_lsa:
              count: 8000
              ignore_count: 3
              ignore_time: 6
              reset_time: 20
              threshold: 40
            networks:
              - area: "0.0.0.0"
                prefix: 10.10.2.0/24
              - area: "0.0.0.0"
                prefix: "10.10.3.0/24"
            redistribute:
              - routes: "static"
            router_id: "170.21.0.4"
          - process_id: 2
            vrf: "vrf01"
            areas:
              - id: "0.0.0.9"
                default_cost: 20
            max_lsa:
              count: 8000
              ignore_count: 3
              ignore_time: 6
              reset_time: 20
              threshold: 40
            networks:
              - area: "0.0.0.0"
                prefix: 10.10.2.0/24
              - area: "0.0.0.0"
                prefix: "10.10.3.0/24"
            redistribute:
              - routes: "static"
            router_id: "170.21.0.4"
          - process_id: 2
            vrf: "vrf01"
            areas:
              - id: "0.0.0.9"
                default_cost: 20
            max_lsa:
              count: 8000
              ignore_count: 3
              ignore_time: 6
              reset_time: 20
              threshold: 40
          - process_id: 3
            vrf: "vrf02"
            redistribute:
              - routes: "connected"

# Task output:
# ------------
#  before: {}

# commands
# - router ospf 1
# - adjacency exchange-start threshold 20045623
# - area 0.0.0.2 filter 10.1.1.0/24
# - area 0.0.0.50  range 172.20.0.0/16 cost 34
# - default-information originate metric 100 metric-type 1
# - distance ospf intra-area 85
# - max-lsa  8000 40 ignore-count 3  ignore-time 6  reset-time 20
# - network 10.10.2.0/24 area 0.0.0.0
# - network 10.10.3.0/24 area 0.0.0.0
# - redistribute static
# - router-id 170.21.0.4
# - exit
# - router ospf 2 vrf vrf01
# - area 0.0.0.9 default-cost 20
# - max-lsa  8000 40 ignore-count 3  ignore-time 6  reset-time 20
# - network 10.10.2.0/24 area 0.0.0.0
# - network 10.10.3.0/24 area 0.0.0.0
# - redistribute static
# - router-id 170.21.0.4
# - exit
# - router ospf 2 vrf vrf01
# - area 0.0.0.9 default-cost 20
# - max-lsa  8000 40 ignore-count 3  ignore-time 6  reset-time 20
# - exit
# - router ospf 3 vrf vrf02
# - redistribute connected
# - exit
#
# after:
#     processes:
#     - adjacency:
#         exchange_start:
#           threshold: 20045623
#       areas:
#       - area_id: 0.0.0.2
#         filter:
#           address: 10.1.1.0/24
#       - area_id: 0.0.0.50
#         range:
#           address: 172.20.0.0/16
#           cost: 34
#       default_information:
#         metric: 100
#         metric_type: 1
#         originate: true
#       distance:
#         intra_area: 85
#       max_lsa:
#         count: 8000
#         ignore_count: 3
#         ignore_time: 6
#         reset_time: 20
#         threshold: 40
#       networks:
#       - area: 0.0.0.0
#         prefix: 10.10.2.0/24
#       - area: 0.0.0.0
#         prefix: 10.10.3.0/24
#       process_id: 1
#       redistribute:
#       - routes: static
#       router_id: 170.21.0.4
#     - areas:
#       - area_id: 0.0.0.9
#         default_cost: 20
#       max_lsa:
#         count: 8000
#         ignore_count: 3
#         ignore_time: 6
#         reset_time: 20
#         threshold: 40
#       process_id: 2
#       vrf: vrf01
#     - max_lsa:
#         count: 12000
#       process_id: 3
#       redistribute:
#       - routes: connected
#       vrf: vrf02

# After state:
# ------------
# localhost#show running-config | section ospf
# router ospf 1
#    router-id 170.21.0.4
#    distance ospf intra-area 85
#    redistribute static
#    area 0.0.0.2 filter 10.1.1.0/24
#    area 0.0.0.50 range 172.20.0.0/16 cost 34
#    network 10.10.2.0/24 area 0.0.0.0
#    network 10.10.3.0/24 area 0.0.0.0
#    max-lsa 8000 40 ignore-time 6 ignore-count 3 reset-time 20
#    adjacency exchange-start threshold 20045623
#    default-information originate metric 100 metric-type 1
#
# router ospf 2 vrf vrf01
#    area 0.0.0.9 default-cost 20
#    max-lsa 8000 40 ignore-time 6 ignore-count 3 reset-time 20
# !
# router ospf 3 vrf vrf02
#    redistribute connected
#    max-lsa 12000

# Using replaced

# Before State:
# -------------
# localhost#show running-config | section ospf
# router ospf 1
#    router-id 170.21.0.4
#    distance ospf intra-area 85
#    redistribute static
#    area 0.0.0.2 filter 10.1.1.0/24
#    area 0.0.0.50 range 172.20.0.0/16 cost 34
#    network 10.10.2.0/24 area 0.0.0.0
#    network 10.10.3.0/24 area 0.0.0.0
#    max-lsa 8000 40 ignore-time 6 ignore-count 3 reset-time 20
#    adjacency exchange-start threshold 20045623
#    default-information originate metric 100 metric-type 1
# !
# router ospf 2 vrf vrf01
#    area 0.0.0.9 default-cost 20
#    max-lsa 8000 40 ignore-time 6 ignore-count 3 reset-time 20
# !
# router ospf 3 vrf vrf02
#    redistribute connected
#    max-lsa 12000
#
- name: replace Ospf configs
  arista.eos.eos_ospfv2:
    config:
      - processes:
          - process_id: 2
            vrf: "vrf01"
            point_to_point: true
            redistribute:
              - routes: "isis"
                isis_level: "level-1"
    state: replaced

# Task output:
# ------------
# before:
#     processes:
#     - adjacency:
#         exchange_start:
#           threshold: 20045623
#       areas:
#       - area_id: 0.0.0.2
#         filter:
#           address: 10.1.1.0/24
#       - area_id: 0.0.0.50
#         range:
#           address: 172.20.0.0/16
#           cost: 34
#       default_information:
#         metric: 100
#         metric_type: 1
#         originate: true
#       distance:
#         intra_area: 85
#       max_lsa:
#         count: 8000
#         ignore_count: 3
#         ignore_time: 6
#         reset_time: 20
#         threshold: 40
#       networks:
#       - area: 0.0.0.0
#         prefix: 10.10.2.0/24
#       - area: 0.0.0.0
#         prefix: 10.10.3.0/24
#       process_id: 1
#       redistribute:
#       - routes: static
#       router_id: 170.21.0.4
#     - areas:
#       - area_id: 0.0.0.9
#         default_cost: 20
#       max_lsa:
#         count: 8000
#         ignore_count: 3
#         ignore_time: 6
#         reset_time: 20
#         threshold: 40
#       process_id: 2
#       vrf: vrf01
#     - max_lsa:
#         count: 12000
#       process_id: 3
#       redistribute:
#       - routes: connected
#       vrf: vrf02
#
# commands:
# - router ospf 2 vrf vrf01
# - no area 0.0.0.9 default-cost 20
# - no max-lsa  8000 40 ignore-time 6  ignore-count 3  reset-time 20
# - point-to-point routes
# - redistribute isis level-1
#
# after:
#     processes:
#     - adjacency:
#         exchange_start:
#           threshold: 20045623
#       areas:
#       - area_id: 0.0.0.2
#         filter:
#           address: 10.1.1.0/24
#       - area_id: 0.0.0.50
#         range:
#           address: 172.20.0.0/16
#           cost: 34
#       default_information:
#         metric: 100
#         metric_type: 1
#         originate: true
#       distance:
#         intra_area: 85
#       max_lsa:
#         count: 8000
#         ignore_count: 3
#         ignore_time: 6
#         reset_time: 20
#         threshold: 40
#       networks:
#       - area: 0.0.0.0
#         prefix: 10.10.2.0/24
#       - area: 0.0.0.0
#         prefix: 10.10.3.0/24
#       process_id: 1
#       redistribute:
#       - routes: static
#       router_id: 170.21.0.4
#     - max_lsa:
#         count: 12000
#       process_id: 2
#       redistribute:
#       - isis_level: level-1
#         routes: isis
#       vrf: vrf01
#     - max_lsa:
#         count: 12000
#       process_id: 3
#       redistribute:
#       - routes: connected
#       vrf: vrf02

# After state:
# ------------
# localhost#show running-config | section ospf
# router ospf 1
#    router-id 170.21.0.4
#    distance ospf intra-area 85
#    redistribute static
#    area 0.0.0.2 filter 10.1.1.0/24
#    area 0.0.0.50 range 172.20.0.0/16 cost 34
#    network 10.10.2.0/24 area 0.0.0.0
#    network 10.10.3.0/24 area 0.0.0.0
#    max-lsa 8000 40 ignore-time 6 ignore-count 3 reset-time 20
#    adjacency exchange-start threshold 20045623
#    default-information originate metric 100 metric-type 1
# !
# router ospf 2 vrf vrf01
#    redistribute isis level-1
#    max-lsa 12000
# !
# router ospf 3 vrf vrf02
#    redistribute connected
#    max-lsa 12000

# Using overridden

# Before state:
# -------------
# localhost#show running-config | section ospf
# router ospf 1
#    router-id 170.21.0.4
#    distance ospf intra-area 85
#    redistribute static
#    area 0.0.0.2 filter 10.1.1.0/24
#    area 0.0.0.50 range 172.20.0.0/16 cost 34
#    network 10.10.2.0/24 area 0.0.0.0
#    network 10.10.3.0/24 area 0.0.0.0
#    max-lsa 8000 40 ignore-time 6 ignore-count 3 reset-time 20
#    adjacency exchange-start threshold 20045623
#    default-information originate metric 100 metric-type 1
# !
# router ospf 2 vrf vrf01
#    redistribute isis level-1
#    max-lsa 12000
# !
# router ospf 3 vrf vrf02
#    redistribute connected
#    max-lsa 12000

- name: override running config with provided config
  arista.eos.eos_ospfv2:
    config:
      - processes:
          - process_id: 2
            vrf: "vrf01"
            redistribute:
              - routes: "connected"
    state: overriden

# Task output:
# ------------

# before:
#     processes:
#     - adjacency:
#         exchange_start:
#           threshold: 20045623
#       areas:
#       - area_id: 0.0.0.2
#         filter:
#           address: 10.1.1.0/24
#       - area_id: 0.0.0.50
#         range:
#           address: 172.20.0.0/16
#           cost: 34
#       default_information:
#         metric: 100
#         metric_type: 1
#         originate: true
#       distance:
#         intra_area: 85
#       max_lsa:
#         count: 8000
#         ignore_count: 3
#         ignore_time: 6
#         reset_time: 20
#         threshold: 40
#       networks:
#       - area: 0.0.0.0
#         prefix: 10.10.2.0/24
#       - area: 0.0.0.0
#         prefix: 10.10.3.0/24
#       process_id: 1
#       redistribute:
#       - routes: static
#       router_id: 170.21.0.4
#     - max_lsa:
#         count: 12000
#       process_id: 2
#       redistribute:
#       - isis_level: level-1
#         routes: isis
#       vrf: vrf01
#     - max_lsa:
#         count: 12000
#       process_id: 3
#       redistribute:
#       - routes: connected
#       vrf: vrf02
#
# commands:
# - no router ospf 1
# - no router ospf 3
# - router ospf 2 vrf vrf01
# - no max-lsa  12000
# - no redistribute isis level-1
# - redistribute connected
#
# after:
#     processes:
#     - max_lsa:
#         count: 12000
#       process_id: 2
#       redistribute:
#       - isis_level: level-1
#         routes: isis
#       vrf: vrf01

# After state:
# ------------
# localhost#show running-config | section ospf
# router ospf 2 vrf vrf01
#    redistribute isis level-1
#    max-lsa 12000
# !

# Using deleted

# Before state:
# -------------
# localhost#show running-config | section ospf
# router ospf 1
#    router-id 170.21.0.4
#    distance ospf intra-area 85
#    redistribute static
#    area 0.0.0.2 filter 10.1.1.0/24
#    area 0.0.0.50 range 172.20.0.0/16 cost 34
#    network 10.10.2.0/24 area 0.0.0.0
#    network 10.10.3.0/24 area 0.0.0.0
#    max-lsa 8000 40 ignore-time 6 ignore-count 3 reset-time 20
#    adjacency exchange-start threshold 20045623
#    default-information originate metric 100 metric-type 1
# !
# router ospf 2 vrf vrf01
#    redistribute connected
#    area 0.0.0.9 default-cost 20
#    max-lsa 8000 40 ignore-time 6 ignore-count 3 reset-time 20
# !
# router ospf 3 vrf vrf02
#    redistribute connected
#    max-lsa 12000
#
- name: Delete OSPF config
  arista.eos.eos_ospfv2:
    config:
      processes:
        - process_id: 1
    state: deleted

# Task output:
# ------------
# before:
#     processes:
#     - adjacency:
#         exchange_start:
#           threshold: 20045623
#       areas:
#       - area_id: 0.0.0.2
#         filter:
#           address: 10.1.1.0/24
#       - area_id: 0.0.0.50
#         range:
#           address: 172.20.0.0/16
#           cost: 34
#       default_information:
#         metric: 100
#         metric_type: 1
#         originate: true
#       distance:
#         intra_area: 85
#       max_lsa:
#         count: 8000
#         ignore_count: 3
#         ignore_time: 6
#         reset_time: 20
#         threshold: 40
#       networks:
#       - area: 0.0.0.0
#         prefix: 10.10.2.0/24
#       - area: 0.0.0.0
#         prefix: 10.10.3.0/24
#       process_id: 1
#       redistribute:
#       - routes: static
#       router_id: 170.21.0.4
#     - areas:
#       - area_id: 0.0.0.9
#         default_cost: 20
#       max_lsa:
#         count: 8000
#         ignore_count: 3
#         ignore_time: 6
#         reset_time: 20
#         threshold: 40
#       process_id: 2
#       redistribute:
#       - routes: connected
#       vrf: vrf01
#     - max_lsa:
#         count: 12000
#       process_id: 3
#       redistribute:
#       - routes: connected
#       vrf: vrf02
#
# commands:
# - no router ospf 1
#
# after:
#     processes:
#     - areas:
#       - area_id: 0.0.0.9
#         default_cost: 20
#       max_lsa:
#         count: 8000
#         ignore_count: 3
#         ignore_time: 6
#         reset_time: 20
#         threshold: 40
#       process_id: 2
#       redistribute:
#       - routes: connected
#       vrf: vrf01
#     - max_lsa:
#         count: 12000
#       process_id: 3
#       redistribute:
#       - routes: connected
#       vrf: vrf02

# After state:
# ------------
# localhost#show running-config | section ospf
# router ospf 2 vrf vrf01
#    redistribute connected
#    area 0.0.0.9 default-cost 20
#    max-lsa 8000 40 ignore-time 6 ignore-count 3 reset-time 20
# !
# router ospf 3 vrf vrf02
#    redistribute connected
#    max-lsa 12000

# Using gathered
# localhost#show running-config | section ospf
# router ospf 2 vrf vrf01
#    redistribute connected
#    area 0.0.0.9 default-cost 20
#    max-lsa 8000 40 ignore-time 6 ignore-count 3 reset-time 20
# !
# router ospf 3 vrf vrf02
#    redistribute connected
#    max-lsa 12000

- name: replace Ospf configs
  arista.eos.eos_ospfv2:
    state: gathered

# Task output:
# ------------
# gathered:
#     processes:
#     - areas:
#       - area_id: 0.0.0.9
#         default_cost: 20
#       max_lsa:
#         count: 8000
#         ignore_count: 3
#         ignore_time: 6
#         reset_time: 20
#         threshold: 40
#       process_id: 2
#       redistribute:
#       - routes: connected
#       vrf: vrf01
#     - max_lsa:
#         count: 12000
#       process_id: 3
#       redistribute:
#       - routes: connected
#       vrf: vrf02

# Using parsed
# ------------

# parsed.cfg
# router ospf 1
#    adjacency exchange-start threshold 20045623
#    area 0.0.0.2 filter 10.1.1.0/24
#    area 0.0.0.50  range 172.20.0.0/16 cost 34
#    default-information originate  metric 100 metric-type 1
#    distance ospf intra-area 85
#    max-lsa  80000 40 ignore-count 3  ignore-time 6  reset-time 20
#    network 10.10.2.0/24 area 0.0.0.0
#    network 10.10.3.0/24 area 0.0.0.0
#    redistribute static
#    router-id 170.21.0.4
# router ospf 2 vrf vrf01,
#    area 0.0.0.9 default-cost 20
#    max-lsa  80000 40 ignore-count 3  ignore-time 6  reset-time 20
# router ospf 3 vrf vrf02
#    redistribute static

- name: Parse running config and display structured facts
  arista.eos.eos_ospfv2:
    running_config: "{{ lookup('file', './parsed.cfg') }}"
    state: parsed

# Task output:
# ------------
# parsed:
#     processes:
#     - adjacency:
#         exchange_start:
#           threshold: 20045623
#       areas:
#       - area_id: 0.0.0.2
#         filter:
#           address: 10.1.1.0/24
#       - area_id: 0.0.0.50
#         range:
#           address: 172.20.0.0/16
#           cost: 34
#       default_information:
#         metric: 100
#         metric_type: 1
#         originate: true
#       distance:
#         intra_area: 85
#       max_lsa:
#         count: 80000
#         ignore_count: 3
#         ignore_time: 6
#         reset_time: 20
#         threshold: 40
#       networks:
#       - area: 0.0.0.0
#         prefix: 10.10.2.0/24
#       - area: 0.0.0.0
#         prefix: 10.10.3.0/24
#       process_id: 1
#       redistribute:
#       - routes: static
#       router_id: 170.21.0.4
#     - areas:
#       - area_id: 0.0.0.9
#         default_cost: 20
#       max_lsa:
#         count: 80000
#         ignore_count: 3
#         ignore_time: 6
#         reset_time: 20
#         threshold: 40
#       process_id: 2
#       vrf: vrf01,
#     - process_id: 3
#       redistribute:
#       - routes: static
#       vrf: vrf02

# Using rendered

- name: replace Ospf configs
  arista.eos.eos_ospfv2:
    config:
      processes:
        - process_id: 1
          adjacency:
            exchange_start:
              threshold: 20045623
          areas:
            - filter:
                address: "10.1.1.0/24"
              area_id: "0.0.0.2"
            - area_id: "0.0.0.50"
              range:
                address: "172.20.0.0/16"
                cost: 34
          default_information:
            metric: 100
            metric_type: 1
            originate: true
          distance:
            intra_area: 85
          max_lsa:
            count: 8000
            ignore_count: 3
            ignore_time: 6
            reset_time: 20
            threshold: 40
          networks:
            - area: "0.0.0.0"
              prefix: 10.10.2.0/24
            - area: "0.0.0.0"
              prefix: "10.10.3.0/24"
          redistribute:
            - routes: "static"
          router_id: "170.21.0.4"
        - process_id: 2
          vrf: "vrf01"
          areas:
            - area_id: "0.0.0.9"
              default_cost: 20
          max_lsa:
            count: 8000
            ignore_count: 3
            ignore_time: 6
            reset_time: 20
            threshold: 40
          networks:
            - area: "0.0.0.0"
              prefix: 10.10.2.0/24
            - area: "0.0.0.0"
              prefix: "10.10.3.0/24"
          redistribute:
            - routes: "static"
          router_id: "170.21.0.4"
        - process_id: 2
          vrf: "vrf01"
          areas:
            - area_id: "0.0.0.9"
              default_cost: 20
          max_lsa:
            count: 8000
            ignore_count: 3
            ignore_time: 6
            reset_time: 20
            threshold: 40
        - process_id: 3
          vrf: "vrf02"
          redistribute:
            - routes: "connected"
    state: rendered

# rendered:
#   - router ospf 1
#   - adjacency exchange-start threshold 20045623
#   - area 0.0.0.2 filter 10.1.1.0/24
#   - area 0.0.0.50  range 172.20.0.0/16 cost 34
#   - default-information originate metric 100 metric-type 1
#   - distance ospf intra-area 85
#   - max-lsa  8000 40 ignore-count 3  ignore-time 6  reset-time 20
#   - network 10.10.2.0/24 area 0.0.0.0
#   - network 10.10.3.0/24 area 0.0.0.0
#   - redistribute static
#   - router-id 170.21.0.4
#   - exit
#   - router ospf 2 vrf vrf01
#   - area 0.0.0.9 default-cost 20
#   - max-lsa  8000 40 ignore-count 3  ignore-time 6  reset-time 20
#   - network 10.10.2.0/24 area 0.0.0.0
#   - network 10.10.3.0/24 area 0.0.0.0
#   - redistribute static
#   - router-id 170.21.0.4
#   - exit
#   - router ospf 2 vrf vrf01
#   - area 0.0.0.9 default-cost 20
#   - max-lsa  8000 40 ignore-count 3  ignore-time 6  reset-time 20
#   - exit
#   - router ospf 3 vrf vrf02
#   - redistribute connected
#   - exit

返回值

通用返回值记录在 这里,以下是此模块特有的字段

描述

之后

字典

模块执行后的结果配置。

返回: 当更改时

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

之前

字典

模块执行之前的配置。

返回:statemergedreplacedoverriddendeletedpurged

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

命令

列表 / elements=string

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

返回:statemergedreplacedoverriddendeletedpurged

示例: ["router ospf 1", "adjacency exchange-start threshold 20045623", "area 0.0.0.2 filter 10.1.1.0/24"]

已收集

字典

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

返回:stategathered

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

已解析

字典

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

返回:stateparsed

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

已渲染

列表 / elements=string

以设备本机格式(脱机)渲染任务中提供的配置。

返回:staterendered

示例: ["router ospf 1", "adjacency exchange-start threshold 20045623", "area 0.0.0.2 filter 10.1.1.0/24"]

作者

  • Gomathi Selvi Srinivasan (@GomathiselviS)