Ansible 101 - Essentials

Skip to Scheduled Dates

Course Overview

Ansible is a powerful IT automation engine used to accelerate DevOps initiatives. It’s an open-source tool that executes repetitive network and system admin tasks. Ansible is used to bring structure and consistency to system deployments, implementations, and changes.

Who Should Attend

  • DevOps Engineers
  • System and Cloud Administrators
  • Network Engineers and Developers
  • Python Developers

Course Objectives

    • Overview of Ansible and critical modules
    • AI LLM prompt engineering for generating Ansible solutions
    • Ansible collections for content delivery
    • Building roles for code reuse
    • YAML formatting
    • Playbook construction and order of execution
    • Jinja2 templating
    • Static and Dynamic inventory management
    • Credential Management and Encryption with Vault
    • Finding solutions on Ansible Galaxy
    • Version controlling code with Git

Course Outline

Ansible Introduction

  • Ansible definition
  • Exploring modules
  • Building a task
  • Places to define Ansible vars
  • hosts aka \"Inventory\"
  • Creating a A play
  • Looking at the “handler”
  • Running a playbook
  • Introduction to YAML
  • Requirements for connecting to remote hosts

Installation

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

Ansible Static Inventory

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

Ansible Tower / AWX

  • What is Ansible Tower and AWX
  • Why you should consider using Jenkins as a replacement for Ansible Tower
  • Pushing and pulling playbooks from GitHub

Roles and Ansible Galaxy

  • Why we need Ansible Roles
  • Role Directory Structure
  • Using Roles
  • Role default variables
  • Converting a Playbook to a Role
  • Exploring Ansible Galaxy
  • Running a role from Ansible Galaxy

YAML

  • YAML Gotchas
  • YAML Dictionary
  • YAML list
  • YAML list of dictionaries
  • YAML Alternate format
  • Relationship to JSON

Ansible Ad hoc commands

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

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

Ansible config file and directory structure

  • ansible.cfg
  • Best practices concerning directory structures and organization
  • Host Inventory and ansible_vars
  • Introduction to roles

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

Ansible config file and directory structure

  • ansible.cfg
  • Ansible Inventory
  • roles

Server Modules to Know

  • Modules documentation
  • setup / gather_facts
  • copy
  • apt / yum / pip
  • command / shell
  • git
  • get_url
  • debug
  • lineinfile

Jinja2

  • What is Jinja2?
  • Jinja2 variables
  • Jinja2 filters
  • Jinja2 tests
  • How to use templates
  • Review of templates

Conditional and Looping Tasks

  • Variables and Loops
  • Using Complex Variables in Loop
  • 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?

Ansible Network Solutions

  • Writing Cisco and Juniper playbooks
  • Modules for Cisco
  • Exploring Juniper solutions
  • Built in Juniper modules
  • Role based Juniper modules
  • Installing a module from Juniper vendor
  • Securing credentials
  • Latest version of Ansible

Dynamic Inventory Management

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

OpenStack and AWS

  • Overview of OpenStack
  • Understanding the OpenStack client
  • What is openstack-sdk
  • clouds.yaml
  • Installing openstack-sdk
  • Using openstack-sdk
  • OpenStack modules
  • os_network
  • os_subnet
  • os_router
  • os_server
  • os_server_action
  • os_security_group
  • What is boto?
  • Installing boto for AWS
  • AWS modules
  • ec2
  • aws_s3_bucket_info
  • redshift

Variables and Python

  • Jinja Filters for variable manipulation
  • Using Python within playbooks for variable manipulation
  • Best practices for Variables
  • Securing credentials with Ansible Vault
  • Encrypting Playbooks with Ansible Vault

 Back to Course Search

Class Dates & Times

Class times are listed Central time

This is a 5-day class

Class dates not listed.
Please contact us for available dates and times.