arista.eos.eos_ospf_interfaces 模块 – OSPF 接口资源模块。

注意

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

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

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

要在 playbook 中使用它,请指定:arista.eos.eos_ospf_interfaces

arista.eos 1.1.0 中的新增功能

概要

  • 此模块管理运行 Arista EOS 的设备上的接口的 OSPF 配置。

参数

参数

注释

config

列表 / 元素=字典

接口的 OSPF 配置列表。

address_family

列表 / 元素=字典

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

afi

字符串 / 必需

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

选择

  • "ipv4"

  • "ipv6"

area

字典

与接口关联的区域。

仅当 afi = ipv4 时有效。

area_id

字符串 / 必需

区域 ID,格式为十进制或 IP 地址。

authentication_key

字典

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

仅当 afi = ipv4 时有效。

encryption

字符串

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

7 指定专有加密类型。

key

字符串

密码(最多 8 个字符)。

authentication_v2

字典

接口上的身份验证设置。

仅当 afi = ipv4 时有效。

message_digest

布尔值

使用消息摘要身份验证。

选择

  • false

  • true

set

布尔值

在接口上启用身份验证。

选择

  • false

  • true

authentication_v3

字典

接口上的身份验证设置。

仅当 afi = ipv6 时有效。

algorithm

字符串

加密算法。

选择

  • "md5"

  • "sha1"

key

字符串

128 位 MD5 密钥或 140 位 SHA1 密钥。

keytype

字符串

指定后面是否跟随未加密/隐藏的密钥。

0 表示未加密的密钥。

7 表示隐藏的密钥。

passphrase

字符串

用于导出身份验证和加密密钥的密码字符串。

spi

整数

IPsec 安全参数索引。

bfd

布尔值

启用 BFD。

选择

  • false

  • true

cost

整数

与接口关联的度量。

dead_interval

整数

检测死路由器的间隔时间。

encryption_v3

字典

接口上的身份验证设置。

仅当 afi = ipv6 时有效。

algorithm

字符串

算法。

选择

  • "md5"

  • "sha1"

encryption

字符串

加密类型。

选择

  • "3des-cbc"

  • "aes-128-cbc"

  • "aes-192-cbc"

  • "aes-256-cbc"

  • "null"

key

字符串

key

keytype

字符串

指定后面是否跟随未加密/隐藏的密钥。

0 表示未加密的密钥。

7 表示隐藏的密钥。

passphrase

字符串

用于导出身份验证和加密密钥的密码字符串。

spi

整数

IPsec 安全参数索引。

hello_interval

整数

hello 数据包传输之间的定时器间隔。

ip_params

列表 / 元素=字典

指定 IPv4/IPv6 的参数。

仅当 afi = ipv6 时有效。

afi

字符串 / 必需

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

选择

  • "ipv4"

  • "ipv6"

area

字典

与接口关联的区域。

仅当 afi = ipv4 时有效。

area_id

字符串 / 必需

区域 ID,格式为十进制或 IP 地址。

bfd

布尔值

启用 BFD。

选择

  • false

  • true

cost

整数

与接口关联的度量。

dead_interval

整数

检测死路由器的间隔时间。

hello_interval

整数

hello 数据包传输之间的定时器间隔。

mtu_ignore

布尔值

如果为 true,则禁用数据库描述数据包的 MTU 检查。

选择

  • false

  • true

network

字符串

接口类型。

passive_interface

布尔值

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

选择

  • false

  • true

priority

整数

接口优先级。

retransmit_interval

整数

LSA 重传间隔。

transmit_delay

整数

LSA 传输延迟。

message_digest_key

字典

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

encryption

字符串

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

7 指定专有加密类型。

key

字符串

身份验证密钥(最多 16 个字符)。

key_id

整数

密钥 ID。

mtu_ignore

布尔值

如果为 true,则禁用数据库描述数据包的 MTU 检查。

选择

  • false

  • true

network

字符串

接口类型。

