Ansible Essentials

Course Overview

Ansible is growing in popularity for good reason, it is both easy to understand, far simpler than Python, and extremely powerful. While Python can be used to do just about anything, Ansible is used to bring structure and consistency to system deployments, implementations, and changes. Students tempted to write a complex Python script to do some networking automation task will discover that problem is already solved by an Ansible module. Lots of unnecessary Python scripts can be eliminated by using Ansible whenever possible.

ansible construction building

Course Outline: Ansible Essentials

3 Days with Hands-on Labs

Day 1: We begin with an introduction to Ansible along, making it clear how ansible may be used to solve DEVOPs problems. The first step is to learn how to get Ansible to connect to hosts. A popular thing to say is that Ansible is “clientless”, making it sound like it is simple to connect to a remote host when in fact for most people, connecting to a remote host is a nightmare for the uninitiated. It takes six hands on labs to master RSA connectivity so that Ansible can connect to remote hosts. With a clear understanding of Ansible connectivity established, we establish a basic understanding of CLI commands and practice using ansible to connect to hosts and issue ad-hoc commands. This will allow students to practice with Ansible, but no requirements on day one to deal with strict YAML formatting of playbooks.

  1. Ansible Overview
  2. Ansible Inventory
  3. Ad hoc commands


Day 2: This is the day we learn how to read and run playbooks.  In other words, today you will learn how to be an Ansible administrator, not a developer. That means we must learn how playboks organize the things we did on day-one, encode them in YAML and make Ansible do real work. The lecture portion will be covered in the morning, with hands on labs dominating the afternoon.  At the end of this day, you will be able to read playbooks with understanding. On this day you will understand how to modify the host file and variables to make ansible perform site-specific tasks.

  1. YAML
  2. Writing a simple Playbook
  3. Ansible Templates and Jinja2
  4. Ansible Modules you need to know
  5. NAPALM and napalm-ansible


Day 3: This is the day you will learn how to write playbooks. In other words, today you will learn how to become an Ansible developer.  You will learn best practices and then do more advanced applications such as conditional processing and looping, both of which require an understanding of ansible variables. Due to the modularity of Ansible, which became clear on day 2, you will branch out and use ansible to configure clouds and even advanced networking configurations.   We will finish the day with a review of Ansible tower, using the latest version of Tower, namely AMX.

  1. Ansible OpenStack Configuration
  2. Ansible variables, conditional and looping tasks
  3. Dynamic Inventory
  4. Roles
  5. Playbook Best practices
  6. NTC (network-to-code) Modules
  7. Ansible Tower / AWX Essentials



Ansible Labs

While students are encouraged to do all the labs, but normally ONLY A PORTION OF THEM is required. The teacher will tell you which labs are mandatory based on the level of skill you wish to develop. Labs will be available 24 x 7 for the duration of the class and can remain available for the following week on request.


Day 1

  1. SSH 101 - client and server configs (/etc/sshd_config and /etc/ssh_config)
  2. SSH 101 - users and passwords + linux command line
  3. RSA Connectivity:
    • SSH 101 - RSA key generation
    • SSH 101 - authorized_keys file + passwordless login
    • SSH 101 - copy-id and ~/.ssh/config
  4. Users 101 - users and groups
  5. Users 101 - sudo, /etc/sudoers, visudo - make someone a sudoer
  6. Users 101 - passwordless sudoers - now make that user a passwordless sudoer
  7. Pip 101 - list, install, freeze, etc
  8. Install different versions of ansible with pip
  9. Install dependencies on host (ad hoc raw)
  10. Set up a simple host file and ad hoc ping (-i hosts file))
  11. Set up a group and group of groups and ping, also ping all
  12. Challenge labs
    • Ad hoc to host with incorrect user (student sees error and fixes username)
    • Ad hoc to host with ssh password (avoid prompts with cli arg)
    • Ad hoc to host with bad RSA key (fix with new one that works)
    • Ad hoc to host with password sudoer (avoid prompts with cli arg and fix with visudo)
  13. Ad hoc a gather fact command
  14. Ad hoc a shell command that does something verifiable


Day 2

  1. yaml dictionary (--extra_vars and show in debug module)
  2. yaml list (--extra_vars and show in debug module)
  3. Set up ansible.cfg file to simplify cli args
  4. A simple multi-step all-in-one playbook
  5. A playbook with inventory file, include file, main file, and var file
  6. Ansible Modules - Template
    • A jinja2 template fill-in-the-blank ini file
    • A jina2 variable example
    • A jinja2 filter example
    • A jinja2 test (if/then) example
  7. Ansible Modules - Command / Shell
  8. Ansible Modules - Copy
  9. Ansible Modules - Apt
  10. Ansible Modules - Yum
  11. Ansible Modules - Get_url
  12. Ansible Modules - File (create directories)
  13. Ansible Modules - quiz via documentation, 10 scavenger hunts
  14. Ansible Modules - Start/Stop/Restart (forced within playbook)
  15. Ansible Handlers - Restart service at the end of playbook (nginx?, networking?)
  16. Ansible Handlers - lots of contrived examples with debug tasks in handlers
  17. Napalm installation (pip)
  18. Napalm examples without ansible
  19. Napalm-ansible ansible module Instal
    • Ansible Modules - Napalm_get_facts
    • Ansible Modules - Napalm_install_config
    • Ansible Modules - Napalm_validate

Day 3

  1. Install openstack dependencies (shade via pip and clouds.yml)
  2. Boot and configure an openstack instance
  3. Advanced Playbooks - Variables and loops
  4. Advanced Playbooks - Complex variable in a loop
  5. Advanced Playbooks - A task using When based on a register variable from a previous task (Idempotent example that also shows conditional execution of a task
  6. Dynamic Inventory - Something that uses
  7. Advanced Playbooks - A multi-role scenario where we boot a web service using roles, templates and everything else we can think of. The capstone event
  8. Install and run an AWX server

Alta3 Research

Ansible Essentials

Duration: 3 Days (instructor-led)

Delivery: Onsite or Instructor-led Virtual

Onsite: Contact us for group quotes

Buy Self-Paced