explaingit

yoas1/ansible-handson

15ShellAudience · ops devopsComplexity · 2/5ActiveSetup · easy

TLDR

Docker-based practice lab for learning Ansible, with a controller and two target containers (Ubuntu and Red Hat) wired together on a private network and a browser code editor.

Mindmap

mindmap
  root((ansible-handson))
    Inputs
      Playbooks
      Inventory yaml
      Vault secret
    Outputs
      Configured worker containers
      Lint reports
    Use Cases
      Practice Ansible locally
      Test playbooks against two distros
      Try ansible-vault flow
    Tech Stack
      Docker
      Ansible
      Python
      code-server

Things people build with this

USE CASE 1

Spin up a local Ansible practice lab without provisioning real VMs

USE CASE 2

Test the same playbook against both Ubuntu 22.04 and Red Hat UBI 9 targets

USE CASE 3

Practice ansible-vault with the bundled vault.secret and encrypted values

USE CASE 4

Edit playbooks in the browser via code-server and run them from the same terminal

Tech stack

DockerAnsiblePythoncode-serverShell

Getting it running

Difficulty · easy Time to first run · 5min

Requires Docker and Docker Compose installed locally; default vault password is devops for the bundled examples.

In plain English

Ansible-HandsOn is a small practice lab for learning Ansible. Ansible is a tool that lets you automate work on servers, such as installing software, copying files, or running commands, by writing the steps in plain text files called playbooks. To learn it, you normally need several Linux machines to practice on. This project gives you that practice setup on your own computer using Docker containers instead of full virtual machines, so it starts in seconds and stays light on memory. The lab has three containers that talk to each other on a private Docker network. The first is the controller, called ansible_controller, which has Python, Ansible itself, and a browser-based code editor called code-server reachable at port 8080. The other two are pretend target servers: ansible_worker1 runs Ubuntu 22.04 and ansible_worker2 runs Red Hat UBI 9. Both workers have OpenSSH and Python installed so the controller can connect to them over SSH and run Ansible tasks. The repo also ships a .config/ folder with the configuration files needed to make Ansible work out of the box. ansible.cfg sets the inventory location, points to a Vault password file, and turns off host key checking, which is fine inside a throwaway Docker network. inventory.yaml lists pretend server groups named prod, dev, and testing. vault.secret holds the default Vault password, which is devops, and is used to encrypt sensitive values. There are also small config files for ansible-lint, yamllint, and pymarkdown, plus a requirements.txt that pins the Python packages installed in the controller. Starting the lab is one command, docker compose up -d, using the compose file shown in the README. The three containers come up together. You then open http://localhost:8080 in a browser to land in the code-server editor, where you can edit files and open a terminal. From that terminal you run ansible-playbook against the playbooks in the repo, for example ansible-playbook playbooks/host_information.yaml. There is a nice touch for the live-edit loop: a process called inotifywait watches the .config/ folder, and when you change a file there, a script named update_config.sh runs automatically to apply the new settings, so you do not have to restart anything by hand.

Copy-paste prompts

Prompt 1
Walk me through bringing up the ansible-handson lab with docker compose up -d and opening code-server
Prompt 2
Explain what the .config folder in ansible-handson does and how update_config.sh reacts to changes
Prompt 3
Run me through writing a playbook that installs nginx on worker1 in this lab
Prompt 4
How does the controller container reach worker1 and worker2 over SSH inside the Docker network
Prompt 5
Show me how to add a new target container to the docker-compose file and register it in inventory.yaml
Open on GitHub → Explain another repo

Generated 2026-05-22 · Model: sonnet-4-6 · Verify against the repo before relying on details.