Information retrieval

We can now use another Ansible playbook, namely cisco_discover_lldp.yml, to execute the LLDP command on the device and copy the output of each device to a tmp directory:

<skip> tasks:   - name: Query for LLDP Neighbors     ios_command:       commands: show lldp neighbors       provider: "{{ cli }}"<skip>

The ./tmp directory now consists of all the routers' output (showing LLDP neighbors) in its own file:

$ ls -l tmp/total 20-rw-rw-r-- 1 echou echou 630 Mar 13 17:12 r1_lldp_output.txt-rw-rw-r-- 1 echou echou 630 Mar 13 17:12 r2_lldp_output.txt-rw-rw-r-- 1 echou echou 701 Mar 12 12:28 r3_lldp_output.txt-rw-rw-r-- 1 echou echou 772 Mar 12 12:28 r5-tor_lldp_output.txt-rw-rw-r-- 1 echou echou 630 Mar 13 17:12 r6-edge_lldp_output.txt

The

Get Mastering Python Networking - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.