自動化ハブの使用開始

Red Hat Ansible Automation Platform 2.2

Ansible コレクションコンテンツのデフォルトサーバーとしての Red Hat Automation Hub の設定

Red Hat Customer Content Services

概要

本書では、Red Hat Automation Hub を認定 Ansible コレクションコンテンツのデフォルトソースとして使用する際に必要な初期手順を説明します。
フィードバックの提供:
このドキュメントを改善するための提案がある場合、またはエラーを見つけた場合は、テクニカルサポート (https://access.redhat.com) に連絡し、Docs コンポーネントを使用して Ansible Automation Platform Jira プロジェクトで issue を作成してください。

はじめに

Red Hat Ansible Automation Hub は、Red Hat サブスクリプションをお持ちのお客様が、Red Hat および弊社のテクノロジーパートナーがサポートするコンテンツをすばやく見つけて使用できる場所を提供し、最も要求の厳しい環境にさらなる安心を提供します。

Ansible Galaxy クライアント ansible-galaxy は、コマンドラインからロールおよびコレクションを管理します。ansible-galaxy クライアントが認定済みでサポートされている Ansible コレクションを可能な限り使用するようにするには、ansible.cfg ファイルを更新して、Ansible コレクションのプライマリーソースとして Red Hat Automation Hub を使用します。

このガイドでは、Red Hat Automation Hub を認定 Ansible コレクションコンテンツのデフォルトソースとして使用するように ansible.cfg ファイルを設定する際に必要な手順を説明します。

多様性を受け入れるオープンソースの強化

Red Hat では、コード、ドキュメント、Web プロパティーにおける配慮に欠ける用語の置き換えに取り組んでいます。まずは、マスター (master)、スレーブ (slave)、ブラックリスト (blacklist)、ホワイトリスト (whitelist) の 4 つの用語の置き換えから始めます。この取り組みは膨大な作業を要するため、今後の複数のリリースで段階的に用語の置き換えを実施して参ります。詳細は、Red Hat CTO である Chris Wright のメッセージ をご覧ください。

第1章 Red Hat Automation Hub API トークンの作成

コレクションをアップロードまたはダウンロードすることで、Automation Hub と対話できるようにする前に、API トークンを作成する必要があります。Automation Hub API トークンは、ansible-galaxy クライアントを Red Hat Automation Hub サーバーに対して認証します。

Automation Hub Token management を使用すると、API トークンを作成できます。

前提条件

  • Red Hat Ansible Automation Platform の有効なサブスクリプション認証情報。

手順

  1. https://cloud.redhat.com/ansible/automation-hub/token/ に移動します。
  2. Load Token をクリックします。
  3. copy アイコンをクリックして、API トークンをクリップボードにコピーします。
  4. API トークンをファイルに貼り付け、安全な場所に保存します。
重要

API トークンは、コンテンツを保護するために使用されるシークレットトークンです。API トークンを安全な場所に保存します。

Automation Hub をデフォルトのコレクションサーバーとして設定したり、ansible-galaxy コマンドラインツールを使用してコレクションをアップロードしたりする場合に、API トークンを使用できるようになりました。

第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 を使用すると、認定され、サポートされているコレクションにアクセスできます。

前提条件

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.

手順

  1. [galaxy] セクション配下に server_list オプションを追加し、1 つ以上のサーバー名を指定します。
  2. 各サーバー名に新しいセクションを作成します。

    [galaxy_server._<server_name>_]
  3. 各サーバー名に url オプションを設定します。サーバー URL に api/galaxy/ サブディレクトリーを含める必要があります。

    https://<server_fully_qualified_domain_name>/api/galaxy/
  4. オプション: auth_url オプションを設定します。コミュニティーの Ansible Galaxy には auth_url が必要ありません。
  5. 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

1
サーバー URL の後に末尾のスラッシュ / を含めます。
2
Ansible Galaxy サーバー URL に /api/galaxy/ サブディレクトリーを含めます。
3
Automation Hub サーバーの URL に /api/galaxy/ サブディレクトリーを含めます。
注記

301 リダイレクトの受信を防ぐために、すべての API URL は末尾のスラッシュ / で終わる必要があります。

これで、CLI を使用して Automation Hub をプライマリーサーバーとして設定できました。次に、サポートされているコレクションのダウンロードとインストールに進むことができます。

関連情報

サーバーリストの設定オプションおよび Ansible Galaxy を Ansible コンテンツソースとして使用する方法の詳細は、Ansible Galaxy ユーザーガイド を参照してください。

2.2. Web コンソールを使用したコンテンツのプライマリーソースとしての Red Hat Automation Hub の設定

Web コンソールを使用して、Red Hat Automation Hub をコンテンツのプライマリーソースとして設定します。Automation Hub を設定するには、認証情報を作成し、それを組織の Galaxy 認証情報フィールドに追加する必要があります。Automation Hub を使用すると、認定され、サポートされているコレクションにアクセスできます。

前提条件

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.

手順

  1. Automation Controller に移動します。
  2. 新規認証情報を作成します。

    1. Credentials 画面で Add をクリックします。
    2. Name フィールドに新規の認証情報の名前を入力します。
    3. オプションで、説明を入力し、認証情報が関連付けられている組織の名前を入力するか、選択します。
    4. Organization で、認証情報を使用する組織を選択します。
    5. 認証情報のタイプとして Ansible Galaxy/Automation Hub API Token を選択します。
    6. Type Details に、前提条件で作成した Galaxy サーバー URL認証サーバー URL、および API トークン を入力します。
    7. Save をクリックします。
  3. 組織の Galaxy Credentials フィールドから作成した認証情報を選択します。

    1. AccessOrganizations に移動します。
    2. Galaxy 認証情報を追加する組織を選択します。
    3. Edit をクリックします。
    4. Galaxy 認証情報 で、Search アイコンをクリックします。
    5. Automation Hub 用に作成した認証情報を選択し、リストの先頭に配置します。
    6. オプション: Ansible Galaxy などのコンテンツのセカンダリーソースがある場合は、Automation Hub 用に作成した認証情報の後にこの認証情報を配置します。
    7. Select をクリックします。
    8. Save をクリックします。

検証

認証情報を検証するには、既存のソース管理管理 (SCM) ベースのプロジェクトを選択し、Refresh アイコンをクリックして更新します。

  1. プロジェクトリポジトリーに移動します。
  2. collections/requirements.yml ファイルを使用するプロジェクトを選択します。
  3. 更新アイコン [refresh icon] をクリックしてプロジェクトを更新します。

プロジェクトのステータスが Successful になると、認証情報は有効です。

Web コンソールを使用して Automation Hub をプライマリーサーバーとして設定したので、サポートされているコレクションのダウンロードとインストールに進むことができます。

関連情報

  1. サーバーリストの設定オプションおよび Ansible Galaxy を Ansible コンテンツソースとして使用する方法の詳細は、Ansible Galaxy ユーザーガイド を参照してください。
  2. 認証情報の作成と使用の詳細は、Automation Controller ユーザーガイド v4.2.1 の 認証情報 セクションを参照してください。

法律上の通知

Copyright © 2023 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.