cisco.iosxr.iosxr_ospfv2 模块 – 用于配置 OSPFv2 的资源模块。

注意

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

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

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

要在 playbook 中使用它,请指定:cisco.iosxr.iosxr_ospfv2

cisco.iosxr 1.0.0 中的新增功能

概要

  • 此模块管理运行 Cisco IOS-XR 的设备上的全局 OSPFv2 配置

参数

参数

注释

config

字典

OSPFv2 进程配置的列表

processes

列表 / 元素=字典

OSPFv2 实例配置的列表

address_family_unicast

布尔值

为 IPv4 地址族启用单播拓扑

选择

  • false

  • true

adjacency_stagger

字典

错开 OSPFv2 邻接关系建立

disable

布尔值

禁用错开 OSPFv2 邻接关系

选择

  • false

  • true

max_adjacency

整数

要建立的最大同时邻居数

min_adjacency

整数

每个区域要建立的初始邻居数(默认为 2)

apply_weight

字典

启用在接口下配置的权重以进行负载分担

bandwidth

整数

用于计算的参考带宽(Mbits/秒)

default_weight

整数

指定未在接口下配置时要使用的默认权重值

areas

列表 / 元素=字典

配置 OSPFv2 区域的属性

area_id

字符串 / 必需

区域 ID,可以是 IP 地址或整数

authentication

字典

启用身份验证

keychain

字符串

指定密钥链名称

message_digest

字典

使用消息摘要身份验证

keychain

字符串

指定密钥链名称

no_auth

布尔值

不使用身份验证

选择

  • false

  • true

authentication_key

字典

用于提及身份验证密码(密钥)

clear

字符串

指定将跟随未加密的密码(密钥)

encrypted

字符串

指定将跟随加密的密码(密钥)

password

字符串

OSPFv2 密码(密钥)

bfd

字典

配置 BFD 参数

fast_detect

字典

配置快速检测

set

布尔值

仅启用快速检测

选择

  • false

  • true

strict_mode

布尔值

保持邻居会话关闭,直到 BFD 会话启动

选择

  • false

  • true

minimum_interval

整数

Hello 间隔(毫秒)

multiplier

整数

检测倍数

cost

整数

接口成本

dead_interval

整数

邻居被声明为死亡后的间隔

default_cost

整数

设置 NSSA/末节区域的摘要默认成本。末节的通告外部路由指标

hello_interval

整数

HELLO 数据包之间的时间

mpls

字典

配置 MPLS 路由协议参数

ldp

字典

配置 LDP 参数

auto_config

布尔值

启用 LDP IGP 接口自动配置

选择

  • false

  • true

sync

布尔值

启用 LDP IGP 同步

选择

  • false

  • true

sync_igp_shortcuts

布尔值

用于 IGP 快捷隧道的 LDP 同步

选择

  • false

  • true

traffic_eng

布尔值

配置一个 OSPF 区域以运行 MPLS 流量工程

选择

  • false

  • true

mtu_ignore

字符串

启用/禁用在 DBD 数据包中忽略 MTU

选择

  • "enable"

  • "disable"

nssa

字典

该区域的 NSSA 设置

default_information_originate

字典

发起默认类型 7 LSA

metric

整数

OSPFv2 默认指标

metric_type

整数

默认路由的指标类型

no_redistribution

布尔值

不将重新分发的 LSA 发送到 NSSA 区域

选择

  • false

  • true

no_summary

布尔值

不将摘要 LSA 发送到 NSSA 区域

选择

  • false

  • true

set

布尔值

将区域配置为 NSSA

选择

  • false

  • true

translate

字典

转换 LSA

type7

字典

从类型 7 转换为类型 5

always

布尔值

始终转换 LSA

选择

  • false

  • true

ranges

列表 / 元素=字典

汇总匹配地址/掩码的路由(仅限边界路由器)

address

字符串 / 必需

前缀格式的 IP (x.x.x.x/len)

advertise

布尔值

通告此范围(默认)

选择

  • false

  • true

not_advertise

布尔值

不通告此范围

选择

  • false

  • true

route_policy

列表 / 元素=字典

指定用于过滤类型 3 LSA 的路由策略(列表只能有一个入站和/或一个出站策略)

direction

字符串

指定入站或出站

选择

  • "in"

  • "out"

parameters

列表 / 元素=字符串

指定策略的参数值

stub

字典

用于将区域配置为末节的设置

no_summary

布尔值

不要将摘要 LSA 发送到末节区域

选择

  • false

  • true

set

布尔值

将区域配置为末节

选择

  • false

  • true

transmit_delay

整数

发送链路状态更新数据包所需的估计时间

列表 / 元素=字典

定义虚拟链路

字典

启用身份验证

字符串

指定密钥链名称

字典

使用消息摘要身份验证

字符串

指定密钥链名称

布尔值

不使用身份验证

选择

  • false

  • true

字典

用于提及身份验证密码(密钥)

字符串

指定将跟随未加密的密码(密钥)

字符串

指定将跟随加密的密码(密钥)

字符串

OSPFv2 密码(密钥)

整数

邻居被声明为死亡后的间隔

整数

HELLO 数据包之间的时间

字符串 / 必需

虚拟链路邻居的路由器 ID (A.B.C.D)

字典

消息摘要身份验证密码(密钥)

整数 / 必需

密钥 ID (1-255)

字典

使用 MD5 算法

布尔值

指定将跟随未加密的密码(密钥)

选择

  • false

  • true

布尔值

指定将跟随加密的密码(密钥)

选择

  • false

  • true

字符串

OSPFv2 密码(密钥)

整数

LSA 重传之间的延迟

整数

链路状态传输延迟

authentication

字典

启用身份验证

keychain

字符串

指定密钥链名称

message_digest

字典

使用消息摘要身份验证

keychain

字符串

指定密钥链名称

set

布尔值

指定消息摘要选择

选择

  • false

  • true

no_auth

布尔值

不使用身份验证

