Goal of this article

Ansible repositories are often treated like loose script folders. That is not enough for production. If you later need to understand why a system changed, you need versioning, review, releases and traceable acceptance.

This article explains how to organize an Ansible repository so changes remain planned, reviewable and traceable.

What should be versioned

  • Inventories without secrets: hosts, groups and non-sensitive operational parameters.
  • Roles, playbooks, templates and handlers.
  • requirements.yaml for collections and external roles.
  • ansible.cfg, lint configuration and CI files.
  • Documentation for maintenance windows, rollout rules and acceptance.

What must not live in the repository

  • Unencrypted passwords, tokens, private keys or customer secrets.
  • Local facts, cache files, retry files and temporary artifacts.
  • Generated logs from production runs when they contain personal or internal data.
  • Host exceptions that are actually architecture decisions and need review.

Step 1: Keep branches small

A branch should contain one functional change: a new role, a package change, a template fix or a new inventory pattern. Large mixed branches are hard to review and hard to roll back.

bash
git checkout -b change/linux-baseline-ssh-dropin
git status
git diff -- roles/linux_baseline templates inventories

Step 2: Pull request with technical intent

Review needs more than "update role". Describe what changes, which hosts are affected, whether a reboot is possible and how the change was tested.

Goal:
- Manage SSH baseline as drop-in
Affected systems:
- linux lab group
Risk:
- SSH reload, no planned reboot
Acceptance:
- ansible-lint
- syntax-check
- check --diff
- test run on lab-node01

Step 3: Mark releases

A Git tag is the technical anchor for AWX, documentation and rollback. AWX should point to a controlled release branch or tags where possible, not to random local states.

bash
git tag -a ansible-2026.10.12 -m "Linux baseline SSH drop-in"
git push origin ansible-2026.10.12

Step 4: Write release notes

Release notes are not bureaucracy. They are the operating manual for the next person who needs to understand why a playbook suddenly behaves differently.

  • What changed?
  • Why did it change?
  • Which systems or groups are affected?
  • Are there reboot, service or SSH risks?
  • How was it tested?
  • What is the rollback path?

Step 5: Plan rollback realistically

Rollback in Ansible does not always mean "run the old Git revision". If a playbook updated packages, deleted users or migrated data, the way back may be complex. Each change needs to state whether rollback is technically possible or whether a forward fix is the realistic path.

Result control / technical acceptance

The technical acceptance follows the same pattern as the grommunio and SUSE articles: PASS means the specific check was actively performed or clearly evidenced. PASS WITH CONDITIONS, SCOPE LIMIT and NOT TESTED remain visible so the article does not claim more than was actually verified.

Git status

Check
Check diff and untracked files
Expected result
Only related changes are included
Status
PASS

Secrets

Check
Scan repository for clear-text secrets
Expected result
No passwords, tokens or private keys in Git state
Status
PASS

Review

Check
Describe goal, risk and acceptance in pull request
Expected result
Change is traceably reviewable
Status
PASS

Release

Check
Define tag or release branch
Expected result
AWX/CI can reference a stable state
Status
PASS WITH CONDITIONS

Rollback

Check
Document rollback or forward fix
Expected result
Recovery path is realistically described
Status
PASS WITH CONDITIONS

Production

Check
Roll release out to production hosts
Expected result
Only after change approval
Status
NOT TESTED IN THIS PASS