cisco.nxos.nxos_lacp_interfaces 模块 – LACP 接口资源模块

注意

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

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

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

要在 playbook 中使用它,请指定:cisco.nxos.nxos_lacp_interfaces

cisco.nxos 1.0.0 中的新增功能

概要

  • 此模块管理 NX-OS 接口的链路聚合控制协议 (LACP) 属性。

参数

参数

注释

config

列表 / 元素=字典

LACP 接口选项的字典。

convergence

字典

此字典包含与收敛相关的可配置选项。仅适用于端口通道。

graceful

布尔值

端口通道 LACP 优雅收敛。仅当 LACP 端口连接到非 Nexus 对等节点时才禁用此选项。与 Nexus 对等节点禁用此选项可能会导致端口暂停。

选项

  • false

  • true

vpc

布尔值

为 vPC 端口通道启用 LACP 收敛。

选项

  • false

  • true

字典

此字典包含与最大和最小端口通道链路相关的可配置选项。仅适用于端口通道。

整数

端口通道最大捆绑。

整数

端口通道最小链路。

mode

字符串

LACP 模式。仅适用于端口通道。

选项

  • "delay"

name

字符串 / 必需

接口名称。

port_priority

整数

接口的 LACP 端口优先级。范围 1-65535。仅适用于以太网。

rate

字符串

LACP 发送 PDU 的速率。仅适用于以太网。在快速速率下,LACP 每 1 秒传输一次。在正常速率下,在链路捆绑后,LACP 每 30 秒传输一次。

选项

  • "fast"

  • "normal"

suspend_individual

布尔值

端口通道 LACP 状态。禁用此选项将导致 LACP 将端口置于单个状态,并且如果它没有从端口通道中的对等端口获得 LACP BPDU,则不会暂停端口。

选项

  • false

  • true

running_config

字符串

此选项仅与 state _parsed_ 一起使用。

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

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

state

字符串

模块完成后的配置状态。

选项

  • "merged" ← (默认)

  • "replaced"

  • "overridden"

  • "deleted"

  • "gathered"

  • "rendered"

  • "parsed"

注释

注意

  • 在 VIRL 上针对 NXOS 7.3.(0)D1(1) 测试

  • 不支持 Cisco MDS

示例

# Using merged

# Before state:
# -------------
#

- name: Merge provided configuration with device configuration.
  cisco.nxos.nxos_lacp_interfaces:
    config:
      - name: Ethernet1/3
        port_priority: 5
        rate: fast
    state: merged

# After state:
# ------------
#
# interface Ethernet1/3
# lacp port-priority 5
# lacp rate fast


# Using replaced

# Before state:
# -------------
#
# interface Ethernet1/3
#   lacp port-priority 5
# interface port-channel11
#   lacp mode delay

- name: Replace device lacp interfaces configuration with the given configuration.
  cisco.nxos.nxos_lacp_interfaces:
    config:
      - name: port-channel11
        links:
          min: 4
    state: replaced

# After state:
# ------------
#
# interface Ethernet1/3
#   lacp port-priority 5
# interface port-channel11
#   lacp min-links 4


# Using overridden

# Before state:
# -------------
#
# interface Ethernet1/3
#   lacp port-priority 5
# interface port-channel11
#   lacp mode delay

- name: Override device configuration of all LACP interfaces attributes of given interfaces
    on device with provided configuration.
  cisco.nxos.nxos_lacp_interfaces:
    config:
      - name: port-channel11
        links:
          min: 4
    state: overridden

# After state:
# ------------
#
# interface port-channel11
# lacp min-links 4


# Using deleted

# Before state:
# -------------
#
# interface Ethernet1/3
#   lacp port-priority 5
# interface port-channel11
#   lacp mode delay

- name: Delete LACP interfaces configurations.
  cisco.nxos.nxos_lacp_interfaces:
    state: deleted

# After state:
# ------------
#

# Using rendered

- name: Use rendered state to convert task input to device specific commands
  cisco.nxos.nxos_lacp_interfaces:
    config:
      - name: Ethernet1/800
        rate: fast
      - name: Ethernet1/801
        rate: fast
        port_priority: 32
      - name: port-channel10
        links:
          max: 15
          min: 2
        convergence:
          graceful: true
    state: rendered

# Task Output (redacted)
# -----------------------

# rendered:
#  - "interface Ethernet1/800"
#  - "lacp rate fast"
#  - "interface Ethernet1/801"
#  - "lacp port-priority 32"
#  - "lacp rate fast"
#  - "interface port-channel10"
#  - "lacp min-links 2"
#  - "lacp max-bundle 15"
#  - "lacp graceful-convergence"

# Using parsed

# parsed.cfg
# ------------

# interface port-channel10
#   lacp min-links 10
#   lacp max-bundle 15
# interface Ethernet1/800
#   lacp port-priority 100
#   lacp rate fast

- name: Use parsed state to convert externally supplied config to structured format
  cisco.nxos.nxos_lacp_interfaces:
    running_config: "{{ lookup('file', 'parsed.cfg') }}"
    state: parsed

# Task output (redacted)
# -----------------------

# parsed:
#   - name: port-channel10
#     links:
#       max: 15
#       min: 10
#   - name: Ethernet1/800
#     port_priority: 100
#     rate: fast

# Using gathered

# Existing device config state
# -------------------------------
# interface Ethernet1/1
#   lacp port-priority 5
#   lacp rate fast
# interface port-channel10
#   lacp mode delay
# interface port-channel11
#   lacp max-bundle 10
#   lacp min-links 5

- name: Gather lacp_interfaces facts from the device using nxos_lacp_interfaces
  cisco.nxos.nxos_lacp_interfaces:
    state: gathered

# Task output (redacted)
# -----------------------
# gathered:
#  - name: Ethernet1/1
#    port_priority: 5
#    rate: fast
#  - name: port-channel10
#    mode: delay
#  - name: port-channel11
#    links:
#      max: 10
#      min: 5

返回值

公共返回值已在此处记录,以下是此模块特有的字段

描述

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

列表 / 元素=字符串

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

返回:始终

示例: ["interface port-channel10", "lacp min-links 5", "lacp mode delay"]

作者

  • Trishna Guha (@trishnaguha)