选择

  • false

  • true

authentication_key

字典

用于提及身份验证密码(密钥)

clear

布尔值

指定将跟随未加密的密码(密钥)

选择

  • false

  • true

encrypted

布尔值

指定将跟随加密的密码(密钥)

选择

  • false

  • true

password

字符串

OSPFv2 密码(密钥)

auto_cost

字典

根据带宽计算 OSPFv2 接口成本

disable

布尔值

根据接口类型分配 OSPFv2 成本

选择

  • false

  • true

reference_bandwidth

整数

以兆比特/秒为单位指定参考带宽

bfd

字典

配置 BFD 参数

fast_detect

字典

配置快速检测

set

布尔值

仅启用快速检测

选择

  • false

  • true

strict_mode

布尔值

保持邻居会话关闭,直到 BFD 会话启动

选择

  • false

  • true

minimum_interval

整数

Hello 间隔(毫秒)

multiplier

整数

检测倍数

capability

字典

启用特定的 OSPFv2 功能

opaque

字典

配置不透明 LSA

disable

布尔值

禁用不透明 LSA 功能

选择

  • false

  • true

set

布尔值

启用不透明 LSA

选择

  • false

  • true

type7

字符串

NSSA 功能

cost

整数

接口成本 (1-65535)

database_filter

字符串

在同步和泛洪期间过滤 OSPFv2 LSA(所有传出的 LSA)。启用/禁用过滤

选择

  • "enable"

  • "disable"

dead_interval

整数

邻居被声明为死亡后的间隔

default_information_originate

字典

分发默认路由

always

布尔值

始终通告默认路由

选择

  • false

  • true

metric

整数

OSPFv2 默认指标

metric_type

整数

默认路由的 OSPFv2 度量类型

route_policy

字符串

将路由策略应用于默认信息源

set

布尔值

启用默认路由的分发

选择

  • false

  • true

default_metric

整数

设置重分发路由的度量值

demand_circuit

字符串

启用/禁用 OSPFv2 按需电路

选择

  • "enable"

  • "disable"

distance

字典

定义管理距离

admin_distance

列表 / 元素=字典

管理距离

access_list

字符串

访问列表名称

source

字符串

源 IP 地址

value

整数

距离值

wildcard

字符串

IP 通配符位 (A.B.C.D)

ospf_distance

字典

OSPFv2 管理距离

external

整数

外部路由的距离

inter_area

整数

区域间路由的距离

intra_area

整数

区域内路由的距离

distribute_bgp_ls

字典

启用向外部服务分发 LSA

instance_id

整数

设置分发进程实例标识符

throttle

整数

连续 LSA 更新之间的限制时间

字典

启用向外部服务分发 LSA

整数

设置分发进程实例标识符

整数

连续 LSA 更新之间的限制时间

distribute_list

列表 / 元素=字典

过滤路由更新中的网络(列表只能有一个入站和/或一个出站策略)

access_list

字符串

入站/出站访问列表

direction

字符串

过滤传入/传出路由更新

选择

  • "in"

  • "out"

outgoing_params

字典

仅指定传出更新的其他参数

id

字符串

对于 BGP,指定 AS 号。2 字节 AS 号(或)asdot (X.Y) 格式的 4 字节 AS 号(或)asplain 格式的 4 字节 AS 号

对于 OSPF,指定 OSPFv2 实例名称

route_type

字符串

路由类型

选择

  • "bgp"

  • "connected"

  • "dagr"

  • "ospf"

  • "static"

route_policy

字符串

用于过滤 OSPFv2 前缀的路由策略(仅用于传入更新)

external_out

字符串

启用/禁用将区域内前缀通告为外部前缀

选择

  • "enable"

  • "disable"

flood_reduction

字符串

启用/禁用 OSPFv2 洪泛减少

选择

  • "enable"

  • "disable"

hello_interval

整数

HELLO 数据包之间的间隔(<1-65535> 秒)

ignore_lsa_mospf

布尔值

收到 MOSPFv2 类型 6 LSA 时不发出抱怨

选择

  • false

  • true

布尔值

启用链路断开事件的快速或早期检测

选择

  • false

  • true

log_adjacency_changes

字典

记录邻接状态更改

detail

布尔值

记录所有状态更改

选择

  • false

  • true

disable

布尔值

禁用记录邻接更改

选择

  • false

  • true

set

布尔值

设置记录邻接

选择

  • false

  • true

loopback_stub_network

字符串

将环回通告为存根网络

选择

  • "enable"

  • "disable"

max_lsa

字典

限制非自身始发的 LSA 数量的功能

ignore_count

整数

设置邻接可以被抑制的次数计数

ignore_time

整数

设置所有邻接都被抑制的分钟数

reset_time

整数

设置 ignore-count 重置为零后的分钟数

threshold

整数

生成警告消息的阈值 (%)

warning_only

布尔值

当超过限制时记录警告消息

选择

  • false

  • true

max_metric

字典

设置最大度量值

router_lsa

字典

自身始发的路由器 LSA 中的最大度量值

external_lsa

字典

外部 LSA 配置

max_metric_value

整数

设置外部 LSA 的最大度量值

set

布尔值

设置外部 LSA 属性

选择

  • false

  • true

include_stub

布尔值

同时通告存根链路的最大度量值

选择

  • false

  • true

on_startup

字典

仅在启动时生效

set

布尔值

设置启动时属性

选择

  • false

  • true

wait_for_bgp_asn

整数

要等待的 BGP 的 ASN

wait_period

整数

启动后等待的秒数

set

布尔值

设置路由器 LSA 属性

选择

  • false

  • true

summary_lsa

字典

摘要 LSA 配置

max_metric_value

整数

摘要 LSA 的最大度量值

set

布尔值

设置摘要 LSA 属性

选择

  • false

  • true

message_digest_key

字典

消息摘要身份验证密码(密钥)

id

整数 / 必需

密钥 ID

md5

字典 / 必需

使用 MD5 算法

