cisco.ios.ios_ospfv2 模块 – 用于配置 OSPFv2 的资源模块。
注意
此模块是 cisco.ios 集合(版本 9.0.3)的一部分。
如果您使用的是 ansible 包,则可能已经安装了此集合。 它不包含在 ansible-core 中。 要检查是否已安装,请运行 ansible-galaxy collection list。
要安装它,请使用:ansible-galaxy collection install cisco.ios。
要在 playbook 中使用它,请指定:cisco.ios.ios_ospfv2。
cisco.ios 1.0.0 中的新增功能
概要
- 此模块在 IOS 平台上配置和管理开放最短路径优先 (OSPF) 版本 2。 
参数
| 参数 | 注释 | 
|---|---|
| OSPF 选项的字典。 | |
| OSPF 实例配置列表。 | |
| 路由器地址族配置模式 | |
| 将命令设置为其默认值 选项 
 | |
| 修改 snmp 参数 配置 SNMP 上下文名称 | |
| 将路由协议与拓扑实例关联 | |
| 进入路由器拓扑子模式 选项 
 | |
| 路由拓扑实例名称 | |
| 配置路由协议拓扑 tid 注意,请参考供应商文档以获取有效值 选项 
 | |
| 配置控制邻接关系的形成 | |
| 允许形成的最大邻接关系数量 请参考供应商文档以获取有效值 | |
| 允许在一个区域中形成的初始邻接关系数量 请参考供应商文档以获取有效值 | |
| 无初始值 选项 
 | |
| OSPF 区域参数 | |
| OSPF 区域 ID,以十进制值表示。 请参阅供应商文档以获取有效值。 OSPF 区域 ID,以 IP 地址格式(例如 A.B.C.D)表示 | |
| 区域身份验证 | |
| 启用区域身份验证 选项 
 | |
| 使用 IPsec 身份验证 选项 
 | |
| 启用特定区域的功能 启用从基本拓扑中排除链接 选项 
 | |
| 设置 NSSA/存根区域的汇总默认成本 存根的通告外部路由指标 注意,请参考供应商文档以获取各自的有效值 | |
| 过滤 OSPF 区域之间的网络 | |
| 应用于发送到此区域和从此区域发送的过滤网络的方向。 选项 
 | |
| IP 前缀列表的名称 | |
| 指定 NSSA 区域 | |
| 将 Type 7 默认路由引入 NSSA 区域 | |
| OSPF 默认指标 | |
| 默认路由的 OSPF 指标类型 OSPF 链路状态类型 选项 
 | |
| 限制默认通告到此 NSSA 区域 选项 
 | |
| 不要将特定于域的功能发送到 NSSA 选项 
 | |
| 不重新分发到此 NSSA 区域 选项 
 | |
| 不要将汇总 LSA 发送到 NSSA 选项 
 | |
| 启用 NSSA 区域 选项 
 | |
| 转换 LSA 始终在此 ABR 上转换 LSA 在转换的 LSA 中抑制转发地址 选项 
 | |
| 汇总匹配地址/掩码的路由(仅限边界路由器) | |
| 要匹配的 IP 地址 | |
| 通告此范围(默认) 由于启用时通告不会显示在 running-config 中,因此对于 playbook 的第二次或后续运行,将不会保持该 playbook 的幂等性。 选项 
 | |
| 此范围的用户指定指标 | |
| 地址的 IP 掩码 | |
| 不通告此范围 选项 
 | |
| 定义一个虚链接及其参数 | |
| 将成本与虚链接关联 虚链接的成本 注意,请参考供应商文档以获取各自的有效值 | |
| 与虚链接目标关联的 IP 地址 (A.B.C.D) | |
| 与虚链接源关联的 IP 地址 (A.B.C.D) | |
| TTL 安全检查 允许的最大 IP 跳数 | |
| 指定存根区域 主干网不能配置为存根区域 | |
| 不要将特定于域的功能发送到存根区域 选项 
 | |
| 不要将汇总 LSA 发送到存根区域 选项 
 | |
| 启用存根区域 选项 
 | |
| 根据带宽计算 OSPF 接口成本 | |
| 使用参考带宽方法分配 OSPF 成本 注意,请参考供应商文档以获取各自的有效值 | |
| 启用 OSPF 自动成本 选项 
 | |
| BFD 配置命令 在所有接口上启用 BFD 选项 
 | |
| 启用特定的 OSPF 功能 | |
| 链路本地信令 (LLS) 支持 选项 
 | |
| 不透明 LSA 选项 
 | |
| 传输区域 选项 
 | |
| 不执行 PE 特定检查 选项 
 | |
| OSPF 路由器兼容性列表 | |
| 与 RFC 1583 兼容 选项 
 | |
| 与 RFC 1587 兼容 选项 
 | |
| 支持 DBD 交换优化 选项 
 | |
| 控制默认信息的分布 | |
| 始终通告默认路由 选项 
 | |
| OSPF 默认指标 注意,请参考供应商文档以获取各自的有效值 | |
| 默认路由的 OSPF 指标类型 请注意,有效范围请参考各自的供应商文档 | |
| 发布默认路由 选项 
 | |
| 路由映射参考名称 | |
| 设置重分发路由的度量值 | |
| 启用或禁用丢弃路由安装 | |
| 丢弃重分发汇总路由的路由 重分发汇总路由的管理距离 请注意,有效范围请参考各自的供应商文档 | |
| 丢弃汇总内部路由的路由 汇总内部路由的管理距离 请注意,有效范围请参考各自的供应商文档 | |
| 启用丢弃路由安装 选项 
 | |
