Udemy
Turn what you know into an opportunity and reach millions around the world.
Learn More
Your cart is empty.
Keep shopping
Ansible: A Complete Course with Step-by-Step Demo and Labs
Role Play
Rating: 4.7 out of 5(261 ratings)
13,758 students

Ansible: A Complete Course with Step-by-Step Demo and Labs

Ansible is one of the Tools for DevOps and infrastructure automation. Automate IT infrastructure easily
Created byVitalii Shumylo
Last updated 10/2026
English
English [Auto],Japanese [Auto],

What you'll learn

  • Explain what Ansible is and how to use this tool
  • Install Ansible
  • Working with inventories
  • Ansible ad hoc commands
  • Working with Ansible playbooks

Course content

1 section • 55 lectures • 7h 33m total length
  • Course Introduction1:38

    Learn how to install Ansible and set up a demonstration lab. Run ad hoc commands and playbooks against a local inventory to simplify configuration management and infrastructure orchestration.

  • Getting Installed3:25

    Explore ways to install ansible across Mac, Windows, and Linux using Python, pip, and Vagrant. Learn to set up a local practice lab with virtual machines and platform-specific steps.

  • Configuring the Environment4:34

    Install ansible on fedora-like or debian-based systems and verify the version. Configure the hosts file, generate an ssh key, and copy it to all target servers for passwordless access.

  • Ad Hoc Commands and an Inventory File4:54

    Explore ad hoc commands and inventory files in Ansible to run tasks across local and remote hosts, using modules and grouped host entries for scalable management.

  • Ad Hoc Commands3:06

    Explore ad hoc Ansible commands on inventory groups using -m to run modules like ping, hostname, and disk checks across servers. Use the apt module with update_cache and state options.

  • Playbooks. Part 12:31

    Learn to create and run Ansible playbooks by defining plays and tasks, using a hosts inventory, and executing with ansible-playbook to apply a module across all hosts or specific groups.

  • Playbooks. Part 27:36

    Learn how Ansible playbooks orchestrate tasks across multiple servers, detailing structure, variables, tasks, modules, and common examples like creating files and directories with proper permissions using become privileges.

  • Playbooks. Part 32:46

    Master Ansible playbooks by deleting files or directories with the file module using state absent, looping to create directories, and managing users with the user module (passwords, groups, shells, force).

  • Playbooks. Part 47:10

    Continue working with playbooks, demonstrating loop constructs to create files, copy content, archive and zip files, and manage packages with apt and yum using when conditions.

  • Section Quiz: A Quick Start with Vagrant lab
  • Building Ansible Lab Environment9:37

    Build a ready-to-use Ansible lab environment with Vagrant and VirtualBox, install and configure the control node and managed hosts, and practice SSH access, Python prerequisites, and authorized_key playbooks.

  • Describing Ansible Inventory Files10:03

    Describe Ansible inventory concepts and distinguish static and dynamic inventories, including managing a static inventory file with host groups, child groups, all and ungrouped groups, and host variables.

  • Guided Exercise: Ansible Inventory Files6:19

    Create and manage static inventories by adding hosts and groups to the default inventory and a custom inventory file, including web servers and US groups, then verify with list-hosts.

  • Managing Ansible Configuaration Files10:54

    Describe where ansible.cfg files live (project directory, home, global) and how precedence selects the active file, and how to edit for defaults.

  • Managing Connectivity and Configuaration Files10:30

    Configure an ssh key on the control node, deploy it to managed hosts with an Ansible playbook using the authorized_key module, and manage privilege escalation with become settings.

  • Guided Exercise: Managing Ansible Configuaration Files5:14

    Customize your Ansible environment by editing the configuration and building a static inventory with groups, then configure privilege escalation to use sudo and root access, and test host lists.

  • Running Ad Hoc Commands15:14

    Learn to run a single Ansible task with ad hoc commands without writing a playbook, using host patterns, modules, and inventory options for quick tests and one-off changes.

  • Guided Exercise: Running Ad Hoc Commands7:58

    Practice running ad hoc commands across multiple managed hosts with privilege escalation using become, and verify file changes with the copy module on both the control node and server a.

  • Lab: Deploying Ansible11:47

    Set up Ansible control node to manage hosts via ad hoc commands using a DevOps SSH key user and no privilege escalation; use copy and command modules to update files.

  • Implementing Playbooks13:58

    learn to implement playbooks in ansible by writing simple yaml-based playbooks, running them across multiple hosts with the ansible-playbook command, and using ad hoc commands for quick tasks.

  • Guided Exercise: Implementing Playbooks8:03

    Write and run Ansible playbooks to install httpd, copy index.html, and start the httpd service. Prepare inventory with web group, validate yaml syntax, run the playbook, and verify with curl.

  • Multiple Plays15:46

    Build Ansible playbooks with multiple plays for different hosts, manage privilege escalation with remote_user and become, and use idempotent modules like copy over shell.

  • Guided Exercise: Multiple Plays9:39

    Perform a syntax check and run the playbook with -v to configure a managed host, enable privilege escalation, update httpd and firewall, deploy intranet content, and verify via uri module.

  • Lab: Implementing Playbooks8:40

    Configure and execute an Ansible lab playbook to install web and database services, enable firewall rules, deploy web content, and test access on the managed host.

  • Managing Variables13:41

    Master Ansible variable handling by defining and referencing host, group, and play variables; learn variable precedence, vault encrypted variables, facts, and how to use registers in playbooks.

  • Guided Exercise: Managing Variables6:17

    Define and use playbook variables to install the Apache web server, open firewall ports, start services, deploy content, and verify the web page responds with status 200.

  • Managing Secrets13:34

    Learn how to protect sensitive data with Ansible vault, encrypt and decrypt files, manage vault passwords and IDs, and securely handle passwords, keys, and sensitive variables in playbooks and inventory.

  • Guided Exercise: Managing Secrets4:40

    Master managing secrets in ansible by encrypting variables in secret.yaml, decrypting them, and running a playbook to create a user on a web server using vault.

  • Managing Facts14:54

    Learn to reference data about managed hosts with Ansible facts, understand automatic fact gathering via the setup module, and create custom INI or JSON facts to tailor configurations.

  • Guided Exercise: Managing Facts4:57

    gather ansible facts from a managed host with the setup module, create and apply a custom fact, and validate the PD service using a playbook and ad hoc checks.

  • Lab: Managing Variables and Facts8:30

    Write and run an Ansible playbook that uses variables, secrets, and facts to automate a web server environment on server b.lab.example.com, configuring Apache with httpd.conf, htpasswd, and basic authentication.

  • Lab: Managing Variables and Facts11:14

    Create a YAML playbook to manage variables and facts, install web server packages, configure basic authentication, and verify access with a URI task in this Ansible lab.

  • Writing Loops and Conditional Tasks17:08

    Learn to write efficient Ansible tasks with loops and conditionals, iterating over lists or dictionaries using the loop keyword, accessing item variables, registering results, and gating execution with when conditions.

  • Guided Exercise: Writing Loops and Conditional Tasks3:08

    Learn to write an Ansible playbook with conditionals using the one keyword and loop key word for task iteration, deploying MariaDB on the database dev host group.

  • Implementing Handlers8:51

    Learn how ansible handlers trigger after task changes via notify, restarting services and applying configuration updates, demonstrated by a configure_db playbook that sets the database password.

  • Handling Task Failure6:35

    Control how Ansible handles task failure by using ignore_errors and failed_one to determine failure conditions. Configure blocks, rescue, always, and changed_one to ensure recovery and handler execution when tasks fail.

  • Guided Exercise: Handling Task Failure8:22

    Explore how to handle task failure in an Ansible playbook, including ignore_errors, block rescue, and always. Configure a host and database group, and define web_package and db_package variables.

  • Guided Lab: Implementing Task Control5:31

    Implement a guided Ansible lab that installs Apache web server with Mod SSL, using conditionals, loops, and handlers to manage tasks and errors, and verify HTTPS with a self-signed certificate.

  • All Forty Web Servers Restarted at Once: Rethinking the Playbook
  • Section Quiz: Continue with Ansible Automation
  • Build a Safe Web Server Playbook: Config, Vault, Handlers and Blocks
  • Seetting up an Ansible Lab with RHEL9 VMs10:55

    Set up an Ansible lab on Red Hat Enterprise Linux 9 VMs by enabling cockpit, configuring firewall, creating virtual machines, and registering with an activation key to install RHEL 9.3.

  • Configuring the VMs7:58

    Clone and power two virtual machines, rename hosts, take snapshots, then install Ansible core on the control node, verify the version, and prepare the lab for remote management.

  • Configuring the prerequisites on managed hosts5:52

    Configure prerequisites on managed hosts for Ansible by ensuring Python is installed, optionally handling SELinux, and understanding module requirements, while setting up the control node and validating the Python version.

  • Setting up SSH Key-based Authentication3:15

    Set up ssh key-based authentication between the control node and the managed node by generating an rsa key pair with ssh-keygen, copying it with ssh-copy-id, and logging in without password.

  • Understanding YAML Syntax. Part 111:39
  • Understanding YAML Syntax. Part 211:02
  • What is an Ansible Inventory?7:42

    Discover how Ansible inventories organize managed hosts as static or dynamic lists, with host and group variables, nested groups, and formats like ini and yaml.

  • Building an Ansible Inventory4:54

    Learn to manage Ansible inventories by editing the default Etsy Ansible hosts with vim, adding a lab group and ungrouped host at 192.168.1.15, and using a static inventory with -i.

  • Using Ansible Ad-Hoc Commands11:24

    Learn to run quick, one-off tasks on multiple servers with Ansible ad hoc commands using modules, host patterns, and optional arguments, without writing a playbook.

  • Ansible Ad-Hoc Commands: A Practical Demonstration6:53

    Master practical Ansible ad-hoc commands to manage hosts using the pin and user modules. Learn command structure, inventory usage, become privileges, idempotency, and error handling for effective system administration.

  • Guided Exercise: Ansible Ad-Hoc Commands in Practice16:27
  • The Auditor Asks: Who Ran That Command on Every Server?
  • Introduction to Ansible Playbooks. Part 18:09

    Learn the fundamentals of ansible playbooks, their structure, and how to write and run your first playbook with hands-on labs on a control node, rhel 9, and a web server.

  • Introduction to Ansible Playbooks. Part 211:32
  • Introduction to Ansible Playbooks. Part 34:24

    Create a revert Ansible playbook to undo the Apache setup by stopping the httpd service, removing the httpd package, and closing the firewall port.

  • Introduction to Ansible Playbooks. Part 46:57
  • Introduction to Ansible Playbooks. Part 58:08
  • Introduction to Ansible Playbooks. Part 67:26
  • Section Quiz: A Quick Start with Red Hat VMs
  • Ansible Systems Administration Practice Test
  • Practice Test 2: Ansible Automation
  • Bonus Lecture: What to Learn Next0:18

Requirements

  • It's good to have Basic Linux knowledge
  • Laptop or PC running Windows, Mac OS X, or any Linux

Description

During this workshop, you will receive an introduction to Ansible that is geared toward people who have no prior experience with the platform. In this course, you will study the fundamentals of Ansible in order to start applying what you've learned as soon as possible after completing the course. Anyone who is interested in learning about Ansible and the core ideas that underpin it, such as IT professionals, developers, operators, DevOps, system administrators, and those in positions comparable to these, is the target audience for this course. Its primary mission is to provide viewers with the knowledge they need to begin using Ansible and the capabilities that it provides, and this is the primary purpose for which it was created. The purpose of this project is to provide a comprehensive overview of the numerous Ansible components and commands that are currently available.


This course will teach you how to use Git and give you assistance in getting started with it so that you may become more productive in your job. The goal of the course is to help you become more productive in your job.


After completing this course, you will be able to:

  • Explain what Ansible is and how to use this tool

  • Install Ansible

  • Run Ad Hoc Commands in Ansible

  • Working with inventories

  • Ansible important commands and modules

  • Creating and running playbooks

And much more...

Who this course is for:

  • Starting DevOps
  • System Administrators
  • IT specialists