cisco.nxos.nxos_ospf_interfaces 模块 – OSPF 接口资源模块。

注意

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

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

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

要在剧本中使用它,请指定:cisco.nxos.nxos_ospf_interfaces

cisco.nxos 1.3.0 中的新功能

概要

  • 此模块管理运行 Cisco NX-OS 的设备上接口的 OSPF(v2/v3)配置。

参数

参数

注释

config

列表 / 元素=字典

接口 OSPF 配置的列表。

address_family

列表 / 元素=字典

地址族上下文中接口上的 OSPF 设置。

afi

字符串 / 必需

接口上 OSPF 设置的地址族标识符 (AFI)。

选项

  • "ipv4"

  • "ipv6"

authentication

字典

接口上的身份验证设置。

enable

布尔值

在接口上启用/禁用身份验证。

选项

  • false

  • true

key_chain

字符串

身份验证密码密钥链。

message_digest

布尔值

使用消息摘要身份验证。

选项

  • false

  • true

null_auth

布尔值

使用 null(禁用)身份验证。

选项

  • false

  • true

authentication_key

字典

配置接口的身份验证密钥。

encryption

整数

0 指定将跟随一个未加密的身份验证密钥。

3 指定将跟随一个 3DES 加密的身份验证密钥。

7 指定将跟随一个 Cisco 类型 7 加密的身份验证密钥。

key

字符串 / 必需

身份验证密钥。

有效值是基于加密密钥值的 Cisco 类型 7 加密密码、3DES 加密密码和未加密(明文)密码。

cost

整数

与接口关联的成本。

dead_interval

整数

死间隔值(以秒为单位)。

default_passive_interface

布尔值

将此接口上的 passive-interface 属性设置为默认值。

此选项与 passive_interface 互斥。

选项

  • false

  • true

hello_interval

整数

Hello 间隔值(以秒为单位)。

instance

整数

实例标识符。

message_digest_key

字典

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

encryption

整数

0 指定将跟随一个未加密的 OSPF 密码(密钥)。

3 指定将跟随一个 3DES 加密的 OSPF 密码(密钥)。

7 指定将跟随一个 Cisco 类型 7 加密的 OSPF 密码(密钥)。

key

字符串 / 必需

身份验证密钥。

有效值是基于加密密钥值的 Cisco 类型 7 加密密码、3DES 加密密码和未加密(明文)密码。

key_id

整数 / 必需

密钥 ID。

mtu_ignore

布尔值

启用/禁用 OSPF MTU 不匹配检测。

选项

  • false

  • true

multi_areas

列表 / 元素=字符串

与接口关联的多区域(不与 OSPF 进程绑定)。

有效值是整数或 IP 地址形式的区域 ID。

network

字符串

网络类型。

选项

  • "broadcast"

  • "point-to-point"

passive_interface

布尔值

禁止在接口上进行路由更新。

此选项与 default_passive_interface 互斥。

选项

  • false

  • true

priority

整数

路由器优先级。

processes

列表 / 元素=字典

OSPF 进程的接口配置。

area

字典

与接口关联的区域。

area_id

字符串 / 必需

IP 地址格式的区域 ID。

secondaries

布尔值

不包括辅助 IPv4/IPv6 地址。

选项

  • false

  • true

multi_areas

列表 / 元素=字符串

与接口关联的多区域。

有效值是整数或 IP 地址形式的区域 ID。

process_id

字符串 / 必需

OSPF 进程标签。

retransmit_interval

整数

数据包重传间隔。

shutdown

布尔值

关闭此接口上的 OSPF。

选项

  • false

  • true

transmit_delay

整数

数据包传输延迟。

name

字符串 / 必需

接口的名称/标识符。

running_config

字符串

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

此选项的值应该是通过执行命令 show running-config | section “^interface” 从 NX-OS 设备收到的输出。

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

state

字符串

配置应保留的状态。

选项

  • "merged" ←(默认)

  • "replaced"

  • "overridden"

  • "deleted"

  • "gathered"

  • "parsed"

  • "rendered"

备注

注意

  • Cisco MDS 不支持

示例

# Using merged

# Before state:
# -------------
# NXOS# show running-config | section ^interface
# interface Ethernet1/1
#   no switchport
# interface Ethernet1/2
#   no switchport
# interface Ethernet1/3
#   no switchport

