cisco.nxos.nxos_lldp_interfaces 模块 – LLDP 接口资源模块

注意

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

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

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

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

cisco.nxos 1.0.0 中的新功能

概述

  • 此模块管理 NX-OS 平台上链路层发现协议 (LLDP) 的接口配置。

参数

参数

注释

config

列表 / 元素=字典

接口的链路层发现配置列表。

name

字符串 / 必需

接口的名称

receive

布尔值

用于启用或禁用该接口上 LLDP 数据包的接收。默认情况下,在全局启用 LLDP 后启用此项。

选择

  • false

  • true

tlv_set

字典

用于配置接口上的 TLV 参数

management_address

字符串

用于提及接口的 IPv4 或 IPv6 管理地址

vlan

整数

用于提及接口的 VLAN

transmit

布尔值

用于启用或禁用该接口上 LLDP 数据包的传输。默认情况下,在全局启用 LLDP 后启用此项。

选择

  • false

  • true

running_config

字符串

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

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

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

state

字符串

配置应处于的状态

选择

  • "merged" ←(默认)

  • "replaced"

  • "overridden"

  • "deleted"

  • "gathered"

  • "rendered"

  • "parsed"

说明

注意

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

  • 不支持 Cisco MDS

  • 在使用此模块之前,需要启用 LLDP 功能

示例

# Using merged

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

- name: Merge provided configuration with device configuration
  cisco.nxos.nxos_lldp_interfaces:
    config:
      - name: Ethernet1/4
        receive: false
        transmit: true
        tlv_set:
          management_address: 192.168.122.64
        vlan: 12
    state: merged

# After state:
# -------------
#
# interface Ethernet1/4
#   no lldp receive
#   lldp tlv-set management-address 192.168.122.64
#   lldp tlv-set vlan 12


# Using replaced

# Before state:
# ------------
#
# interface Ethernet1/4
#   no lldp receive
#   lldp tlv-set management-address 192.168.122.64
# interface Ethernet1/5
#   no lldp transmit
#   lldp tlv-set vlan 10

- name: Replace LLDP configuration on interfaces with given configuration
  cisco.nxos.nxos_lldp_interfaces:
    config:
      - name: Ethernet1/4
        transmit: false
        tlv_set:
          vlan: 2
    state: replaced


# After state:
# -----------
#
# interface Ethernet1/4
#   no lldp transmit
#   lldp tlv_set vlan 2
# interface Ethernet1/5
#   no lldp transmit
#   lldp tlv-set vlan 10


# Using overridden

# Before state:
# ------------
#
# interface Ethernet1/4
#   no lldp receive
#   lldp tlv-set management-address 192.168.122.64
# interface Ethernet1/5
#   no lldp transmit
#   lldp tlv-set vlan 10

- name: Override LLDP configuration on all interfaces with given configuration
  cisco.nxos.nxos_lldp_interfaces:
    config:
      - name: Ethernet1/7
        receive: false
        tlv_set:
          vlan: 12
    state: overridden


# After state:
# -----------
#
# interface Ethernet1/7
#   no lldp receive
#   lldp tlv_set vlan 12


# Using deleted

# Before state:
# ------------
#
# interface Ethernet1/4
#   lldp tlv-set management vlan 24
#   no lldp transmit
# interface mgmt0
#   no lldp receive

- name: Delete LLDP interfaces configuration
  cisco.nxos.nxos_lldp_interfaces:
    state: deleted

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

返回值

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

描述

after

列表 / 元素=字符串

生成的配置模型调用。

返回:当更改时

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

before

列表 / 元素=字符串

模型调用之前的配置。

返回:始终

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

commands

列表 / 元素=字符串

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

返回:始终

示例: ["interface Ethernet1/2", "lldp receive", "lldp tlv-set vlan 12"]

作者

  • Adharsh Srivats Rangarajan (@adharshsrivatsr)