clear

布尔值

指定将跟随未加密的密码(密钥)

选择

  • false

  • true

encrypted

布尔值

指定将跟随加密的密码(密钥)

选择

  • false

  • true

password

字符串

OSPFv2 密码(密钥)

microloop_avoidance

字典

避免微环路

protected

布尔值

仅对受保护的前缀避免微环路)

选择

  • false

  • true

rib_update_delay

整数

在 SPF 和 RIB 更新之间引入的延迟

segment_routing

布尔值

启用分段路由微环路避免

选择

  • false

  • true

monitor_convergence

字典

启用 OSPFv2 路由收敛监控

prefix_list

字符串

启用单个前缀监控

track_external_routes

布尔值

启用跟踪外部(类型 5/7)前缀监控

选择

  • false

  • true

track_ip_frr

布尔值

启用跟踪 IP-Frr 收敛

选择

  • false

  • true

track_summary_routes

布尔值

启用跟踪摘要(区域间)前缀监控

选择

  • false

  • true

mpls

字典

配置 MPLS 路由协议参数

ldp

字典

配置 LDP 参数

auto_config

布尔值

启用 LDP IGP 接口自动配置

选择

  • false

  • true

sync

布尔值

启用 LDP IGP 同步

选择

  • false

  • true

sync_igp_shortcuts

布尔值

用于 IGP 快捷隧道的 LDP 同步

选择

  • false

  • true

traffic_eng

字典

用于 MPLS 流量工程的路由协议命令

autoroute_exclude

字典

排除使用 TE 隧道的 IP 地址目标

parameters

列表 / 元素=字符串

指定策略的参数值

route_policy

字符串

策略名称

igp_intact

布尔值

保留一个或多个带有隧道下一跳的 IPv4 下一跳

选择

  • false

  • true

ldp_sync_update

布尔值

启用 LDP 同步引起的度量传播

选择

  • false

  • true

multicast_intact

布尔值

将组播完整路径发布到 RIB

选择

  • false

  • true

router_id

字符串

系统的流量工程稳定 IP 地址

mtu_ignore

字符串

启用/禁用在 DBD 数据包中忽略 MTU

选择

  • "enable"

  • "disable"

network

字典

网络类型

broadcast

布尔值

指定 OSPFv2 广播多路访问网络

选择

  • false

  • true

non_broadcast

布尔值

指定 OSPFv2 NBMA 网络

选择

  • false

  • true

point_to_multipoint

布尔值

指定 OSPFv2 点到多点网络

选择

  • false

  • true

point_to_point

布尔值

指定 OSPFv2 点到点网络

选择

  • false

  • true

nsf

字典

不间断转发

cisco

字典

思科不间断转发

enforce_global

布尔值

当检测到整个 OSPFv2 进程的非 NSF 感知邻居时,取消 NSF 重新启动

选择

  • false

  • true

set

布尔值

启用思科 NSF

选择

  • false

  • true

flush_delay_time

整数

允许外部路由学习的最长时间

ietf

字典

IETF 平滑重启

helper_disable

布尔值

禁用路由器的辅助支持级别

选择

  • false

  • true

set

布尔值

仅启用 ietf 选项

选择

  • false

  • true

interval

整数

NSF 重新启动之间的最小间隔(<90-3600> 秒)

lifetime

整数

重新启动后最大路由生存期(<90-1800> 秒)

nsr

布尔值

为此进程中的所有 VRF 启用 NSR。“False”选项禁用此进程中所有 VRF 的 NSR

选择

  • false

  • true

packet_size

整数

要使用的 OSPFv2 数据包的大小。最小 = 576 最大 = MTU 字节

passive

字符串

启用/禁用被动

选择

  • "enable"

  • "disable"

prefix_suppression

字典

抑制前缀的通告

secondary_address

布尔值

启用/禁用辅助地址抑制

选择

  • false

  • true

set

布尔值

设置抑制选项

选择

  • false

  • true

priority

整数

路由器优先级

process_id

字符串 / 必需

OSPFv2 进程 ID

protocol_shutdown

字典

协议特定配置

host_mode

布尔值

仅允许发送到此框的流量(思科支持)

选择

  • false

  • true

limit

字典

传入优先级事件的高水位线

high

整数

当传入事件队列超过此值时,Hello 事件将被丢弃

low

整数

当传入事件队列超过此值时,DBD/LS 更新/请求数据包将被丢弃

medium

整数

当传入事件队列超过此值时,LSA ACK 将被丢弃

on_reload

布尔值

仅在重新加载后关闭

选择

  • false

  • true

set

布尔值

关闭 OSPFv2 协议

选择

  • false

  • true

redistribute

字典

从另一个路由协议重新分发信息

id

字符串

应用程序路由的 OnePK 应用程序名称(或)bgp 和 eigrp 的 AS 号(或)isis 和 ospf 的实例名称

level

整数

ISIS 级别

选择

  • 1

  • 2

  • 12

lsa_type_summary

布尔值

重分发路由的 LSA 类型 3

选择

  • false

  • true

match

字符串

路由的重分发。对于 OSPFv2 - 外部/内部/NSSA 外部 1/2。对于 EIGRP - 外部/内部

metric

整数

重分发路由的度量值

metric_type

整数

重分发路由的 OSPFv2 外部度量类型

选择

  • 1

  • 2

nssa_only

布尔值

仅重分发到 NSSA 区域

选择

  • false

  • true

preserve_med

布尔值

保留 BGP 路由的 MED

选择

  • false

  • true

route_policy

字典

将路由策略应用于重分发

name

字符串

策略名称

parameters

列表 / 元素=字符串

指定策略的参数值

route_type

字符串

要重分发的路由类型

选择

  • "application"

  • "bgp"

  • "connected"

  • "dagr"

  • "eigrp"

  • "isis"

  • "mobile"

  • "ospf"

  • "rip"

  • "static"

  • "subscriber"

tag

整数

设置重分发到 OSPFv2 的路由的标记