- name: Merge the provided configuration with the existing running configuration
  cisco.nxos.nxos_ospf_interfaces:
    config:
      - name: Ethernet1/1
        address_family:
          - afi: ipv4
            processes:
              - process_id: '100'
                area:
                  area_id: 1.1.1.1
                  secondaries: false
            multi_areas:
              - 11.11.11.11
          - afi: ipv6
            processes:
              - process_id: '200'
                area:
                  area_id: 2.2.2.2
                multi_areas:
                  - 21.0.0.0
              - process_id: '300'
                multi_areas:
                  - 50.50.50.50
            multi_areas:
              - 16.10.10.10
      - name: Ethernet1/2
        address_family:
          - afi: ipv4
            authentication:
              enable: true
              key_chain: test-1
            message_digest_key:
              key_id: 10
              encryption: 3
              key: abc01d272be25d29
            cost: 100
          - afi: ipv6
            network: broadcast
            shutdown: true
      - name: Ethernet1/3
        address_family:
          - afi: ipv4
            authentication_key:
              encryption: 7
              key: 12090404011C03162E
    state: merged

# Task output:
# ------------
# before:
# - name: Ethernet1/1
# - name: Ethernet1/2
# - name: Ethernet1/3
#
# commands:
# - interface Ethernet1/1
# - ip router ospf multi-area 11.11.11.11
# - ip router ospf 100 area 1.1.1.1 secondaries none
# - ipv6 router ospfv3 multi-area 16.10.10.10
# - ipv6 router ospfv3 200 area 2.2.2.2
# - ipv6 router ospfv3 200 multi-area 21.0.0.0
# - ipv6 router ospfv3 300 multi-area 50.50.50.50
# - interface Ethernet1/2
# - ip ospf authentication key-chain test-1
# - ip ospf authentication
# - ip ospf message-digest-key 10 md5 3 abc01d272be25d29
# - ip ospf cost 100
# - ospfv3 network broadcast
# - ospfv3 shutdown
# - interface Ethernet1/3
# - ip ospf authentication-key 7 12090404011C03162E
#
# after:
#   - address_family:
#     - afi: ipv4
#       multi_areas:
#       - 11.11.11.11
#       processes:
#       - area:
#           area_id: 1.1.1.1
#           secondaries: false
#         process_id: '100'
#     - afi: ipv6
#       multi_areas:
#       - 16.10.10.10
#       processes:
#       - area:
#           area_id: 2.2.2.2
#         multi_areas:
#         - 21.0.0.0
#         process_id: '200'
#       - multi_areas:
#         - 50.50.50.50
#         process_id: '300'
#     name: Ethernet1/1
#   - address_family:
#     - afi: ipv4
#       authentication:
#         enable: true
#         key_chain: test-1
#       cost: 100
#       message_digest_key:
#         encryption: 3
#         key: VALUE_SPECIFIED_IN_NO_LOG_PARAMETER
#         key_id: 10
#     - afi: ipv6
#       network: broadcast
#       shutdown: true
#     name: Ethernet1/2
#   - address_family:
#     - afi: ipv4
#       authentication_key:
#         encryption: 7
#         key: VALUE_SPECIFIED_IN_NO_LOG_PARAMETER
#     name: Ethernet1/3

# After state:
# ------------
# NXOS# show running-config | section ^interface
# interface Ethernet1/1
#   no switchport
#   ip router ospf 100 area 1.1.1.1 secondaries none
#   ip router ospf multi-area 11.11.11.11
#   ipv6 router ospfv3 200 area 2.2.2.2
#   ipv6 router ospfv3 multi-area 16.10.10.10
#   ipv6 router ospfv3 200 multi-area 21.0.0.0
#   ipv6 router ospfv3 300 multi-area 50.50.50.50
# interface Ethernet1/2
#   no switchport
#   ip ospf authentication
#   ip ospf authentication key-chain test-1
#   ip ospf message-digest-key 10 md5 3 abc01d272be25d29
#   ip ospf cost 100
#   ospfv3 network broadcast
#   ospfv3 shutdown
# interface Ethernet1/3
#   no switchport
#   ip ospf authentication-key 7 12090404011C03162E


# Using replaced