| 定义管理距离 | |
| OSPF 管理距离 | |
| 访问控制列表名称/编号 | |
| IP 源地址 | |
| 管理距离 | |
| 通配符位 | |
| OSPF 距离 | |
| 外部类型 5 和类型 7 路由 | |
| 区域间路由 | |
| 区域内路由 | |
| 在路由更新中过滤网络 | |
| IP 访问控制列表 | |
| 过滤传入和传出的路由更新。 选项 
 | |
| 接口配置(千兆以太网 A/B) 对传入流量有效 | |
| IP 访问控制列表名称/编号 | |
| 协议配置 (bgp 1)。 对传出流量有效 | |
| 在路由更新中过滤前缀 | |
| 过滤传入和传出的路由更新。 选项 
 | |
| 用于基于网关过滤传入更新的网关名称 | |
| 接口配置(千兆以太网 A/B) 对传入流量有效 | |
| IP 前缀列表的名称 | |
| 协议配置 (bgp 1)。 对传出流量有效 | |
| 在路由更新中过滤前缀 | |
| 路由映射名称 | |
| OSPF 域 ID | |
| IP 地址 | |
| IP 地址格式的 OSPF 域 ID | |
| 辅助域 ID 选项 
 | |
| 空域 ID 选项 
 | |
| OSPF 域标签,即 OSPF 域标签 - 32 位值 请注意,有效范围请参考各自的供应商文档 | |
| 事件日志记录 | |
| 启用事件日志记录 选项 
 | |
| 当日志缓冲区满时禁用日志记录 选项 
 | |
| 暂停事件日志记录 选项 
 | |
| 事件日志中存储的最大事件数 注意,请参考供应商文档以获取各自的有效值 | |
| 交互式帮助系统的描述 选项 
 | |
| 不抱怨特定事件 在接收指定类型的 LSA(MOSPF 类型 6 LSA)时不抱怨 选项 
 | |
| 接口 ID 的来源 SNMP MIB ifIndex 选项 
 | |
| 启用增量 SPF 计算 选项 
 | |
| 限制特定的 OSPF 功能以及 LS 更新、DBD 和 LS 请求重传 | |
| 按需电路重传 | |
| 禁用此功能 选项 
 | |
| 最大重传次数 | |
| 非按需电路重传 | |
| 禁用此功能 选项 
 | |
| 最大重传次数 | |
| 启用或禁用将本地 RIB 用作路由标准 | |
| 启用将本地 RIB 用作路由标准 选项 
 | |
| 本地 RIB 用于验证外部/NSSA 转发地址 选项 
 | |
| 本地 RIB 用作区域间汇总的标准 选项 
 | |
| 本地 RIB 用作 NSSA 转换的标准 选项 
 | |
| 记录邻接状态的变化 | |
| 记录所有状态更改 选项 
 | |
| 记录邻接状态的变化 选项 
 | |
| 要接受的最大非自生成 LSA 数量 | |
| 可以抑制邻接关系的最大次数 注意,请参考供应商文档以获取各自的有效值 | |
| 抑制所有邻接关系的分钟数 注意,请参考供应商文档以获取各自的有效值 | |
| 要接受的最大非自生成 LSA 数量 注意,请参考供应商文档以获取各自的有效值 | |
| 忽略计数重置为零后的分钟数 注意,请参考供应商文档以获取各自的有效值 | |
| 生成警告消息的阈值 (%) 注意,请参考供应商文档以获取各自的有效值 | |
| 仅在超出限制时发出警告消息 选项 
 | |
| 设置最大度量 | |
| 使用最大度量值覆盖外部 LSA 度量 覆盖外部 LSA 中的度量 注意,请参考供应商文档以获取各自的有效值 | |
| 为路由器 LSA 中的存根链路设置最大度量 选项 
 | |
| 在重新启动后暂时设置最大度量 | |
| 路由器 LSA 以最大度量值发起的时间(以秒为单位) 请注意,有效范围请参考各自的供应商文档 | |
| 让 BGP 决定何时发起具有正常度量的路由器 LSA 选项 
 | |
| 自发起的路由器 LSA 中的最大度量 选项 
 | |
| 使用最大度量值覆盖汇总 LSA 度量 请注意,有效范围请参考各自的供应商文档 | |
| 通过多条路径转发数据包 路径数 | |
| 配置 MPLS 路由协议参数 | |
| MPLS LDP 的路由协议命令 | |
| MPLS LDP 的路由协议命令 | |
| 配置 OSPF 区域以运行 MPLS LDP | |
| 配置 LDP 自动配置并设置配置 选项 
 | |
| 配置 LDP-IGP 同步 选项 
 | |
| 让 BGP 决定何时发起具有正常度量的路由器 LSA | |
| 配置 OSPF 区域以运行 MPLS 流量工程 OSPF 区域 ID,以十进制值或 IP 地址格式表示 | |
| MPLS TE 自动路由排除 基于 IP 前缀列表的名称过滤前缀 | |
| 此 OSPF 进程的 MPLS TE 接口配置 | |
| 将此接口的 MPLS TE 信息通告到区域 OSPF 区域 ID,以十进制值表示 | |
| TE 接口配置(千兆以太网 A/B) | |
| 流量工程网状组通告 | |
| 将洪泛范围配置为区域 | |
| 网状组 ID | |
| 接口配置(千兆以太网 A/B) | |
| MPLS TE 和 PIM 交互 选项 
 | |