retransmit_interval

整数

LSA 重传之间的延迟

router_id

字符串

IPv4 地址格式 (A.B.C.D) 的 OSPFv2 路由器 ID

security_ttl

字典

启用安全性

hops

整数

允许的最大 IP 跳数 <1-254>

set

布尔值

启用 TTL 安全性

选择

  • false

  • true

summary_in

字符串

启用/禁用将外部前缀通告为区域间

选择

  • "enable"

  • "disable"

summary_prefix

列表 / 元素=字典

配置 IP 地址摘要

not_advertise

布尔值

抑制与指定前缀/掩码对匹配的路由

选择

  • false

  • true

prefix

字符串 / 必需

IP 摘要地址/掩码 (A.B.C.D/前缀)

tag

整数

设置标记

timers

字典

配置与计时器相关的常量

graceful_shutdown

字典

平滑关闭的计时器(思科支持)

initial_delay

整数

开始平滑关闭之前的延迟

retain_routes

整数

平滑关闭后保持路由活动的时间

lsa

字典

OSPFv2 全局 LSA 计时器

group_pacing

整数

OSPFv2 LSA 组步调计时器。刷新或最大化一组 LSA 之间的间隔

min_arrival

整数

OSPFv2 MinLSArrival 计时器。接受同一 LSA 之间的最小间隔(毫秒)

refresh

整数

OSPFv2 LSA 刷新间隔。自身始发的 LSA 应多久刷新一次(以秒为单位)

pacing_flood

整数

OSPFv2 洪泛步调计时器。在所有接口上步调洪泛的间隔(毫秒)

throttle

字典

OSPFv2 限制计时器

fast_reroute

整数

快速重路由限制计时器。SPF 结束和快速重路由计算开始之间的延迟(以毫秒为单位)

lsa_all

字典

所有类型的 OSPFv2 LSA 的 LSA 限制计时器

initial_delay

整数

以毫秒为单位生成 LSA 的第一次出现的延迟

max_delay

整数

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

min_delay

整数

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

spf

字典

OSPFv2 SPF 限制计时器

change_delay

整数

接收到 SPF 计算更改之间的延迟(以毫秒为单位)

max_wait

整数

SPF 计算的最大等待时间(以毫秒为单位)

second_delay

整数

第一次和第二次 SPF 计算之间的延迟(以毫秒为单位)

transmit_delay

整数

发送链路状态更新数据包所需的估计时间

weight

整数

接口权重

running_config

字符串

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

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

状态 parsedrunning_config 选项中读取配置,并根据资源模块的 argspec 将其转换为 Ansible 结构化数据,然后该值将在结果中的 parsed 键中返回。

state

字符串

配置应保留的状态。

选择

  • "merged" ←(默认)

  • "replaced"

  • "deleted"

  • "parsed"

  • "gathered"

  • "rendered"

  • "overridden"

注释

注意

示例

# Using merged

# Before state:
# -------------
#
# RP/0/RP0/CPU0:anton#show running-config router ospf
# Thu Jun 11 15:54:44.569 UTC
# % No such configuration item(s)
#

- name: Merge provided OSPFv2 configuration with the existing configuration
  cisco.iosxr.iosxr_ospfv2:
    config:
      processes:
        - process_id: '27'
          areas:
            - area_id: '10'
              hello_interval: 2
              authentication:
                keychain: ansi11393
        - process_id: '26'
          adjacency_stagger:
            max_adjacency: 20
            min_adjacency: 10
        - process_id: '10'
          authentication:
            keychain: ansible_test1102
          areas:
            - area_id: '11'
              default_cost: 5
              cost: 11
            - area_id: 22
              default_cost: 6
        - process_id: '30'
          areas:
            - area_id: 11
              default_cost: 5
            - area_id: 22
              default_cost: 6
          cost: 2
          default_metric: 10
          transmit_delay: 2
          hello_interval: 1
          dead_interval: 2
          retransmit_interval: 2
          weight: 2
          packet_size: 577
          priority: 1
          router_id: 2.2.2.2
          demand_circuit: enable
          passive: disable
          summary_in: enable
          flood_reduction: disable
          mtu_ignore: enable
          external_out: disable
    state: merged

# Task Output:
# ------------
#
# before: {}
#
# commands:
#   - router ospf 30
#   - cost 2
#   - weight 2
#   - passive disable
#   - priority 1
#   - flood-reduction disable
#   - default-metric 10
#   - router-id 2.2.2.2
#   - demand-circuit enable
#   - packet-size 577
#   - transmit-delay 2
#   - summary-in enable
#   - external-out disable
#   - dead-interval 2
#   - hello-interval 1
#   - retransmit-interval 2
#   - mtu-ignore enable
#   - area 11 default-cost 5
#   - area 22 default-cost 6
#   - router ospf 26
#   - adjacency stagger 10 20
#   - router ospf 10
#   - authentication keychain ansible_test1102
#   - area 11 default-cost 5
#   - area 11 cost 11
#   - area 22 default-cost 6
#   - router ospf 27
#   - area 10 authentication keychain ansi11393
#   - area 10 hello-interval 2
#
# after:
#     processes:
#     - areas:
#       - area_id: '11'
#         cost: 11
#         default_cost: 5
#       - area_id: '22'
#         default_cost: 6
#       authentication:
#         keychain: ansible_test1102
#       process_id: '10'
#     - adjacency_stagger:
#         max_adjacency: 20
#         min_adjacency: 10
#       process_id: '26'
#     - areas:
#       - area_id: '10'
#         authentication:
#           keychain: ansi11393
#         hello_interval: 2
#       process_id: '27'
#     - areas:
#       - area_id: '11'
#         default_cost: 5
#       - area_id: '22'
#         default_cost: 6
#       cost: 2
#       dead_interval: 2
#       default_metric: 10
#       demand_circuit: enable
#       external_out: disable
#       flood_reduction: disable
#       hello_interval: 1
#       mtu_ignore: enable
#       packet_size: 577
#       passive: disable
#       priority: 1
#       process_id: '30'
#       retransmit_interval: 2
#       router_id: 2.2.2.2
#       summary_in: enable
#       transmit_delay: 2
#       weight: 2
#
# After state:
# ------------
#
# router ospf 10
#  authentication keychain ansible_test1102
#  area 11
#   cost 11
#   default-cost 5
#  !
#  area 22
#   default-cost 6
#  !
# !
# router ospf 26
#  adjacency stagger 10 20
# !
# router ospf 27
#  area 10
#   authentication keychain ansi11393
#   hello-interval 2
#  !
# !
# router ospf 30
#  router-id 2.2.2.2
#  summary-in enable
#  external-out disable
#  cost 2
#  packet-size 577
#  weight 2
#  passive disable
#  priority 1
#  mtu-ignore enable
#  flood-reduction disable
#  dead-interval 2
#  retransmit-interval 2
#  demand-circuit enable
#  hello-interval 1
#  transmit-delay 2
#  default-metric 10
#  area 11
#   default-cost 5
#  !
#  area 22
#   default-cost 6
#  !
# !