# Before state:
# -------------
# NXOS# show running-config | section ^interface
# interface Ethernet1/1
#   no switchport
#   ip router ospf 100 area 1.1.1.1 secondaries none
#   ip router ospf multi-area 11.11.11.11
#   ipv6 router ospfv3 200 area 2.2.2.2
#   ipv6 router ospfv3 multi-area 16.10.10.10
#   ipv6 router ospfv3 200 multi-area 21.0.0.0
#   ipv6 router ospfv3 300 multi-area 50.50.50.50
# interface Ethernet1/2
#   no switchport
#   ip ospf authentication
#   ip ospf authentication key-chain test-1
#   ip ospf message-digest-key 10 md5 3 abc01d272be25d29
#   ip ospf cost 100
#   ospfv3 network broadcast
#   ospfv3 shutdown
# interface Ethernet1/3
#   no switchport
#   ip ospf authentication-key 7 12090404011C03162E

- name: Replace OSPF configurations of listed interfaces with provided configurations
  cisco.nxos.nxos_ospf_interfaces:
    config:
      - name: Ethernet1/1
        address_family:
          - afi: ipv4
            processes:
              - process_id: "100"
                area:
                  area_id: 1.1.1.1
                  secondaries: false
            multi_areas:
              - 11.11.11.12
      - name: Ethernet1/3
    state: replaced

# Task output:
# ------------
# before:
#   - address_family:
#     - afi: ipv4
#       multi_areas:
#       - 11.11.11.11
#       processes:
#       - area:
#           area_id: 1.1.1.1
#           secondaries: false
#         process_id: '100'
#     - afi: ipv6
#       multi_areas:
#       - 16.10.10.10
#       processes:
#       - area:
#           area_id: 2.2.2.2
#         multi_areas:
#         - 21.0.0.0
#         process_id: '200'
#       - multi_areas:
#         - 50.50.50.50
#         process_id: '300'
#     name: Ethernet1/1
#   - address_family:
#     - afi: ipv4
#       authentication:
#         enable: true
#         key_chain: test-1
#       cost: 100
#       message_digest_key:
#         encryption: 3
#         key: VALUE_SPECIFIED_IN_NO_LOG_PARAMETER
#         key_id: 10
#     - afi: ipv6
#       network: broadcast
#       shutdown: true
#     name: Ethernet1/2
#   - address_family:
#     - afi: ipv4
#       authentication_key:
#         encryption: 7
#         key: VALUE_SPECIFIED_IN_NO_LOG_PARAMETER
#     name: Ethernet1/3
#
# commands:
# - interface Ethernet1/1
# - ip router ospf multi-area 11.11.11.12
# - no ip router ospf multi-area 11.11.11.11
# - no ipv6 router ospfv3 multi-area 16.10.10.10
# - no ipv6 router ospfv3 200 area 2.2.2.2
# - no ipv6 router ospfv3 200 multi-area 21.0.0.0
# - no ipv6 router ospfv3 300 multi-area 50.50.50.50
# - interface Ethernet1/3
# - no ip ospf authentication-key 7 12090404011C03162E
#
# after:
#   - address_family:
#     - afi: ipv4
#       multi_areas:
#       - 11.11.11.12
#       processes:
#       - area:
#           area_id: 1.1.1.1
#           secondaries: false
#         process_id: '100'
#     name: Ethernet1/1
#   - address_family:
#     - afi: ipv4
#       authentication:
#         enable: true
#         key_chain: test-1
#       cost: 100
#       message_digest_key:
#         encryption: 3
#         key: VALUE_SPECIFIED_IN_NO_LOG_PARAMETER
#         key_id: 10
#     - afi: ipv6
#       network: broadcast
#       shutdown: true
#     name: Ethernet1/2
#   - name: Ethernet1/3
#
# After state:
# ------------
# NXOS# show running-config | section ^interface
# interface Ethernet1/1
#   no switchport
#   ip router ospf 100 area 1.1.1.1 secondaries none
#   ip router ospf multi-area 11.11.11.12
# interface Ethernet1/2
#   no switchport
#   ip ospf authentication
#   ip ospf authentication key-chain test-1
#   ip ospf message-digest-key 10 md5 3 abc01d272be25d29
#   ip ospf cost 100
#   ospfv3 network broadcast
#   ospfv3 shutdown
# interface Ethernet1/3
#   no switchport


# Using overridden

