Skip to content
Latchkey

Ansible "FAILED! ... couldn’t resolve module/action" in CI

Ansible could not find a module or action your task referenced. The collection that provides it is not installed, or the module name is not fully qualified.

What this error means

A task fails immediately with couldn’t resolve module/action, naming the module. The runner has Ansible but not the collection that ships that module - common in CI where Galaxy requirements were never installed.

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

Common causes

Required collection not installed

Modules like community.docker.* or amazon.aws.* live in Galaxy collections. ansible-core ships only built-ins, so CI must install the collection from requirements.yml.

Unqualified or misspelled module name

Using a short name (docker_container) without its collection namespace, or a typo, leaves Ansible unable to resolve the fully qualified collection name.

How to fix it

Install collections from requirements

Install the Galaxy requirements as a step before running the playbook.

.github/workflows/deploy.yml
- run: ansible-galaxy collection install -r requirements.yml
- run: ansible-playbook -i inventory site.yml

Use fully qualified module names

Reference modules by their full collection path so resolution is unambiguous.

playbook.yml
- name: Run a container
  community.docker.docker_container:
    name: web
    image: nginx:latest

How to prevent it

  • Pin collections in requirements.yml and install them in CI before the playbook runs.
  • Always use fully qualified collection names (FQCN) for non-builtin modules.
  • Cache the Galaxy collections path keyed on requirements.yml.

Related guides

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