# Using replaced
#
# Before state:
# -------------
#
#
# RP/0/RP0/CPU0:anton#show running-config router ospf
# Thu Jun 11 16:06:44.406 UTC
# router ospf 10
#  authentication keychain ansible_test1102
#  area 11
#   cost 11
#   default-cost 5
#  !
#  area 22
#   default-cost 6
#  !
# !
# router ospf 26
#  adjacency stagger 10 20
# !
# router ospf 27
#  area 10
#   authentication keychain ansi11393
#   hello-interval 2
#  !
# !
# router ospf 30
#  router-id 2.2.2.2
#  summary-in enable
#  external-out disable
#  cost 2
#  packet-size 577
#  weight 2
#  passive disable
#  priority 1
#  mtu-ignore enable
#  flood-reduction disable
#  dead-interval 2
#  retransmit-interval 2
#  demand-circuit enable
#  hello-interval 1
#  transmit-delay 2
#  default-metric 10
#  area 11
#   default-cost 5
#  !
#  area 22
#   default-cost 6
#  !
# !
#
- name: Replace running OSPFv2 routes configurations with provided config.
  cisco.iosxr.iosxr_ospfv2:
    config:
      processes:
        - process_id: 27
          areas:
            - area_id: 10
              hello_interval: 2
            - area_id: 20
              cost: 2
              default_cost: 2
              authentication:
                keychain: ansi11393
        - process_id: 26
          adjacency_stagger:
            min_adjacency: 10
            max_adjacency: 20
    state: replaced

# Task Output:
# ------------
#
# before:
#     processes:
#     - areas:
#       - area_id: '11'
#         cost: 11
#         default_cost: 5
#       - area_id: '22'
#         default_cost: 6
#       authentication:
#         keychain: ansible_test1102
#       process_id: '10'
#     - adjacency_stagger:
#         max_adjacency: 20
#         min_adjacency: 10
#       process_id: '26'
#     - areas:
#       - area_id: '10'
#         authentication:
#           keychain: ansi11393
#         hello_interval: 2
#       process_id: '27'
#     - areas:
#       - area_id: '11'
#         default_cost: 5
#       - area_id: '22'
#         default_cost: 6
#       cost: 2
#       dead_interval: 2
#       default_metric: 10
#       demand_circuit: enable
#       external_out: disable
#       flood_reduction: disable
#       hello_interval: 1
#       mtu_ignore: enable
#       packet_size: 577
#       passive: disable
#       priority: 1
#       process_id: '30'
#       retransmit_interval: 2
#       router_id: 2.2.2.2
#       summary_in: enable
#       transmit_delay: 2
#       weight: 2
#
# commands:
#   - router ospf 27
#   - no area 10 authentication keychain ansi11393
#   - area 20 authentication keychain ansi11393
#   - area 20 default-cost 2
#   - area 20 cost 2
#
# after:
#     processes:
#     - areas:
#       - area_id: '11'
#         cost: 11
#         default_cost: 5
#       - area_id: '22'
#         default_cost: 6
#       authentication:
#         keychain: ansible_test1102
#       process_id: '10'
#     - adjacency_stagger:
#         max_adjacency: 20
#         min_adjacency: 10
#       process_id: '26'
#     - areas:
#       - area_id: '10'
#         hello_interval: 2
#       - area_id: '20'
#         authentication:
#           keychain: ansi11393
#         cost: 2
#         default_cost: 2
#       process_id: '27'
#     - areas:
#       - area_id: '11'
#         default_cost: 5
#       - area_id: '22'
#         default_cost: 6
#       cost: 2
#       dead_interval: 2
#       default_metric: 10
#       demand_circuit: enable
#       external_out: disable
#       flood_reduction: disable
#       hello_interval: 1
#       mtu_ignore: enable
#       packet_size: 577
#       passive: disable
#       priority: 1
#       process_id: '30'
#       retransmit_interval: 2
#       router_id: 2.2.2.2
#       summary_in: enable
#       transmit_delay: 2
#       weight: 2
#
# After state:
# ------------
#
# RP/0/RP0/CPU0:anton(config)#do show running-config router ospf
# Thu Jun 11 16:40:31.038 UTC
# router ospf 10
#  authentication keychain ansible_test1102
#  area 11
#   cost 11
#   default-cost 5
#  !
#  area 22
#   default-cost 6
#  !
# !
# router ospf 26
#  adjacency stagger 10 20
# !
# router ospf 27
#  area 10
#   hello-interval 2
#  !
#  area 20
#   cost 2
#   authentication keychain ansi11393
#   default-cost 2
#  !
# !
# router ospf 30
#  router-id 2.2.2.2
#  summary-in enable
#  external-out disable
#  cost 2
#  packet-size 577
#  weight 2
#  passive disable
#  priority 1
#  mtu-ignore enable
#  flood-reduction disable
#  dead-interval 2
#  retransmit-interval 2
#  demand-circuit enable
#  hello-interval 1
#  transmit-delay 2
#  default-metric 10
#  area 11
#   default-cost 5
#  !
#  area 22
#   default-cost 6
#  !
# !

