Skip to content
Latchkey

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

  1. Confirm the requested collection version exists.
  2. Provide the API token for private servers via a secret.
  3. 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

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