cisco.ios.ios_lldp_global – LLDP resource module

Note

This plugin is part of the cisco.ios collection (version 2.6.0).

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 version 1.0.0: of cisco.ios

Synopsis

  • This module configures and manages the Link Layer Discovery Protocol(LLDP) attributes on IOS platforms.

Note

This module has a corresponding action plugin.

Parameters

Parameter

Comments

config

dictionary

A dictionary of LLDP options

enabled

boolean

Enable LLDP

Choices:

  • no

  • yes

holdtime

integer

LLDP holdtime (in sec) to be sent in packets.

Refer to vendor documentation for valid values.

reinit

integer

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.

timer

integer

Specify the rate at which LLDP packets are sent (in sec).

Refer to vendor documentation for valid values.

tlv_select

dictionary

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.

four_wire_power_management

boolean

Cisco 4-wire Power via MDI TLV

Choices:

  • no

  • yes

mac_phy_cfg

boolean

IEEE 802.3 MAC/Phy Configuration/status TLV

Choices:

  • no

  • yes

management_address

boolean

Management Address TLV

Choices:

  • no

  • yes

port_description

boolean

Port Description TLV

Choices:

  • no

  • yes

port_vlan

boolean

Port VLAN ID TLV

Choices:

  • no

  • yes

power_management

boolean

IEEE 802.3 DTE Power via MDI TLV

Choices:

  • no

  • yes

system_capabilities

boolean

System Capabilities TLV

Choices:

  • no

  • yes

system_description

boolean

System Description TLV

Choices:

  • no

  • yes

system_name

boolean

System Name TLV

Choices:

  • no

  • yes

running_config

string

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 running_config option and transforms it into Ansible structured data as per the resource module’s argspec and the value is then returned in the parsed key within the result.

state

string

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 config option to platform specific CLI commands which will be returned in the rendered key within the result. For state rendered active connection to remote host is not required.

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 running_config option and transforms it into JSON format as per the resource module parameters and the value is returned in the parsed key within the result. The value of running_config option should be the same format as the output of command show running-config | include ip route|ipv6 route executed on device. For state parsed active connection to remote host is not required.

Choices:

  • merged ← (default)

  • replaced

  • deleted

  • rendered

  • gathered

  • parsed

Notes

Note

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

after

dictionary

The configuration as structured data after module completion.

Returned: when changed

Sample: “The configuration returned will always be in the same format of the parameters above.”

before

dictionary

The configuration as structured data prior to module invocation.

Returned: always

Sample: “The configuration returned will always be in the same format of the parameters above.”

commands

list / elements=string

The set of commands pushed to the remote device

Returned: always

Sample: [“lldp holdtime 10”, “lldp run”, “lldp timer 10”]

Authors

  • Sumit Jaiswal (@justjais)