Chapter 4 Where to Start with Network Automation?

For diagrams, tables, or exact code formatting, .

JOHN W. CAPOBIANCOPRINTED PAGE 67
 
[DATA-CENTER:children] 
LAB-DATA-CENTER-7K 
LAB-DATA-CENTER-5K 
 
 
[DATA-CENTER-7K] 
DC01_7K 
DC02_7K
 
[DATA-CENTER-5K] 
DC01_5K 
DC02_5K 
 
 
[WAN:children] 
WAN-ISR 
WAN-ACCESS 
 
 
[WAN-ISR] 
WANISR01 
 
 
[WAN-ACCESS] 
WANACCESS01 
 
 
[DMZ] 
DMZ01 
DMZ02

For more information about working with inventory files in Ansible visit: https://docs.ansible.com/ansible/latest/user_guide/intro_inventory.html The Linux host needs to be able to resolve these hostnames. Ideally, populate the DNS server records so Ansible can dynamically resolve the hostnames. Otherwise update the local /etc/hosts file and create static records.

Building the hosts.ini file might be trivial provided an accurate inventory system, an up to date IP workbook, network topology diagrams or NMS inventory system exists. Otherwise, it may take a bit of manual discovery to ensure complete coverage of the network. At this point the network is operating in manual mode and will be unable to use Ansible to help build its own inventory file. Use Ansible to run the Cisco IOS show cdp neighbors commands and use the output to map the network if necessary. Ideally, export a list of devices from your NMS or offline documentation; however, do not underestimate the effort involved in building and maintaining this host.ini file.

Gather Information Network reconnaissance is a massive challenge to tackle on an enterprise network even with powerful network management systems in place. Many commands must be executed at the CLI to capture the information required to troubleshoot a problem or to design a new solution. It can be tedious and cumbersome having to hop from device-to-device and collect information, that could very well be stale or obsolete by the time the change is drafted. It especially does not scale well for larger changes. Now that the inventory file, hosts.ini, is ready, Ansible can execute playbooks against the devices. Some advantages to this approach include: