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 can be used by both network and server administrators alike.


ansible construction building

Course Outline: Ansible Essentials

5 Days with Hands-on Labs


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 can be used by both network and server administrators alike.

Day 1

1. Ansible Introduction

  • Ansible definition
  • A module
  • A task
  • Ansible vars
  • Ansible tasks
  • hosts aka "Inventory"
  • A play
  • handlers
  • The Ansible playbook
  • passwordless sudo and RSA access
  • Public Key Encryption as Privacy
  • Public Key Encryption as Authentication
  • Exploring the lab environment

2. Installation

  • Configuration requirements on the control machine
  • Python requirements on the host
  • Using ansible raw to install Python

Day 2

3. Ansible config file and directory structure

  • ansible.cfg
  • Ansible Inventory
  • roles

3. Ansible Static Inventory

  • Defining Hosts and Groups
  • Host and Group variables
  • Groups of Groups
  • Default Groups

4. Ansible Ad hoc commands

  • Ad hoc command syntax
  • Parallel Shell commands
  • Managing packages
  • Managing users and groups
  • Gathering facts
  • ad hoc cheat sheet

5. Ansible config file and directory structure

  • ansible.cfg
  • Host Inventory and ansible_vars
  • roles

6. YAML

  • YAML Gotchas
  • YAML Dictionary
  • YAML list
  • YAML list of dictionaries
  • YAML Alternate format

Day 3

7. Writing a Simple Playbook

  • Elements of a well written playbook
  • A well-written Ansible play
  • Using include files for tasks
  • A well-written ansible variable file
  • A well-written ansible inventory file

 

8. Key Modules you need to know

  • Understanding modules documentation
  • Copy
  • apt / yum / pip
  • command / shell
  • git
  • get_url
  • debug
  • Manage L3 interfaces on network devices
  • Manage Layer-2 interface on network devices
  • Manage VLANs on network devices
  • OpenVswitch NFV
  • Manage Interface on network devices

9. Ansible templates

  • What is Jinja2?
  • jinja variables
  • jinja filters
  • jinja tests
  • How to use ansible template
  • Review of the ansible template documentation

Day 4

10. Conditional and Looping Tasks

  • Variables and Loops
  • Using Complex Variables in Loops
  • Variables and Templates
  • Using variables in conditions
  • Blocks
  • Prompts
  • Getting variables from the system
  • Setting variables in playbooks
  • registered variables
  • Getting variables from the command line
  • Where is the best source to derive variables values?

11. Dynamic Inventory Management

  • What is Dynamic Inventory?
  • A review of static Inventory Practices
  • Using JSON as an Inventory Source
  • AWS EC2 Example
  • OpenStack Example

12. OpenStack Configuration

  • Enough OpenStack to Survive
  • Understanding the OpenStack client
  • What is shade?
  • clouds.yaml
  • Installing shade
  • Using shade
  • os_network
  • os_subnet
  • os_router
  • os_server
  • os_server_action
  • os_security_group
  • os_security_group_rule

13. napalm-ansible

  • Network Automation Transactions
  • What is NAPALM?
  • How NAPALM works
  • napalm installation
  • Load/Replace configuration
  • Network Driver
  • Connecting to the Device
  • Replacing the Configuration
  • Rollback Changes
  • Disconnecting
  • NAPALM Context Manager
  • Extending NAPALM Example
  • What is napalm-ansible?
  • napalm-ansible Installation
  • napalm_ping
  • napalm_get_facts
  • napalm_install_config
  • napalm_validate

14. Networktocode ntc-ansible

  • What is ntc-ansible
  • TextFSM
  • Installation
  • ntc Modules
  • Example

Day 5

15. Roles

  • Why we need Ansible Roles
  • Role Directory Structure
  • Using Roles
  • Role default variables
  • Converting a Playbook to a Role

 

16. Playbook Best Practices

  • Directory Layout
  • Use Dynamic Inventory With Clouds
  • How to Differentiate Staging vs Production
  • Group And Host Variables
  • Top Level Playbooks Are Separated By Server Type
  • If you must use shell stay idempotent!
  • 7 More Best Practices

17. Ansible Tower / AWX Essentials

  • What is Ansible Tower and AWX



Labs:

  1. SSH client and server configs
  2. RSA key gen
  3. Install ansible
  4. Inventory and Ad-Hoc commands
  5. Ad-Hoc modules and gather facts
  6. Ad-Hoc elevated
  7. Day one challenge lab #1
  8. Day one challenge lab #2
  9. Mastering the yaml list
  10. Install host dependencies ad-hoc raw
  11. Mastering the yaml dictionary
  12. ansible.cfg setup
  13. Writing a simple multi-step all-in-one playbook
  14. Write a playbook with separate vars file
  15. Ansible shell Module
  16. Ansible copy module
  17. Ansible apt module
  18. Ansible yum module
  19. Ansible get-url module
  20. Ansible file module
  21. Ansible git module
  22. Ansible template Module
  23. Mastering Ansible module documentation
  24. Manual Launch of an OpenStack Instance
  25. Launch an OpenStack Instance with Ansible and shade
  26. Dynamic Inventory
  27. Configuring a Web Service with Ansible
  28. Using Ansible handlers
  29. Ansible error handling
  30. Install GNS3
  31. Setup GNS3 networking
  32. Configure the switches
  33. Network Device PLaybook
  34. Network get_config and archive playbook
  35. Writing a custom network device playbook
  36. Napalm first steps
  37. Napalm validation
  38. Napalm changes, validation, and rollback
  39. Napalm basic python script
  40. Napalm Challenge
  41. Reading variables into playbooks from files
  42. Using Ansible to call python script
  43. Installing a custom Ansible module
  44. Using Ansible to fetch running config
  45. Using Ansible to merge config
  46. Using Ansible to validate a configuration
  47. Creating custom Ansible roles
  48. Ansible galaxy and roles
  49. Ansible release process - writing a complex playbook
  50. Ansible Tower Install
  51. Tracking with Ansible logs
  52. Ansible Vault - encrypting sensitive data

Alta3 Research

Ansible Essentials


Duration: 5 Days (instructor-led)

Delivery: Onsite or Instructor-led Virtual

Price:
Onsite: Contact us for group quotes

Course Outline PDF: Download PDF

Buy Self-Paced