Network Automation Cookbook: Proven and actionable recipes to automate and manage network devices using Ansible 9781789951875, 1789951879

Take your network automation skills to the next level with practical recipes on managing network devices from a variety

529 193 21MB

English Pages 482 [472] Year 2020

Report DMCA / Copyright

DOWNLOAD FILE

Network Automation Cookbook: Proven and actionable recipes to automate and manage network devices using Ansible
 9781789951875, 1789951879

Table of contents :
Cover
Title Page
Copyright and Credits
About Packt
Contributors
Table of Contents
Preface
Chapter 1: Building Blocks of Ansible
Technical requirements
Installing Ansible
Getting ready
How to do it...
How it works..
How it works...
See also...
Building Ansible's inventory
Getting ready
How to do it...
How it works...
Using Ansible's variables
Getting ready
How to do it...
How it works...
There's more...
Building Ansible's playbook
Getting ready
How to do it...
How it works...
Using Ansible's conditionals
Getting ready
How to do it...
How it works...
See also...
Using Ansible's loops
Getting ready
How to do it...
How it works..
See also...
Securing secrets with Ansible Vault
How to do it...
How it works..
There's more...
Using Jinja2 with Ansible
Getting ready
How to do it...
How it works...
See also...
Using Ansible's filters
How to do it...
How it works...
Using Ansible Tags
How to do it...
How it works...
See also...
Customizing Ansible's settings
How to do it...
How it works...
See also...
Using Ansible Roles
How to do it...
How it works...
See also
Chapter 2: Managing Cisco IOS Devices Using Ansible
Technical requirements
Building an Ansible network inventory
Getting ready
How to do it...
How it works...
Connecting to Cisco IOS devices
Getting ready
How to do it...
How it works...
There's more...
Configuring basic system information
Getting ready
How to do it...
How it works...
See also...
Configuring interfaces on IOS devices
Getting ready
How to do it...
How it works...
See also...
Configuring L2 VLANs on IOS devices
Getting ready
How to do it...
How it works...
Configuring trunk and access interfaces
Getting ready 
How to do it...
How it works...
See also...
Configuring interface IP addresses
Getting ready
How to do it...
How it works...
See also...
Configuring OSPF on IOS devices
Getting ready
How to do it...
How it works...
Collecting IOS device facts
Getting ready
How to do it...
How it works...
There's more...
See also...
Validating network reachability on IOS devices
Getting ready
How to do it...
How it works...
Retrieving operational data from IOS devices
Getting ready
How to do it...
How it works...
Validating network states with pyATS and Ansible
Getting ready
How to do it...
How it works...
See also...
Chapter 3: Automating Juniper Devices in the Service Providers Using Ansible
Technical requirements
Building the network inventory
Getting ready
How to do it...
How it works...
Connecting and authenticating to Juniper devices
Getting ready
How to do it...
How it works...
There's more...
Enabling NETCONF on Junos OS devices
Getting ready
How to do it...
How it works...
Configuring generic system options on Juniper devices
Getting ready
How to do it...
How it works...
There's more...
See also...
Configuring interfaces on Juniper devices
Getting ready
How to do it...
How it works...
There's more...
Configuring OSPF on Juniper devices
How to do it...
How it works...
Configuring MPLS on Juniper devices
How to do it...
How it works...
Configuring BGP on Juniper devices
How to do it...
How it works...
Deploying configuration on Juniper devices
Getting ready
How to do it...
How it works...
There's more...
See also...
Configuring the L3VPN service on Juniper devices
Getting ready
How to do it...
How it works...
See also...
Gathering Juniper device facts using Ansible
Getting ready
How it works...
See also...
Validating network reachability on Juniper devices
Getting ready
How to do it...
How it works...
See also...
Retrieving operational data from Juniper devices
Getting ready
How to do it...
How it works...
There's more...
Validating the network state using PyEZ operational tables
Getting ready
How to do it...
How it works...
See also...
Chapter 4: Building Data Center Networks with Arista and Ansible
Technical requirements
Building the Ansible network inventory
Getting ready
How to do it...
How it works...
Connecting to and authenticating Arista devices from Ansible
Getting ready
How to do it...
How it works...
Enabling eAPI on Arista devices
Getting ready
How to do it...
How it works...
See also...
Configuring generic system options on Arista devices
Getting ready
How to do it...
How it works...
There's more...
Configuring interfaces on Arista devices
Getting ready
How to do it...
How it works...
There's more...
See also...
Configuring the underlay BGP on Arista devices
Getting ready
How to do it...
How it works...
Configuring the overlay BGP EVPN on Arista devices
Getting ready
How to do it...
How it works...
Deploying the configuration on Arista devices
Getting ready
How to do it...
How it works...
See also...
Configuring VLANs on Arista devices
Getting ready
How to do it...
How it works...
See also...
Configuring VXLANs tunnels on Arista devices
Getting ready
How to do it...
How it works...
Gathering Arista device facts
Getting ready
How to do it...
How it works...
See also...
Retrieving operational data from Arista devices
Getting ready
How to do it...
How it works...
See also...
Chapter 5: Automating Application Delivery with F5 LTM and Ansible
Technical requirements
Building an Ansible network inventory
Getting ready
How to do it...
How it works...
Connecting and authenticating to BIG-IP devices
Getting ready
How to do it...
How it works...
There's more...
Configuring generic system options on BIG-IP devices
Getting ready
How to do it...
How it works...
Configuring interfaces and trunks on BIG-IP devices
Getting ready
How to do it...
How it works...
See also...
Configuring VLANs and self-IPs on BIG-IP devices
Getting ready
How to do it...
How it works...
See also...
Configuring static routes on BIG-IP devices
Getting ready
How to do it...
How it works...
Deploying nodes on BIG-IP devices
Getting ready
How to do it...
How it works...
Configuring a load balancing pool on BIG-IP devices
Getting ready
How to do it...
How it works...
See also...
Configuring virtual servers on BIG-IP devices
Getting ready
How to do it...
How it works...
See also...
Retrieving operational data from BIG-IP nodes
Getting ready
How to do it...
How it works...
There's more...
See also...
Chapter 6: Administering a Multi-Vendor Network with NAPALM and Ansible
Technical requirements
Installing NAPALM and integrating with Ansible
Getting ready
How to do it...
How it works…
Building an Ansible network inventory
How to do it…
How it works…
Connecting and authenticating to network devices using Ansible
Getting ready
How to do it…
How it works…
Building the device configuration
Getting ready
How to do it…
How it works…
Deploying configuration on network devices using NAPALM
Getting ready
How to do it…
How it works…
There's more…
Collecting device facts with NAPALM
Getting ready
How to do it…
How it works…
See also…
Validating network reachability using NAPALM
Getting ready
How to do it…
How it works…
Validating and auditing networks with NAPALM
Getting ready
How to do it…
How it works…
See also…
Chapter 7: Deploying and Operating AWS Networking Resources with Ansible
Technical requirements
Installing the AWS SDK
Getting ready
How to do it...
How it works...
Building an Ansible inventory
How to do it...
How it works...
Authenticating to your AWS account
Getting ready
How to do it...
How it works...
Deploying VPCs using Ansible
Getting ready
How to do it...
How it works...
See also
Deploying subnets using Ansible
Getting ready
How to do it...
How it works...
See also
Deploying IGWs using Ansible
Getting ready
How to do it...
How it works...
See also
Controlling routing within a VPC using Ansible
Getting ready
How to do it...
How it works...
See also
Deploying network ACLs using Ansible
Getting ready
How to do it...
How it works...
See also
Deployment validation using Ansible
Getting ready
How to do it...
How it works...
See also
Decommissioning resources on AWS using Ansible
Getting ready
How to do it...
How it works...
Chapter 8: Deploying and Operating Azure Networking Resources with Ansible
Technical requirements
Installing the Azure SDK
Getting ready
How to do it…
How it works…
See also…
Building an Ansible inventory
How to do it…
How it works…
Authenticating to your Azure account
Getting ready
How to do it…
How it works…
See also…
Creating a resource group
Getting ready
How to do it…
How it works...
See also...
Creating virtual networks
Getting ready
How to do it...
How it works...
See also...
Creating subnets
Getting ready
How to do it...
How it works...
See also...
Building user-defined routes
Getting ready
How to do it...
How it works...
See also...
Deploying network security groups
Getting ready
How to do it...
How it works...
See also...
Deployment validation using Ansible
Getting ready
How to do it...
How it works...
See also...
Decommissioning Azure resources using Ansible
Getting ready
How to do it...
How it works...
Chapter 9: Deploying and Operating GCP Networking Resources with Ansible
Technical requirements
Installing the GCP SDK
Getting ready
How to do it...
How it works...
See also...
Building an Ansible inventory
How to do it...
How it works...
Authenticating to your GCP account
Getting ready
How to do it...
How it works...
There's more...
See also...
Creating GCP VPC networks
Getting ready
How to do it...
How it works...
There is more...
See also...
Creating subnets
Getting ready
How to do it...
How it works...
See also...
Deploying firewall rules in GCP
Getting ready
How to do it...
How it works...
See also...
Deploying VMs in GCP
Getting ready
How to do it...
How it works...
See also...
Adjusting routing within a VPC
Getting ready
How to do it...
How it works..
See also...
Validating GCP deployment using Ansible
Getting ready
How to do it...
How it works...
See also...
Decommissioning GCP resources using Ansible
Getting ready
How to do it...
How it works...
Chapter 10: Network Validation with Batfish and Ansible
Technical requirements
Installing Batfish
Getting ready
How to do it...
How it works…
See also...
Integrating Batfish with Ansible
Getting ready
How to do it…
How it works…
See also...
Generating the network configuration
Getting ready
How to do it...
How it works...
Creating a network snapshot for Batfish
Getting ready
How to do it...
How it works…
See also...
Initializing the network snapshot with Ansible
Getting ready
How to do it...
How it works...
Collecting network facts from Batfish
Getting ready
How to do it...
How it works...
There's more...
See also...
Validating traffic forwarding with Batfish
Getting ready
How to do it...
How it works...
Validating ACLs with Batfish
Getting ready
How to do it…
How it works…
Chapter 11: Building a Network Inventory with Ansible and NetBox
Technical requirements
Installing NetBox
Getting ready
How to do it…
How it works…
There's more
See also...
Integrating NetBox with Ansible
Getting ready
How to do it…
How it works…
See also...
Populating sites in NetBox
Getting ready
How to do it…
How it works…
See also...
Populating devices in NetBox
Getting ready
How to do it...
How it works…
See also...
Populating interfaces in NetBox
Getting ready
How to do it…
How it works…
See also...
Populating IP addresses in NetBox
Getting ready
How to do it…
How it works…
See also...
Populating IP prefixes in NetBox
Getting ready
How to do it…
How it works…
See also...
Using NetBox as a dynamic inventory source for Ansible
Getting ready
How to do it…
How it works…
There's more
See also...
Generating a configuration using NetBox
Getting ready
How to do it…
How it works…
Chapter 12: Simplifying Automation with AWX and Ansible
Technical requirements
Installing AWX
Getting ready
How to do it…
How it works…
There's more...
See also...
Managing users and teams on AWX
Getting ready
How to do it…
How it works…
See also...
Creating a network inventory on AWX
Getting ready
How to do it…
How it works…
Managing network credentials on AWX
Getting ready
How to do it…
How it works…
See also...
Creating projects on AWX
Getting ready
How to do it…
How it works…
See also...
Creating templates on AWX
Getting ready
How to do it…
How it works…
See also...
Creating workflow templates on AWX
Getting ready
How to do it…
How it works…
See also...
Running automation tasks using the AWX API
Getting ready
How to do it…
How it works…
There's more…
See also...
Chapter 13: Advanced Techniques and Best Practices for Ansible
Technical requirements
Installing Ansible in a virtual environment
Getting ready
How to do it...
How it works...
Validating YAML and Ansible playbooks
Getting ready
How to do it...
How it works...
There's more...
See also...
Calculating the execution time for Ansible playbooks
How to do it...
How it works...
See also...
Validating user input using Ansible
How to do it...
How it works...
Running Ansible in check mode
How to do it...
How it works...
There's more...
See also...
Controlling parallelism and rolling updates in Ansible
How to do it...
How it works...
See also...
Configuring fact caching in Ansible
How to do it...
How it works...
There's more...
See also...
Creating custom Python filters for Ansible
How to do it...
How it works...
There's more...
Other Books You May Enjoy
Index

Polecaj historie