Skip to content
Latchkey

ansible-lint "command not found" in CI

ansible-lint ships as its own pip package, separate from ansible-core. On a runner where it was not installed, the lint step fails with exit code 127 before any rule runs.

What this error means

A ansible-lint step fails with "ansible-lint: command not found" and exit code 127.

Terminal
/home/runner/work/_temp/script.sh: line 1: ansible-lint: command not found
Error: Process completed with exit code 127.

Common causes

ansible-lint was never installed

It is not part of ansible-core and not preinstalled on hosted runners; without a pip install step the command is absent.

Installed into a different interpreter

A pip install ran against a Python not on PATH, so the ansible-lint launcher is not resolvable in the lint step.

How to fix it

Install ansible-lint in CI

Install a pinned ansible-lint alongside ansible-core so the command exists.

.github/workflows/ci.yml
- uses: actions/setup-python@v5
  with:
    python-version: '3.12'
- run: pip install "ansible-lint==24.9.2" ansible-core
- run: ansible-lint

Use the official ansible-lint action

The maintained action installs and runs ansible-lint for you.

.github/workflows/ci.yml
- uses: ansible/ansible-lint@main

How to prevent it

  • Pin ansible-lint in test requirements or use the official action.
  • Install it into the same interpreter as ansible-core.
  • Cache the pip directory to keep lint steps fast.

Related guides

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