Information Gathering: Continued
Explore how to automate network reconnaissance using Ansible's ios_facts playbook. Learn to gather detailed device facts, generate JSON files for each device, and manage outputs with Git. Understand how to execute and verify plays that collect essential Cisco IOS data, enabling scalable and dynamic network documentation.
We'll cover the following...
Explanation of the ios_facts.yml playbook
First, specify the scope of the play (hosts) and specify the tasks.
The task name is IOS Facts on CAMPUS, which will display during runtime. Register the output to the variable named ios_facts_output.
The provider (credentials) can be found in the variable {{ ioscli }}.
Copy (copy) the content (content) of the variable
ios_facts_output and apply the filter (|) to_nice_json to the
output. Send this output (dest) to a file called {{ inventory_hostname }}, a variable that will be replaced at run time
with each device hostname. Finally, append and create the file with
_ios_facts_output as a JavaScript Object Notation (JSON) file
in the JSON format.
Review the check mode output from the playbook that executes against all
hosts listed in the [CAMPUS] group (referencing hosts).
The task [IOS Facts on CAMPUS] is executed, serially, against the
hosts. This task has run successfully (for example, ok: [Core])
on each host. Confirm that there are no errors present in the playbook and the
commands executed successfully.
Next, the task [copy] executes on each host creating (for example, changed: [CORE]) new output files for each host.
The play recap shows the status of each device (ok=2), how many
changes will be made (changed=1), if the device was unreachable, and
how many ...