Mastering Ansible

4.3 (6599)
Mastering Ansible
Learning paid
5 hours course
Course by Udemy
Mastering Ansible
What will you learn?
Execute ad-hoc commands against servers using Ansible
Write Ansible configuration playbooks to deploy a 3-tier web application
Configure Ansible roles with tasks, handlers, files, templates, and default variables
Write operational playbooks to check cluster status and perform a cluster restart.
Optimize Ansible playbooks to reduce playbook execution time.
Test and troubleshoot Ansible playbook execution.
About the course

Mastering Ansible is a step-by-step journey of learning Ansible for configuration management and orchestration.

The course is designed as a journey through configuring a realistic application stack from the ground up. Instead of going page-by-page through the Ansible documentation, topics are ordered to align with the growing complexity of our application as we build it up and refactor it.

In addition to the core concepts of configuration with Ansible, we spend time on building tools to help us maintain and troubleshoot our application. The goal is to have a workflow where all of the configuration and troubleshooting is done through ansible playbooks that can be committed to a repository and improved over time.

The course is divided into 6 sections, starting with initial installation and foundational concepts. Starting in section 3, we build up a sample application environment layer-by-layer, learning a new concept in each lecture. After the application is up and running, we refactor our setup in section 4 with an emphasis on modularity and encapsulation. In section 5, we optimize our code and learn about techniques to reduce the playbook execution time. The course finishes with a final section on troubleshooting and testing.

For each lecture, we introduce a new Ansible concept and apply it to our playbooks. For most lectures, we execute the new concept in the demo environment so you can see what the output should look like. In the notes of each lecture, you'll find a link to the relevant documentation pages, along with a snapshot of the codebase at the end of that lecture.

This course was built with Ansible version 1.9.3, applied to a 3-tiered web application environment leveraging NGINX, Apache2, Python, and MySQL on Ubuntu Linux servers. We do not cover administering Windows servers in this course.

This course is designed as an introduction to Ansible, but also as a guide for engineers interested in configuration management, orchestration, infrastructure-as-code, and devops principles.


Welcome to Mastering Ansible!This lecture covers the course goals and format.The course is divided into 6 sections, starting with Environment Setup and Foundational Concepts.For the bulk of the course, we configure a realistic 3-tier web application, refactor it, and then optimize it.We finish the course with a section on testing and troubleshooting.Prior linux systems administration experience is expected.

Configuration Management & Orchestration

Understand broad automation concepts: configuration management and orchestration.Configuration management is concerned with getting a single server into a desired state.Orchestration is focused on executing tasks in a specific order across one or many hosts.Throughout this course, we'll use Ansible to do both.

Get your environment setup to run Ansible
Environment Setup
In this course, we will implement a 3-tier web application topology using one (1) NGINX load-balancer, two (2) application nodes running Apache2 and Python, one (1) MySQL database server, and one (1) control machine for running Ansible.If you want to follow along, you can setup an environment that fits these requirements:
  1. Access to a control machine that can run Ansible
  2. Servers running Ubuntu Trusty (14.04) - 5 in total
  3. SSH keypair trusts from the control machine to all other nodes (so no password is required to login via ssh)
  4. Access via a user that has superuser (sudo) privileges on the end hosts

In the Appendix (Lecture 55), I provide details on the docker setup that I use throughout the course.In the materials below, is a Vagrantfile that can be used to create a similar vagrant setup.Rename "Vagrantfile.txt" to "Vagrantfile" and read the "README" comments inside of the file to get started.
The first step in using Ansible is installing Ansible!In this lecture, we will:
  • Install the Ansible tools using a package manager (apt-get for the Ubuntu-based demo environment)
  • Test the installed binaries by checking the version on the command line
Learn the basics of writing and executing Ansible playbooks
Inventory Pt 1
Ansible needs to know all of the hosts that it can connect to and manage.In this lecture, we will cover:
  • The concept of the inventory file and how Ansible uses it
  • The default Ansible inventory file format and location (/etc/ansible/hosts).
Inventory Pt 2
We need to populate an inventory file so that Ansible can reach our environment hosts.Rather than populate the default location on the control machine, we can create a simple file in our local repository and tell Ansible to use it, by default.In this lecture, we will:
  • Configure a local inventory file with hostnames and groups (dev)
  • Configure a local config file to use the new inventory file by default (ansible.cfg)
Host Selection
Once the inventory is populated, you can tell Ansible to execute against all or some subset of the included hosts.In this lecture, we'll:
  • Use host patterns to target a subset of the full inventory: all, , <hostname>, <groupname>, :, !
It's time to execute Ansible against our environment hosts.In this lecture, we will:
  • Learn about the basic building block of Ansible: the task.
  • Understand the structure of tasks: modules and arguments.
  • Execute ad-hoc tasks using the ansible command with the ping and command modules.
Running ad-hoc Ansible commands are great for troubleshooting and discovery, but the real power of Ansible is in coding those tasks into playbooks that you can save and run, as needed.In this lecture, we will:
  • Group tasks for a common set of hosts together into plays.
  • Create our first playbook (hostname.yml) to encode the command task into an Ansible YAML file.
Playbook Execution
With our playbook written, it's time to execute it and review the output.In this lecture, we will:
  • Execute the hostname.yml playbook against hosts using the ansible-playbook command.
  • Review the output of the ansible-playbook command.
  • You should have a Linux or Mac OS X computer, or access to at lease one Linux virtual machine for installing Ansible.
  • You'll need a code editor or IDE of your choice.
  • You'll need a terminal and ssh client for running Ansible against target hosts.
  • You should have access to 5 Linux servers (bare-metal or virtual machine) if you want to setup the course environment and follow along step-by-step.
Chris Lunsford
Chris Lunsford
Software Founder, Developer, Operations Engineer
Udemy courses are suited to professional development. The platform is organized in such a way that it is experts themselves that decide the topic and when the course will start. All supporting documents are made available to you for lifetime access. On this platform, you can find a course on about any subject, and that is no exaggeration – from a tutorial on how to ride a motorcycle, to managing the financial markets. The language and the course format are established by the teacher. This is why it is important to read the information about the course carefully before parting with any money.
Comments (6599)
Like any other website, konevy uses «cookies». These cookies are used to store information including visitor's preferences, and the pages on the website that the visitor accessed or visited. The information is used to optimize the users' experience by customizing our web page content based on visitors' browser type and/or other information. For more general information on cookies, please read the «What Are Cookies» article on Cookie Consent website.