Webinar Management System

Ansible for Networking Engineers

Home » Webinars » Network Automation » Ansible for Networking Engineers

26:12 Introduction

When facing a long study process, it makes sense to start with “what are we doing”, “why are we doing it” and “how is the material structured”. This section will give you these answers, and a procedure you can use to set up a simple Ansible test environment.
Introduction 12:53 2017-05-29
Webinar Structure and More Information 10:22 2017-05-29

2:57 Additional resources

Create a Simple Ansible Test Environment 445K 2017-08-10
Errata 200K 2017-02-16
Sample Ansible-based network automation solutions
Full-blown VLAN-as-a-service solution
Deploying Ansible in Production 2:57 2017-07-02

21:32 Case Study: DMVPN Router Configuration Generation and Deployment

One of the simplest network automation use cases is the automated network generation using unified device templates. We’ll illustrate this concept with a DMVPN deployment case study that runs throughout this webinar and includes data model generation, sample device templates, and configuration deployment with Ansible.
Automated DMVPN Deployment Case Study 2.1M 2015-08-18
Case Study - Introduction 14:27 2015-08-19
Case Study - Network Design 7:05 2015-08-19

47:28 YAML and JSON

YAML is the data presentation language used extensively by Ansible playbooks and variable files. JSON is the presentation language used between Ansible and external components. It obviously makes sense to be familiar with both, and you’ll have to understand the basics of YAML to write your playbooks.
Introduction to YAML and JSON 15:54 2017-03-07
Scalar values in YAML and JSON 8:24 2017-03-07
Simple lists and dictionaries 9:44 2017-03-07
Complex Data Types 13:26 2017-03-07

Additional resources

YAML and JSON Hands-On Exercises 161K 2017-05-15
Slide deck 2.2M 2016-11-17
Source code for YAML Examples
Online YAML validator

26:51 Case Study: Building the Data Model with YAML

The second step in any automated service (or infrastructure) deployment should be a well thought-out data model (the first one should be a service definition). This section describes how you can generate a typical data model, or extract it from sample router configurations, and write it as a series of YAML files that can be used by Ansible playbooks.
Building the Data Model 9:15 2015-08-19
Case Study - Data Model for DMVPN Network 11:26 2016-02-12
Case Study - DMVPN Data Model in YAML 6:10 2015-08-19
Source code for DMVPN case study

1:20:46 Jinja2 - the Templating Tool Used by Ansible

You might think you’d need a templating tool only when generating device (or service or software) configuration from templates. Not true - Ansible uses Jinja2 extensively, from evaluating expressions to specifying conditions, and finally generating text files from templates. Without understanding Jinja2 you’ll have a hard time understanding even moderately complex Ansible playbooks.
Introduction to Jinja2 14:40 2017-03-07
Complex Data Objects and Loops 22:15 2017-03-07
Variables, Macros and Includes 9:59 2017-03-07
Python Methods in Jinja2 6:08 2017-03-07
IP Address Handling 11:48 2017-03-07
Whitespace Handling in Jinja2 15:56 2017-11-23

Errata and New Features

New features in Ansible 2.4 and corrections 216K 2017-10-02

Additional resources

Jinja2 Hands-On Exercises 279K 2017-05-15
Slide deck 7.7M 2017-11-23
Source code for Jinja2 Examples
Jinja2 live parser
Dockerfile for Jinja2 renderer script

16:26 Case Study: Creating Device Configurations with Jinja2 Templates

Next step in our case study: after building a data model describing our DMVPN deployment, we’ll create Jinja2 templates that will be used to create device configurations.
Case Study - Preparing Configuration Templates 7:02 2015-08-19
Case Study - DMVPN Configuration Templates in Jinja2 9:24 2015-08-19
Source code for DMVPN case study

1:05:46 Using Ansible

Finally it’s time to get our hands dirty and do some real automation work. You’ll learn about Ansible inventory, authentication mechanisms, Ansible modules, and the basics of Ansible playbooks - just enough to generate device configurations from templates or execute simple commands on network devices.
Introduction to Ansible 23:28 2017-05-29
Ansible Playbooks 22:19 2017-05-29
Generating Configurations from Jinja2 Templates 13:29 2017-05-29
Case Study - Building Router Configurations with Ansible 6:30 2015-08-19

Additional resources

Review questions 198K 2017-05-29
Slide deck 3.2M 2016-12-05
Source code for examples used in this section

1:41:06 Ansible Deeper Dive

Ready for some headier Ansible stuff? Let’s explore the details of Ansible facts and variables, play and task execution (including error handling), implementing loops, working with files, and using exotic Jinja2 filters.
Ansible Variables 19:34 2017-05-29
Play and Task Execution 10:04 2017-05-29
Error Handling in Ansible Playbooks 6:27 2017-05-29
Working with Files 17:59 2017-07-14
Loops in Ansible Playbooks 11:11 2017-06-06
Tracking Changes in Ansible Playbooks 13:21 2017-07-25
Using Check Mode for Dry Runs 11:49 2017-07-25
Exotic Jinja2 Filters 10:41 2017-06-06

Additional resources

