Network Automation Cookbook
上QQ阅读APP看书,第一时间看更新

Managing Cisco IOS Devices Using Ansible

In this chapter, we will outline how to automate Cisco IOS-based devices using Ansible. We will explore the different modules available in Ansible to automate configuration and collect network information from Cisco IOS devices. This chapter will be based on the following sample network diagram, and we will walk through how we can implement this network design using Ansible:

The following table outlines the management IP addresses on the Cisco nodes, which Ansible will use to connect to the devices:

      

 

The main recipes covered in this chapter are as follows:

  • Building an Ansible network inventory
  • Connecting to Cisco IOS devices
  • Configuring basic system information
  • Configuring interfaces on IOS devices
  • Configuring L2 VLANS on IOS devices
  • Configuring trunk and access interfaces
  • Configuring interface IP addresses
  • Configuring OSPF on IOS devices
  • Collecting IOS device facts
  • Validating network reachability on IOS devices
  • Retrieving operational data from IOS devices
  • Validating network states with pyATS and Ansible

Device           Role           Vendor           MGMT Port           MGMT IP

           

access01           Access switch           Cisco IOS 15.1           Ethernet0/0           172.20.1.18

           

access02           Access switch           Cisco IOS 15.1           Ethernet0/0           172.20.1.19

           

core01           Core switch           Cisco IOS 15.1           Ethernet0/0           172.20.1.20

           

core02           Core switch           Cisco IOS 15.1           Ethernet0/0           172.20.1.21

           

wan01           WAN router           Cisco IOS–XE 16.6.1           GigabitEthernet1           172.20.1.22

           

wan02           WAN router           Cisco IOS–XE 16.6.1           GigabitEthernet1           172.20.1.23