| 路由器接口配置(千兆以太网 A/B) | |
| 指定邻居路由器 | |
| 邻居地址 (A.B.C.D) | |
| 点对多点邻居度量的 OSPF 开销 请注意,有效范围请参考各自的供应商文档 | |
| 在点对多点邻居的同步和洪泛期间过滤 OSPF LSA 过滤所有传出 LSA 选项 
 | |
| 非广播邻居的 OSPF 死路由器轮询间隔(以秒为单位) | |
| 非广播邻居优先级的 OSPF 优先级 | |
| 在 IP 网络上启用路由 | |
| 网络号 | |
| 设置 OSPF 区域 ID | |
| OSPF 通配符位 | |
| 不间断转发 | |
| 思科不间断转发 | |
| 禁用辅助支持 选项 
 | |
| 辅助支持 选项 
 | |
| IETF 平滑重启 | |
| 禁用辅助支持 选项 
 | |
| 辅助支持 选项 
 | |
| 启用辅助严格 LSA 检查 选项 
 | |
| 抑制接口(千兆以太网 A/B)上的路由更新 具有相应接口编号的接口名称 被动接口参数已弃用,引入了具有附加功能的新参数被动接口,此属性将在 2026-07-18 之后删除。 | |
| 抑制接口上的路由更新 | |
| 抑制所有接口上的路由更新 选项 
 | |
| 抑制/取消抑制接口上的路由更新 | |
| 接口名称(千兆以太网 A/B) | |
| 抑制/取消抑制路由更新 选项 
 | |
| 启用前缀抑制 选项 
 | |
| OSPF 拓扑优先级 注意,请参考供应商文档以获取各自的有效值 | |
| 进程 ID | |
| Hello/路由器进程队列深度 | |
| OSPF Hello 进程队列深度 | |
| 队列中的最大数据包数 | |
| 无限制队列深度 选项 
 | |
| OSPF 路由器进程队列深度 | |
| 队列中的最大数据包数 | |
| 无限制队列深度 选项 
 | |
| 此 OSPF 进程的路由器 ID 地址 IP 地址格式的 OSPF 路由器 ID (A.B.C.D) | |
| 关闭路由器进程 选项 
 | |
| 配置 IP 地址汇总 | |
| IP 汇总地址 | |
| IP 汇总掩码 | |
| 不通告或转换 选项 
 | |
| 将汇总限制为 NSSA 区域 选项 
 | |
| 设置标签 | |
| 调整路由计时器 | |
| OSPF LSA 计时器,到达计时器 接受同一 LSA 之间的最小间隔(以毫秒为单位) 注意,请参考供应商文档以获取各自的有效值 | |
| OSPF 步调计时器 | |
| OSPF 洪泛步调计时器 在接口上限制洪泛的最小间隔(以毫秒为单位) 注意,请参考供应商文档以获取各自的有效值 | |
| OSPF LSA 组步调计时器 刷新或最大化一组 LSA 之间的间隔(以秒为单位) 注意,请参考供应商文档以获取各自的有效值 | |
| OSPF 重传步调计时器 邻居重传之间的最小间隔(以毫秒为单位) 注意,请参考供应商文档以获取各自的有效值 | |
| OSPF 限制计时器 | |
| OSPF LSA 限制计时器 | |
| 生成首次出现的 LSA 的延迟(以毫秒为单位) 注意,请参考供应商文档以获取各自的有效值 | |
| 在生成同一 LSA 之间的最大延迟(以毫秒为单位) 注意,请参考供应商文档以获取各自的有效值 | |
| 在生成同一 LSA 之间的最小延迟(以毫秒为单位) 注意,请参考供应商文档以获取各自的有效值 | |
| OSPF SPF 限制计时器 - 接收到 SPF 计算更改之间的延迟(以毫秒为单位)- 请注意,有关各自的有效值,请参阅供应商文档 | |
| 第一次和第二次 SPF 计算之间的延迟(以毫秒为单位) 注意,请参考供应商文档以获取各自的有效值 | |
| SPF 计算的最大等待时间(以毫秒为单位) 注意,请参考供应商文档以获取各自的有效值 | |
| 接收到 SPF 计算更改之间的延迟(以毫秒为单位) 注意,请参考供应商文档以获取各自的有效值 | |
| 如何在备用路径上计算流量共享 所有流量在最小度量路径之间共享 为等价路径使用不同的接口 选项 
 | |
| TTL 安全检查 | |
| 允许的最大 IP 跳数 注意,请参考供应商文档以获取各自的有效值 | |
| 在所有接口上启用 TTL 安全 选项 
 | |
| 指定 VPN 路由/转发实例的参数 | |
| 此选项仅与状态 parsed 一起使用。 此选项的值应是通过执行命令 sh running-config | section ^router ospf 从 IOS 设备收到的输出。 状态 parsed 从  | |
| 配置应保留的状态 状态 rendered、gathered 和 parsed 不会对设备执行任何更改。 状态 rendered 将  gathered 状态将从设备获取运行配置,并按照资源模块参数规范将其转换为结构化数据,该值将返回到结果中的 gathered 键中。 parsed 状态从  选项 
 | 
说明
注意
- 已在 CML 上的 Cisco IOSXE 版本 17.3 中测试过。 
- 此模块与连接 - network_cli一起工作。请参阅 https://docs.ansible.org.cn/ansible/latest/network/user_guide/platform_ios.html
示例
# Using merged
# Before state:
# -------------
#
# router-ios#sh running-config | section ^router ospf
# router-ios#
- name: Merge provided OSPF V2 configuration
  cisco.ios.ios_ospfv2:
    config:
      processes:
        - process_id: 1
          max_metric:
            router_lsa: true
            on_startup:
              time: 110
          areas:
            - area_id: "5"
              capability: true
              authentication:
                enable: true
            - area_id: "10"
              authentication:
                message_digest: true
              nssa:
                default_information_originate:
                  metric: 10
                translate: suppress-fa
              default_cost: 10
              filter_list:
                - name: test_prefix_in
                  direction: in
                - name: test_prefix_out
                  direction: out
          network:
            - address: 198.51.100.0
              wildcard_bits: 0.0.0.255
              area: 5
          default_information:
            originate: true
          passive_interfaces:
            default: true
            interface:
              set_interface: false
              name:
                - GigabitEthernet0/1
                - GigabitEthernet0/2
        - process_id: 200
          vrf: blue
          domain_id:
            ip_address:
              address: 192.0.3.1
          max_metric:
            router_lsa: true
            on_startup:
              time: 100
          auto_cost:
            reference_bandwidth: 4
          areas:
            - area_id: "10"
              capability: true
          distribute_list:
            acls:
              - name: 10
                direction: out
              - name: 123
                direction: in
    state: merged
# Task Output:
# ------------
# before: {}
# commands:
#   - router ospf 200 vrf blue
#   - auto-cost reference-bandwidth 4
#   - domain-id 192.0.3.1
#   - max-metric router-lsa on-startup 100
#   - area 10 capability default-exclusion
#   - distribute-list 10 out
#   - distribute-list 123 in
#   - router ospf 1
#   - default-information originate
#   - max-metric router-lsa on-startup 110
#   - area 5 capability default-exclusion
#   - area 10 authentication message-digest
#   - area 10 default-cost 10
#   - area 10 nssa default-information-originate metric 10
#   - area 10 nssa translate type7 suppress-fa
#   - area 10 filter-list prefix test_prefix_in in
#   - area 10 filter-list prefix test_prefix_out out
#   - network 198.51.100.0 0.0.0.255 area 5
#   - passive-interface default
#   - no passive-interface GigabitEthernet0/1
#   - no passive-interface GigabitEthernet0/2
# after:
#     processes:
#     - areas:
#       - area_id: '10'
#         capability: true
#       auto_cost:
#         reference_bandwidth: 4
#         set: true
#       distribute_list:
#         acls:
#         - direction: out
#           name: '10'
#         - direction: in
#           name: '123'
#       domain_id:
#         ip_address:
#           address: 192.0.3.1
#       max_metric:
#         on_startup:
#           time: 100
#         router_lsa: true
#       process_id: 200
#       vrf: blue
#     - areas:
#       - area_id: '5'
#         capability: true
#       - area_id: '10'
#         authentication:
#           message_digest: true
#         default_cost: 10
#         filter_list:
#         - direction: in
#           name: test_prefix_in
#         - direction: out
#           name: test_prefix_out
#         nssa:
#           default_information_originate:
#             metric: 10
#           translate: suppress-fa
#       default_information:
#         originate: true
#       max_metric:
#         on_startup:
#           time: 110
#         router_lsa: true
#       network:
#       - address: 198.51.100.0
#         area: '5'
#         wildcard_bits: 0.0.0.255
#       passive_interfaces:
#         default: true
#         interface:
#           name:
#           - GigabitEthernet2
#           - GigabitEthernet1
#           set_interface: false
#       process_id: 1
# After state:
# ------------
#
# router-ios#sh running-config | section ^router ospf
# router ospf 200 vrf blue
#  domain-id 192.0.3.1
#  max-metric router-lsa on-startup 100
#  auto-cost reference-bandwidth 4
#  area 10 capability default-exclusion
#  distribute-list 10 out
#  distribute-list 123 in
# router ospf 1
#  max-metric router-lsa on-startup 110
#  area 5 capability default-exclusion
#  area 10 authentication message-digest
#  area 10 nssa default-information-originate metric 10
#  area 10 nssa translate type7 suppress-fa
#  area 10 default-cost 10
#  area 10 filter-list prefix test_prefix_in in
#  area 10 filter-list prefix test_prefix_out out
#  passive-interface default
#  no passive-interface GigabitEthernet1
#  no passive-interface GigabitEthernet2
#  network 198.51.100.0 0.0.0.255 area 5
#  default-information originate
# Using replaced
# Before state:
# -------------
#
# router-ios#sh running-config | section ^router ospf
# router ospf 200 vrf blue
#  domain-id 192.0.3.1
#  max-metric router-lsa on-startup 100
#  auto-cost reference-bandwidth 4
#  area 10 capability default-exclusion
#  distribute-list 10 out
#  distribute-list 123 in
# router ospf 1
#  max-metric router-lsa on-startup 110
#  area 5 capability default-exclusion
#  area 10 authentication message-digest
#  area 10 nssa default-information-originate metric 10
#  area 10 nssa translate type7 suppress-fa
#  area 10 default-cost 10
#  area 10 filter-list prefix test_prefix_in in
#  area 10 filter-list prefix test_prefix_out out
#  passive-interface default
#  no passive-interface GigabitEthernet1
#  no passive-interface GigabitEthernet2
#  network 198.51.100.0 0.0.0.255 area 5
#  default-information originate
- name: Replace running config with provided OSPF V2 configuration
  cisco.ios.ios_ospfv2:
    config:
      processes:
        - process_id: 200
          vrf: blue
          domain_id:
            ip_address:
              address: 192.0.4.1
          max_metric:
            router_lsa: true
            on_startup:
              time: 200
          maximum_paths: 15
          ttl_security:
            hops: 7
          areas:
            - area_id: "10"
              default_cost: 10
              authentication:
                message_digest: true
        - process_id: 100
          vrf: ospf_vrf
          domain_id:
            ip_address:
              address: 192.0.5.1
          auto_cost:
            reference_bandwidth: 5
          areas:
            - area_id: "5"
              authentication:
                message_digest: true
              nssa:
                default_information_originate:
                  metric: 10
                translate: suppress-fa
    state: replaced
