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

注意

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

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

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

要在剧本中使用它,请指定: 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

字符串

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

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

state *parsed* 从 running_config 选项读取配置并将其转换为 Ansible 结构化数据,该数据符合资源模块的 argspec,然后该值将在结果中的 *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

列表 / 元素=字符串

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

返回:已更改时

示例: ["The configuration returned will always be in the same format\n of the parameters above.\n"]

before

列表 / 元素=字符串

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

返回:始终返回

示例: ["The configuration returned will always be in the same format\n of the parameters above.\n"]

commands

列表 / 元素=字符串

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

返回:始终返回

示例: ["command 1", "command 2", "command 3"]

作者

  • Nathaniel Case (@Qalthos)