Chapter 3. Configuring Red Hat automation hub as the primary source for content
To access Ansible Certified Content Collections, configure Red Hat automation hub as your primary source of content. You can configure automation hub in the command-line interface (CLI) or the web console.
3.1. Using the CLI to configure Red Hat automation hub as the primary content source
To configure automation hub, you must update the ansible.cfg
configuration file. By default, the ansible.cfg
configuration file is located in the /etc/ansible/
directory. With automation hub, you have access to certified, supported collections.
Prerequisites
- You have obtained the API token for the automation hub server. See Creating the Red Hat automation hub API token for more information.
Creating a new token revokes any previous tokens generated for automation hub. Update any automation controller or scripts created with the previous token to include the new token.
Procedure
-
Open the
ansible.cfg
file. -
Add the
server_list
option under the[galaxy]
section and include one or more server names. Create a new section for each server name:
[galaxy_server._<server_name>_]
Set the
url
option for each server name:https://<server_fully_qualified_domain_name>/api/galaxy/
-
Optional: Set the
auth_url
option. The community Ansible Galaxy does not require anauth_url
. - Set the API token for the automation hub server.
Example
The following ansible.cfg
configuration file example shows how to configure multiple servers in prioritized order. Automation hub is 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://console.redhat.com/api/automation-hub/content/published/ 1 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/content/rh-certified/ 2 username=my_user password=my_pass
To prevent a 301 redirect, all API URLs must end with a trailing slash /.
You have now configured automation hub as your primary server. You can begin to download and install supported collections.
Additional resources
For more information about server list configuration options and using Ansible Galaxy as an Ansible content source, see the Ansible Galaxy User Guide.
3.2. Using the web console to configure Red Hat automation hub as the primary content source
To configure automation hub, you must create a credential and add it to the Organization’s Galaxy Credentials field. With automation hub, you have access to certified, supported collections.
Prerequisites
- You have obtained the API token for the automation hub server. See Creating the Red Hat automation hub API token for more information.
Creating a new token revokes any previous tokens generated for automation hub. Update any automation controller or scripts created with the previous token.
Procedure
- Navigate to your automation controller.
Create a new credential.
-
Navigate to
. - Click .
- Enter the name for your new credential in the Name field.
- Optional: Enter a description and enter or select the name of the organization with which the credential is associated.
- Under Organization, select the organization that you want to use the credential for.
- Select Ansible Galaxy/Automation Hub API Token as the credential type.
- Under Type Details, enter the Galaxy Server URL, Authentication Server URL, and API Token previously created.
- Click .
-
Navigate to
Select the credential that you created from the Organization’s Galaxy Credentials field.
-
Navigate to
. - Select the organization where want to add your Galaxy credentials.
- Click .
- Under Galaxy Credentials, click the icon.
- Select the credential that you created for automation hub, and place it at the beginning of the list.
- Optional: If you have a secondary source of content, such as Ansible Galaxy, place this credential after the credential that you created for automation hub.
- Click .
- Click .
-
Navigate to
Verification
To validate the credential, update an existing source control management (SCM)-based project by selecting the project and clicking the
icon.- Navigate to your project repository.
-
Select a project that uses a
collections/requirements.yml
file. - Update the project by clicking the icon.
If the Status of the project is Successful, then the credential is valid.
You have now configured automation hub as your primary server. You can begin to download and install supported collections.
Additional resources
- For more information about server list configuration options and using Ansible Galaxy as an Ansible content source, see the Ansible Galaxy User Guide.
- For more information about creating and using credentials, see the Credentials section of Automation Controller User Guide v4.2.1.