A simple playbook that will login to hosts, grab CDP neighbor information (except phones) and put the results into a text file on the local host.
--- - hosts: lab gather_facts: no connection: local tasks: - name: OBTAIN LOGIN CREDENTIALS include_vars: secrets.yaml - name: DEFINE PROVIDER set_fact: provider: user: "{{ creds['username'] }}" password: "{{ creds['password'] }}" - name: GRABBING CDP NEIGHBORS ios_command: provider: "{{ provider }}" commands: show cdp neigh | e SEP register: cdp_nei - copy: content: "{{ cdp_nei }}" dest: "/home/ubuntu/{{ inventory_hostname }}.txt"