# Task Output:
# ------------
#
# before:
#     processes:
#     - areas:
#       - area_id: '10'
#         capability: true
#       auto_cost:
#         reference_bandwidth: 4
#         set: true
#       distribute_list:
#         acls:
#         - direction: out
#           name: '10'
#         - direction: in
#           name: '123'
#       domain_id:
#         ip_address:
#           address: 192.0.3.1
#       max_metric:
#         on_startup:
#           time: 100
#         router_lsa: true
#       process_id: 200
#       vrf: blue
#     - areas:
#       - area_id: '5'
#         capability: true
#       - area_id: '10'
#         authentication:
#           message_digest: true
#         default_cost: 10
#         filter_list:
#         - direction: in
#           name: test_prefix_in
#         - direction: out
#           name: test_prefix_out
#         nssa:
#           default_information_originate:
#             metric: 10
#           translate: suppress-fa
#       default_information:
#         originate: true
#       max_metric:
#         on_startup:
#           time: 110
#         router_lsa: true
#       network:
#       - address: 198.51.100.0
#         area: '5'
#         wildcard_bits: 0.0.0.255
#       passive_interfaces:
#         default: true
#         interface:
#           name:
#           - GigabitEthernet2
#           - GigabitEthernet1
#           set_interface: false
#       process_id: 1
#
# commands:
# - router ospf 100 vrf ospf_vrf
# - auto-cost reference-bandwidth 5
# - domain-id 192.0.5.1
# - area 5 authentication message-digest
# - area 5 nssa translate type7 suppress-fa
# - area 5 nssa default-information-originate metric 10
# - router ospf 200 vrf blue
# - no auto-cost reference-bandwidth 4
# - no distribute-list 10 out
# - no distribute-list 123 in
# - domain-id 192.0.4.1
# - max-metric router-lsa on-startup 200
# - maximum-paths 15
# - ttl-security all-interfaces hops 7
# - area 10 authentication message-digest
# - no area 10 capability default-exclusion
# - area 10 default-cost 10
#     ]
#
# after:
#     processes:
#     - areas:
#       - area_id: '10'
#         authentication:
#           message_digest: true
#         default_cost: 10
#       domain_id:
#         ip_address:
#           address: 192.0.4.1
#       max_metric:
#         on_startup:
#           time: 200
#         router_lsa: true
#       maximum_paths: 15
#       process_id: 200
#       ttl_security:
#         hops: 7
#       vrf: blue
#     - areas:
#       - area_id: '5'
#         authentication:
#           message_digest: true
#         nssa:
#           default_information_originate:
#             metric: 10
#           translate: suppress-fa
#       auto_cost:
#         reference_bandwidth: 5
#         set: true
#       domain_id:
#         ip_address:
#           address: 192.0.5.1
#       process_id: 100
#       vrf: ospf_vrf
#     - areas:
#       - area_id: '5'
#         authentication:
#           enable: true
#         capability: true
#       - area_id: '10'
#         authentication:
#           message_digest: true
#         default_cost: 10
#         filter_list:
#         - direction: in
#           name: test_prefix_in
#         - direction: out
#           name: test_prefix_out
#         nssa:
#           default_information_originate:
#             metric: 10
#           translate: suppress-fa
#       default_information:
#         originate: true
#       max_metric:
#         on_startup:
#           time: 110
#         router_lsa: true
#       network:
#       - address: 198.51.100.0
#         area: '5'
#         wildcard_bits: 0.0.0.255
#       process_id: 1
# After state:
# -------------
# router-ios#sh running-config | section ^router ospf
# router ospf 200 vrf blue
#  domain-id 192.0.4.1
#  max-metric router-lsa on-startup 200
#  ttl-security all-interfaces hops 7
#  area 10 authentication message-digest
#  area 10 default-cost 10
#  maximum-paths 15
# router ospf 100 vrf ospf_vrf
#  domain-id 192.0.5.1
#  auto-cost reference-bandwidth 5
#  area 5 authentication message-digest
#  area 5 nssa default-information-originate metric 10
#  area 5 nssa translate type7 suppress-fa
# router ospf 1
#  max-metric router-lsa on-startup 110
#  area 5 capability default-exclusion
#  area 5 authentication
#  area 10 authentication message-digest
#  area 10 nssa default-information-originate metric 10
#  area 10 nssa translate type7 suppress-fa
#  area 10 default-cost 10
#  area 10 filter-list prefix test_prefix_in in
#  area 10 filter-list prefix test_prefix_out out
#  network 198.51.100.0 0.0.0.255 area 5
#  default-information originate
# Using overridden
# Before state:
# -------------
#
# router-ios#sh running-config | section ^router ospf
# router ospf 200 vrf blue
#  domain-id 192.0.3.1
#  max-metric router-lsa on-startup 100
#  auto-cost reference-bandwidth 4
#  area 10 capability default-exclusion
#  distribute-list 10 out
#  distribute-list 123 in
# router ospf 1
#  max-metric router-lsa on-startup 110
#  area 10 authentication message-digest
#  area 10 nssa default-information-originate metric 10
#  area 10 nssa translate type7 suppress-fa
#  area 10 default-cost 10
#  area 10 filter-list prefix test_prefix_out out
#  network 198.51.100.0 0.0.0.255 area 5
#  default-information originate
- name: Override provided OSPF V2 configuration
  cisco.ios.ios_ospfv2:
    config:
      processes:
        - process_id: 200
          vrf: blue
          domain_id:
            ip_address:
              address: 192.0.4.1
          max_metric:
            router_lsa: true
            on_startup:
              time: 200
          maximum_paths: 15
          ttl_security:
            hops: 7
          areas:
            - area_id: "10"
              default_cost: 10
              authentication:
                message_digest: true
        - process_id: 100
          vrf: ospf_vrf
          domain_id:
            ip_address:
              address: 192.0.5.1
          auto_cost:
            reference_bandwidth: 5
          areas:
            - area_id: "5"
              authentication:
                message_digest: true
              nssa:
                default_information_originate:
                  metric: 10
                translate: suppress-fa
    state: overridden
