How do you measure the health of an Ansible codebase?
BeginnerProductionTesting, CI/CD and Quality
Answer
A few numbers we track over time:
- Lint: current profile level and number of
noqalines (should trend down). - Test coverage: share of roles with a Molecule scenario that passes idempotence.
- Drift: hosts reporting
changedon a scheduled check-mode run. - Run health: failure rate and duration per job template, from AWX or CI.
- Freshness: age of pinned collection versions and of the ansible-core version.
- Risky patterns: count of
shell/commandtasks and ofignore_errors: true.
None of these need a fancy tool; a weekly CI job that greps and reports them is enough to show whether the code is getting better or worse.
More on Testing, CI/CD and Quality
What does a testing pyramid look like for Ansible code?BeginnerHow do you roll out `ansible-lint` profiles across a team without blocking everyone?IntermediateWhen do you use `skip_list`, `warn_list` and `# noqa`?IntermediateHow do you set up pre-commit hooks for an Ansible repo?BeginnerHow is a Molecule scenario laid out, and what does `molecule test` actually run?IntermediateDocker, Podman or real VMs as the Molecule driver: how do you choose?Advanced