Getting started with Red Hat Ansible Automation Hub

Red Hat Ansible Automation Platform 1.2

Configuring Red Hat Automation Hub as your default server for Ansible collections content

Red Hat Customer Content Services

Abstract

This guide walks you through the initial steps required to use Red Hat Automation Hub as the default source for certified Ansible collections content.
Providing Feedback:
If you have a suggestion to improve this documentation, or find an error, create an issue at http://issues.redhat.com. Select the Automation Hub (AAH) project and use the Documentation component.

Preface

Red Hat Ansible Automation Hub provides a place for Red Hat subscribers to quickly find and use content that is supported by Red Hat and our technology partners to deliver additional reassurance for the most demanding environments.

The Ansible Galaxy client, ansible-galaxy, manages roles and collections from the command line. To ensure that the ansible-galaxy client uses certified, supported Ansible collections whenever possible, you should update your ansible.cfg file to use Red Hat Automation Hub as your primary source of Ansible collections.

This guide walks you through the steps required to configure your ansible.cfg file to use Red Hat Automation Hub as the default source for certified Ansible collections content.

Chapter 1. Creating the Red Hat Automation Hub API token

Before you can interact with Automation Hub by uploading or downloading collections, you need to create an API token. The Automation Hub API token authenticates your ansible-galaxy client to the Red Hat Automation Hub server.

You can create an API token using Automation Hub Token management.

Prerequisites

  • Valid subscription credentials for Red Hat Ansible Automation Platform.

Procedure

  1. Navigate to https://cloud.redhat.com/ansible/automation-hub/token/.
  2. Click Load Token.
  3. Click copy icon to copy the API token to the clipboard.
  4. Paste the API token into a file and store in a secure location.
Important

The API token is a secret token used to protect your content. Store your API token in a secure location.

The API token is now available to use to configure Automation Hub as your default collections server or when uploading collections using the ansible-galaxy command line tool.

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 if necessary. The community Ansible Galaxy does not require an auth_url.
  4. Set the auth_url option for each server name.
  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/ 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/
username=my_user
password=my_pass

1
A trailing slash / must follow the 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.

Legal Notice

Copyright © 2021 Red Hat, Inc.
The text of and illustrations in this document are licensed by Red Hat under a Creative Commons Attribution–Share Alike 3.0 Unported license ("CC-BY-SA"). An explanation of CC-BY-SA is available at http://creativecommons.org/licenses/by-sa/3.0/. In accordance with CC-BY-SA, if you distribute this document or an adaptation of it, you must provide the URL for the original version.
Red Hat, as the licensor of this document, waives the right to enforce, and agrees not to assert, Section 4d of CC-BY-SA to the fullest extent permitted by applicable law.
Red Hat, Red Hat Enterprise Linux, the Shadowman logo, the Red Hat logo, JBoss, OpenShift, Fedora, the Infinity logo, and RHCE are trademarks of Red Hat, Inc., registered in the United States and other countries.
Linux® is the registered trademark of Linus Torvalds in the United States and other countries.
Java® is a registered trademark of Oracle and/or its affiliates.
XFS® is a trademark of Silicon Graphics International Corp. or its subsidiaries in the United States and/or other countries.
MySQL® is a registered trademark of MySQL AB in the United States, the European Union and other countries.
Node.js® is an official trademark of Joyent. Red Hat is not formally related to or endorsed by the official Joyent Node.js open source or commercial project.
The OpenStack® Word Mark and OpenStack logo are either registered trademarks/service marks or trademarks/service marks of the OpenStack Foundation, in the United States and other countries and are used with the OpenStack Foundation's permission. We are not affiliated with, endorsed or sponsored by the OpenStack Foundation, or the OpenStack community.
All other trademarks are the property of their respective owners.