Toolkit: AWX, Navigator, Semaphore & More
The ansible-* commands are enough to start. Teams that run Ansible every day add tools for running it centrally, packaging its dependencies, testing it and seeing what happened.
Running Ansible centrally
| Tool | What it is | Why |
|---|---|---|
| AWX | the open-source web UI, REST API and scheduler for Ansible (upstream of Red Hat Ansible Automation Platform); runs on Kubernetes via the AWX Operator | RBAC ("the on-call team may run restart_app.yml on prod, nothing else"), credentials stored server-side, schedules, job history, approvals, surveys (forms for parameters) |
| Red Hat Ansible Automation Platform | the supported product: automation controller (AWX), private Automation Hub, Event-Driven Ansible, certified collections | enterprises with support contracts |
| Semaphore UI | a lighter open-source web UI (one Go binary + a database) | small teams that want schedules and history without Kubernetes |
| CI pipelines | GitHub Actions / GitLab CI jobs that run ansible-playbook |
already there; good for "apply on merge" |
ansible-pull |
each node pulls a Git repository and runs a playbook against itself | pull model without a server (comparison) |
Event-Driven Ansible (ansible-rulebook) |
rulebooks that react to events (Alertmanager webhooks, Kafka, file changes) by running playbooks | automated remediation |
Packaging: execution environments
"It works on my laptop" happens with Ansible too: different ansible-core, a missing collection, a Python library a module imports (boto3, kubernetes, psycopg). An execution environment (EE) is a container image with all of it inside:
| Tool | Use |
|---|---|
| ansible-builder | builds an EE image from execution-environment.yml (base image, collections, Python and system packages) |
| ansible-navigator | runs playbooks inside an EE (ansible-navigator run site.yml --eei registry.example.com/ee-linkly:1.4 -m stdout), with a TUI to browse results |
| ansible-dev-tools | one package (and a dev container image) with ansible-core, ansible-lint, molecule, navigator, builder and ansible-creator (scaffolds collections and playbook projects) |
AWX runs every job in an EE, so the image you test locally is the one production runs.
Testing and quality
| Tool | Use |
|---|---|
| ansible-lint | static checks (lesson) |
| Molecule | role and collection tests (lesson) |
| ansible-test | sanity, unit and integration tests for collections (what Galaxy collections use) |
| Testinfra / Goss | assertions about a server's state in Python or YAML, usable from Molecule |
| yamllint | YAML style; ansible-lint runs it for you |
| VS Code Ansible extension | completion, hover docs, inline lint, powered by the Ansible language server |
Seeing what happened
| Tool | Use |
|---|---|
| callback plugins | change or add output: ansible.posix.json (machine-readable), ansible.posix.profile_tasks (task timings), community.general.mail/Slack notifications |
| ARA | records every playbook run (tasks, results, files, hosts) in a database with a web UI |
log_path in ansible.cfg |
a plain log file of every run on the control node |
The JSON callback turns a run into data you can query, for example in a CI step that fails when anything changed on a "should be clean" check run:
cat > site.yml <<'YML'
- name: Drift check
hosts: localhost
gather_facts: false
tasks:
- name: Config file
ansible.builtin.copy:
dest: app.conf
content: "workers=4\n"
mode: "0644"
YML
ansible-playbook site.yml >/dev/null
echo "workers=8" > app.conf # drift
ANSIBLE_STDOUT_CALLBACK=ansible.posix.json ansible-playbook site.yml --check \
| jq -c '.stats.localhost, [.plays[].tasks[] | select(.hosts.localhost.changed) | .task.name]'{"changed":1,"failures":0,"ignored":0,"ok":1,"rescued":0,"skipped":0,"unreachable":0}
["Config file"]
Around Ansible
| Tool | Relationship |
|---|---|
| Terraform / OpenTofu | creates the machines Ansible configures (lesson) |
| cloud-init | first-boot setup inside cloud VMs (user, SSH key), before Ansible can connect |
| Packer | builds machine images; its ansible provisioner runs your roles inside the image build |
| HashiCorp Vault, cloud secret managers | secrets read at run time through lookups instead of Ansible Vault files |
| Mitogen for Ansible | a third-party strategy plugin that speeds up runs by keeping Python interpreters alive on the hosts; check that it supports your ansible-core version before relying on it |
Test yourself
What is an execution environment?
- A Python virtualenv on each host
- A container image with ansible-core, collections and their Python dependencies
- An AWX project
- A Molecule scenario
Which tool gives RBAC, schedules and job history for playbook runs?
- ansible-lint
- AWX / Automation Platform (or Semaphore)
- Molecule
- ansible-doc
How do you get machine-readable results from ansible-playbook?
--json- A JSON stdout callback such as
ansible.posix.json -vvvv--diff