Using Ansible for Configuration Management and Deployments

Course Instructor
course instructor image
Terrence Cox
A veteran of twenty years in Information Technology in a variety of roles. He has worked in development, security and infrastructure well before they merged into what we now call DevOps. He provides training in Linux, VMWare, DevOps (Ansible, Jenkins, etc) as well as containers and AWS topics.

Introduction

Syllabus

00:08:09

Introduction to Ansible

00:06:02

Ansible vs. Other Tools

00:08:49

Introduction to YAML

00:05:06

YAML Examples

00:10:41

Ansible Documentation: Modules

00:08:34

Setup and Configuration

Test Environment Setup

00:11:09

Download and Installation

00:09:38

Ansible Configuration File

00:11:59

Ansible Python Dependencies

00:07:02

The HOSTS File

00:08:06

Overriding the Default HOSTS File

00:06:12

Overriding the Default System Ansible.Cfg File

00:11:08

Overriding the Default Roles Path

00:08:14

Exercise: Configure Test Environment for Secure Access

00:30:00

Exercise: Configuring the Ansible Host Environment

00:30:00

Exercise: Ansible Facts

00:30:00

Ansible Playbooks

Configuring Your 'Ansible' Account

00:08:03

Ansible Command Line

00:09:44

System Facts

00:08:34

System Facts: Common Values for Playbooks

00:10:13

Our First Playbook

00:11:36

Variables: Inclusion Types

00:09:45

Target Section

00:10:12

Variable Section

00:11:54

Task Section

00:10:52

Handler Section

00:10:20

Outlining Your Playbook

00:08:05

Create a Playbook from Our Outline

00:16:27

Optimizing Your Playbook

00:12:47

Taking Our Playbook for a Dry Run

00:07:45

Asychronous Polling

00:08:26

Simple Variable Substitution

00:09:05

Lookups

00:11:18

RunOnce

00:08:05

Local Actions

00:08:06

Loops

00:08:49

Conditionals

00:11:39

Until

00:08:41

Notify

00:10:20

Vault

00:10:08

Prompt - Interactive Playbook

00:08:19

Basic Include Statements

00:09:17

Tags

00:12:03

Basic Error Handling

00:08:04

Includes - Breaking Your Playbook Into Discrete Plays

00:18:13

Starting At Task or Stepping Through All Tasks

00:09:44

Passing Variables Into Playbooks at the Command Line

00:08:06

Using Jinja2 Templates

00:10:45

LocalAction

00:08:14

DelegateTo

00:10:04

Exercise: Running Ansible Commands Against Hosts

00:30:00

Exercise: Querying a Remote System

00:30:00

Exercise: Create a Simple Playbook

00:30:00

Exercise: Building a Larger Playbook - Target Section

00:30:00

Exercise: Building a Larger Playbook - Variable Section

00:30:00

Exercise: Building a Larger Playbook - Task Section

00:30:00

Exercise: Playbooks - Loops

00:30:00

Exercise: Playbooks - Notify

00:30:00

Exercise: Playbooks - Conditionals

00:30:00

Exercise: Playbooks - Lookup

00:30:00

Exercise: Playbooks - Local Action

00:30:00

Exercise: Playbooks - Run Once

00:30:00

Exercise: Playbooks - Prompt

00:30:00

Exercise: Playbooks - Includes

00:30:00

Exercise: Playbooks - Tags

00:30:00

Exercise: Playbooks - Until

00:30:00

Exercise: Playbooks - Ignore Errors

00:30:00

Exercise: Playbooks - Discrete Plays

00:30:00

Exercise: Playbooks - Create an Outline

00:30:00

Exercise: Playbooks - Create Playbook from Outline

00:30:00

Exercise: Playbooks - Optimize Your Outline Playbook

00:30:00

Exercise: Take Your Playbook for a DryRun

00:30:00

Exercise: Jinja2 Template Creation

00:30:00

Exercise: Playbooks - Using Templates

00:30:00

Exercise: Playbooks - Start At

00:30:00

Exercise: Playbooks - Step Into

00:30:00

Exercise: Playbooks - Variables from Command Line

00:30:00

Exercise: Playbooks - DelegateTo

00:30:00

Ansible Modules

The 'Setup' Module

