Unable to install collections from Red Hat Automation Hub

I’m building an execution environment in a CI pipeline and it’s unable to install certain collections. I’m receiving this error:

> ANSIBLE_GALAXY_DISABLE_GPG_VERIFY=1 ansible-galaxy collection install $ANSIBLE_GALAXY_CLI_COLLECTION_OPTS -r requirements.yml --collections-path "/usr/share/ansible/collections"
Starting galaxy collection install process
Process install dependency map
[WARNING]: Skipping Galaxy server https://console.redhat.com/api/automation-hub/. Got an unexpected error when getting available versions of collection microsoft.ad: 'results'
[WARNING]: Skipping Galaxy server https://console.redhat.com/api/automation-hub/. Got an unexpected error when getting available versions of collection microsoft.sql: 'results'
[WARNING]: Skipping Galaxy server https://console.redhat.com/api/automation-hub/. Got an unexpected error when getting available versions of collection redhat.satellite_operations: 'results'
ERROR! Failed to resolve the requested dependencies map. Could not satisfy the following requirements:
* redhat.satellite_operations:3.0.0 (direct request)

The first 2 (microsoft.ad and microsoft.sql) are available publicly on Ansible Galaxy, whereas redhat.satellite_operations is on Red Hat’s Hybrid Cloud Automation Hub and requires authentication, which I think is the issue. I generated a token for the AH here.

I’ve tried passing the token with ansible-galaxy collection install --token $TOKEN redhat.satellite_operations, but no change. I’ve also tried including the token in the ansible.cfg:

[galaxy]
server_list = automation_hub, galaxy_hub
[galaxy_server.automation_hub]
url=https://console.redhat.com/api/automation-hub/
token=token123
[galaxy_server.galaxy_hub]
url=https://galaxy.ansible.com/

Is the Automation Hub the issue? What’s the right way to authenticate with it? Or if not, how can I get this working?

hello,

the entries look incomplete for the automation hub.

I think you should have an entry for the repositoriy of certified collections, with this URL :
https://console.redhat.com/api/automation-hub/content/published/

… and another entry for the repository hosting the validated collections, such as :
https://console.redhat.com/api/automation-hub/content/validated/

Johan

The issue was the way I was authenticating with Automation Hub. I changed my ansible.cfg to this:

[galaxy]
server_list = galaxy_hub, automation_hub

[galaxy_server.automation_hub]
url=https://console.redhat.com/api/automation-hub/
auth_url=https://sso.redhat.com/auth/realms/redhat-external/protocol/openid-connect/token

[galaxy_server.galaxy_hub]
url=https://galaxy.ansible.com/

And instead of passing the token with --token, I use these environment variables:

  • ANSIBLE_GALAXY_SERVER_AUTOMATION_HUB_TOKEN
  • ANSIBLE_GALAXY_SERVER_GALAXY_HUB_TOKEN

This fixed my issue.

1 Like