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.
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
- List required collections in
requirements.yml. - Run
ansible-galaxy collection installbefore the playbook. - Re-run so the FQCN resolves.
# 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.
ansible-galaxy collection install -r requirements.ymlHow to prevent it
- Pin required collections in
requirements.ymland install them in CI. - Cache the Galaxy collection path between runs.
- Use FQCNs and keep the providing collection installed.