cisco.nxos.nxos_lacp 模块 – LACP 资源模块

注意

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

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

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

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

cisco.nxos 1.0.0 中的新增功能

概要

  • 此模块管理 NX-OS 设备上的全局链路聚合控制协议 (LACP)。

参数

参数

注释

config

字典

LACP 全局选项。

system

字典

LACP 系统选项

mac

字典

用于 LACP 协议交换的 MAC 地址

address

字符串

MAC 地址(格式:xxxx.xxxx.xxxx)。

role

字符串

交换机的角色。

选项

  • "primary"

  • "secondary"

priority

整数

在 LACP 协商中使用的系统优先级。

running_config

字符串

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

此选项的值应是从 NX-OS 设备执行命令 **show running-config | include lacp** 收到的输出。

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

state

字符串

模块完成后的配置状态。

状态 replacedoverridden 对此模块具有相同的行为。

选项

  • "merged" ← (默认)

  • "replaced"

  • "overridden"

  • "deleted"

  • "gathered"

  • "rendered"

  • "parsed"

注释

注意

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

  • 不支持 Cisco MDS

  • 此模块应启用 lacp 功能。

示例

# Using merged

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

- name: Merge provided configuration with device configuration.
  cisco.nxos.nxos_lacp:
    config:
      system:
        priority: 10
        mac:
          address: 00c1.4c00.bd15
    state: merged

# After state:
# ------------
#
# lacp system-priority 10
# lacp system-mac 00c1.4c00.bd15


# Using replaced

# Before state:
# -------------
#
# lacp system-priority 10

- name: Replace device global lacp configuration with the given configuration.
  cisco.nxos.nxos_lacp:
    config:
      system:
        mac:
          address: 00c1.4c00.bd15
    state: replaced

# After state:
# ------------
#
# lacp system-mac 00c1.4c00.bd15


# Using deleted

# Before state:
# -------------
#
# lacp system-priority 10

- name: Delete global LACP configurations.
  cisco.nxos.nxos_lacp:
    state: deleted

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

# Using rendered

- name: Render platform specific configuration lines (without connecting to the device)
  cisco.nxos.nxos_lacp:
    config:
      system:
        priority: 10
        mac:
          address: 00c1.4c00.bd15
          role: secondary
    state: rendered

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

# rendered:
#   - "lacp system-priority 10"
#   - "lacp system-mac 00c1.4c00.bd15 role secondary"

# Using parsed

# parsed.cfg
# ------------
# lacp system-priority 10
# lacp system-mac 00c1.4c00.bd15 role secondary

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

# Task output (redacted)
# -----------------------
# parsed:
#  system:
#    priority: 10
#    mac:
#      address: 00c1.4c00.bd15
#      role: secondary

# Using gathered

# Existing device config state
# -------------------------------
# Nexus9000v# show running-config | include lacp
# lacp system-priority 11
# lacp system-mac 00c1.4c00.bd15 role primary

- name: Gather lacp facts from the device using nxos_lacp
  cisco.nxos.nxos_lacp:
    state: gathered

# Task output (redacted)
# -----------------------
# gathered:
#  system:
#    priority: 11
#    mac:
#      address: 00c1.4c00.bd15
#      role: primary

返回值

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

描述

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

列表 / 元素=字符串

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

返回:始终返回

示例: ["lacp system-priority 15", "lacp system-mac 00c1.4c00.bd15 role primary"]

作者

  • Trishna Guha (@trishnaguha)