cisco.ios.ios_lldp_global 模块 – 配置 LLDP 的资源模块。
注意
此模块是 cisco.ios 集合 (版本 9.0.3) 的一部分。
如果您使用的是 ansible
软件包,则可能已经安装了此集合。它不包含在 ansible-core
中。要检查它是否已安装,请运行 ansible-galaxy collection list
。
要安装它,请使用: ansible-galaxy collection install cisco.ios
。
要在剧本中使用它,请指定: cisco.ios.ios_lldp_global
。
cisco.ios 1.0.0 中的新增功能
概要
此模块配置和管理 IOS 平台上的链路层发现协议 (LLDP) 属性。
参数
参数 |
注释 |
---|---|
LLDP 选项的字典 |
|
启用 LLDP 选项
|
|
LLDP 保持时间(以秒为单位),将发送在数据包中。 请参考供应商文档以了解有效值。 |
|
指定 LLDP 初始化的延迟(以秒为单位)。 请参考供应商文档以了解有效值。 注意,如果 LLDP reinit 配置了起始值,则不会保持幂等性,因为 Cisco 设备不会记录配置的起始 reinit 值。因此,Ansible 无法从设备端验证相应的起始 reinit 值是否已配置。如果尝试在每次运行中应用起始 reinit 值,Ansible 将显示 changed 为 True。对于任何其他 reinit 值,将保持幂等性,因为任何其他 reinit 值都会记录在 Cisco 设备中。 |
|
指定发送 LLDP 数据包的速率(以秒为单位)。 请参考供应商文档以了解有效值。 |
|
选择要发送的 LLDP TLV,即类型-长度-值。 注意,如果配置了 tlv-select,则不会保持幂等性,因为 Cisco 设备不会记录配置的 tlv-select 选项。因此,Ansible 无法从设备端验证相应的 tlv-select 选项是否已配置。如果尝试在每次运行中应用 tlv-select 选项,Ansible 将显示 changed 为 True。 |
|
通过 MDI TLV 进行 Cisco 4 线供电 选项
|
|
IEEE 802.3 MAC/Phy 配置/状态 TLV 选项
|
|
管理地址 TLV 选项
|
|
端口描述 TLV 选项
|
|
端口 VLAN ID TLV 选项
|
|
IEEE 802.3 DTE 通过 MDI TLV 供电 选项
|
|
系统功能 TLV 选项
|
|
系统描述 TLV 选项
|
|
系统名称 TLV 选项
|
|
此选项仅与 state *parsed* 一起使用。 此选项的值应为通过执行命令 **show running-config | section ^lldp** 从 IOS 设备接收到的输出。 state *parsed* 从 |
|
配置应保留的状态 该模块对 replaced 和 overridden 状态具有声明性相似的行为。 状态 *rendered*、*gathered* 和 *parsed* 不会对设备进行任何更改。 状态 *rendered* 将 状态 *gathered* 将从设备获取运行配置,并将其转换为符合资源模块 argspec 格式的结构化数据,该值将在结果中的 *gathered* 密钥中返回。 状态 *parsed* 从 选项
|
备注
注意
在 CML 上针对 Cisco IOSXE 版本 17.3 进行测试。
此模块适用于连接
network_cli
。请参阅 https://docs.ansible.org.cn/ansible/latest/network/user_guide/platform_ios.html
示例
# Using merged
# Before state:
# -------------
# vios#sh running-config | section ^lldp
# vios1#
- name: Merge provided configuration with device configuration
cisco.ios.ios_lldp_global:
config:
holdtime: 10
enabled: true
reinit: 3
timer: 10
state: merged
# After state:
# ------------
# vios#sh running-config | section ^lldp
# lldp timer 10
# lldp holdtime 10
# lldp reinit 3
# lldp run
# Using replaced
# Before state:
# -------------
# vios#sh running-config | section ^lldp
# lldp timer 10
# lldp holdtime 10
# lldp reinit 3
# lldp run
- name: Replaces LLDP device configuration with provided configuration
cisco.ios.ios_lldp_global:
config:
holdtime: 20
reinit: 5
state: replaced
# After state:
# -------------
# vios#sh running-config | section ^lldp
# lldp holdtime 20
# lldp reinit 5
# Using Deleted without any config passed
# "(NOTE: This will delete all of configured LLDP module attributes)"
# Before state:
# -------------
# vios#sh running-config | section ^lldp
# lldp timer 10
# lldp holdtime 10
# lldp reinit 3
# lldp run
- name: Delete LLDP attributes
cisco.ios.ios_lldp_global:
state: deleted
# After state:
# -------------
# vios#sh running-config | section ^lldp
# vios1#
# Using Gathered
# Before state:
# -------------
#
# vios#sh running-config | section ^lldp
# lldp timer 10
# lldp holdtime 10
# lldp reinit 3
# lldp run
- name: Gather listed interfaces with provided configurations
cisco.ios.ios_lldp_global:
config:
state: gathered
# Module Execution Result:
# ------------------------
#
# "gathered": {
# "enabled": true,
# "holdtime": 10,
# "reinit": 3,
# "timer": 10
# }
# After state:
# ------------
#
# vios#sh running-config | section ^lldp
# lldp timer 10
# lldp holdtime 10
# lldp reinit 3
# lldp run
# Using Rendered
- name: Render the commands for provided configuration
cisco.ios.ios_lldp_global:
config:
holdtime: 10
enabled: true
reinit: 3
timer: 10
state: rendered
# Module Execution Result:
# ------------------------
#
# "rendered": [
# "lldp holdtime 10",
# "lldp run",
# "lldp timer 10",
# "lldp reinit 3"
# ]
# Using Parsed
# File: parsed.cfg
# ----------------
#
# lldp timer 10
# lldp holdtime 10
# lldp reinit 3
# lldp run
- name: Parse the commands for provided configuration
cisco.ios.ios_lldp_global:
running_config: "{{ lookup('file', 'parsed.cfg') }}"
state: parsed
# Module Execution Result:
# ------------------------
#
# "parsed": {
# "enabled": true,
# "holdtime": 10,
# "reinit": 3,
# "timer": 10
# }
返回值
常见的返回值已在此处记录,以下是此模块特有的字段
键 |
描述 |
---|---|
模块完成后的结构化数据配置。 返回值:已更改时 示例: |
|
模块调用之前的结构化数据配置。 返回值:始终返回 示例: |
|
推送到远程设备的命令集 返回值:始终返回 示例: |