Skip to content

Add Configuration Management with Ansible project - #143

Open
tungbq wants to merge 1 commit into
mainfrom
feat/add-ansible-configuration-management-project
Open

Add Configuration Management with Ansible project#143
tungbq wants to merge 1 commit into
mainfrom
feat/add-ansible-configuration-management-project

Conversation

@tungbq

@tungbq tungbq commented Sep 4, 2026

Copy link
Copy Markdown
Owner

Closes #14. (Note: #65 looks like a duplicate of the same ask — leaving that one for you to close/merge as you see fit.)

Summary

Adds projects/ansible-configuration-management/ — a hands-on Ansible best-practices demo: roles, inventory-scoped group vars, a Jinja2 template, and a handler, targeting two ubuntu:22.04 containers via the community.docker connection plugin. No SSH keys, no cloud account, no VMs to provision — just Docker.

  • common role — apt baseline packages + a marker file
  • webserver role — installs nginx, templates index.html per-host from one shared template, starts nginx, and notifies a reload handler only when the template actually changed
  • playbooks/site.yml — bootstraps python3/sudo on the minimal target images via a raw pre-task (a genuinely common real-world gotcha on fresh/minimal hosts), then gathers facts and runs the roles
  • demo_project.sh — spins up the two containers, runs the playbook, verifies both hosts serve the expected per-host content, then runs the playbook a second time and expects changed=0 for every host — proving idempotency, not just claiming it
  • .github/workflows/verify-ansible-configuration-management.yml — matches the repo's existing per-project verify-*.yml convention
  • README.md: row 17 (Configuration Management with Ansible) marked ✔️ Done, now linking to the project folder instead of the issue

Test plan

  • Ran the exact committed demo_project.sh end-to-end against real Docker containers on this machine, from a clean slate — first run configured both hosts (changed=6 each), curl confirmed both serve correct per-host content, second run reported changed=0 for both hosts.
  • Separately verified the notify/handler path: changed app_environment in inventory/group_vars/all.yml, re-ran — only the template task and the Reload nginx handler showed changed; curl confirmed the served page actually updated to the new value.
  • ansible-lint . — 0 failures, 0 warnings, production profile (had to fix one real no-changed-when finding on the reload handler along the way).
  • shellcheck demo_project.sh — clean.
  • Followed CONTRIBUTING.md's flow and the structure in docs/project_template.md.

Closes #14.

- projects/ansible-configuration-management/: an Ansible best-practices
  demo (roles, inventory group_vars, a Jinja2 template, a handler)
  targeting two ubuntu:22.04 containers via the community.docker
  connection plugin - no SSH keys, no cloud account needed.
- common role: apt baseline + a marker file. webserver role: installs
  nginx, templates index.html per-host, notifies a reload handler only
  when the template actually changes.
- demo_project.sh runs the playbook twice end-to-end and asserts the
  second run reports changed=0 for every host - proving idempotency,
  not just claiming it. Also verified the notify/handler path by
  editing group_vars and confirming only the changed file + reload show
  up, and the served content actually updates.
- Passes ansible-lint's production profile and shellcheck clean.
- Adds .github/workflows/verify-ansible-configuration-management.yml,
  matching the existing per-project verify-*.yml convention.
- README.md: marks row 17 (Configuration Management with Ansible) Done,
  linking to the new project folder instead of issue #14.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

project: Configuration Management with Ansible

1 participant