passive_interface

布尔值

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

仅当 afi = ipv6 时有效。

选择

  • false

  • true

priority

整数

接口优先级。

retransmit_interval

整数

LSA 重传间隔。

shutdown

布尔值

在此接口上关闭 OSPF。

选择

  • false

  • true

transmit_delay

整数

LSA 传输延迟。

name

字符串

接口的名称/标识符。

running_config

字符串

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

此选项的值应为通过执行命令 show running-config | section interface 从 EOS 设备接收的输出。

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

state

字符串

应将配置保留在的状态。

选择

  • "merged" ← (默认)

  • "replaced"

  • "overridden"

  • "deleted"

  • "gathered"

  • "parsed"

  • "rendered"

示例

# Using merged

# Before state:
# -------------
# veos(config)#show running-config | section interface | ospf
# veos(config)#

- name: Merge provided configuration with device configuration
  arista.eos.eos_ospf_interfaces:
    config:
      - name: "Vlan1"
        address_family:
          - afi: "ipv4"
            area:
              area_id: "0.0.0.50"
            cost: 500
            mtu_ignore: true
          - afi: "ipv6"
            dead_interval: 44
            ip_params:
              - afi: "ipv6"
                mtu_ignore: true
                network: "point-to-point"
    state: merged

# Task output:
# ------------
# before: []
#
# commands:
# - interface Vlan1
# - ip ospf area 0.0.0.50
# - ip ospf cost 500
# - ip ospf mtu-ignore
# - ospfv3 dead-interval 44
# - ospfv3 ipv6 mtu-ignore
# - ospfv3 ipv6 network point-to-point
#
# after:
#   - address_family:
#     - afi: ipv4
#       area:
#         area_id: 0.0.0.50
#       cost: 500
#       mtu_ignore: true
#     - afi: ipv6
#       dead_interval: 44
#       ip_params:
#       - afi: ipv6
#         mtu_ignore: true
#         network: point-to-point
#     name: Vlan1

# After state:
# ------------
# veos(config)#show running-config | section interface | ospf
# interface Vlan1
#    ip ospf cost 500
#    ip ospf mtu-ignore
#    ip ospf area 0.0.0.50
#    ospfv3 dead-interval 44
#    ospfv3 ipv6 network point-to-point
#    ospfv3 ipv6 mtu-ignore

# Using replaced

# Before state:
# -------------
# veos(config)#show running-config | section interface | ospf
# interface Vlan1
#    ip ospf cost 500
#    ip ospf dead-interval 29
#    ip ospf hello-interval 66
#    ip ospf mtu-ignore
#    ip ospf area 0.0.0.50
#    ospfv3 cost 106
#    ospfv3 hello-interval 77
#    ospfv3 dead-interval 44
#    ospfv3 transmit-delay 100
#    ospfv3 ipv4 priority 45
#    ospfv3 ipv4 area 0.0.0.5
#    ospfv3 ipv6 passive-interface
#    ospfv3 ipv6 retransmit-interval 115
#    ospfv3 ipv6 network point-to-point
#    ospfv3 ipv6 mtu-ignore
# !
# interface Vlan2
#    ospfv3 ipv4 hello-interval 45
#    ospfv3 ipv4 retransmit-interval 100
#    ospfv3 ipv4 area 0.0.0.6

- name: Replace device configuration with provided configuration
  arista.eos.eos_ospf_interfaces:
    config:
      - name: "Vlan1"
        address_family:
          - afi: "ipv6"
            cost: 44
            bfd: true
            ip_params:
              - afi: "ipv6"
                mtu_ignore: true
                network: "point-to-point"
                dead_interval: 56
    state: replaced

