自動化ハブの使用開始

Red Hat Ansible Automation Platform 2.1

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 を使用して API トークンを作成できます。Token management をクリックします。

前提条件

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

手順

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

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

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

1.1. オフライントークンをアクティブな状態に維持

オフライントークンをアクティブな状態にしておくと、ユーザーがオフラインの場合でも、アプリケーションがユーザーの代わりにアクションを実行する必要がある場合に便利です。たとえば、ルーチンデータのバックアップです。

オフライントークンは、30 日の非アクティブ後に有効期限が切れます。オフライントークンを定期的に更新することで、オフライントークンの有効期限が切れないようにすることができます。

注記

オフライントークンの期限が切れたら、新しいトークンを要求する必要があります。

定期的に以下のコマンドを実行して、トークンの有効期限が切れないようにします。

curl https://sso.redhat.com/auth/realms/redhat-external/protocol/openid-connect/token -d grant_type=refresh_token -d client_id="cloud-services" -d refresh_token="{{ user_token }}" --fail --silent --show-error --output /dev/null

第2章 コンテンツの主なソースとして Red Hat Automation Hub を設定

Ansible Certified Content Collections にアクセスするための、Red Hat Automation Hub を主要なコンテンツソースとして設定します。コマンドラインインターフェイス(CLI)または Web コンソールで Automation Hub を設定できます。

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/ サブディレクトリーを含めます。
注記

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

これで、CLI を使用して Automation Hub をプライマリーサーバーとして設定し、サポートされるコレクションのダウンロードおよびインストールを続行できるようになりました。

関連情報

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

2.2. Web コンソールを使用したコンテンツの主なソースとして Red Hat Automation Hub を設定

Web コンソールを使用して、Red Hat Automation Hub を主要なコンテンツソースとして設定します。Automation Hub を設定するには、認証情報を作成して、組織の Galaxy Credentials フィールドに追加する必要があります。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. [ Add ] を [ Credentials screen.
    2. 新しい認証情報の名前を Name フィールドで指定します。
    3. オプション:説明を入力し、認証情報が関連付けられている組織の名前を入力するか、選択します。
    4. の下でOrganization認証情報を使用する組織を選択します。
    5. を選択します。Ansible Galaxy/Automation Hub API Token 認証情報タイプとして。
    6. の下でType Details次のように入力します。 Galaxy Server URL, Authentication Server URL、および API Token 前提条件 で作成されます。
    7. Save をクリックします。
  3. 組織の から作成した認証情報を選択します。 Galaxy Credentials フィールドで指定します。

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

検証

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

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

プロジェクトのステータスが の場合 Successfulその後、認証情報が有効になります。

これで、Web コンソールを使用して Automation Hub をプライマリーサーバーとして設定し、サポートされるコレクションのダウンロードおよびインストールを続行できるようになりました。

関連情報

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

法律上の通知

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.