00:10:13

The 'File' Module

00:11:06

The 'Pause' Module

00:11:36

The 'WaitFor' Module

00:08:25

The 'Yum' Module

00:10:40

The 'Apt' Module

00:11:12

The 'Service' Module

00:10:21

The 'Copy' Module

00:12:25

The 'Command' Module

00:08:14

The 'Cron' Module

00:08:19

The 'Debug' Module

00:08:40

The 'Fetch' Module

00:09:10

The 'User' Module

00:08:32

The 'AT' Module

00:08:56

The 'DNF' Module

00:08:47

The 'Apache2_Module' Module

00:08:11

The 'SetFact' Module

00:08:51

The 'Stat' Module

00:11:36

The 'Script' Module

00:12:26

The 'Shell' Module

00:10:28

The 'SELinux' Module

00:09:36

The 'SEBoolean' Module

00:11:38

The 'Raw' Module

00:07:31

The 'Ping' Module

00:07:06

The 'Package' Module

00:07:33

The 'Unarchive' Module

00:08:09

The 'HTPasswd' Module

00:10:22

The 'GetURL' Module

00:07:07

The 'Group' Module

00:07:31

The 'Mail' Module

00:09:15

The 'Filesystem' Module

00:10:15

The 'Mount' Module

00:08:25

The 'Notify' Module

00:10:20

The 'AptRepo' Module

00:08:06

The 'AptKey' Module

00:07:43

The ' ACL' Module

00:08:39

The 'Git' Module

00:08:55

Creating a Jinja2 Template File

00:08:02

The 'Template' Module

00:10:45

The 'MySQL_DB' Module

00:13:51

The 'MySQL_User' Module

00:11:04

The 'Kernel_Blacklist' Module

00:07:10

Exercise: The Pause Module

00:30:00

Exercise: The WaitFor Module

00:30:00

Exercise: The Setup Module

00:30:00

Exercise: The 'Yum' Module

00:30:00

Exercise: The 'Apt' Module

00:30:00

Exercise: The 'Service' Module

00:30:00

Exercise: The 'Copy' Module

00:30:00

Exercise: The 'Command' Module

00:30:00

Exercise: The 'Cron' Module

00:30:00

Exercise: The 'Debug' Module

00:30:00

Exercise: The 'User' Module

00:30:00

Exercise: The 'Fetch' Module

00:30:00

Exercise: The 'SetFact' Module

00:30:00

Exercise: The 'Stat' Module

00:30:00

Exercise: The 'Script' Module

00:30:00

Exercise: The 'Debug' Module

00:30:00

Exercise: The 'Fetch' Module

00:30:00

Exercise: The 'User' Module

00:30:00

Exercise: The 'AT' Module

00:30:00

Exercise: The 'DNF' Module

00:30:00

Exercise: The 'Shell' Module

00:30:00

Exercise: The 'SELinux' Module

00:30:00

Exercise: The 'SEBoolean' Module

00:30:00

Exercise: The 'Raw' Module

00:30:00

Exercise: The 'Ping' Module

00:30:00

Exercise: The 'HTPasswd' Module

00:30:00

Exercise: The 'GetURL' Module

00:30:00

Exercise: The 'Group' Module

00:30:00

Exercise: The 'Filesystem' Module

00:30:00

Exercise: The 'Mount' Module

00:30:00

Exercise: The 'Mail' Module

00:30:00

Exercise: The 'Unarchive' Module

00:30:00

Exercise: The 'Notify' Module

00:30:00

Exercise: The 'Apt Repo' Module

00:30:00

Exercise: The 'AptKey' Module

00:30:00

Exercise: The 'ACL' Module

00:30:00

Exercise: The 'MySQL_DB' Module

00:30:00

Exercise: The 'MySQL_User' Module

00:30:00

Roles

Roles - The Directory Structure

00:10:28

Role Based Tasks

00:11:51

Task Order - Pre and Post Tasks

00:07:35

Roles - Conditional Execution

00:10:59

Roles - Variable Substitution

00:09:24

Roles - Handlers

00:10:59

Roles - Using Notification

00:08:45

Roles - Configuring Alternate Roles Paths

00:07:02

Roles - Conditional Include Statements

00:11:11

Roles - Waiting For Events