# Using overridden
#
# Before state:
# -------------
#
# RP/0/RP0/CPU0:anton#show running-config router ospf
# Thu Jun 11 16:06:44.406 UTC
# router ospf 10
#  authentication keychain ansible_test1102
#  area 11
#   cost 11
#   default-cost 5
#  !
#  area 22
#   default-cost 6
#  !
# !
# router ospf 26
#  adjacency stagger 10 20
# !
# router ospf 27
#  area 10
#   hello-interval 2
#  !
#  area 20
#   cost 2
#   authentication keychain ansi11393
#   default-cost 2
#  !
# !
# router ospf 30
#  router-id 2.2.2.2
#  summary-in enable
#  external-out disable
#  cost 2
#  packet-size 577
#  weight 2
#  passive disable
#  priority 1
#  mtu-ignore enable
#  flood-reduction disable
#  dead-interval 2
#  retransmit-interval 2
#  demand-circuit enable
#  hello-interval 1
#  transmit-delay 2
#  default-metric 10
#  area 11
#   default-cost 5
#  !
#  area 22
#   default-cost 6
#  !
# !

- name: Override existing OSPFv2 configurations with provided config.
  cisco.iosxr.iosxr_ospfv2:
    config:
      processes:
        - process_id: 27
          areas:
            - area_id: 10
              hello_interval: 2
              authentication:
                keychain: ansi11393
            - area_id: 20
              cost: 2
              default_cost: 2
              authentication:
                keychain: ansi11393
        - process_id: 26
          adjacency_stagger:
            min_adjacency: 10
            max_adjacency: 20
    state: overridden


#
# Task Output:
# ------------
#
# before:
#     processes:
#     - areas:
#       - area_id: '11'
#         cost: 11
#         default_cost: 5
#       - area_id: '22'
#         default_cost: 6
#       authentication:
#         keychain: ansible_test1102
#       process_id: '10'
#     - adjacency_stagger:
#         max_adjacency: 20
#         min_adjacency: 10
#       process_id: '26'
#     - areas:
#       - area_id: '10'
#         hello_interval: 2
#       - area_id: '20'
#         authentication:
#           keychain: ansi11393
#         cost: 2
#         default_cost: 2
#       process_id: '27'
#     - areas:
#       - area_id: '11'
#         default_cost: 5
#       - area_id: '22'
#         default_cost: 6
#       cost: 2
#       dead_interval: 2
#       default_metric: 10
#       demand_circuit: enable
#       external_out: disable
#       flood_reduction: disable
#       hello_interval: 1
#       mtu_ignore: enable
#       packet_size: 577
#       passive: disable
#       priority: 1
#       process_id: '30'
#       retransmit_interval: 2
#       router_id: 2.2.2.2
#       summary_in: enable
#       transmit_delay: 2
#       weight: 2

#
# commands:
#   - router ospf 10
#   - no authentication keychain ansible_test1102
#   - no area 11 default-cost 5
#   - no area 11 cost 11
#   - no area 22 default-cost 6
#   - router ospf 30
#   - no cost 2
#   - no weight 2
#   - no passive disable
#   - no priority 1
#   - no flood-reduction disable
#   - no default-metric 10
#   - no router-id 2.2.2.2
#   - no demand-circuit enable
#   - no packet-size 577
#   - no transmit-delay 2
#   - no summary-in enable
#   - no external-out disable
#   - no dead-interval 2
#   - no hello-interval 1
#   - no retransmit-interval 2
#   - no mtu-ignore enable
#   - no area 11 default-cost 5
#   - no area 22 default-cost 6
#   - router ospf 27
#   - area 10 authentication keychain ansi11393
#
# after:
#     processes:
#     - process_id: '10'
#     - adjacency_stagger:
#         max_adjacency: 20
#         min_adjacency: 10
#       process_id: '26'
#     - areas:
#       - area_id: '10'
#         authentication:
#           keychain: ansi11393
#         hello_interval: 2
#       - area_id: '20'
#         authentication:
#           keychain: ansi11393
#         cost: 2
#         default_cost: 2
#       process_id: '27'
#     - process_id: '30'
#
# After state:
# ------------
#
# RP/0/RP0/CPU0:anton#show running-config router ospf
# Thu Jun 11 16:50:36.332 UTC
# router ospf 10
#  area 11
#  !
#  area 22
#  !
# !
# router ospf 26
#  adjacency stagger 10 20
# !
# router ospf 27
#  area 10
#   authentication keychain ansi11393
#   hello-interval 2
#  !
#  area 20
#   cost 2
#   authentication keychain ansi11393
#   default-cost 2
#  !
# !
# router ospf 30
#  area 11
#  !
#  area 22
#  !
# !
#

# Using deleted
#
# Before state:
# -------------
#
# RP/0/RP0/CPU0:anton#show running-config router ospf
# Thu Jun 11 16:06:44.406 UTC
# router ospf 10
#  authentication keychain ansible_test1102
#  area 11
#   cost 11
#   default-cost 5
#  !
#  area 22
#   default-cost 6
#  !
# !
# router ospf 26
#  adjacency stagger 10 20
# !
# router ospf 27
#  area 10
#   authentication keychain ansi11393
#   hello-interval 2
#  !
#  area 20
#   cost 2
#   authentication keychain ansi11393
#   default-cost 2
#  !
# !
# router ospf 30
#  router-id 2.2.2.2
#  summary-in enable
#  external-out disable
#  cost 2
#  packet-size 577
#  weight 2
#  passive disable
#  priority 1
#  mtu-ignore enable
#  flood-reduction disable
#  dead-interval 2
#  retransmit-interval 2
#  demand-circuit enable
#  hello-interval 1
#  transmit-delay 2
#  default-metric 10
#  area 11
#   default-cost 5
#  !
#  area 22
#   default-cost 6
#  !
# !

