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.
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.
- run: ansible-galaxy collection install -r requirements.yml
- run: ansible-playbook -i inventory site.ymlUse fully qualified module names
Reference modules by their full collection path so resolution is unambiguous.
- name: Run a container
community.docker.docker_container:
name: web
image: nginx:latestHow to prevent it
- Pin collections in
requirements.ymland 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.