- AnsibleFest
- Products
- Community
- Webinars & Training
- Blog

Documentation

# ios_lldp_interfaces – Manage link layer discovery protocol (LLDP) attributes of interfaces on Cisco IOS devices

New in version 2.9.

- Synopsis

- Parameters

- Notes

- Examples

- Return Values

- Status

## Synopsis

- This module manages link layer discovery protocol (LLDP) attributes of interfaces on Cisco IOS devices.

## Parameters

Parameter | Choices/Defaults | Comments
--- | --- | ---
config list / elements=dictionary |  | A dictionary of LLDP options
| med_tlv_select dictionary |  | Selection of LLDP MED TLVs to send NOTE, if med-tlv-select is configured idempotency won't be maintained as Cisco device doesn't record configured med-tlv-select options. As such, Ansible cannot verify if the respective med-tlv-select options is already configured or not from the device side. If you try to apply med-tlv-select option in every play run, Ansible will show changed as True.
|  | inventory_management boolean | Choices: no yes | LLDP MED Inventory Management TLV
| name string / required |  | Full name of the interface excluding any logical unit number, i.e. GigabitEthernet0/1.
| receive boolean | Choices: no yes | Enable LLDP reception on interface.
| tlv_select dictionary |  | Selection of LLDP type-length-value i.e. TLVs 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.
|  | power_management boolean | Choices: no yes | IEEE 802.3 DTE Power via MDI TLV
| transmit boolean | Choices: no yes | Enable LLDP transmission on interface.
state string | Choices: merged ← replaced overridden deleted | The state of the configuration after module completion

## Notes

Note

- Tested against Cisco IOSv Version 15.2 on VIRL

- This module works with connection `network_cli`, See IOS Platform Options.

