You are on page 1of 8

Ansible 2 for Beginners

Section 1: Ansible 2 – What's It All About?

1.1 The Course Overview

This video provides an overview of the entire course.

1.2 What Is Ansible?

In this section, you'll learn about the most popular uses of the Ansible automation tool. It's a tool that
you can use to manage the full life cycle of your infrastructure.

o Use of the Ansible automation tool

o Ansible Security

1.3 Why Ansible?

Ansible is more than just configuration management, like many other tools in this space. It's also much
more lightweight than competitors like Puppet and Chef—to configure a server, all you need is an SSH
login and Python 2 installed.

o Reasons to try Ansible

1.4 Demonstration – From Bash to Ansible

We'll use a simple example: installing and configuring an nginx server and a simple static HTML website,
first using bash and then using Ansible.

o A demonstration of how configuration management has changed over time

o Differences between traditional bash and process in Ansible

o An example on manual versus shell script versus playbook

1.5 Course Layout

This video gives you an overview of how the course is structured. The focus is on practical, real-world
applications, since that prepares you for real-life application of this knowledge.

o Install and set up the environment for Ansible

o Basic configuration files

o Cloud integration and Ansible tower


1.6 Basic Ansible Vocabulary

In this video, we'll cover the basic Ansible vocabulary. You'll have many basic questions answered.

o What's the difference between a server and a machine?

o What is an Ansible target machine?

o How do Ansible tasks, plays, and playbooks fit together?

1.7 New Features in Ansible 2.0

In this video, you'll learn about the new features and improvements that Ansible 2.0 offers.

o Task blocks (which can make your code easier to read and reason about)

o Dynamic includes (which can allow you to simplify your playbooks)

o Execution strategies (which can dramatically improve Ansible's performance on large


deployments)

Section 2: Setting up the Learning Environment

2.1 Creating an Ansible Home Base

In this video, we'll set up an environment that you can use to safely practice everything you see in this
course.

o Which type of VM to use for your Ansible Controller machine

o How to set things up to make your learning experience comfortable

2.2 Installing Ansible

In this video, you'll learn the three most popular ways to install Ansible, and decide which one is right for
you.

o How to install Ansible through your package manager (if you just want a low-fuss install
to learn with )

o How to install Ansible through their third-party repository (PPA) in Ubuntu (if you want
something more up-to-date)

o How to install Ansible through pip (if you've already got a Python development
environment set up)

o Use the Ansible-provided script to set up your shell environment so that you can use
your bleeding-edge Ansible code
2.3 Bleeding-Edge Ansible Installation

In this video, we'll cover how to build Ansible directly from its repository. This method is useful if you
absolutely need a bleeding-edge feature, or if you're interested in contributing to the Ansible source
code.

o Clone the Ansible repository

o Initialize all submodules

o Install the Python libraries that are required to build Ansible

2.4 Setting up our Test Environment

In this video you'll learn how to simulate test machines with LXC (Linux Containers). LXC is a lightweight
precursor to Docker which will let us configure some test hosts that we can run Ansible against.

o Create three containers

2.5 Target Machine Requirements

Ansible only requires two things: Python 2 and a running SSH service. In this video, I'll show you the 10-
second process that prepares a brand-new host for Ansible.

o Automated by a playbook in one of the first pieces of Ansible code

Section 3: Jumping into Ansible 2

3.1 Ansible Configuration Hierarchy

In this video, you'll learn where Ansible looks for its primary configuration file, and the different ways in
which you can approach configuring Ansible.

o The top-level Ansible configuration file

o The user-level Ansible configuration file

o A config file in the directory that Ansible is being executed from

o The ANSIBLE-CONFIG environment variable

3.2 Ansible Hosts Inventory File

How does Ansible know which hosts to configure? The Ansible Hosts (Inventory) file!

o What the inventory file is?

o Basic syntax for the Ansible inventory file


o The top-level Ansible inventory file (/etc/ansible/hosts)

3.3 Ad-Hoc Commands

Ad-Hoc Commands are simple one-off commands that perform a single action on a target host. These
simple replacements for small bash scripts or 'for' loops are run from the command-line, and work well
for cases where a full-featured Playbook is overkill. You'll see Ad-Hoc commands for doing several things
across one server, or many servers at once

o Pinging and checking memory usage

o Install a package

o Add timeouts to your commands

o Specify additional command-line arguments (custom users, ignoring host-key checking,


etc.)

3.4 Introduction top playbooks

Playbooks are the Ansible feature you'll be working with on most projects. In this video, you'll learn the
three components that make a Playbook what it is: tasks, templates, and handlers.

o Discuss how Playbooks make code reuse easy

o See some simple examples of practical playbooks

3.5 Playbook Structure

In this video, you'll learn how to structure your playbooks for maximum readability, predictability, and
flexibility. You'll learn about Roles, and how they can help you reuse code. Note: For this course, we're
not using every available Playbook feature, because it can make things excessively complex. We're
focusing on the practical 90% of features that you'll be using every day.

o Look at some Python code that creates an empty playbook template