# Before state:
# -------------
# NXOS# show running-config | section ^interface
# interface Ethernet1/1
#   no switchport
#   ip router ospf 100 area 1.1.1.1 secondaries none
#   ip router ospf multi-area 11.11.11.11
#   ipv6 router ospfv3 200 area 2.2.2.2
#   ipv6 router ospfv3 multi-area 16.10.10.10
#   ipv6 router ospfv3 200 multi-area 21.0.0.0
#   ipv6 router ospfv3 300 multi-area 50.50.50.50
# interface Ethernet1/2
#   no switchport
#   ip ospf authentication
#   ip ospf authentication key-chain test-1
#   ip ospf message-digest-key 10 md5 3 abc01d272be25d29
#   ip ospf cost 100
#   ospfv3 network broadcast
#   ospfv3 shutdown
# interface Ethernet1/3
#   no switchport
#   ip ospf authentication-key 7 12090404011C03162E

- name: Override all OSPF interfaces configuration with provided configuration
  cisco.nxos.nxos_ospf_interfaces:
    config:
      - name: Ethernet1/1
        address_family:
          - afi: ipv4
            processes:
              - process_id: "100"
                area:
                  area_id: 1.1.1.1
                  secondaries: false
            multi_areas:
              - 11.11.11.12
    state: overridden

# Task output:
# ------------
# before:
#   - address_family:
#     - afi: ipv4
#       multi_areas:
#       - 11.11.11.11
#       processes:
#       - area:
#           area_id: 1.1.1.1
#           secondaries: false
#         process_id: '100'
#     - afi: ipv6
#       multi_areas:
#       - 16.10.10.10
#       processes:
#       - area:
#           area_id: 2.2.2.2
#         multi_areas:
#         - 21.0.0.0
#         process_id: '200'
#       - multi_areas:
#         - 50.50.50.50
#         process_id: '300'
#     name: Ethernet1/1
#   - address_family:
#     - afi: ipv4
#       authentication:
#         enable: true
#         key_chain: test-1
#       cost: 100
#       message_digest_key:
#         encryption: 3
#         key: VALUE_SPECIFIED_IN_NO_LOG_PARAMETER
#         key_id: 10
#     - afi: ipv6
#       network: broadcast
#       shutdown: true
#     name: Ethernet1/2
#   - address_family:
#     - afi: ipv4
#       authentication_key:
#         encryption: 7
#         key: VALUE_SPECIFIED_IN_NO_LOG_PARAMETER
#     name: Ethernet1/3
#
# commands:
# - interface Ethernet1/2
# - no ip ospf authentication key-chain test-1
# - no ip ospf authentication
# - no ip ospf message-digest-key 10 md5 3 abc01d272be25d29
# - no ip ospf cost 100
# - no ospfv3 network broadcast
# - no ospfv3 shutdown
# - interface Ethernet1/3
# - no ip ospf authentication-key 7 12090404011C03162E
# - interface Ethernet1/1
# - ip router ospf multi-area 11.11.11.12
# - no ip router ospf multi-area 11.11.11.11
# - no ipv6 router ospfv3 multi-area 16.10.10.10
# - no ipv6 router ospfv3 200 area 2.2.2.2
# - no ipv6 router ospfv3 200 multi-area 21.0.0.0
# - no ipv6 router ospfv3 300 multi-area 50.50.50.50
#
# after:
#   - address_family:
#     - afi: ipv4
#       multi_areas:
#       - 11.11.11.12
#       processes:
#       - area:
#           area_id: 1.1.1.1
#           secondaries: false
#         process_id: '100'
#     name: Ethernet1/1
#   - name: Ethernet1/2
#   - name: Ethernet1/3

# After state:
# -------------
# NXOS# show running-config | section ^interface
# interface Ethernet1/1
#   no switchport
#   ip router ospf 100 area 1.1.1.1 secondaries none
#   ip router ospf multi-area 11.11.11.12
# interface Ethernet1/2
#   no switchport
# interface Ethernet1/3
#   no switchport

# Using deleted to delete OSPF config of a single interface

# Before state:
# -------------
# NXOS# show running-config | section ^interface
# interface Ethernet1/1
#   no switchport
#   ip router ospf 100 area 1.1.1.1 secondaries none
#   ip router ospf multi-area 11.11.11.11
#   ipv6 router ospfv3 200 area 2.2.2.2
#   ipv6 router ospfv3 multi-area 16.10.10.10
#   ipv6 router ospfv3 200 multi-area 21.0.0.0
#   ipv6 router ospfv3 300 multi-area 50.50.50.50
# interface Ethernet1/2
#   no switchport
#   ip ospf authentication
#   ip ospf authentication key-chain test-1
#   ip ospf message-digest-key 10 md5 3 abc01d272be25d29
#   ip ospf cost 100
#   ospfv3 network broadcast
#   ospfv3 shutdown
# interface Ethernet1/3
#   no switchport
#   ip ospf authentication-key 7 12090404011C03162E

