Ansible 201 – Network Automation with Python and Ansible

Continue your studies of Ansible, with a focus on automating common elements within the network. In addition to Ansible, students will study enough Python to understand Ansible’s plugin architecture. Lessons and labs focus on using both Python and Ansible to interact with and configure your network devices. At the conclusion of this course you will return to work empowered with skills necessary to automate network management. This class is a combination of live demonstrations and hands-on labs with virtual network devices and endpoints as targets for your configuration.

Students looking for server applications should see: Ansible 202 (Server)

Days : 5
Price :

This product is currently out of stock and unavailable.


Who should attend

  • Network Administrators
  • Ansible Developers
  • Python Developers
  • Administrators interested in Automation
  • Individuals interested in devops, specifically for networking


  • Ansible 101 (Ansible Essentials)
  • Coding experience in another language serves as an adequate prerequisite

Course Objectives

  • Version controlling code with Git
  • Open SSH sessions and pass commands to remote servers
  • Remotely open CLI to network devices
  • Move files via SFTP
  • Overview of Ansible modules
  • Ansible collections for network automation
  • Custom Ansible modules with Python
  • Best practices for automating the management and configuration of network devices

Outline: Ansible 201  Network Automation with Python and Ansible (A201N)

Day 01

Ansible and Python Review
  • Ansible definition
  • Exploring modules
  • Overview of Python and Ansible
  • Python whitespace rules & best practices
  • Conditional expressions
  • Relational and Boolean operators
  • Lists, Tuples, Dictionaries
  • Indexing and slicing
  • Builtin functions
  • Writing custom functions
  • Getting at methods
  • Iterating with Loops (for and while)
  • Working with files
  • Software Control Management (SCM) (Git, Github, GitLab, Bitbucket, Cloudshare, etc.)
  • Getting at RESTful interfaces with Python
  • Working with JSON
  • PythonAnsible and Paramiko
  • Using Paramiko to SSH with keys and passwords

Day 2

Network Automation
  • RESTful API review
  • API keys
  • Paramiko Review
  • Using Paramiko to SFTP with keys and passwords
  • Introduction to Netmiko (automating routers and switches)
  • Using Netmiko to send commands to / from network devices
  • Working with YAML
  • Converting JSON to YAML with Python

Day 3

Critical Ansible Catchup & Review
  • Ansible keywords
  • YAML and JSON for data exchange
  • Ansible and YAML
  • Ansible Playbook components
  • Tying together Python and Ansible – Using Python within Ansible
  • Ansible Network Modules
  • What is new in Ansible (most current updates / release notes)
  • Network Agnostic modules
  • Writing network playbooks
  • Reviewing the construction of network playbooks
  • Writing Ansible playbooks that respond to network failures

Day 4

Blending Python and Ansible Skillsets
  • Review how to use Python within Ansible
  • Calling Python scripts with Ansible
  • Jinja2 Templating Engine for Python (and Ansible)
  • Using Templates in Ansible playbooks
  • Jinja2 filters, looping, and other useful tricks for automating with Ansible
  • Playbook tagging for selective runs
  • When to use Python and when to use Ansible
  • Writing a custom collection
  • Writing custom roles
  • Extending Ansible to support Palo Alto (Optional  Case Study)
  • Extending Ansible to support Juniper vendor modules (Optional  Case Study)
  • Extending Ansible to support NAPALM (Optional  Case Study)

Day 5

Customizing Ansible with Python
  • Review – Running Scripts with Ansible
  • Prompting for Ansible user input
  • Ansible Galaxy & Getting at Roles
  • Writing a custom Ansible Module with Python
  • Ansible “Engine” vs Ansible “Tower” – marketing hype, capabilities, costs, etc.
  • Case Study: Automate your Enterprise Network
  • Writing your own Ansible modules in Python
  • Overview  NETCONF / YANG and what they mean for Python and Ansible
  • Molecule – Testing your roles