# Task output:
# ------------
# before:
#   - address_family:
#     - afi: ipv4
#       area:
#         area_id: 0.0.0.50
#       cost: 500
#       dead_interval: 29
#       hello_interval: 66
#       mtu_ignore: true
#     - afi: ipv6
#       cost: 106
#       dead_interval: 44
#       hello_interval: 77
#       ip_params:
#       - afi: ipv4
#         area:
#           area_id: 0.0.0.5
#         priority: 45
#       - afi: ipv6
#         mtu_ignore: true
#         network: point-to-point
#         passive_interface: true
#         retransmit_interval: 115
#       transmit_delay: 100
#     name: Vlan1
#   - address_family:
#     - afi: ipv6
#       ip_params:
#       - afi: ipv4
#         area:
#           area_id: 0.0.0.6
#         hello_interval: 45
#         retransmit_interval: 100
#     name: Vlan2
#
# commands:
# - interface Vlan1
# - no ip ospf cost 500
# - no ip ospf dead-interval 29
# - no ip ospf hello-interval 66
# - no ip ospf mtu-ignore
# - no ip ospf area 0.0.0.50
# - ospfv3 cost 44
# - ospfv3 bfd
# - ospfv3 authentication ipsec spi 30 md5 passphrase 7 7hl8FV3lZ6H1mAKpjL47hQ==
# - no ospfv3 ipv4 priority 45
# - no ospfv3 ipv4 area 0.0.0.5
# - ospfv3 ipv6 dead-interval 56
# - no ospfv3 ipv6 passive-interface
# - no ospfv3 ipv6 retransmit-interval 115
# - no ospfv3 hello-interval 77
# - no ospfv3 dead-interval 44
# - no ospfv3 transmit-delay 100
#
# after:
#   - address_family:
#     - afi: ipv6
#       bfd: true
#       cost: 44
#       ip_params:
#       - afi: ipv6
#         mtu_ignore: true
#         network: point-to-point
#     name: Vlan1
#   - address_family:
#     - afi: ipv6
#       ip_params:
#       - afi: ipv4
#         area:
#           area_id: 0.0.0.6
#         hello_interval: 45
#         retransmit_interval: 100
#     name: Vlan2

# After state:
# ------------
# veos(config)#show running-config | section interface | ospf
# interface Vlan1
#    ospfv3 bfd
#    ospfv3 cost 44
#    no ospfv3 ipv6 passive-interface
#    ospfv3 ipv6 network point-to-point
#    ospfv3 ipv6 mtu-ignore
# !
# interface Vlan2
#    ospfv3 ipv4 hello-interval 45
#    ospfv3 ipv4 retransmit-interval 100
#    ospfv3 ipv4 area 0.0.0.6

# Using overidden

# Before state:
# -------------
# veos(config)#show running-config | section interface | ospf
# interface Vlan1
#    ip ospf dead-interval 29
#    ip ospf hello-interval 66
#    ip ospf mtu-ignore
#    ospfv3 bfd
#    ospfv3 cost 106
#    ospfv3 hello-interval 77
#    ospfv3 transmit-delay 100
#    ospfv3 ipv4 priority 45
#    ospfv3 ipv4 area 0.0.0.5
#    ospfv3 ipv6 passive-interface
#    ospfv3 ipv6 dead-interval 56
#    ospfv3 ipv6 retransmit-interval 115
#    ospfv3 ipv6 network point-to-point
#    ospfv3 ipv6 mtu-ignore
# !
# interface Vlan2
#    ospfv3 ipv4 hello-interval 45
#    ospfv3 ipv4 retransmit-interval 100
#    ospfv3 ipv4 area 0.0.0.6

- name: Override device configuration with provided configuration
  arista.eos.eos_ospf_interfaces:
    config:
      - name: "Vlan1"
        address_family:
          - afi: "ipv6"
            cost: 44
            bfd: true
            ip_params:
              - afi: "ipv6"
                mtu_ignore: true
                network: "point-to-point"
                dead_interval: 56
    state: overridden