- name: Delete OSPF config from a single interface
  cisco.nxos.nxos_ospf_interfaces:
    config:
      - name: Ethernet1/1
    state: deleted

# Task output:
# ------------
# before:
#   - address_family:
#     - afi: ipv4
#       multi_areas:
#       - 11.11.11.11
#       processes:
#       - area:
#           area_id: 1.1.1.1
#           secondaries: false
#         process_id: '100'
#     - afi: ipv6
#       multi_areas:
#       - 16.10.10.10
#       processes:
#       - area:
#           area_id: 2.2.2.2
#         multi_areas:
#         - 21.0.0.0
#         process_id: '200'
#       - multi_areas:
#         - 50.50.50.50
#         process_id: '300'
#     name: Ethernet1/1
#   - address_family:
#     - afi: ipv4
#       authentication:
#         enable: true
#         key_chain: test-1
#       cost: 100
#       message_digest_key:
#         encryption: 3
#         key: VALUE_SPECIFIED_IN_NO_LOG_PARAMETER
#         key_id: 10
#     - afi: ipv6
#       network: broadcast
#       shutdown: true
#     name: Ethernet1/2
#   - address_family:
#     - afi: ipv4
#       authentication_key:
#         encryption: 7
#         key: VALUE_SPECIFIED_IN_NO_LOG_PARAMETER
#     name: Ethernet1/3
#
# commands:
# - interface Ethernet1/1
# - no ip router ospf multi-area 11.11.11.11
# - no ip router ospf 100 area 1.1.1.1 secondaries none
# - no ipv6 router ospfv3 multi-area 16.10.10.10
# - no ipv6 router ospfv3 200 area 2.2.2.2
# - no ipv6 router ospfv3 200 multi-area 21.0.0.0
# - no ipv6 router ospfv3 300 multi-area 50.50.50.50
#
# after:
#   - name: Ethernet1/1
#   - address_family:
#     - afi: ipv4
#       authentication:
#         enable: true
#         key_chain: test-1
#       cost: 100
#       message_digest_key:
#         encryption: 3
#         key: VALUE_SPECIFIED_IN_NO_LOG_PARAMETER
#         key_id: 10
#     - afi: ipv6
#       network: broadcast
#       shutdown: true
#     name: Ethernet1/2
#   - address_family:
#     - afi: ipv4
#       authentication_key:
#         encryption: 7
#         key: VALUE_SPECIFIED_IN_NO_LOG_PARAMETER
#     name: Ethernet1/3


# After state:
# ------------
# NXOS# show running-config | section ^interface
# interface Ethernet1/1
#   no switchport
# interface Ethernet1/2
#   no switchport
#   ip ospf authentication
#   ip ospf authentication key-chain test-1
#   ip ospf message-digest-key 10 md5 3 abc01d272be25d29
#   ip ospf cost 100
#   ospfv3 network broadcast
#   ospfv3 shutdown
# interface Ethernet1/3
#   no switchport
#   ip ospf authentication-key 7 12090404011C03162E

# Using deleted to delete OSPF config from all interfaces

# Before state:
# -------------
# NXOS# show running-config | section ^interface
# interface Ethernet1/1
#   no switchport
#   ip router ospf 100 area 1.1.1.1 secondaries none
#   ip router ospf multi-area 11.11.11.11
#   ipv6 router ospfv3 200 area 2.2.2.2
#   ipv6 router ospfv3 multi-area 16.10.10.10
#   ipv6 router ospfv3 200 multi-area 21.0.0.0
#   ipv6 router ospfv3 300 multi-area 50.50.50.50
# interface Ethernet1/2
#   no switchport
#   ip ospf authentication
#   ip ospf authentication key-chain test-1
#   ip ospf message-digest-key 10 md5 3 abc01d272be25d29
#   ip ospf cost 100
#   ospfv3 network broadcast
#   ospfv3 shutdown
# interface Ethernet1/3
#   no switchport
#   ip ospf authentication-key 7 12090404011C03162E

- name: Delete OSPF config from all interfaces
  cisco.nxos.nxos_ospf_interfaces:
    state: deleted

