community / community.general / 2.5.9 / module / lldp get details reported by lldp Authors: Andy Hill (@andyhky)community.general.lldp (2.5.9) — module
Install with ansible-galaxy collection install community.general:==2.5.9
collections: - name: community.general version: 2.5.9
Reads data out of lldpctl
# Retrieve switch/port information - name: Gather information from lldp community.general.lldp:
- name: Print each switch/port ansible.builtin.debug: msg: "{{ lldp[item]['chassis']['name'] }} / {{ lldp[item]['port']['ifname'] }}" with_items: "{{ lldp.keys() }}"