See how Insoft Services is responding to COVID-19

Python NETPYA: Network Automation with Python and Ansible

X

Contact Us

We would love to hear from you. Please complete this form to pre-book or request further information about our delivery options.

Subscribe

I'd like to receive emails with the latest updates and promotions from Insoft.

Data Protection & Privacy

I hereby allow Insoft Ltd. to contact me on this topic. Further, I authorise Insoft Ltd. processing, using collecting and storing my personal data for the purpose of these activities. All your data will be protected and secured as outlined in our privacy policy.


Upcoming Dates

Jul 26 - Jul 29, 2021
09:00 - 17:00
Online

Oct 18 - Oct 21, 2021
09:00 - 17:00
Online

Python NETPYA: Network Automation with Python and Ansible
4 days  (Instructor Led Online)  |  Networking

Course Details

This course teaches students to blend Python skillsets with Ansible through the lens of automating networks. Automation techniques for the most popular vendor (incl. Cisco, Juniper, Arista) will be subjects of study, however, students may request examples from vendors within their own environments. Topics begin with a focus on automating networks with Python; this skill set is then folded into a broadening understanding of automating with Ansible. Students will have programmatic experience automating enterprise class networks by the conclusion of this course (includes writing custom Ansible modules with Python).

Class is a combination of lecture, demonstration, and hands-on labs. Students are invited to share their own relevant Python and Ansible scripts with the instructor to ensure class subjects are as relevant as possible.

All notes and scripts will be made available to students by the end of each day via a cloud-share or email. Lab time will be given reinforce that day’s topics and demonstrations.

Class is appropriate for those interested in automation, specifically network automation, and those looking to marry a Python and Ansible skillset.

Outline

Critical Python Catchup & Review

  • Overview of Python and Ansible
  • Python white space rules & best practices
  • Printing and more Printing
  • Date types and Variables
  • Packing and Unpacking Variables
  • f Strings
  • Conditional expressions
  • Relational and Boolean operators
  • Lists, Tuples, Dictionaries
  • Indexing and slicing
  • Built-in functions
  • Iterating with Loops (for and while)
  • Working with files
  • Software Control Management (SCM) (Git, Github, Bitbucket, Cloudshare, etc.)
  • Using Python to access REST interfaces
  • Working with JSON
  • Python, Ansible and Paramiko
  • Using Paramiko to SSH with keys and passwords
  • RESTful API review
  • API keys
  • Paramiko Review
  • Using Paramiko to SFTP with keys and passwords

 

Python and Network Automation

  • 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
  • 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

 

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
  • “Big Picture” options for using Python & Ansible within your Network
  • Ansible Roles

 

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
  • When to use Python and when to use Ansible
  • Writing your own Ansible modules in Python
  • “Big Picture” options for using Python & Ansible within your Network
  • Overview – NETCONF / YANG and what they mean for Python and Ansible
  • Molecule – Testing your roles

 

Lab Outline

  • Lab 0 – Setting up the Admin PC for Development
  • Lab 1 – Build your First Python Script
  • Lab 2 – More Python
  • Lab 3 – Strings in Python
  • Lab 4 – Using argv
  • Lab 5 – Lists and Dictionaries
  • Lab 6 – Loops and if-else
  • Lab 7 – Defining a Function
  • Lab 8 – Using Python Scripting and the REST API
  • Lab 9 – Telnetib (Optional)
  • Lab 10 – Paramiko
  • Lab 11 – Netmiko
  • Lab 12 – Ansible Installation
  • Lab 13 – Verify the Ansible Installation
  • Lab 14 – CSRX-1 SSH Connectivity
  • Lab 15 – Cisco IOS Show Command Execution with Ansible
  • Lab 16 – Configuration Changes with Ansible
  • Lab 17 – Create a Custom Module for Ansible
  • Lab 18 – Installing and Using a Role from Galaxy
  • Lab 19 – Ansible and Jinja2 Templating
  • Lab 20 – Integrating Template Instantiation and Device Synchronization into a Playbook

Target Audience

The primary audience for this course is as follows:

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