# Task Output:
# ------------
# before:
#     processes:
#     - areas:
#       - area_id: '10'
#         capability: true
#       auto_cost:
#         reference_bandwidth: 4
#         set: true
#       distribute_list:
#         acls:
#         - direction: out
#           name: '10'
#         - direction: in
#           name: '123'
#       domain_id:
#         ip_address:
#           address: 192.0.3.1
#       max_metric:
#         on_startup:
#           time: 100
#         router_lsa: true
#       process_id: 200
#       vrf: blue
#     - areas:
#       - area_id: '10'
#         authentication:
#           message_digest: true
#         default_cost: 10
#         filter_list:
#         - direction: out
#           name: test_prefix_out
#         nssa:
#           default_information_originate:
#             metric: 10
#           translate: suppress-fa
#       default_information:
#         originate: true
#       max_metric:
#         on_startup:
#           time: 110
#         router_lsa: true
#       network:
#       - address: 198.51.100.0
#         area: '5'
#         wildcard_bits: 0.0.0.255
#       process_id: 1
#
# commands:
# - no router ospf 1
# - router ospf 100 vrf ospf_vrf
# - auto-cost reference-bandwidth 5
# - domain-id 192.0.5.1
# - area 5 authentication message-digest
# - area 5 nssa translate type7 suppress-fa
# - area 5 nssa default-information-originate metric 10
# - router ospf 200 vrf blue
# - no auto-cost reference-bandwidth 4
# - no distribute-list 10 out
# - no distribute-list 123 in
# - domain-id 192.0.4.1
# - max-metric router-lsa on-startup 200
# - maximum-paths 15
# - ttl-security all-interfaces hops 7
# - area 10 authentication message-digest
# - no area 10 capability default-exclusion
# - area 10 default-cost 10
#
# after:
#     processes:
#     - areas:
#       - area_id: '10'
#         authentication:
#           message_digest: true
#         default_cost: 10
#       domain_id:
#         ip_address:
#           address: 192.0.4.1
#       max_metric:
#         on_startup:
#           time: 200
#         router_lsa: true
#       maximum_paths: 15
#       process_id: 200
#       ttl_security:
#         hops: 7
#       vrf: blue
#     - areas:
#       - area_id: '5'
#         authentication:
#           message_digest: true
#         nssa:
#           default_information_originate:
#             metric: 10
#           translate: suppress-fa
#       auto_cost:
#         reference_bandwidth: 5
#         set: true
#       domain_id:
#         ip_address:
#           address: 192.0.5.1
#       process_id: 100
#       vrf: ospf_vrf
#
# After state:
# ------------
#
# router-ios#sh running-config | section ^router ospf
# router ospf 200 vrf blue
#  domain-id 192.0.4.1
#  max-metric router-lsa on-startup 200
#  ttl-security all-interfaces hops 7
#  area 10 authentication message-digest
#  area 10 default-cost 10
#  maximum-paths 15
# router ospf 100 vrf ospf_vrf
#  domain-id 192.0.5.1
#  auto-cost reference-bandwidth 5
#  area 5 authentication message-digest
#  area 5 nssa default-information-originate metric 10
#  area 5 nssa translate type7 suppress-fa
# Using deleted
# Before state:
# -------------
#
# router-ios#sh running-config | section ^router ospf
# router ospf 200 vrf blue
#  domain-id 192.0.3.1
#  max-metric router-lsa on-startup 100
#  auto-cost reference-bandwidth 4
#  area 10 capability default-exclusion
#  distribute-list 10 out
#  distribute-list 123 in
# router ospf 1
#  max-metric router-lsa on-startup 110
#  area 10 authentication message-digest
#  area 10 nssa default-information-originate metric 10
#  area 10 nssa translate type7 suppress-fa
#  area 10 default-cost 10
#  area 10 filter-list prefix test_prefix_out out
#  network 198.51.100.0 0.0.0.255 area 5
#  default-information originate
- name: Delete provided OSPF V2 processes
  cisco.ios.ios_ospfv2:
    config:
      processes:
        - process_id: 1
        - process_id: 200
          vrf: blue
    state: deleted
