第2章 コンテンツの主なソースとして Red Hat Automation Hub を設定
Ansible Certified Content Collections にアクセスするためのコンテンツのプライマリーソースとして Red Hat Automation Hub を設定します。Automation Hub は、コマンドラインインターフェイス (CLI) または Web コンソールで設定できます。
2.1. CLI を使用したコンテンツのプライマリーソースとしての Red Hat Automation Hub の設定
CLI を使用して、Red Hat Automation Hub をコンテンツのプライマリーソースとして設定します。Automation Hub を設定するには、ansible.cfg 設定ファイルを変更する必要があります。Automation Hub を使用すると、認定され、サポートされているコレクションにアクセスできます。
前提条件
- Automation Hub サーバーの API トークンを取得している。詳細は、Red Hat Automation Hub API トークンの作成 を参照してください。
Creating a new token revokes any previous tokens generated for Private Automation Hub. Ensure that you update any Controller or scripts that you created with the previous token.
手順
-
[galaxy]セクション配下にserver_listオプションを追加し、1 つ以上のサーバー名を指定します。 各サーバー名に新しいセクションを作成します。
[galaxy_server._<server_name>_]
各サーバー名に
urlオプションを設定します。サーバー URL にapi/galaxy/サブディレクトリーを含める必要があります。https://<server_fully_qualified_domain_name>/api/galaxy/-
オプション:
auth_urlオプションを設定します。コミュニティーの Ansible Galaxy にはauth_urlが必要ありません。 - Automation Hub サーバーの API トークンを設定します。
以下の ansible.cfg 設定ファイルの例は、優先順位の高い順に複数のサーバーを設定する方法を示しています。Automation Hub がプライマリーソースとして設定され、Ansible Galaxy サーバーがセカンダリーソースとして設定されています。
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
301 リダイレクトの受信を防ぐために、すべての API URL は末尾のスラッシュ / で終わる必要があります。
これで、CLI を使用して Automation Hub をプライマリーサーバーとして設定できました。次に、サポートされているコレクションのダウンロードとインストールに進むことができます。
関連情報
サーバーリストの設定オプションおよび Ansible Galaxy を Ansible コンテンツソースとして使用する方法の詳細は、Ansible Galaxy ユーザーガイド を参照してください。