Skip to content

nirgeier/AnsibleLabs

Repository files navigation

profile for CodeWizard at Stack Overflow, Q&A for professional and enthusiast programmers  Linkedin BadgeGmail BadgeOutlook Badge

Docker Hub GHCR Killercoda


Ansible Hands-on Repository

  • A collection of Hands-on labs for Ansible.
  • Each lab builds on the previous one, guiding you from basic setup to advanced automation.

Ansible Labs


Lab Topic Description Build Status
000 Setup Build Docker containers for Ansible labs 000
001 Verify Ansible Configure ansible.cfg, verify connectivity with ping 001
002 Inventory Create inventory files, static and dynamic inventory types 002
003 Modules Explore built-in modules, ad-hoc commands, module documentation 003
004 Playbooks Write YAML playbooks, tasks, plays, and execution flow 004
005 Facts Gather host facts, use facts in playbooks, custom facts 005
006 Git Module Clone and manage Git repositories with the git module 006
007 User Management Create users, manage passwords and SSH keys 007
008 Challenges Practice exercises combining previous lab concepts
009 Roles Structure playbooks into reusable roles with galaxy init 009
010 Loops & Conditionals Iterate with loops, apply conditionals with when 010
011 Jinja2 Templates Create dynamic templates with filters, loops, and conditionals 011
012 Host & Group Variables Set per-host and per-group variables in inventory 012
013 Ad-Hoc Commands Run one-off commands without writing a playbook 013
014 Playbook Variables Define, override, and use variables in playbooks 014
015 Handlers & Blocks Trigger handlers on change, group tasks with blocks 015
016 File Modules Manage files, directories, links, and permissions 016
017 Package & Service Install packages and manage services across distros 017
018 Galaxy & Collections Install roles and collections from Ansible Galaxy 018
019 Ansible Vault Encrypt secrets, use vault passwords in playbooks 019
020 Tags Selectively run tasks with tags and skip-tags 020
021 Ansible with Docker Manage Docker containers and images via Ansible 021
022 Debugging Use debug module, verbosity, and register to troubleshoot 022
023 Idempotency Write idempotent tasks, understand changed vs ok states 023
024 Ansible Lint Lint playbooks for best practices and style issues 024
025 CI/CD Jenkins Integrate Ansible playbooks into Jenkins pipelines 025
026 CI/CD GitHub Actions Run Ansible in GitHub Actions workflows 026
027 CI/CD GitLab Integrate Ansible with GitLab CI/CD pipelines 027
028 Custom Modules Write Python-based custom Ansible modules 028
029 Advanced Execution Strategies, forks, async tasks, and run options 029
030 AWX / AAP Job Templates, Workflows, and RBAC in AWX and AAP 030
031 Facts Deep Dive Magic variables, set_fact, cached facts, and fact filtering 031
032 Plugins Callback, lookup, filter, and connection plugins 032
033 Best Practices Directory layout, naming, tagging, and security guidelines 033
034 Security Hardening Harden Linux systems with Ansible playbooks 034
035 Cloud Modules Manage AWS, GCP, and Azure resources with Ansible 035

Getting Started

Option 1 - Killercoda (No Install Required)

Launch on Killercoda

No installation required - runs entirely in your browser with all tools pre-installed.

Option 2 - Docker Compose (Full Environment)

Ansible Labs use multiple containers (controller + 3 target servers). Use Docker Compose for the full interactive environment:

git clone https://github.com/nirgeier/AnsibleLabs
cd AnsibleLabs
docker compose -f docker/docker-compose.yml up -d

Open http://localhost:3000 - left pane shows the MkDocs documentation, right pane has tabs for the Ansible controller and all three target servers.

Option 3 - Docker (Web UI only)

# From GHCR (recommended)
docker run -d --name ansible-labs -p 3000:3000 ghcr.io/nirgeier/ansible-labs:latest

# From Docker Hub
docker run -d --name ansible-labs -p 3000:3000 nirgeier/ansible-labs:latest

Open http://localhost:3000 in your browser.

Option 4 - From Source

git clone https://github.com/nirgeier/AnsibleLabs
cd AnsibleLabs/Labs/000-setup
bash _demo.sh

About

A collection of Ansible Labs for learning and practicing Ansible skills

Resources

Stars

Watchers

Forks

Sponsor this project

 

Packages

 
 
 

Contributors