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

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.

Day1

1. Ansible Introduction

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

4. Ansible Static Inventory

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

5. Ansible Ad hoc commands

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

6. YAML

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

Day 3

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

8. Networktocode ntc-ansible

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

9. 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

 

10. Ansible templates

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

Day 4

11. 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

12. Dynamic Inventory Management

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

13. 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

Day 5

14. 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?

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. SSH users and passwords
  3. RSA key gen
  4. Sudoers and visudo
  5. Users and groups
  6. Passwordless Sudoers
  7. Pip essentials
  8. Install ansible
  9. Inventory and Ad-Hoc commands
  10. Ad-Hoc modules and gather facts
  11. Ad-Hoc elevated
  12. Day one challenge lab #1
  13. Day one challenge lab #2
  14. Install host dependencies ad-hoc raw
  15. Mastering the yaml dictionary
  16. Mastering the yaml list
  17. ansible.cfg setup
  18. Writing multi-step all-in-one playbook
  19. Write a playbook with separate var file
  20. Ansible template Module
  21. Ansible Command and Shell Modules
  22. Ansible Copy module
  23. Ansible apt module
  24. Ansible yum module
  25. Ansible get-url module
  26. Ansible file module
  27. Ansible git module
  28. Mastering Ansible module documentation
  29. Launch an OpenStack VM
  30. Launch an OpenStack VM with Ansible
  31. Dynamic Inventory
  32. Configuring a Web Service with Ansible
  33. Using Ansible handlers
  34. Ansible error handling
  35. Install GNS3
  36. Setup GNS3 networking
  37. Configure the switches
  38. Napalm first steps
  39. Napalm validation
  40. Napalm changes and validation
  41. Napalm basic python script
  42. Napalm advanced python script
  43. Vincent's Lab
  44. Ansible calling python
  45. Ansible napalm gather facts
  46. Ansible Napalm fetch
  47. Ansible Napalm install config
  48. Ansible napalm validation
  49. Ansible Napalm roles
  50. Ansible release process
  51. Ansible Tower demo

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