# Task output:
# ------------
# before:
#   - address_family:
#     - afi: ipv4
#       dead_interval: 29
#       hello_interval: 66
#       mtu_ignore: true
#     - afi: ipv6
#       bfd: true
#       cost: 106
#       hello_interval: 77
#       ip_params:
#       - afi: ipv4
#         area:
#           area_id: 0.0.0.5
#         priority: 45
#       - afi: ipv6
#         dead_interval: 56
#         mtu_ignore: true
#         network: point-to-point
#         passive_interface: true
#         retransmit_interval: 115
#       transmit_delay: 100
#     name: Vlan1
#   - address_family:
#     - afi: ipv6
#       ip_params:
#       - afi: ipv4
#         area:
#           area_id: 0.0.0.6
#         hello_interval: 45
#         retransmit_interval: 100
#     name: Vlan2
#
# commands:
# - interface Vlan2
# - no ospfv3 ipv4 hello-interval 45
# - no ospfv3 ipv4 retransmit-interval 100
# - no ospfv3 ipv4 area 0.0.0.6
# - interface Vlan1
# - no ip ospf dead-interval 29
# - no ip ospf hello-interval 66
# - no ip ospf mtu-ignore
# - ospfv3 cost 44
# - ospfv3 authentication ipsec spi 30 md5 passphrase 7 7hl8FV3lZ6H1mAKpjL47hQ==
# - no ospfv3 ipv4 priority 45
# - no ospfv3 ipv4 area 0.0.0.5
# - no ospfv3 ipv6 passive-interface
# - no ospfv3 ipv6 retransmit-interval 115
# - no ospfv3 hello-interval 77
# - no ospfv3 transmit-delay 100
#
# after:
#   - address_family:
#     - afi: ipv6
#       bfd: true
#       cost: 44
#       ip_params:
#       - afi: ipv6
#         dead_interval: 56
#         mtu_ignore: true
#         network: point-to-point
#     name: Vlan1

# After state:
# ------------
# veos(config)#show running-config | section interface | ospf
# interface Vlan1
#    ospfv3 bfd
#    ospfv3 cost 44
#    no ospfv3 ipv6 passive-interface
#    ospfv3 ipv6 dead-interval 56
#    ospfv3 ipv6 network point-to-point
#    ospfv3 ipv6 mtu-ignore

# Using deleted

# Before state:
# -------------
# veos(config)#show running-config | section interface | ospf
# interface Vlan1
#    ip ospf dead-interval 29
#    ip ospf hello-interval 66
#    ip ospf mtu-ignore
#    ospfv3 bfd
#    ospfv3 cost 106
#    ospfv3 hello-interval 77
#    ospfv3 transmit-delay 100
#    ospfv3 ipv4 priority 45
#    ospfv3 ipv4 area 0.0.0.5
#    ospfv3 ipv6 passive-interface
#    ospfv3 ipv6 dead-interval 56
#    ospfv3 ipv6 retransmit-interval 115
#    ospfv3 ipv6 network point-to-point
#    ospfv3 ipv6 mtu-ignore
# !
# interface Vlan2
#    ospfv3 ipv4 hello-interval 45
#    ospfv3 ipv4 retransmit-interval 100
#    ospfv3 ipv4 area 0.0.0.6

- name: Delete provided ospf interface config
  arista.eos.eos_ospf_interfaces:
    config:
      - name: "Vlan1"
    state: deleted

# Task output:
# ------------
# before:
#   - address_family:
#     - afi: ipv4
#       dead_interval: 29
#       hello_interval: 66
#       mtu_ignore: true
#     - afi: ipv6
#       bfd: true
#       cost: 106
#       hello_interval: 77
#       ip_params:
#       - afi: ipv4
#         area:
#           area_id: 0.0.0.5
#         priority: 45
#       - afi: ipv6
#         dead_interval: 56
#         mtu_ignore: true
#         network: point-to-point
#         passive_interface: true
#         retransmit_interval: 115
#       transmit_delay: 100
#     name: Vlan1
#   - address_family:
#     - afi: ipv6
#       ip_params:
#       - afi: ipv4
#         area:
#           area_id: 0.0.0.6
#         hello_interval: 45
#         retransmit_interval: 100
#     name: Vlan2

