
Learn the essentials of ansible through hands-on labs, starting with basics and advancing to playbooks, ad hoc commands, and deploying a fully functional multi-node lamp stack for configuration management.
Explore the course overview and lab setup for Ansible essentials, including a five-VM lab topology with Vagrant or Docker and a complete LAMP stack deployment.
Get to know Ansible's key components such as Ansible Controller, playbooks, modules, tasks etc.
Continually updated Text Document with Course FAQs.
Learn about the multiple methods to install Ansible. Install latest version of Ansible on a controller machine.
Learn about the Ansible inventory file. Create and customize an inventory file for deploying a 3-tier web application with Ansible.
Get familiar with the Ansible configuration file. Learn how to customize and use it in a multi-project environment.
Master ansible ad-hoc commands to manage multi-node infrastructure with quick one-liners, using inventory and modules to perform tasks like uptime checks, service control, or install packages.
Explore Ansible playbooks and YAML basics, including ad hoc tasks, handlers, loops, conditionals, variables, facts, and Jinja templating, while reviewing mappings, lists, dictionaries, quotes, and indentation.
Execute tasks in Ansible playbooks by calling modules to perform a unit of work on matched hosts, ensuring idempotency and item potency so repeated runs reach the desired state.
Create your first Ansible playbook with a single play and task that installs a patchy web server using the yum module, targeting web servers and updating the cache.
Execute a playbook against target hosts, gather system facts with the setup module, and run tasks in sequence. Learn privilege escalation and use verbose outputs to diagnose playbook runs.
Learn how the ansible setup module gathers facts about remote hosts and supports OS-family based decisions. Apply these facts to choose the right package manager and Apache package in playbooks.
Start the Apache service with Ansible's service module by setting name and state to started. Enable it to boot automatically and verify it runs.
Use Ansible's copy module to deploy files to remote hosts with owner, group, and mode; leverage content or source files, backups, and idempotent updates for an Apache site.
Master using loops in ansible to copy multiple files with a single task, and adopt best practices for package management with yum or apt and php installation.
Use variables in Ansible playbooks to handle differences across systems, enabling reusable, readable configurations; define base dir and other variables, and override values for deployment paths to improve maintainability.
Learn the basics of ansible variables: naming rules, types like integers, booleans, lists, and dictionaries; declare and reference variables in playbooks with double braces, and loop over lists and dictionaries.
Explore how to define and use variables in Ansible across playbooks and inventory, including vars files, include_vars, host and group vars, and extra vars.
Develop and deploy an Ansible playbook using the lineinfile module to populate the /etc/hosts file across all lab VMs, enabling name resolution and smooth testing.
Configure Apache virtual hosts with an Ansible playbook, push and enable the vhost configuration, ensure Apache loads it, and serve index.php from the correct document root across web servers.
Ansible essentials show error handling for patchy apache configuration by validating the virtual host with a config test. Use the command module to halt on error and revert.
Learn to detect failures and continue playbooks by registering task results and using when conditions to revert bad configurations, debug messages, and remove invalid files so Apache restarts are safe.
Learn to use Ansible ignore_errors to continue a playbook after a failed task, and how the fail module stops execution for a sane state, emphasizing task order and idempotency.
Learn how blocks enhance error handling in Ansible by grouping tasks, applying inherited directives, and using rescue and always sections to recover from failures in a web playbook.
Learn to use the git module in a playbook to clone a repository and deploy an index.html page as the default page, including installing git and testing the default page.
Master Ansible templating with Jinja2 by using the template module to generate dynamic configuration files through variable substitution, for loops, and conditional statements on the Ansible controller.
Install and configure MariaDB on the database server, create the demo database and user, copy sample data, and enable web servers to query the database via a three-tier lamp stack.
Configure the firewalld module to allow port 80 and port 3306 across web servers, load balancer, and database, with curl tests and RAM considerations.
Explore how Ansible tags target specific tasks and blocks, run or skip tagged content, and use tag inheritance with list tasks and list tags to manage lamp stack playbooks.
Learn to modularize Ansible playbooks with includes, imports, and roles to create reusable task files. Compare static and dynamic behaviors and apply the dry principle.
Organize playbooks with ansible roles, a predefined directory structure, and a framework for variables, tasks, files, templates, and modules. Call roles within a play; they cannot be executed directly.
Discover the standard yaml-based Ansible role structure, with eight directories, and learn to create roles manually or via the ansible galaxy tool, preparing a web role for Apache installation.
Learn to organize Ansible roles by structuring tasks and handlers, migrate playbook tasks to role main files, and manage imports, includes, and notify statements for reliable automation.
Explore how to define and manage role variables in Ansible, comparing defaults and vars, understanding precedence, using namespace best practices, and migrating variables into role definitions.
Define and explore the meta/main.yml to manage Galaxy info and role dependencies, and observe how dependent roles run before the main web role in a test playbook.
Migrate playbooks to roles and execute them via a playbook, targeting common, web, database, and load balancer groups while managing host facts and static versus dynamic imports.
Explore setting up a local, disposable Ansible lab environment using Vagrant and VirtualBox, with instant provisioning and preconfigured Vagrant boxes for rapid testing and playbook development.
Install and configure vagrant on your local machine using virtual box as the hypervisor. Set up a lab environment and verify the installation for hands-on practice.
This is the Vagrantfile I have used to set up the lab environment. It requires a little customization like folders etc and also you should remove the '.txt' file extension before running "vagrant init" command.
Ansible is a simple to understand, simple to adopt, simple to use IT configuration management and automation tool. With the Ansible Essentials course, you can start from the basics and go all the way to creating your own playbooks and roles with Ansible.
This is a focused course designed to rapidly get you up to speed on using Ansible automation engine in real life. As an IT professional, you'll develop a solid understanding of Ansible and will be able to apply it to daily automation and configuration management tasks.
Ansible Essentials course includes lots of examples and hands-on labs and aims at providing students with first-hand experience with course concepts. You can follow along the course by setting up your own lab environment. A Vagrant environment is used throughout the course, and in the appendix, you'll find detailed lectures showing you how to set up one for yourself.
Each lecture introduces a new Ansible concept. Concepts are first explained, and then relevant examples are provided. Some of them are also demoed in the lab environment showing you how they can be applied to playbooks. And finally, we apply the concept to our LAMP Stack playbooks.
Course follows a progressive path that mirrors a real-world approach to automation. It's divided into five sections, starting with the architectural overview and foundational concepts. In section 2, we'll install Ansible automation engine and learn about inventory, which is the first thing we need to get started automating tasks with Ansible. We'll learn ad-hoc commands and also discover some of Ansible's commonly used modules in section 3.
Then we'll move on to ansible playbooks. Playbooks let us use fully-fledged configuration management and orchestration capabilities of Ansible. Ansible playbooks are written in YAML, so before diving into the details of playbooks, we'll do a YAML overview. Then, we'll learn about playbook basics, including playbook structure, idempotency, and tasks. We'll learn how to run a playbook, check its syntax, and control its output with verbose.
Then we'll start building our 3 tier web application. In each lecture, we'll learn one or more ansible features, and we'll apply them to our project. In this part of the course, you'll learn about handlers, Jinja2 templating, loops, variables, error handling, and much more. At the end of this section, you'll have prepared playbooks that can deploy a fully functional multi-node LAMP stack on your machines.
In section 5, we'll cover how to organize playbooks more effectively where you'll learn about imports, includes, and roles. We'll refactor the playbooks into roles and make them easy to share and reuse.
This course is based on Red Hat® Ansible Engine 2.8 and CentOS Linux 7.7. By following along the course, you'll learn how to set up a 3-tiered web application environment that leverages Apache2, Python, and MySQL on CentOS machines.