o Compare that to a playbook-creating Ansible playbook

3.6 Introduction to Modules

In this video, you'll learn what Ansible modules are and how they help you get things done.

o Where to find documentation for modules you are interested in

o The advantages of using modules vs. manually managing a task

o Managing state versus managing process, and how it can make your life easier

3.7 Common Modules


In this video, you'll learn about some of the most popular (and useful!) Ansible modules. At the end of
this video, you'll have a list of modules to dig into, which you can use to manage

o Using Package module

o Using Files and Directories module

o Using System state module

3.8 Variables and Facts

In this video, you'll learn about how Ansible deals with Variables and Facts:

o The different levels (namespaces) at which variables can be applied

o The most common places to set variables and their benefits/drawbacks

o How Ansible gathers facts about a target host, and when you might want to disable this
behavior

o How you can access facts that Ansible has registered

Section 4: A Real-World Playbook

4.1 Real-Life Playbook: Mattermost Deployment

In this video, you'll see a real-life web application deployment. We'll be setting up Mattermost, an open-
source alternative to the popular Slack team-chat application.

o Deployed on a single test host

o Install and configure the Mattermost application

4.2 Real-Life Playbook Walkthrough

This video reviews everything we just saw in the application deployment. After watching this video,
you'll start to have an intuitive 'real-world' grasp of how a playbook works.

o Look at the different modules

o Ansible features that were used


Section 5: Loops, Blocks, Strategies, and Galaxies

5.1 Debugging and Troubleshooting

While developing Ansible automation, you'll be doing a lot of troubleshooting as part of the process. In
this video, I'll show you the most common Ansible features that you'll use for debugging, along with
some of the most common Ansible errors you'll encounter.

o Doing troubleshooting

o Use debugging along with Ansible errors

5.2 Conditionals and Control Flow

In this video, you'll learn about the control flow that you can use in your Tasks and Plays. At the end of
this video, you'll be comfortable with Ansible iteration constructs like:

o with_items

o with_dict

o with_nested and conditionals like:

o when

o register

o changed_when

o failed_when

o Learn about the control flow

o Use Tasks and Plays

5.3 Templating, Control Flow, and Iteration in Jinja2

In addition to control flow in your YAML files, we can also introduce control flow for our file content in
your Jinja2 templates.

o Introduce control flow for your file content

o Use regular Python for control flow and iteration

5.4 YAML Basics

We have been using YAML to write your Playbooks, Plays, Tasks, and Handlers. Now it's time to dig in for
a moment and learn some of the rules you need to keep in mind when working with this markup
language.
o Learn some of the rules of YAML

o Working with this markup language

5.5 Ansible Blocks

Task Blocks are one of the useful new features in Ansible 2.0. They allow you to group related tasks
together, so you can tie control-flow to larger chunks of actions. This is something that comes in handy
for larger actions which are made up of several tasks.

o Learn the optional 'rescue' and 'always' block features

5.6 Performance and Execution Strategies

Ansible has two built-in execution strategies that affect how it applies tasks to hosts. Knowing whether
you want to use the linear (default) strategy or the free strategy can make the difference between
completing a deployment in minutes or hours

o Difference between using a linear(default) strategy and free strategy

o Choosing the right feature

5.7 Ansible Galaxy

Ansible Galaxy allows you to leverage open-source roles that other people in the Ansible community
have created. It can be useful for studying code that others have written, or for quickly getting some
functionality that you need without having to write it from scratch.

o Install a role from Ansible Galaxy

o Use that role in a Playbook

o Control where a downloaded role is stored

o Remove a role (cleanup)

5.8 Security

In this video, I'll cover some of the basic security features. This is essentially a quick list of "best
practices" and "things to watch out for." Using Ansible for provisioning, deployment, configuration
management, and orchestration does not absolve you of managing the security of your systems...you'll
still have to invest thought and planning into how you do this.

o Cover some of the basic security features

o Using Ansible for provisioning, deployment, configuration management, and


orchestration
Section 6: Ansible in the Cloud

6.1 Ansible in the Cloud

Ansible can be used to provision services on all major cloud providers: Amazon Web Services (AWS),
OpenStack, Google Cloud, Microsoft Azure, and more. There are also Ansible modules for on-premise
virtualization and cloud solutions, which makes it really easy to get started.

o Use provision services on all major cloud providers

o UseAnsible modules for on-premise virtualization and cloud solutions

6.2 Ansible AWS Demo

In this demonstration, you'll see how the Mattermost Deployment playbook was ported to Amazon
AWS.

o Provisioning and configuring Application Servers on EC2

o Provisioning an RDS instance and a replica to handle our database needs

o Creating EC2 security groups to manage access and protect our infrastructure

o Dynamically creating host groups from the infrastructure we're provisioning

6.3 Ansible Tower

This video will give you a quick taste of Ansible's commercial solution: Ansible Tower. This is a web
application wrapper around the core open-source Ansible toolset

o Role-based Access Control.

o An API that you can integrate into the rest of your automation tooling.

o A GUI that allows nontechnical users to leverage Ansible's power.

You might also like