# commands:
# - interface Vlan1
# - no ip ospf dead-interval 29
# - no ip ospf hello-interval 66
# - no ip ospf mtu-ignore
# - no ospfv3 bfd
# - no ospfv3 cost 106
# - no ospfv3 hello-interval 77
# - no ospfv3 transmit-delay 100
# - no ospfv3 ipv4 priority 45
# - no ospfv3 ipv4 area 0.0.0.5
# - no ospfv3 ipv6 passive-interface
# - no ospfv3 ipv6 dead-interval 56
# - no ospfv3 ipv6 retransmit-interval 115
# - no ospfv3 ipv6 network point-to-point
# - no ospfv3 ipv6 mtu-ignore
#
# after:
#   - address_family:
#     - afi: ipv6
#       ip_params:
#       - afi: ipv4
#         area:
#           area_id: 0.0.0.6
#         hello_interval: 45
#         retransmit_interval: 100
#     name: Vlan2

# After state:
# ------------
# veos#show running-config | section interface | ospf
# interface Vlan2
#    ospfv3 ipv4 hello-interval 45
#    ospfv3 ipv4 retransmit-interval 100
#    ospfv3 ipv4 area 0.0.0.6

# Using parsed

# parsed.cfg
# ----------
# interface Vlan1
#    ip ospf dead-interval 29
#    ip ospf hello-interval 66
#    ip ospf mtu-ignore
#    ip ospf cost 500
#    ospfv3 bfd
#    ospfv3 cost 106
#    ospfv3 hello-interval 77
#    ospfv3 transmit-delay 100
#    ospfv3 ipv4 priority 45
#    ospfv3 ipv4 area 0.0.0.5
#    ospfv3 ipv6 passive-interface
#    ospfv3 ipv6 dead-interval 56
#    ospfv3 ipv6 retransmit-interval 115
#    ospfv3 ipv6 network point-to-point
#    ospfv3 ipv6 mtu-ignore
# !
# interface Vlan2
#    ospfv3 ipv4 hello-interval 45
#    ospfv3 ipv4 retransmit-interval 100
#    ospfv3 ipv4 area 0.0.0.6
#

- name: parse provided config into structured facts
  arista.eos.eos_ospf_interfaces:
    running_config: "{{ lookup('file', './parsed.cfg') }}"
    state: parsed

# Task output:
# ------------
# parsed:
#   - address_family:
#     - afi: ipv4
#       cost: 500
#       dead_interval: 29
#       hello_interval: 66
#       mtu_ignore: true
#     - afi: ipv6
#       bfd: true
#       cost: 106
#       hello_interval: 77
#       ip_params:
#       - afi: ipv4
#         area:
#           area_id: 0.0.0.5
#         priority: 45
#       - afi: ipv6
#         dead_interval: 56
#         mtu_ignore: true
#         network: point-to-point
#         passive_interface: true
#         retransmit_interval: 115
#       transmit_delay: 100
#     name: Vlan1
#   - address_family:
#     - afi: ipv6
#       ip_params:
#       - afi: ipv4
#         area:
#           area_id: 0.0.0.6
#         hello_interval: 45
#         retransmit_interval: 100
#     name: Vlan2

# Using gathered:

# Device config:
# veos#show running-config | section interface | ospf
# interface Vlan1
#    ip ospf cost 500
#    ip ospf dead-interval 29
#    ip ospf hello-interval 66
#    ip ospf mtu-ignore
#    ip ospf area 0.0.0.50
#    ospfv3 cost 106
#    ospfv3 hello-interval 77
#    ospfv3 transmit-delay 100
#    ospfv3 ipv4 priority 45
#    ospfv3 ipv4 area 0.0.0.5
#    ospfv3 ipv6 passive-interface
#    ospfv3 ipv6 dead-interval 56
#    ospfv3 ipv6 retransmit-interval 115
#    ospfv3 ipv6 network point-to-point
#    ospfv3 ipv6 mtu-ignore
# !
# interface Vlan2
#    ospfv3 ipv4 hello-interval 45
#    ospfv3 ipv4 retransmit-interval 100
#    ospfv3 ipv4 area 0.0.0.6