# Task output:
# ------------
# before:
#   - name: Ethernet1/1
#   - address_family:
#     - afi: ipv4
#       authentication:
#         enable: true
#         key_chain: test-1
#       cost: 100
#       message_digest_key:
#         encryption: 3
#         key: VALUE_SPECIFIED_IN_NO_LOG_PARAMETER
#         key_id: 10
#     - afi: ipv6
#       network: broadcast
#       shutdown: true
#     name: Ethernet1/2
#   - address_family:
#     - afi: ipv4
#       authentication_key:
#         encryption: 7
#         key: VALUE_SPECIFIED_IN_NO_LOG_PARAMETER
#     name: Ethernet1/3
#
# commands:
# - interface Ethernet1/1
# - no ip router ospf multi-area 11.11.11.11
# - no ip router ospf 100 area 1.1.1.1 secondaries none
# - no ipv6 router ospfv3 multi-area 16.10.10.10
# - no ipv6 router ospfv3 200 area 2.2.2.2
# - no ipv6 router ospfv3 200 multi-area 21.0.0.0
# - no ipv6 router ospfv3 300 multi-area 50.50.50.50
# - interface Ethernet1/2
# - no ip ospf authentication key-chain test-1
# - no ip ospf authentication
# - no ip ospf message-digest-key 10 md5 3 abc01d272be25d29
# - no ip ospf cost 100
# - no ospfv3 network broadcast
# - no ospfv3 shutdown
# - interface Ethernet1/3
# - no ip ospf authentication-key 7 12090404011C03162E
#
# after:
#   - name: Ethernet1/1
#   - name: Ethernet1/2
#   - name: Ethernet1/3

# After state:
# ------------
# NXOS# show running-config | section ^interface
# interface Ethernet1/1
#   no switchport
# interface Ethernet1/2
#   no switchport
# interface Ethernet1/3
#   no switchport

# Using rendered

- name: >-
    Render platform specific configuration lines with state rendered (without
    connecting to the device)
  cisco.nxos.nxos_ospf_interfaces:
    config:
      - name: Ethernet1/1
        address_family:
          - afi: ipv4
            processes:
              - process_id: '100'
                area:
                  area_id: 1.1.1.1
                  secondaries: false
            multi_areas:
              - 11.11.11.11
          - afi: ipv6
            processes:
              - process_id: '200'
                area:
                  area_id: 2.2.2.2
                multi_areas:
                  - 21.0.0.0
              - process_id: '300'
                multi_areas:
                  - 50.50.50.50
            multi_areas:
              - 16.10.10.10
      - name: Ethernet1/2
        address_family:
          - afi: ipv4
            authentication:
              enable: true
              key_chain: test-1
            message_digest_key:
              key_id: 10
              encryption: 3
              key: abc01d272be25d29
            cost: 100
          - afi: ipv6
            network: broadcast
            shutdown: true
      - name: Ethernet1/3
        address_family:
          - afi: ipv4
            authentication_key:
              encryption: 7
              key: 12090404011C03162E
    state: rendered


# Task Output:
# ------------
# rendered:
# - interface Ethernet1/1
# - ip router ospf multi-area 11.11.11.11
# - ip router ospf 100 area 1.1.1.1 secondaries none
# - ipv6 router ospfv3 multi-area 16.10.10.10
# - ipv6 router ospfv3 200 area 2.2.2.2
# - ipv6 router ospfv3 200 multi-area 21.0.0.0
# - ipv6 router ospfv3 300 multi-area 50.50.50.50
# - interface Ethernet1/2
# - ip ospf authentication key-chain test-1
# - ip ospf authentication
# - ip ospf message-digest-key 10 md5 3 abc01d272be25d29
# - ip ospf cost 100
# - ospfv3 network broadcast
# - ospfv3 shutdown
# - interface Ethernet1/3
# - ip ospf authentication-key 7 12090404011C03162E

# Using parsed

# parsed.cfg
# ------------
# interface Ethernet1/1
#   ip router ospf 100 area 1.1.1.1 secondaries none
#   ip router ospf multi-area 11.11.11.11
#   ipv6 router ospfv3 200 area 2.2.2.2
#   ipv6 router ospfv3 200 multi-area 21.0.0.0
#   ipv6 router ospfv3 300 multi-area 50.50.50.50
#   ipv6 router ospfv3 multi-area 16.10.10.10
# interface Ethernet1/2
#   ip ospf authentication
#   ip ospf authentication key-chain test-1
#   ip ospf message-digest-key 10 md5 3 abc01d272be25d29
#   ip ospf cost 100
#   ospfv3 network broadcast
#   ospfv3 shutdown
# interface Ethernet1/3
#   ip ospf authentication-key 7 12090404011C03162E