- name: Deleted provided ospfv2 processes.
  cisco.iosxr.iosxr_ospfv2:
    config:
      processes:
        - process_id: '10'
        - process_id: '26'
        - process_id: '27'
        - process_id: '30'
    state: deleted


#
# Task Output:
# ------------
#
# before:
#     processes:
#     - areas:
#       - area_id: '11'
#         cost: 11
#         default_cost: 5
#       - area_id: '22'
#         default_cost: 6
#       authentication:
#         keychain: ansible_test1102
#       process_id: '10'
#     - adjacency_stagger:
#         max_adjacency: 20
#         min_adjacency: 10
#       process_id: '26'
#     - areas:
#       - area_id: '10'
#         authentication:
#           keychain: ansi11393
#         hello_interval: 2
#       - area_id: '20'
#         authentication:
#           keychain: ansi11393
#         cost: 2
#         default_cost: 2
#       process_id: '27'
#     - areas:
#       - area_id: '11'
#         default_cost: 5
#       - area_id: '22'
#         default_cost: 6
#       cost: 2
#       dead_interval: 2
#       default_metric: 10
#       demand_circuit: enable
#       external_out: disable
#       flood_reduction: disable
#       hello_interval: 1
#       mtu_ignore: enable
#       packet_size: 577
#       passive: disable
#       priority: 1
#       process_id: '30'
#       retransmit_interval: 2
#       router_id: 2.2.2.2
#       summary_in: enable
#       transmit_delay: 2
#       weight: 2
#
# commands:
#   - router ospf 10
#   - no authentication keychain ansible_test1102
#   - no area 11 default-cost 5
#   - no area 11 cost 11
#   - no area 22 default-cost 6
#   - router ospf 26
#   - no adjacency stagger 10 20
#   - router ospf 27
#   - no area 10 authentication keychain ansi11393
#   - no area 10 hello-interval 2
#   - no area 20 authentication keychain ansi11393
#   - no area 20 default-cost 2
#   - no area 20 cost 2
#   - router ospf 30
#   - no cost 2
#   - no weight 2
#   - no passive disable
#   - no priority 1
#   - no flood-reduction disable
#   - no default-metric 10
#   - no router-id 2.2.2.2
#   - no demand-circuit enable
#   - no packet-size 577
#   - no transmit-delay 2
#   - no summary-in enable
#   - no external-out disable
#   - no dead-interval 2
#   - no hello-interval 1
#   - no retransmit-interval 2
#   - no mtu-ignore enable
#   - no area 11 default-cost 5
#   - no area 22 default-cost 6
#
# after:
#     processes:
#     - process_id: '10'
#     - process_id: '26'
#     - process_id: '27'
#     - process_id: '30'

# After state:
# ------------
#
# RP/0/RP0/CPU0:anton(config)#show running-config router ospf
# Thu Jun 11 17:07:34.218 UTC
# router ospf 10
#  area 11
#  !
#  area 22
#  !
# !
# router ospf 26
# !
# router ospf 27
#  area 10
#  !
#  area 20
#  !
# !
# router ospf 30
#  area 11
#  !
#  area 22
#  !
# !


# Using parsed
# parsed.cfg
# ------------
# Thu Jun 11 17:28:51.918 UTC
# router ospf 10
#  authentication keychain ansible_test1102
#  area 11
#   cost 11
#   default-cost 5
#  !
#  area 22
#   default-cost 6
#  !
# !
# router ospf 26
#  authentication message-digest keychain ansible1101pass
#  adjacency stagger 10 20
# !
# router ospf 27
#  area 10
#   authentication keychain ansi11393
#   hello-interval 2
#  !
# !
# router ospf 30
#  router-id 2.2.2.2
#  summary-in enable
#  external-out disable
#  cost 2
#  packet-size 577
#  weight 2
#  passive disable
#  priority 1
#  mtu-ignore enable
#  flood-reduction disable
#  dead-interval 2
#  retransmit-interval 2
#  demand-circuit enable
#  hello-interval 1
#  transmit-delay 2
#  default-metric 10
#  area 11
#   default-cost 5
#  !
#  area 22
#   default-cost 6
#  !
# !
#
- name: Parsed the device configuration to get output commands
  cisco.iosxr.iosxr_ospfv2:
    running_config: "{{ lookup('file', './parsed.cfg') }}"
    state: parsed
#
# Task Output:
# ------------
#
# parsed:
#     processes:
#     - areas:
#       - area_id: '11'
#         cost: 11
#         default_cost: 5
#       - area_id: '22'
#         default_cost: 6
#       authentication:
#         keychain: ansible_test1102
#       process_id: '10'
#     - adjacency_stagger:
#         max_adjacency: 20
#         min_adjacency: 10
#       authentication:
#         message_digest:
#           keychain: ansible1101pass
#       process_id: '26'
#     - areas:
#       - area_id: '10'
#         authentication:
#           keychain: ansi11393
#         hello_interval: 2
#       process_id: '27'
#     - areas:
#       - area_id: '11'
#         default_cost: 5
#       - area_id: '22'
#         default_cost: 6
#       cost: 2
#       dead_interval: 2
#       default_metric: 10
#       demand_circuit: enable
#       external_out: disable
#       flood_reduction: disable
#       hello_interval: 1
#       mtu_ignore: enable
#       packet_size: 577
#       passive: disable
#       priority: 1
#       process_id: '30'
#       retransmit_interval: 2
#       router_id: 2.2.2.2
#       summary_in: enable
#       transmit_delay: 2
#       weight: 2