Review questions and Hands-On Challenges 227K 2017-07-25
Slide deck 2.7M 2017-06-27
Source code for examples used in this section

1:17:27 Ansible Networking Modules - Executing Commands

It’s time to work with real network devices. You’ll learn how to log into network devices, execute commands on them, and get device facts and operational data.

1:11:32 Connecting, Authenticating and Executing Commands

Networking Modules Introduction 11:10 2017-06-27
Connecting and Authenticating to Network Devices 15:20 2017-06-27
Executing Commands on Routers and Switches 23:23 2017-06-19
Simple Command-Based Playbooks 21:39 2017-01-04
Slide deck 2.7M 2017-11-29

5:55 Getting Operational Data

Getting Operational Data from Network Devices 16M 2017-11-30
Gathering Network Device Facts 15M 2017-11-30
Get Structured Data with Show Commands 18M 2017-11-30
Parsing Show Outputs 23M 2017-11-30
Use SNMP to Get Device Facts 5:55 2017-01-04
Slide deck 4.9M 2017-11-30

Additional resources

Vagrantfile and VIRL Topology used in this section
Source code for examples used in this section
Source code for parse_cli examples used in this section
Network modules debugging and troubleshooting guide

1:03:01 Ansible Networking Modules - Managing Configurations

After managing read-only access to network devices, let’s change device configurations. We’ll cover simple configuration changes, declarative intent modules, and deploying full-blown configuration files.
Managing Network Device Configurations with Ansible 6:43 2017-06-06
Declarative Intent Modules 22:19 2017-06-06
Generic Configuration Changes 19:49 2017-06-06
Deploying Configuration Files 14:10 2017-06-06
How wrong indent combined with Ansible networking modules can trash your device configuration (by Patrick Ogenstad)

Additional resources

Vagrantfile and VIRL Topology used in this section
Review Questions and Hands-On Challenges 247K 2017-06-06
Slide deck 2.5M 2017-01-04
Source code for examples used in this section

33:28 Creating Reusable Code

You want to reuse excellent bits of your code in multiple projects and package them as ready-to-use libraries, right? Let’s dig into playbook- and play-level includes, looping over included modules (which is the closest you can get to subroutine calls in Ansible), and Ansible roles.
Play and Task Includes 12:36 2017-07-02
Task Includes and Loops 6:47 2017-07-02
Ansible Roles 14:05 2017-07-02

Additional resources

Review Questions 156K 2017-07-12
Slide deck 1.9M 2017-03-07
Sample playbooks for Ansible 'include' functionality
Ansible roles examples

Further reading

Using Ansible roles to manage large-scale infrastructure

49:24 Extending Ansible

Ansible is a powerful tool, but it shouldn’t be used as a generic-purpose programming language, so don’t try to use it as a Swiss Army Chainsaw - complex tasks should be implemented with a real programming language using Ansible callbacks, modules, external components, or (simplest possible option) Jinja2 filters and tests.
Extending Ansible 9:13 2017-06-30
Dynamic Inventory and Hosts 10:15 2017-06-30
Callback Plugins 9:05 2017-06-30
Jinja2 Filters and Tests 20:51 2017-06-30

Additional resources

Review Questions and Hands-On Exercises 167K 2017-07-13
Slide deck 1.8M 2017-03-07
Sample Jinja2 filters

1:18:29 Using NAPALM with Ansible

Ansible includes low-level network device modules - you have to use a different module for every vendor or operating system. NAPALM provides an abstraction library that gives you a uniform interface to device configurations, operational data, and even fully-automated device state validation… with an easy-to-use set of Ansible modules.
What Is NAPALM 23:10 2017-05-23
NAPALM Ansible Modules 18:07 2017-05-23
Fully-Automated Verification 15:09 2017-05-23
Hands-On Examples and Playbooks 22:03 2017-05-23

Additional resources

Slide deck 583K 2017-05-21
Source code for examples used in this section

Solutions for Hands-On Exercises

Solutions for YAML and JSON Hands-On Exercises 238K 2017-06-27
Solutions for Jinja2 Hands-On Exercises 705K 2017-06-29

Sample Ansible Playbooks

This section contains sample Ansible playbooks from ipSpace.net GitHub repositories.
Collect SSH keys from managed devices
Store Device Configurations to Git Repository
Extract DHCP pools from Cisco IOS routers or switches
Configure DHCP pools and cleanup stale entries
Extract network topology (including network graph) from interface Description-to-Links
Generate network topology graph from LLDP neighbor data
Create a fabric data model from interface descriptions
Create and deploy DMVPN configurations on Cisco IOS routers
Deploy approved configurations from Git repository to candidate configurations on network devices
Simple compliance check framework
Create device uptime report from SNMP facts
Transform infrastructure data model into device-focused data model
Configure and verify OSPF neighbors
Configure and verify BGP neighbors
Configure VRFs and VPNv4 address families from list of customer services

Webinar description

This webinar focuses on Ansible, the configuration management tool most commonly used by network automation professionals. It also describes YAML, the text file format used by Ansible, and Jinja2 templating language.
You started this section on %started%