- name: arse externally provided OSPF interfaces config
  cisco.nxos.nxos_ospf_interfaces:
    running_config: "{{ lookup('file', 'ospf_interfaces.cfg') }}"
    state: parsed

# Task output:
# ------------
# parsed:
#   - address_family:
#     - afi: ipv4
#       multi_areas:
#       - 11.11.11.11
#       processes:
#       - area:
#           area_id: 1.1.1.1
#           secondaries: false
#         process_id: '100'
#     - afi: ipv6
#       multi_areas:
#       - 16.10.10.10
#       processes:
#       - area:
#           area_id: 2.2.2.2
#         multi_areas:
#         - 21.0.0.0
#         process_id: '200'
#       - multi_areas:
#         - 50.50.50.50
#         process_id: '300'
#     name: Ethernet1/1
#   - address_family:
#     - afi: ipv4
#       authentication:
#         enable: true
#         key_chain: test-1
#       cost: 100
#       message_digest_key:
#         encryption: 3
#         key: VALUE_SPECIFIED_IN_NO_LOG_PARAMETER
#         key_id: 10
#     - afi: ipv6
#       network: broadcast
#       shutdown: true
#     name: Ethernet1/2
#   - address_family:
#     - afi: ipv4
#       authentication_key:
#         encryption: 7
#         key: VALUE_SPECIFIED_IN_NO_LOG_PARAMETER
#     name: Ethernet1/3

# Using gathered

# On-box config

# NXOS# show running-config | section ^interface
# interface Ethernet1/1
#   no switchport
#   ip router ospf 100 area 1.1.1.1 secondaries none
#   ip router ospf multi-area 11.11.11.12
# interface Ethernet1/2
#   no switchport
#   ip ospf authentication
#   ip ospf authentication key-chain test-1
#   ip ospf message-digest-key 10 md5 3 abc01d272be25d29
#   ip ospf cost 100
#   ospfv3 network broadcast
#   ospfv3 shutdown
# interface Ethernet1/3
#   no switchport

# Task output:
# ------------
# gathered:
#   - address_family:
#     - afi: ipv4
#       multi_areas:
#       - 11.11.11.12
#       processes:
#       - area:
#           area_id: 1.1.1.1
#           secondaries: false
#         process_id: '100'
#     name: Ethernet1/1
#   - address_family:
#     - afi: ipv4
#       authentication:
#         enable: true
#         key_chain: test-1
#       cost: 100
#       message_digest_key:
#         encryption: 3
#         key: VALUE_SPECIFIED_IN_NO_LOG_PARAMETER
#         key_id: 10
#     - afi: ipv6
#       network: broadcast
#       shutdown: true
#     name: Ethernet1/2
#   - name: Ethernet1/3

返回值

常见的返回值记录在这里,以下是此模块独有的字段

描述

after

列表 / 元素=字符串

生成的配置模型调用。

已返回: 当更改时

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

before

列表 / 元素=字符串

模型调用之前的配置。

已返回: 始终

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

commands

列表 / 元素=字符串

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

已返回: 始终

示例: ["interface Ethernet1/1", "ip router ospf multi-area 11.11.11.11", "ip router ospf 100 area 1.1.1.1 secondaries none", "no ipv6 router ospfv3 multi-area 16.10.10.10", "ipv6 router ospfv3 200 area 2.2.2.2", "ipv6 router ospfv3 200 multi-area 21.0.0.0", "ipv6 router ospfv3 300 multi-area 50.50.50.50", "interface Ethernet1/2", "no ip ospf authentication key-chain test-1", "ip ospf authentication"]

已收集

列表 / 元素=字符串

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

返回:stategathered

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

已解析

列表 / 元素=字符串

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

返回:stateparsed

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

已渲染

列表 / 元素=字符串

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

返回:staterendered

示例: ["interface Ethernet1/1", "ip router ospf multi-area 11.11.11.11", "ip router ospf 100 area 1.1.1.1 secondaries none"]

作者

  • Nilashish Chakraborty (@NilashishC)