ansible-galaxy "failed to download collection" in CI
ansible-galaxy could not fetch a collection from the registry -- a transient network/registry hiccup, an unavailable version, or missing auth for a private server.
What this error means
ansible-galaxy collection install fails with "failed to download collection" or an HTTP/timeout error against galaxy.ansible.com or a private Automation Hub. It is frequently intermittent.
ansible
ERROR! Failed to download collection 'community.general:8.5.0' :
Unknown error when attempting to call Galaxy at
'https://galaxy.ansible.com/api/': <urlopen error [Errno -3] Temporary failure
in name resolution>Common causes
Transient registry/network failure
A DNS hiccup, timeout, or Galaxy/Automation Hub blip interrupts the download even though config is correct.
Missing version or auth
The requested version does not exist, or a private server needs a token the runner did not provide.
How to fix it
Retry, and configure the server/auth correctly
Re-run the install; for private servers, configure the server list and token.
.github/workflows/ci.yml
ansible-galaxy collection install -r requirements.yml
# private Automation Hub: set server + token in ansible.cfg
# [galaxy]
# server_list = automation_hub
# [galaxy_server.automation_hub]
# url = https://console.redhat.com/api/automation-hub/
# token = ${AH_TOKEN}Resolve version/auth issues
- Confirm the requested collection version exists.
- Provide the API token for private servers via a secret.
- Cache collections to reduce dependence on the registry.
How to prevent it
- Pin and cache collections to reduce registry round-trips.
- Configure private server URLs and tokens correctly.
- Run installs on a platform that auto-retries transient download failures.
Related guides
Ansible "couldn't resolve module/action" in CIFix Ansible "couldn't resolve module/action" in CI -- a task uses a module from a collection that is not inst…
Ansible "the role X was not found" in CIFix Ansible "the role X was not found" in CI -- a play references a role that is not on the roles path and wa…
Ansible module "not found on remote" / missing dependency in CIFix Ansible "module not found" / missing remote dependency in CI -- a module needs a Python library or binary…