# Task Output:
# ------------
# before:
#     processes:
#     - areas:
#       - area_id: '10'
#         capability: true
#       auto_cost:
#         reference_bandwidth: 4
#         set: true
#       distribute_list:
#         acls:
#         - direction: out
#           name: '10'
#         - direction: in
#           name: '123'
#       domain_id:
#         ip_address:
#           address: 192.0.3.1
#       max_metric:
#         on_startup:
#           time: 100
#         router_lsa: true
#       process_id: 200
#       vrf: blue
#     - areas:
#       - area_id: '10'
#         authentication:
#           message_digest: true
#         default_cost: 10
#         filter_list:
#         - direction: out
#           name: test_prefix_out
#         nssa:
#           default_information_originate:
#             metric: 10
#           translate: suppress-fa
#       default_information:
#         originate: true
#       max_metric:
#         on_startup:
#           time: 110
#         router_lsa: true
#       network:
#       - address: 198.51.100.0
#         area: '5'
#         wildcard_bits: 0.0.0.255
#       process_id: 1
#
# commands:
# - no router ospf 1
#
# processes:
#     - areas:
#       - area_id: '10'
#         capability: true
#       auto_cost:
#         reference_bandwidth: 4
#         set: true
#       distribute_list:
#         acls:
#         - direction: out
#           name: '10'
#         - direction: in
#           name: '123'
#       domain_id:
#         ip_address:
#           address: 192.0.3.1
#       max_metric:
#         on_startup:
#           time: 100
#         router_lsa: true
#       process_id: 200
#       vrf: blue
#
# After state:
# ------------
# router-ios#sh running-config | section ^router ospf
# router ospf 200 vrf blue
#  domain-id 192.0.3.1
#  max-metric router-lsa on-startup 100
#  auto-cost reference-bandwidth 4
#  area 10 capability default-exclusion
#  distribute-list 10 out
#  distribute-list 123 in
# Using deleted without any config passed (NOTE: This will delete all OSPFV2 configuration from device)
# Before state:
# -------------
#
# router-ios#sh running-config | section ^router ospf
# router ospf 200 vrf blue
#  domain-id 192.0.3.1
#  max-metric router-lsa on-startup 100
#  auto-cost reference-bandwidth 4
#  area 10 capability default-exclusion
#  distribute-list 10 out
#  distribute-list 123 in
# router ospf 1
#  max-metric router-lsa on-startup 110
#  area 10 authentication message-digest
#  area 10 nssa default-information-originate metric 10
#  area 10 nssa translate type7 suppress-fa
#  area 10 default-cost 10
#  area 10 filter-list prefix test_prefix_out out
#  network 198.51.100.0 0.0.0.255 area 5
#  default-information originate
- name: Delete all OSPF processes
  cisco.ios.ios_ospfv2:
    state: deleted
# Task Output:
# ------------
# before:
#     processes:
#     - areas:
#       - area_id: '10'
#         capability: true
#       auto_cost:
#         reference_bandwidth: 4
#         set: true
#       distribute_list:
#         acls:
#         - direction: out
#           name: '10'
#         - direction: in
#           name: '123'
#       domain_id:
#         ip_address:
#           address: 192.0.3.1
#       max_metric:
#         on_startup:
#           time: 100
#         router_lsa: true
#       process_id: 200
#       vrf: blue
#     - areas:
#       - area_id: '10'
#         authentication:
#           message_digest: true
#         default_cost: 10
#         filter_list:
#         - direction: out
#           name: test_prefix_out
#         nssa:
#           default_information_originate:
#             metric: 10
#           translate: suppress-fa
#       default_information:
#         originate: true
#       max_metric:
#         on_startup:
#           time: 110
#         router_lsa: true
#       network:
#       - address: 198.51.100.0
#         area: '5'
#         wildcard_bits: 0.0.0.255
#       process_id: 1
#
# commands:
# - no router ospf 200 vrf blue
# - no router ospf 1
#
# after: {}
#
# After state:
# ------------
# router-ios#sh running-config | section ^router ospf
# router-ios#
# Using Gathered
# Before state:
# -------------
#
# router-ios#sh running-config | section ^router ospf
# router ospf 200 vrf blue
#  domain-id 192.0.3.1
#  max-metric router-lsa on-startup 100
#  auto-cost reference-bandwidth 4
#  area 10 capability default-exclusion
#  distribute-list 10 out
#  distribute-list 123 in
# router ospf 1
#  max-metric router-lsa on-startup 110
#  area 10 authentication message-digest
#  area 10 nssa default-information-originate metric 10
#  area 10 nssa translate type7 suppress-fa
#  area 10 default-cost 10
#  area 10 filter-list prefix test_prefix_out out
#  network 198.51.100.0 0.0.0.255 area 5
#  default-information originate
- name: Gather OSPFV2 running configurations
  cisco.ios.ios_ospfv2:
    config:
    state: gathered