- name: gather runnig config
  arista.eos.eos_ospf_interfaces:
    state: gathered

# Task output:
# ------------
# gathered:
#   - address_family:
#     - afi: ipv4
#       area:
#         area_id: 0.0.0.50
#       cost: 500
#       dead_interval: 29
#       hello_interval: 66
#       mtu_ignore: true
#     - afi: ipv6
#       cost: 106
#       hello_interval: 77
#       ip_params:
#       - afi: ipv4
#         area:
#           area_id: 0.0.0.5
#         priority: 45
#       - afi: ipv6
#         dead_interval: 56
#         mtu_ignore: true
#         network: point-to-point
#         passive_interface: true
#         retransmit_interval: 115
#       transmit_delay: 100
#     name: Vlan1
#   - address_family:
#     - afi: ipv6
#       ip_params:
#       - afi: ipv4
#         area:
#           area_id: 0.0.0.6
#         hello_interval: 45
#         retransmit_interval: 100
#     name: Vlan2

# Using rendered

- name: Render provided configuration
  arista.eos.eos_ospf_interfaces:
    config:
      - name: "Vlan1"
        address_family:
          - afi: "ipv4"
            dead_interval: 29
            mtu_ignore: true
            hello_interval: 66
          - afi: "ipv6"
            hello_interval: 77
            cost: 106
            transmit_delay: 100
            ip_params:
              - afi: "ipv6"
                retransmit_interval: 115
                dead_interval: 56
                passive_interface: true
              - afi: "ipv4"
                area:
                  area_id: "0.0.0.5"
                priority: 45
      - name: "Vlan2"
        address_family:
          - afi: "ipv6"
            ip_params:
              - afi: "ipv4"
                area:
                  area_id: "0.0.0.6"
                hello_interval: 45
                retransmit_interval: 100
          - afi: "ipv4"
            message_digest_key:
              key_id: 200
              encryption: 7
              key: "hkdfhtu=="

    state: rendered

# Task output:
# ------------
# rendered:
# - interface Vlan1
# - ip ospf dead-interval 29
# - ip ospf mtu-ignore
# - ip ospf hello-interval 66
# - ospfv3 hello-interval 77
# - ospfv3 cost 106
# - ospfv3 transmit-delay 100
# - ospfv3 ipv4 area 0.0.0.5
# - ospfv3 ipv4 priority 45
# - ospfv3 ipv6 retransmit-interval 115
# - ospfv3 ipv6 dead-interval 56
# - ospfv3 ipv6 passive-interface
# - interface Vlan2
# - ip ospf message-digest-key 200 md5 7 hkdfhtu==
# - ospfv3 ipv4 area 0.0.0.6
# - ospfv3 ipv4 hello-interval 45
# - ospfv3 ipv4 retransmit-interval 100

返回值

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

描述

after

列表 / 元素=字符串

模块执行后的结果配置。

已返回:当更改时

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

之前

列表 / 元素=字符串

模块执行之前的配置。

返回:statemerged, replaced, overridden, deletedpurged

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

命令

列表 / 元素=字符串

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

返回:statemerged, replaced, overridden, deletedpurged

示例: ["interface Vlan1", "ip ospf dead-interval 29", "ip ospf mtu-ignore"]

已收集

列表 / 元素=字符串

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

返回:stategathered

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

已解析

列表 / 元素=字符串

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

返回:stateparsed

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

已渲染

列表 / 元素=字符串

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

返回:staterendered

示例: ["interface Vlan1", "ip ospf dead-interval 29", "ip ospf mtu-ignore"]

作者

  • Gomathi Selvi Srinivasan (@GomathiselviS)