Skip to content
Latchkey

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.

ansible-lint
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
# .ansible-lint
profile: moderate   # raise to safety, then shared, then production

Fix the required rules, auto-fixing where possible

  1. Run ansible-lint --fix to clear auto-fixable rules like fqcn.
  2. Address the remaining required rules (file permissions, changed_when).
  3. Raise the profile once the current tier is clean.
Terminal
ansible-lint --fix
ansible-lint --profile production

How to prevent it

  • Raise the profile one tier at a time.
  • Keep .ansible-lint committed so local and CI agree.
  • Run ansible-lint --fix regularly to stay ahead of strict rules.

Frequently asked questions

What causes "production profile violations"?
Rules that are warnings at lower profiles become hard failures at production, so the same code now fails.
How do I fix production profile violations?
Set the profile in config and raise it step by step, fixing each tier before advancing.

Related guides

References

Latchkey auto-heals failures like this one - detected, fixed, and retried without you. Start free → 30-day trial · No credit card