lldp – get details reported by lldp — Ansible Documentation

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

Documentation

# lldp – get details reported by lldp

- Synopsis
- Requirements
- Notes
- Examples
- Status

## Synopsis

- Reads data out of lldpctl

## Requirements

The below requirements are needed on the host that executes this module.

- lldpctl

## Notes

Note

- Requires lldpd running and lldp enabled on switches

## Examples

    # Retrieve switch/port information
     - name: Gather information from lldp
       lldp:

     - name: Print each switch/port
       debug:
        msg: "{{ lldp[item]['chassis']['name'] }} / {{ lldp[item]['port']['ifname'] }}"
       with_items: "{{ lldp.keys() }}"

    # TASK: [Print each switch/port] ***********************************************************
    # ok: [10.13.0.22] => (item=eth2) => {"item": "eth2", "msg": "switch1.example.com / Gi0/24"}
    # ok: [10.13.0.22] => (item=eth1) => {"item": "eth1", "msg": "switch2.example.com / Gi0/3"}
    # ok: [10.13.0.22] => (item=eth0) => {"item": "eth0", "msg": "switch3.example.com / Gi0/3"}

## Status

- This module is not guaranteed to have a backwards compatible interface. [preview]
- This module is maintained by the Ansible Community. [community]

### Authors

- Andy Hill (@andyhky)

Hint

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