# Using rendered
#
- name: Render the commands for provided  configuration
  cisco.iosxr.iosxr_ospfv2:
    config:
      processes:
        - process_id: 27
          areas:
            - area_id: 10
              hello_interval: 2
              authentication:
                keychain: ansi11393
        - process_id: 26
          adjacency_stagger:
            min_adjacency: 10
            max_adjacency: 20
        - process_id: 10
          authentication:
            keychain: ansible_test1102
          areas:
            - area_id: 11
              default_cost: 5
              cost: 11
            - area_id: 22
              default_cost: 6
        - process_id: 30
          areas:
            - area_id: 11
              default_cost: 5
            - area_id: 22
              default_cost: 6
          cost: 2
          default_metric: 10
          transmit_delay: 2
          hello_interval: 1
          dead_interval: 2
          retransmit_interval: 2
          weight: 2
          packet_size: 577
          priority: 1
          router_id: 2.2.2.2
          demand_circuit: enable
          passive: disable
          summary_in: enable
          flood_reduction: disable
          mtu_ignore: enable
          external_out: disable
    state: rendered


#
# Task Output:
# ------------
#
# rendered:
#   - router ospf 27
#   - area 10 authentication keychain ansi11393
#   - area 10 hello-interval 2
#   - router ospf 26
#   - adjacency stagger 10 20
#   - router ospf 10
#   - authentication keychain ansible_test1102
#   - area 11 default-cost 5
#   - area 11 cost 11
#   - area 22 default-cost 6
#   - router ospf 30
#   - cost 2
#   - weight 2
#   - passive disable
#   - priority 1
#   - flood-reduction disable
#   - default-metric 10
#   - router-id 2.2.2.2
#   - demand-circuit enable
#   - packet-size 577
#   - transmit-delay 2
#   - summary-in enable
#   - external-out disable
#   - dead-interval 2
#   - hello-interval 1
#   - retransmit-interval 2
#   - mtu-ignore enable
#   - area 11 default-cost 5
#   - area 22 default-cost 6


# Using gathered
#
# Before state:
# -------------
#
# RP/0/RP0/CPU0:anton#show running-config router ospf
# Thu Jun 11 16:06:44.406 UTC
# router ospf 10
#  authentication keychain ansible_test1102
#  area 11
#   cost 11
#   default-cost 5
#  !
#  area 22
#   default-cost 6
#  !
# !
# router ospf 26
#  adjacency stagger 10 20
# !
# router ospf 27
#  area 10
#   authentication keychain ansi11393
#   hello-interval 2
#  !
#  area 20
#  !
# !
# router ospf 30
#  router-id 2.2.2.2
#  summary-in enable
#  external-out disable
#  cost 2
#  packet-size 577
#  weight 2
#  passive disable
#  priority 1
#  mtu-ignore enable
#  flood-reduction disable
#  dead-interval 2
#  retransmit-interval 2
#  demand-circuit enable
#  hello-interval 1
#  transmit-delay 2
#  default-metric 10
#  area 11
#   default-cost 5
#  !
#  area 22
#   default-cost 6
#  !
# !
#
- name: Gather ospfv2 routes configuration
  cisco.iosxr.iosxr_ospfv2:
    state: gathered
#
#
# Task Output:
# ------------
#
# gathered:
#     processes:
#     - areas:
#       - area_id: '11'
#         cost: 11
#         default_cost: 5
#       - area_id: '22'
#         default_cost: 6
#       authentication:
#         keychain: ansible_test1102
#       process_id: '10'
#     - adjacency_stagger:
#         max_adjacency: 20
#         min_adjacency: 10
#       process_id: '26'
#     - areas:
#       - area_id: '10'
#         authentication:
#           keychain: ansi11393
#         hello_interval: 2
#       process_id: '27'
#     - areas:
#       - area_id: '11'
#         default_cost: 5
#       - area_id: '22'
#         default_cost: 6
#       cost: 2
#       dead_interval: 2
#       default_metric: 10
#       demand_circuit: enable
#       external_out: disable
#       flood_reduction: disable
#       hello_interval: 1
#       mtu_ignore: enable
#       packet_size: 577
#       passive: disable
#       priority: 1
#       process_id: '30'
#       retransmit_interval: 2
#       router_id: 2.2.2.2
#       summary_in: enable
#       transmit_delay: 2
#       weight: 2
#
# After state:
# -------------
#
# RP/0/RP0/CPU0:anton#show running-config router ospf
# Thu Jun 11 16:06:44.406 UTC
# router ospf 10
#  authentication keychain ansible_test1102
#  area 11
#   cost 11
#   default-cost 5
#  !
#  area 22
#   default-cost 6
#  !
# !
# router ospf 26
#  authentication message-digest keychain ansible1101pass
#  adjacency stagger 10 20
# !
# router ospf 27
#  area 10
#  authentication keychain ansi11393
#   hello-interval 2
# !
# !
# router ospf 30
# router-id 2.2.2.2
# summary-in enable
# external-out disable
# cost 2
# packet-size 577
# weight 2
# passive disable
# priority 1
# mtu-ignore enable
# flood-reduction disable
# dead-interval 2
# retransmit-interval 2
# demand-circuit enable
# hello-interval 1
# transmit-delay 2
# default-metric 10
# area 11
#  default-cost 5
# !
# area 22
#  default-cost 6
# !
# !
#

返回值

通用返回值记录在 此处,以下是此模块独有的字段

描述

after

字典

生成的配置模型调用。

返回: 更改时

示例: "返回的配置始终与\n 上述参数的格式相同。\n"

before

字典

模型调用之前的配置。

返回: 始终

示例: "返回的配置始终与\n 上述参数的格式相同。\n"

commands

列表 / 元素=字符串

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

返回: 始终

示例: ["router ospf 30", "authentication message-digest keychain 'ansible1101pass'"]

已收集

字典

从远程设备收集的网络资源信息,以结构化数据的形式呈现。

返回:stategathered

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

已解析

字典

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

返回:stateparsed

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

已渲染

列表 / 元素=字符串

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

返回:staterendered

示例: ["router ospf 27", "area 10 authentication keychain ansi11393"]

作者

  • Rohit Thakur (@rohitthakur2590)