cisco.ios.ios_lldp_global module – Resource module to configure LLDP.
Note
This module is part of the cisco.ios collection (version 3.3.2).
You might already have this collection installed if you are using the ansible
package.
It is not included in ansible-core
.
To check whether it is installed, run ansible-galaxy collection list
.
To install it, use: ansible-galaxy collection install cisco.ios
.
To use it in a playbook, specify: cisco.ios.ios_lldp_global
.
New in cisco.ios 1.0.0
Synopsis
This module configures and manages the Link Layer Discovery Protocol(LLDP) attributes on IOS platforms.
Parameters
Parameter |
Comments |
---|---|
A dictionary of LLDP options |
|
Enable LLDP Choices:
|
|
LLDP holdtime (in sec) to be sent in packets. Refer to vendor documentation for valid values. |
|
Specify the delay (in secs) for LLDP to initialize. Refer to vendor documentation for valid values. NOTE, if LLDP reinit is configured with a starting value, idempotency won’t be maintained as the Cisco device doesn’t record the starting reinit configured value. As such, Ansible cannot verify if the respective starting reinit value is already configured or not from the device side. If you try to apply starting reinit value in every play run, Ansible will show changed as True. For any other reinit value, idempotency will be maintained since any other reinit value is recorded in the Cisco device. |
|
Specify the rate at which LLDP packets are sent (in sec). Refer to vendor documentation for valid values. |
|
Selection of LLDP TLVs i.e. type-length-value to send NOTE, if tlv-select is configured idempotency won’t be maintained as Cisco device doesn’t record configured tlv-select options. As such, Ansible cannot verify if the respective tlv-select options is already configured or not from the device side. If you try to apply tlv-select option in every play run, Ansible will show changed as True. |
|
Cisco 4-wire Power via MDI TLV Choices:
|
|
IEEE 802.3 MAC/Phy Configuration/status TLV Choices:
|
|
Management Address TLV Choices:
|
|
Port Description TLV Choices:
|
|
Port VLAN ID TLV Choices:
|
|
IEEE 802.3 DTE Power via MDI TLV Choices:
|
|
System Capabilities TLV Choices:
|
|
System Description TLV Choices:
|
|
System Name TLV Choices:
|
|
This option is used only with state parsed. The value of this option should be the output received from the IOS device by executing the command show running-config | section ^lldp. The state parsed reads the configuration from |
|
The state the configuration should be left in The states rendered, gathered and parsed does not perform any change on the device. The state rendered will transform the configuration in The state gathered will fetch the running configuration from device and transform it into structured data in the format as per the resource module argspec and the value is returned in the gathered key within the result. The state parsed reads the configuration from Choices:
|
Notes
Note
Tested against Cisco IOSv Version 15.2 on VIRL.
This module works with connection
network_cli
. See https://docs.ansible.com/ansible/latest/network/user_guide/platform_ios.html
Examples
# 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
# }
Return Values
Common return values are documented here, the following are the fields unique to this module:
Key |
Description |
---|---|
The configuration as structured data after module completion. Returned: when changed Sample: |
|
The configuration as structured data prior to module invocation. Returned: always Sample: |
|
The set of commands pushed to the remote device Returned: always Sample: |