Add Configuration Management with Ansible project - #143
Open
tungbq wants to merge 1 commit into
Open
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 twoubuntu:22.04containers via thecommunity.dockerconnection plugin. No SSH keys, no cloud account, no VMs to provision — just Docker.commonrole — apt baseline packages + a marker filewebserverrole — installs nginx, templatesindex.htmlper-host from one shared template, starts nginx, and notifies a reload handler only when the template actually changedplaybooks/site.yml— bootstrapspython3/sudoon the minimal target images via arawpre-task (a genuinely common real-world gotcha on fresh/minimal hosts), then gathers facts and runs the rolesdemo_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 expectschanged=0for every host — proving idempotency, not just claiming it.github/workflows/verify-ansible-configuration-management.yml— matches the repo's existing per-projectverify-*.ymlconvention✔️ Done, now linking to the project folder instead of the issueTest plan
demo_project.shend-to-end against real Docker containers on this machine, from a clean slate — first run configured both hosts (changed=6each), curl confirmed both serve correct per-host content, second run reportedchanged=0for both hosts.app_environmentininventory/group_vars/all.yml, re-ran — only the template task and theReload nginxhandler showedchanged;curlconfirmed the served page actually updated to the new value.ansible-lint .— 0 failures, 0 warnings,productionprofile (had to fix one realno-changed-whenfinding on the reload handler along the way).shellcheck demo_project.sh— clean.docs/project_template.md.