W3cubDocs

/Ansible 2.11

cisco.nxos.nxos_lldp_global – LLDP resource module

Note

This plugin is part of the cisco.nxos collection (version 1.4.0).

To install it use: ansible-galaxy collection install cisco.nxos.

To use it in a playbook, specify: cisco.nxos.nxos_lldp_global.

New in version 1.0.0: of cisco.nxos

Synopsis

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

Note

This module has a corresponding action plugin.

Parameters

Parameter Choices/Defaults Comments
config
dictionary
A list of link layer discovery configurations
holdtime
integer
Amount of time the receiving device should hold the information (in seconds)
port_id
integer
    Choices:
  • 0
  • 1
This attribute defines if the interface names should be advertised in the long(0) or short(1) form.
reinit
integer
Amount of time to delay the initialization of LLDP on any interface (in seconds)
timer
integer
Frequency at which LLDP updates need to be transmitted (in seconds)
tlv_select
dictionary
This attribute can be used to specify the TLVs that need to be sent and received in the LLDP packets. By default, all TLVs are advertised
dcbxp
boolean
    Choices:
  • no
  • yes
Used to specify the Data Center Bridging Exchange Protocol TLV
management_address
dictionary
Used to specify the management address in TLV messages
v4
boolean
    Choices:
  • no
  • yes
Management address with TLV v4
v6
boolean
    Choices:
  • no
  • yes
Management address with TLV v6
port
dictionary
Used to manage port based attributes in TLV messages
description
boolean
    Choices:
  • no
  • yes
Used to specify the port description TLV
vlan
boolean
    Choices:
  • no
  • yes
Used to specify the port VLAN ID TLV
power_management
boolean
    Choices:
  • no
  • yes
Used to specify IEEE 802.3 DTE Power via MDI TLV
system
dictionary
Used to manage system based attributes in TLV messages
capabilities
boolean
    Choices:
  • no
  • yes
Used to specify the system capabilities TLV
description
boolean
    Choices:
  • no
  • yes
Used to specify the system description TLV
name
boolean
    Choices:
  • no
  • yes
Used to specify the system name TLV
running_config
string
This option is used only with state parsed.
The value of this option should be the output received from the NX-OS device by executing the command show running-config | include 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
    Choices:
  • merged
  • replaced
  • deleted
  • gathered
  • rendered
  • parsed
The state of the configuration after module completion

Notes

Note

  • Tested against NxOS 7.3.(0)D1(1) on VIRL
  • The LLDP feature needs to be enabled before using this module

Examples

# Using merged
# Before state:
# -------------
#
# user(config)# show running-config | include lldp
# feature lldp

- name: Merge provided configuration with device configuration
  cisco.nxos.nxos_lldp_global:
    config:
      timer: 35
      holdtime: 100
    state: merged

# After state:
# ------------
#
# user(config)# show running-config | include lldp
# feature lldp
# lldp timer 35
# lldp holdtime 100


# Using replaced
# Before state:
# -------------
#
# user(config)# show running-config | include lldp
# feature lldp
# lldp holdtime 100
# lldp reinit 5
# lldp timer 35

- name: Replace device configuration of specific LLDP attributes with provided configuration
  cisco.nxos.nxos_lldp_global:
    config:
      timer: 40
      tlv_select:
        system:
          description: true
          name: false
        management_address:
          v4: true
    state: replaced

# After state:
# ------------
#
# user(config)# show running-config | include lldp
# feature lldp
# lldp timer 40
# no lldp tlv-select system-name


# Using deleted
# Before state:
# -------------
#
# user(config)# show running-config | include lldp
# feature lldp
# lldp holdtime 5
# lldp reinit 3

- name: Delete LLDP configuration (this will by default remove all lldp configuration)
  cisco.nxos.nxos_lldp_global:
    state: deleted

# After state:
# ------------
#
# user(config)# show running-config | include lldp
# feature lldp

# Using rendered

- name: Use rendered state to convert task input to device specific commands
  cisco.nxos.nxos_lldp_global:
    config:
      holdtime: 130
      port_id: 1
      reinit: 5
      tlv_select:
        dcbxp: yes
        power_management: yes
    state: rendered

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

# rendered:
#   - "lldp tlv-select dcbxp"
#   - "lldp tlv-select power-management"
#   - "lldp portid-subtype 1"
#   - "lldp reinit 5"
#   - "lldp holdtime 130"

# Using parsed

# parsed.cfg
# ------------
# lldp holdtime 131
# lldp reinit 7
# no lldp tlv-select system-name
# no lldp tlv-select system-description

# Task output (redacted)
# -----------------------

# parsed:
#   holdtime: 131
#   reinit: 7
#   tlv_select:
#     system:
#       description: false
#       name: false

# Using gathered

# Existing device config state
# -------------------------------
# feature lldp
# lldp holdtime 129
# lldp reinit 5
# lldp timer 35
# no lldp tlv-select system-name

# Task output (redacted)
# -----------------------

# gathered:
#   reinit: 5
#   timer: 35
#   tlv_select:
#     system:
#       name: False
#   holdtime: 129

Return Values

Common return values are documented here, the following are the fields unique to this module:

Key Returned Description
after
dictionary
when changed
The configuration as structured data after module completion.

Sample:
The configuration returned will always be in the same format of the parameters above.
before
dictionary
always
The configuration as structured data prior to module invocation.

Sample:
The configuration returned will always be in the same format of the parameters above.
commands
list / elements=string
always
The set of commands pushed to the remote device.

Sample:
['lldp holdtime 125', 'lldp reinit 4', 'no lldp tlv-select system-name']


Authors

  • Adharsh Srivats Rangarajan (@adharshsrivatsr)

© 2012–2018 Michael DeHaan
© 2018–2021 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/2.11/collections/cisco/nxos/nxos_lldp_global_module.html