Skip to content
Latchkey

Ansible "couldn't resolve module/action" collection not installed in CI

Ansible could not map a fully qualified collection name to a module because the collection that provides it is not installed on the runner. A clean CI image only ships ansible-core builtins, so external collections must be installed first.

What this error means

The run fails with "ERROR! couldn't resolve module/action 'community.general.timezone'. This often indicates a misspelling, missing collection, or incorrect module path." even though the playbook is correct.

ansible
ERROR! couldn't resolve module/action 'community.docker.docker_container'. This
often indicates a misspelling, missing collection, or incorrect module path.

Common causes

The collection is not installed on the runner

ansible-core ships only builtins, so collections like community.general or community.docker must be installed before the play runs.

No requirements.yml driving the install

Without a galaxy requirements file the CI job never installs the collection the playbook depends on.

How to fix it

Install collections from requirements.yml

  1. List required collections in requirements.yml.
  2. Run ansible-galaxy collection install before the playbook.
  3. Re-run so the FQCN resolves.
requirements.yml
# requirements.yml
collections:
  - name: community.docker
    version: ">=3.0.0"

Install as a CI step

Install the collections before the playbook step so the modules are present.

.github/workflows/ci.yml
ansible-galaxy collection install -r requirements.yml

How to prevent it

  • Pin required collections in requirements.yml and install them in CI.
  • Cache the Galaxy collection path between runs.
  • Use FQCNs and keep the providing collection installed.

Related guides

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