## Examples

    # Using merged
    #
    # Before state:
    # -------------
    #
    # vios#sh lldp interface
    # GigabitEthernet0/0:
    #    Tx: enabled
    #    Rx: disabled
    #    Tx state: IDLE
    #    Rx state: WAIT FOR FRAME
    #
    # GigabitEthernet0/1:
    #    Tx: disabled
    #    Rx: disabled
    #    Tx state: IDLE
    #    Rx state: WAIT FOR FRAME
    #
    # GigabitEthernet0/2:
    #    Tx: disabled
    #    Rx: disabled
    #    Tx state: IDLE
    #    Rx state: INIT
    #
    # GigabitEthernet0/3:
    #    Tx: enabled
    #    Rx: enabled
    #    Tx state: IDLE
    #    Rx state: WAIT FOR FRAME
    #

    - name: Merge provided configuration with device configuration
      ios_lldp_interfaces:
        config:
          - name: GigabitEthernet0/1
            receive: True
            transmit: True
          - name: GigabitEthernet0/2
            receive: True
          - name: GigabitEthernet0/3
            transmit: True
        state: merged

    # After state:
    # ------------
    #
    # vios#sh lldp interface
    # GigabitEthernet0/0:
    #    Tx: enabled
    #    Rx: disabled
    #    Tx state: IDLE
    #    Rx state: WAIT FOR FRAME
    #
    # GigabitEthernet0/1:
    #    Tx: enabled
    #    Rx: enabled
    #    Tx state: IDLE
    #    Rx state: WAIT FOR FRAME
    #
    # GigabitEthernet0/2:
    #    Tx: disabled
    #    Rx: enabled
    #    Tx state: IDLE
    #    Rx state: INIT
    #
    # GigabitEthernet0/3:
    #    Tx: enabled
    #    Rx: disabled
    #    Tx state: IDLE
    #    Rx state: WAIT FOR FRAME
    #

    # Using overridden
    #
    # Before state:
    # -------------
    #
    # vios#sh lldp interface
    # GigabitEthernet0/0:
    #    Tx: enabled
    #    Rx: enabled
    #    Tx state: IDLE
    #    Rx state: WAIT FOR FRAME
    #
    # GigabitEthernet0/1:
    #    Tx: enabled
    #    Rx: enabled
    #    Tx state: IDLE
    #    Rx state: WAIT FOR FRAME
    #
    # GigabitEthernet0/2:
    #    Tx: disabled
    #    Rx: disabled
    #    Tx state: IDLE
    #    Rx state: INIT
    #
    # GigabitEthernet0/3:
    #    Tx: enabled
    #    Rx: enabled
    #    Tx state: IDLE
    #    Rx state: WAIT FOR FRAME
    #

    - name: Override device configuration of all lldp_interfaces with provided configuration
      ios_lldp_interfaces:
        config:
          - name: GigabitEthernet0/2
            receive: True
            transmit: True
        state: overridden

    # After state:
    # ------------
    #
    # vios#sh lldp interface
    # GigabitEthernet0/0:
    #    Tx: disabled
    #    Rx: disabled
    #    Tx state: IDLE
    #    Rx state: WAIT FOR FRAME
    #
    # GigabitEthernet0/1:
    #    Tx: disabled
    #    Rx: disabled
    #    Tx state: IDLE
    #    Rx state: WAIT FOR FRAME
    #
    # GigabitEthernet0/2:
    #    Tx: enabled
    #    Rx: enabled
    #    Tx state: IDLE
    #    Rx state: INIT
    #
    # GigabitEthernet0/3:
    #    Tx: disabled
    #    Rx: disabled
    #    Tx state: IDLE
    #    Rx state: WAIT FOR FRAME

    # Using replaced
    #
    # Before state:
    # -------------
    #
    # vios#sh lldp interface
    # GigabitEthernet0/0:
    #    Tx: enabled
    #    Rx: enabled
    #    Tx state: IDLE
    #    Rx state: WAIT FOR FRAME
    #
    # GigabitEthernet0/1:
    #    Tx: enabled
    #    Rx: enabled
    #    Tx state: IDLE
    #    Rx state: WAIT FOR FRAME
    #
    # GigabitEthernet0/2:
    #    Tx: disabled
    #    Rx: disabled
    #    Tx state: IDLE
    #    Rx state: INIT
    #
    # GigabitEthernet0/3:
    #    Tx: enabled
    #    Rx: enabled
    #    Tx state: IDLE
    #    Rx state: WAIT FOR FRAME
    #

    - name: Replaces device configuration of listed lldp_interfaces with provided configuration
      ios_lldp_interfaces:
        config:
          - name: GigabitEthernet0/2
            receive: True
            transmit: True
          - name: GigabitEthernet0/3
            receive: True
        state: replaced

    # After state:
    # ------------
    #
    # vios#sh lldp interface
    # GigabitEthernet0/0:
    #    Tx: enabled
    #    Rx: enabled
    #    Tx state: IDLE
    #    Rx state: WAIT FOR FRAME
    #
    # GigabitEthernet0/1:
    #    Tx: enabled
    #    Rx: enabled
    #    Tx state: IDLE
    #    Rx state: WAIT FOR FRAME
    #
    # GigabitEthernet0/2:
    #    Tx: enabled
    #    Rx: enabled
    #    Tx state: IDLE
    #    Rx state: INIT
    #
    # GigabitEthernet0/3:
    #    Tx: disabled
    #    Rx: enabled
    #    Tx state: IDLE
    #    Rx state: WAIT FOR FRAME
    #

    # Using Deleted
    #
    # Before state:
    # -------------
    #
    # vios#sh lldp interface
    # GigabitEthernet0/0:
    #    Tx: enabled
    #    Rx: enabled
    #    Tx state: IDLE
    #    Rx state: WAIT FOR FRAME
    #
    # GigabitEthernet0/1:
    #    Tx: enabled
    #    Rx: enabled
    #    Tx state: IDLE
    #    Rx state: WAIT FOR FRAME
    #
    # GigabitEthernet0/2:
    #    Tx: disabled
    #    Rx: disabled
    #    Tx state: IDLE
    #    Rx state: INIT
    #
    # GigabitEthernet0/3:
    #    Tx: enabled
    #    Rx: enabled
    #    Tx state: IDLE
    #    Rx state: WAIT FOR FRAME
    #

    - name: "Delete LLDP attributes of given interfaces (Note: This won't delete the interface itself)"
      ios_lldp_interfaces:
        config:
          - name: GigabitEthernet0/1
        state: deleted

    # After state:
    # -------------
    #
    # vios#sh lldp interface
    # GigabitEthernet0/0:
    #    Tx: disabled
    #    Rx: disabled
    #    Tx state: IDLE
    #    Rx state: WAIT FOR FRAME
    #
    # GigabitEthernet0/1:
    #    Tx: enabled
    #    Rx: enabled
    #    Tx state: IDLE
    #    Rx state: WAIT FOR FRAME
    #
    # GigabitEthernet0/2:
    #    Tx: disabled
    #    Rx: disabled
    #    Tx state: IDLE
    #    Rx state: INIT
    #
    # GigabitEthernet0/3:
    #    Tx: enabled
    #    Rx: enabled
    #    Tx state: IDLE
    #    Rx state: WAIT FOR FRAME
    #

    # Using Deleted without any config passed
    # "(NOTE: This will delete all of configured LLDP module attributes)"
    #
    # Before state:
    # -------------
    #
    # vios#sh lldp interface
    # GigabitEthernet0/0:
    #    Tx: enabled
    #    Rx: enabled
    #    Tx state: IDLE
    #    Rx state: WAIT FOR FRAME
    #
    # GigabitEthernet0/1:
    #    Tx: enabled
    #    Rx: enabled
    #    Tx state: IDLE
    #    Rx state: WAIT FOR FRAME
    #
    # GigabitEthernet0/2:
    #    Tx: disabled
    #    Rx: disabled
    #    Tx state: IDLE
    #    Rx state: INIT
    #
    # GigabitEthernet0/3:
    #    Tx: enabled
    #    Rx: enabled
    #    Tx state: IDLE
    #    Rx state: WAIT FOR FRAME
    #

    - name: "Delete LLDP attributes for all configured interfaces (Note: This won't delete the interface itself)"
      ios_lldp_interfaces:
        state: deleted

    # After state:
    # -------------
    #
    # vios#sh lldp interface
    # GigabitEthernet0/0:
    #    Tx: disabled
    #    Rx: disabled
    #    Tx state: IDLE
    #    Rx state: WAIT FOR FRAME
    #
    # GigabitEthernet0/1:
    #    Tx: disabled
    #    Rx: disabled
    #    Tx state: IDLE
    #    Rx state: WAIT FOR FRAME
    #
    # GigabitEthernet0/2:
    #    Tx: disabled
    #    Rx: disabled
    #    Tx state: IDLE
    #    Rx state: INIT
    #
    # GigabitEthernet0/3:
    #    Tx: disabled
    #    Rx: disabled
    #    Tx state: IDLE
    #    Rx state: WAIT FOR FRAME
    #

## Return Values

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

Key | Returned | Description
--- | --- | ---
after list | 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 list | 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 | always | The set of commands pushed to the remote device. Sample: ['interface GigabitEthernet 0/1', 'lldp transmit', 'lldp receive']

## Status

- This module is not guaranteed to have a backwards compatible interface. [preview]

- This module is maintained by the Ansible Network Team. [network]

### Red Hat Support

More information about Red Hat’s support of this module is available from this Red Hat Knowledge Base article.

### Authors

- Sumit Jaiswal (@justjais)

Hint

If you notice any issues in this documentation, you can edit this document to improve it.