Skip to content
Latchkey

ansible-lint Fails the Pipeline - Fix Rule Violations in CI

ansible-lint flagged rule violations and exited non-zero, failing the pipeline. The findings are real style/correctness issues - unqualified module names, missing changed_when, risky shell usage - not a tool malfunction.

What this error means

The lint step ends with a list of violations and a non-zero exit. It is deterministic: the same playbooks trigger the same rules every run until the code is fixed or the rule is explicitly handled.

ansible-lint output
playbook.yml:12: fqcn[action-core]: Use FQCN for builtin module actions (command).
playbook.yml:20: no-changed-when: Commands should not change things if nothing
needs doing.
Failed: 2 failure(s) ...

Common causes

Real rule violations in the playbooks

Unqualified module names (command vs ansible.builtin.command), missing changed_when, or shell where command suffices each trip a default rule.

No config to scope or skip rules intentionally

Without a .ansible-lint config, every default rule applies project-wide, so legitimate exceptions are not declared and fail the run.

How to fix it

Fix the flagged issues

Address the specific rules - qualify module names, add changed_when, and prefer command over shell where you do not need a shell.

playbook.yml
- name: Restart app
  ansible.builtin.command: systemctl restart app
  changed_when: true   # this command always changes state

Configure rules deliberately

Use a project config to set the profile and skip rules you have justified, rather than ignoring failures.

.ansible-lint
# .ansible-lint
profile: production
skip_list:
  - var-naming[no-role-prefix]

How to prevent it

  • Run ansible-lint locally and in PR checks so violations surface early.
  • Commit a .ansible-lint config that pins the profile and any justified skips.
  • Adopt FQCN and changed_when conventions across all playbooks.

Frequently asked questions

What causes "ansible-lint violations"?
Unqualified module names (command vs ansible.builtin.command), missing changed_when, or shell where command suffices each trip a default rule.
How do I fix ansible-lint violations?
Address the specific rules - qualify module names, add changed_when, and prefer command over shell where you do not need a shell.

Related guides

References

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