Chapter 2. Configuring Red Hat automation hub as the primary source for content

You can define Red Hat automation hub as the default source for content in the ansible.cfg configuration file.

Prerequisites

  • Obtain the API token for the automation hub server. See Creating the automation hub API token for more information.

Procedure

  1. Add the server_list option under the [galaxy] section and provide one or more server names.
  2. Create a new section for each server name:

    [galaxy_server.<server_name>]
  3. Set the url option for each server name. You must include the api/galaxy/ subdirectory in the server URL:

    https://<server_fully_qualified_domain_name>/api/galaxy/
  4. Set the auth_url option if necessary. The community Ansible Galaxy does not require an auth_url.
  5. Set the API token for the automation hub server.

The following ansible.cfg example shows how to configure multiple servers in prioritized order, with automation hub configured as your primary source and an Ansible Galaxy server as a secondary source:

ansible.cfg

[galaxy]
server_list = automation_hub, my_org_hub

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

token=my_ah_token

[galaxy_server.my_org_hub]
url=https://automation.my_org/api/galaxy/ 3
username=my_user
password=my_pass

1
A trailing slash / must follow the server URL.
2
Include the /api/galaxy/ subdirectory in the Galaxy server URL.
3
Include the /api/galaxy/ subdirectory in the automation hub server URL.

You have now configured automation hub as your default server and can proceed to download and install supported collections.

For more information on server list configuration options and using Ansible Galaxy as an Ansible content source, see the Ansible Galaxy User Guide.