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.
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.
- name: Restart app
ansible.builtin.command: systemctl restart app
changed_when: true # this command always changes stateConfigure rules deliberately
Use a project config to set the profile and skip rules you have justified, rather than ignoring failures.
# .ansible-lint
profile: production
skip_list:
- var-naming[no-role-prefix]How to prevent it
- Run
ansible-lintlocally and in PR checks so violations surface early. - Commit a
.ansible-lintconfig that pins the profile and any justified skips. - Adopt FQCN and
changed_whenconventions across all playbooks.