# Task Output:
# ------------
#
# gathered:
#     processes:
#     - areas:
#       - area_id: '10'
#         capability: true
#       auto_cost:
#         reference_bandwidth: 4
#         set: true
#       distribute_list:
#         acls:
#         - direction: out
#           name: '10'
#         - direction: in
#           name: '123'
#       domain_id:
#         ip_address:
#           address: 192.0.3.1
#       max_metric:
#         on_startup:
#           time: 100
#         router_lsa: true
#       process_id: 200
#       vrf: blue
#     - areas:
#       - area_id: '10'
#         authentication:
#           message_digest: true
#         default_cost: 10
#         filter_list:
#         - direction: out
#           name: test_prefix_out
#         nssa:
#           default_information_originate:
#             metric: 10
#           translate: suppress-fa
#       default_information:
#         originate: true
#       max_metric:
#         on_startup:
#           time: 110
#         router_lsa: true
#       network:
#       - address: 198.51.100.0
#         area: '5'
#         wildcard_bits: 0.0.0.255
#       process_id: 1
# After state:
# ------------
#
# router-ios#sh running-config | section ^router ospf
# router ospf 200 vrf blue
#  domain-id 192.0.3.1
#  max-metric router-lsa on-startup 100
#  auto-cost reference-bandwidth 4
#  area 10 capability default-exclusion
#  distribute-list 10 out
#  distribute-list 123 in
# router ospf 1
#  max-metric router-lsa on-startup 110
#  area 10 authentication message-digest
#  area 10 nssa default-information-originate metric 10
#  area 10 nssa translate type7 suppress-fa
#  area 10 default-cost 10
#  area 10 filter-list prefix test_prefix_out out
#  network 198.51.100.0 0.0.0.255 area 5
#  default-information originate
# Using Rendered
- name: Render the commands for provided  configuration
  cisco.ios.ios_ospfv2:
    config:
      processes:
        - process_id: 1
          max_metric:
            router_lsa: true
            on_startup:
              time: 110
          areas:
            - area_id: "5"
              capability: true
              authentication:
                enable: true
            - area_id: "10"
              authentication:
                message_digest: true
              nssa:
                default_information_originate:
                  metric: 10
                translate: suppress-fa
              default_cost: 10
              filter_list:
                - name: test_prefix_in
                  direction: in
                - name: test_prefix_out
                  direction: out
          network:
            - address: 198.51.100.0
              wildcard_bits: 0.0.0.255
              area: 5
          default_information:
            originate: true
        - process_id: 200
          vrf: blue
          domain_id:
            ip_address:
              address: 192.0.3.1
          max_metric:
            router_lsa: true
            on_startup:
              time: 100
          auto_cost:
            reference_bandwidth: 4
          areas:
            - area_id: "10"
              capability: true
          distribute_list:
            acls:
              - name: 10
                direction: out
              - name: 123
                direction: in
    state: rendered
# Task Output:
# ------------
# rendered:
# - router ospf 200 vrf blue
# - auto-cost reference-bandwidth 4
# - distribute-list 10 out
# - distribute-list 123 in
# - domain-id 192.0.3.1
# - max-metric router-lsa on-startup 100
# - area 10 capability default-exclusion
# - router ospf 1
# - default-information originate
# - max-metric router-lsa on-startup 110
# - network 198.51.100.0 0.0.0.255 area 5
# - area 10 authentication message-digest
# - area 10 default-cost 10
# - area 10 nssa translate type7 suppress-fa
# - area 10 nssa default-information-originate metric 10
# - area 10 filter-list prefix test_prefix_out out
# - area 10 filter-list prefix test_prefix_in in
# - area 5 authentication
# - area 5 capability default-exclusion
#
# Using Parsed
# File: parsed.cfg
# ----------------
#
# router ospf 100
#  auto-cost reference-bandwidth 5
#  domain-id 192.0.5.1
#  area 5 authentication message-digest
#  area 5 nssa translate type7 suppress-fa
#  area 5 nssa default-information-originate metric 10
- name: Parse the provided configuration with the existing running configuration
  cisco.ios.ios_ospfv2:
    running_config: "{{ lookup('file', 'parsed.cfg') }}"
    state: parsed
# Task Output:
# ------------
# parsed:
#     processes:
#     - areas:
#       - area_id: '5'
#         authentication:
#           message_digest: true
#         nssa:
#           default_information_originate:
#             metric: 10
#           translate: suppress-fa
#       auto_cost:
#         reference_bandwidth: 5
#         set: true
#       domain_id:
#         ip_address:
#           address: 192.0.5.1
#       process_id: 100
返回值
通用返回值记录在此处,以下是此模块特有的字段
| 键 | 描述 | 
|---|---|
| 生成的配置模型调用。 返回: 当更改时 示例:  | |
| 模型调用之前的配置。 返回: 总是 示例:  | |
| 推送到远程设备的命令集。 返回: 总是 示例:  | |
| 从远程设备收集的关于网络资源的结构化数据事实。 返回: 当 state 为  示例:  | |
| 根据模块 argspec 将 running_config 选项中提供的设备原生配置解析为结构化数据。 返回: 当 state 为  示例:  | |
| 任务中提供的配置以设备原生格式呈现(离线)。 返回: 当 state 为  示例:  | 