00:08:01

Roles - Executing a Task Until

00:09:35

Roles - Using Tags

00:07:32

Roles - Breaking a Playbook Into a Role

00:18:13

Roles - Passing Variables from Command Line

00:09:03

Roles - Using Jinja2 Templates

00:10:45

Roles - DelegateTo

00:11:32

Roles - LocalAction

00:08:24

Exercise: Roles - Create Directory Structure

00:30:00

Exercise: Roles - Tasks Within a Role

00:30:00

Exercise: Roles - Pre and Post Tasks

00:30:00

Exercise: Roles - Variable Substitution

00:30:00

Exercise: Roles - Conditional Roles

00:30:00

Exercise: Roles - Using Templates

00:30:00

Ansible Command Line Usage

Ansible Command Line - Installing Packages

00:08:30

Ansible Command Line - Services and Hosts

00:08:11

Ansible Command Line - Commands and Shells

00:07:34

Ansible Command Line - Managing Users

00:08:53

Ansible Command Line - Create and Manage Cron Jobs

00:09:03

Ansible Command Line - Running Arbitrary Commands

00:07:16

Ansible Command Line - Output Tree

00:07:47

Exercise: Ansible Command Line - Run Arbitrary Module Commands

00:30:00

Exercise: Ansible Command Line - Installing Packages

00:30:00

Exercise: Ansible Command Line - Managing Services

00:30:00

Exercise: Ansible Command Line - Managing Users

00:30:00

Exercise: Ansible Command Line - Managing CRON Jobs

00:30:00

Exercise: Ansible Command Line - Run Arbitrary System Commands

00:30:00

Use Cases

Creating a Web Server Deployment - Outline

00:14:24

Creating a Web Server Deployment - Playbook First Pass

00:19:22

Creating a Web Server Deployment - Playbook Optimization

00:15:03

Creating a Web Server Deployment - Breaking Into Role(s)

00:16:20

Creating an NFS Server Deployment - Outline

00:10:39

Creating an NFS Server Deployment - Playbook First Pass

00:28:04

Creating an NFS Server Deployment - Playbook Optimization

00:12:28

Creating an NFS Server Deployment - Breaking Into Role(s)

00:21:16

Creating a Database Server Deployment - Outline

00:11:59

Creating a Database Server Deployment - Playbook First Pass

00:23:36

Creating a Database Server Deployment - Playbook Optimization

00:15:34

Creating a Database Server Deployment - Breaking Into Role(s)

00:13:52

Exercise: Use Case - Create a Web Server Outline

00:30:00

Exercise: Use Case - Create a DB Server Outline

00:30:00

Exercise: Use Case - Create an NFS Server Outline

00:30:00

Advanced Topics and Ansible 2.0 Updates

Galaxy Introduction and Usage

00:11:00

Ansible 2.0 - Installation

00:11:20

Ansible 2.0 - Playbooks: User Privilege Escalation Changes

00:08:05

Ansible 2.0 - Modules: The 'Find' Module

00:09:51

Ansible 2.0 - Modules: The 'Package' Module

00:09:05

Ansible 2.0 - Roles: User Privilege Escalation Changes

00:10:19

Ansible 2.0 - Roles: The 'Find' Module

00:08:47

Ansible 2.0 - Roles: The 'Package' Module

00:07:36

Exercise: The 'Find' Module

00:30:00

Exercise: The 'Package' Module

00:30:00

Conclusion

Conclusion and Next Steps

00:07:12

Details

Ansible continues to gain traction as a powerful, enterprise level configuration and deployment management tool. With it's standardized Playbook formatting and reliance on Python standards, it is easy to use, quick to learn and puts the power of automation at everyone's fingertips. In this course, we will cover Ansible configuration, modules, command line usage and Playbook building. By the time you are done, you will be able to use Ansible to automate and manage your DevOps infrastructure.

Study Guides

Ansible Playbook Examples

This is a listing of all the Ansible playbooks created during the video demonstrations of modules/roles/functions within this course.

Ansible Introduction

Ansible Intro to YAML

Ansible vs. Other Tools

Ansible Playbook Examples - Roles

Another example of playbooks, this time from the Roles section of the course.

Instructor Deck

Community

Looking For Team Training?

Learn More