Skip to content
Latchkey

ansible-lint failures blocking CI

ansible-lint returned a non-zero exit because tasks violate its rules -- missing FQCNs, no changed_when on commands, risky shell usage -- or a stricter profile/version now treats prior warnings as errors.

What this error means

The lint step fails the job, listing rule ids and lines (e.g. fqcn[action-core], no-changed-when, risky-shell-pipe). It often starts failing after an ansible-lint upgrade or a profile change, without the playbooks themselves changing.

ansible
site.yml:8: fqcn[action-core]: Use FQCN for builtin module actions (copy).
site.yml:14: no-changed-when: Commands should not change things if nothing
needs doing.

Failed: 2 failure(s), 0 warning(s) on 1 files. Last profile that met the
validation criteria was 'basic'.

Common causes

Rule violations in tasks

Bare module names instead of FQCNs, commands without changed_when, or risky shell usage trip specific rules.

Stricter profile or new version

Raising the profile (basic -> production) or upgrading ansible-lint promotes previously-tolerated patterns to failures.

How to fix it

Fix the flagged rules and pin the linter

Address each rule id, and pin ansible-lint so the rule set does not shift unexpectedly.

site.yml
- name: Place config
  ansible.builtin.copy:        # FQCN satisfies fqcn rule
    src: app.conf
    dest: /etc/app.conf
- name: Get status
  ansible.builtin.command: app status
  changed_when: false          # satisfies no-changed-when

Manage rule scope deliberately

  1. Set an explicit profile in .ansible-lint so upgrades are predictable.
  2. Skip or warn specific rules in config only with justification.
  3. Run ansible-lint locally with the pinned version before pushing.

How to prevent it

  • Pin ansible-lint and its profile in CI for stable results.
  • Use FQCNs and changed_when by default in tasks.
  • Run the linter locally with the same version before pushing.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →