Chapter 6 Network Reconnaissance

For diagrams, tables, or exact code formatting, .

JOHN W. CAPOBIANCOPRINTED PAGE 109

Create a variable: - set_fact: ={{ _result.stdout_lines | to_nice_yaml }} These are variables registered for later use. Set what is held in the registered variable, typically, the standard output lines (stdout_lines) in a human-readable (to_nice_yaml)(to_nice_json) format:

file: path= The path where the file will be created at run time. Typically invoke {{ inventory_hostname }} variable to include the device hostname as part of the file name.

lineinfile: 
   line: '{{ item }}' 
     with_items: 
 
Method of adding lines of data to an output file one line at a time. In this case the {{ 
inventory_hostname }} along with the registered output {{ ospfneighbour }} are added to the file.

A full library of ios_command_show_.yml files can be built over time with the most commonly used commands. Here is a short list of commands that can be automated:

 show cdp neighbors  show spanning-tree  show spanning-tree blockedports  show ip ospf neighbors  show ip route  show ip route vrf  show interface  show interface status  show version  show inventory  show ip interface brief  show arp  show mac-address table  show etherchannel summary  show vlan  show tech Summary Information gathering playbooks are simple and safe first steps towards network automation. Over time, a library of on-demand or scheduled playbooks will be be developed. These playbooks automatically generate important information about each device on the network. In addition to automating the repetitive, time consuming, and mundane task of documenting the network, the organization starts building a data warehouse of dynamically generated output files in the repository. By collecting output from the entire network on a regular basis, a historical state view in the form of the TFS repository exists. This repository shows the exact location of changes made to the network. The only limitation is creativity and how to use the wealth of information available.