arista.eos.eos_lag_interfaces 模块 – LAG 接口资源模块

注意

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

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

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

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

arista.eos 1.0.0 中的新功能

概要

  • 此模块管理 Arista EOS 设备上的链路聚合组的属性。

参数

参数

注释

config

列表 / 元素=字典

链路聚合组配置的列表。

members

列表 / 元素=字典

属于该组的以太网接口。

member

字符串

作为 LAG 成员的以太网接口的名称。

mode

字符串

此接口的 LAG 模式。

选项

  • "active"

  • "on"

  • "passive"

name

字符串 / 必需

链路聚合组 (LAG) 的端口通道接口的名称,例如 Port-Channel5。

running_config

字符串

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

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

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

state

字符串

模块完成后的配置状态。

选项

  • "merged" ← (默认)

  • "replaced"

  • "overridden"

  • "deleted"

  • "rendered"

  • "gathered"

  • "parsed"

注意

注意

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

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

示例

# Using merged

# Before state:
# -------------
#
# veos#show running-config | section interface
# interface Ethernet1
#   channel-group 5 mode on
# interface Ethernet2

- name: Merge provided LAG attributes with existing device configuration
  arista.eos.eos_lag_interfaces:
    config:
      - name: Port-Channel5
        members:
          - member: Ethernet2
            mode: "on"
    state: merged

# After state:
# ------------
#
# veos#show running-config | section interface
# interface Ethernet1
#   channel-group 5 mode on
# interface Ethernet2
#   channel-group 5 mode on


# Using replaced

# Before state:
# -------------
#
# veos#show running-config | section interface
# interface Ethernet1
#   channel-group 5 mode on
# interface Ethernet2

- name: Replace all device configuration of specified LAGs with provided configuration
  arista.eos.eos_lag_interfaces:
    config:
      - name: Port-Channel5
        members:
          - member: Ethernet2
            mode: "on"
    state: replaced

# After state:
# ------------
#
# veos#show running-config | section interface
# interface Ethernet1
# interface Ethernet2
#   channel-group 5 mode on


# Using overridden

# Before state:
# -------------
#
# veos#show running-config | section interface
# interface Ethernet1
#   channel-group 5 mode on
# interface Ethernet2

- name: Override all device configuration of all LAG attributes with provided configuration
  arista.eos.eos_lag_interfaces:
    config:
      - name: Port-Channel10
        members:
          - member: Ethernet2
            mode: "on"
    state: overridden

# After state:
# ------------
#
# veos#show running-config | section interface
# interface Ethernet1
# interface Ethernet2
#   channel-group 10 mode on


# Using deleted

# Before state:
# -------------
#
# veos#show running-config | section interface
# interface Ethernet1
#   channel-group 5 mode on
# interface Ethernet2
#   channel-group 5 mode on

- name: Delete LAG attributes of the given interfaces.
  arista.eos.eos_lag_interfaces:
    config:
      - name: Port-Channel5
        members:
          - member: Ethernet1
    state: deleted

# After state:
# ------------
#
# veos#show running-config | section interface
# interface Ethernet1
# interface Ethernet2
#   channel-group 5 mode on

# Using parsed:

# parsed.cfg
# interface Ethernet1
#   channel-group 5 mode on
# interface Ethernet2
#   channel-group 5 mode on

- name: Use parsed to convert native configs to structured data
  arista.eos.lag_interfaces:
    running_config: "{{ lookup('file', 'parsed.cfg') }}"
    state: parsed

# Output:
#   parsed:
#     - name: Port-Channel5
#       members:
#         - member: Ethernet2
#           mode: "on"
#         - member: Ethernet1
#           mode: "on"

# using rendered:

- name: Use Rendered to convert the structured data to native config
  arista.eos.eos_lag_interfaces:
    config:
      - name: Port-Channel5
        members:
          - member: Ethernet2
            mode: "on"
          - member: Ethernet1
            mode: "on"
    state: rendered
# -----------
# Output
# -----------
#
# rendered:

# interface Ethernet1
#   channel-group 5 mode on
# interface Ethernet2
#   channel-group 5 mode on


# Using gathered:

# native config:
# interface Ethernet1
#   channel-group 5 mode on
# interface Ethernet2
#   channel-group 5 mode on

- name: Gather lldp_global facts from the device
  arista.eos.lldp_global:
    state: gathered

# Output:
#   gathered:
#     - name: Port-Channel5
#       members:
#         - member: Ethernet2
#           mode: on
#         - member: Ethernet1
#           mode: on

返回值

常见的返回值记录在此处,以下是此模块特有的字段

描述

after

列表 / 元素=字符串

模块完成后,配置为结构化数据。

返回: 当更改时

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

before

列表 / 元素=字符串

模块调用之前,配置为结构化数据。

返回: 始终

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

commands

列表 / 元素=字符串

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

返回: 始终

示例: ["命令 1", "命令 2", "命令 3"]

作者

  • Nathaniel Case (@Qalthos)