ansible-lint "production" profile failure in CI
ansible-lint profiles (min, basic, moderate, safety, shared, production) get progressively stricter. Selecting production promotes many rules to failures, so a repo that passed at basic suddenly reports a batch of violations.
What this error means
After setting profile: production, ansible-lint fails with a list of rules (fqcn, name[casing], risky-file-permissions, no-changed-when) that used to be warnings.
Failed: 12 failure(s), 0 warning(s) on 8 files. Last profile that met the validation
criteria was 'moderate'. Rule 'risky-file-permissions' is required by profile 'production'.Common causes
The production profile promotes optional rules to errors
Rules that are warnings at lower profiles become hard failures at production, so the same code now fails.
The jump in profile was too large at once
Moving straight to production surfaces every gap simultaneously instead of incrementally.
How to fix it
Adopt the profile incrementally
Set the profile in config and raise it step by step, fixing each tier before advancing.
# .ansible-lint
profile: moderate # raise to safety, then shared, then productionFix the required rules, auto-fixing where possible
- Run
ansible-lint --fixto clear auto-fixable rules like fqcn. - Address the remaining required rules (file permissions, changed_when).
- Raise the profile once the current tier is clean.
ansible-lint --fix
ansible-lint --profile productionHow to prevent it
- Raise the profile one tier at a time.
- Keep
.ansible-lintcommitted so local and CI agree. - Run
ansible-lint --fixregularly to stay ahead of strict rules.