Red Hat Ansible Automation Platform Operator インストールガイド

Red Hat Ansible Automation Platform 2.1

本書では、OpenShift Container Platform の Red Hat Ansible Automation Platform Operator でサポートされるインストールシナリオの手順および参考情報を提供します。

Red Hat Customer Content Services

概要

フィードバックの提供:
このドキュメントを改善するための提案がある場合、またはエラーを見つけた場合は、テクニカルサポート (https://access.redhat.com) に連絡し、Docs コンポーネントを使用して Ansible Automation Platform Jira プロジェクトで issue を作成してください。

はじめに

Red Hat Ansible Automation Platform に興味をお持ちいただきありがとうございます。Ansible Automation Platform は、Ansible を装備した環境に、制御、ナレッジ、委譲の機能を追加して、チームが複雑かつ複数層のデプロイメントを管理できるように支援する商用サービスです。

本書では、Ansible Automation Platform Operator を OpenShift Container Platform にインストールする際のインストール要件およびプロセスについて説明します。

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

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

第1章 Red Hat OpenShift Container Platform への Red Hat Ansible Automation Platform Operator のインストール計画

Red Hat Ansible Automation Platform は、Red Hat Enterprise Linux 8 と Red Hat Openshift の両方でサポートされます。

OpenShift Operator は、Red Hat OpenShift Container Platform に複雑な分散ソフトウェアの day 2 操作のインストールおよび自動化に役立ちます。Ansible Automation Platform Operator を使用すると、Red Hat OpenShift Container Platform に Red Hat OpenShift Container Platform をデプロイし、管理できます。

本セクションを使用すると、Red Hat OpenShift Container Platform 環境に Red Hat Ansible Automation Platform のインストールを計画することができます。インストールを行う前に、サポートされているインストールシナリオを確認し、要件を満たしていることを確認してください。

1.1. Ansible Automation Platform Operator について

Ansible Automation Platform Operator は、OpenShift 環境で新規の Ansible Automation Platform インスタンスのクラウドネイティブのプッシュボタンデプロイメントを提供します。Ansible Automation Platform Operator には、Automation Controller および Private Automation Hub のインスタンスをデプロイして管理するリソースタイプが含まれます。 また、オートメーションコントローラのデプロイメント内でジョブを定義して起動するための、オートメーションコントローラのジョブリソースも含まれています。 

Kubernetes ネイティブ Operator を使用して Ansible Automation Platform インスタンスをデプロイすると、Red Hat OpenShift Container Platform にデプロイされた Playbook からインスタンスを起動するという利点があります。これには、Red Hat Ansible Automation Platform デプロイメントへのアップグレードおよび完全なライフサイクルサポートが含まれます。

OperatorHub の Red Hat Operator カタログから Ansible Automation Platform Operator をインストールできます。

1.2. OpenShift Container Platform バージョンの互換性

Ansible Automation Platform 2.1 インストール用の Ansible Automation Platform Operator は、OpenShift Container Platform 4.7 以降のバージョンで利用できます。

関連情報

1.3. Red Hat OpenShift Container Platform のサポート対象のインストールシナリオ

Red Hat OpenShift Container Platform Web コンソールで OperatorHub を使用して、Ansible Automation Platform Operator をインストールできます。

または、OpenShift Container Platform コマンドラインインターフェイス (CLI) oc から Ansible Automation Platform Operator をインストールできます。

以下のワークフローのいずれかに従って Ansible Automation Platform Operator をインストールし、これを使用して必要な Ansible Automation Platform のコンポーネントをインストールします。

  • 最初に自動化コントローラーおよびお客様のリソース、次に Automation Hub およびカスタマーリソース。
  • 最初に Automation Hub とお客様のリソース、次に自動化コントローラーとカスタマーリソース。
  • Automation Controller およびお客様のリソース。
  • Automation Hub およびカスタムリソース。

1.4. カスタムリソース

プライマリーインストールワークフローごとにカスタムリソースを定義できます。

1.5. 関連情報

第2章 Red Hat OpenShift Container Platform への Ansible Automation Platform オペレーターのインストール

前提条件

  • Operator Hub に Red Hat Ansible Automation Platform カタログがインストールされている。
  • プラットフォーム用の StorageClass オブジェクトと、ReadWriteMany アクセスモードの永続ボリューム要求 (PVC) を作成している。詳細は、Dyamic Provisioning を参照してください。
  • ReadWriteMany アクセスモードを使用して Amazon Web Services で Red Hat OpenShift Container Platform クラスターを実行するには、NFS またはその他のストレージを追加する必要がある。

手順

  1. Red Hat OpenShift Container Platform にログインします。
  2. に移動します。OperatorsOperatorHub をクリックします。
  3. Red Hat Ansible Automation Platform Operator を検索し、 をクリックします。Install をクリックします。
  4. を選択します。Update Channel:

    • stable-2.x: namespace スコープの Operator をインストールします。これにより、Automation Hub および自動化コントローラーインスタンスのデプロイメントが、Operator がインストールされている namespace に制限されます。これはほとんどの場合に適しています。stable-2.x チャネルは管理者特権を必要とせず、単一の namespace のみを監視するため、使用するリソースが少なくなります。
    • stable-2.x-cluster-scoped: クラスター内の複数の namespace にわたって Automation Hub と自動化コントローラーをデプロイし、クラスター内のすべての namespace に対して管理者特権を必要とします。
  5. を選択します。Installation ModeInstalled Namespace、および Approval Strategy をクリックします。
  6. をクリックします。Install をクリックします。

インストールプロセスが開始します。インストールが完了すると、Red Hat Ansible Automation Platform オペレーターが指定された名前空間にインストールされていることを通知するモーダルが表示されます。

  • をクリックします。View Operator 新しくインストールされた Red Hat Ansible Automation Platform オペレーターを表示します。

第3章 Red Hat OpenShift Container Platform Web コンソールへの自動化コントローラーのインストールおよび設定

これらの手順を使用して、自動化コントローラーオペレーターを Red Hat OpenShift Container Platform にインストールし、カスタムリソースを指定し、外部データベースを使用して Ansible Automation Platform をデプロイできます。

注記

自動化コントローラーのインスタンスが削除されても、関連する PVC は自動的に削除されません。これにより、新しいデプロイメントの名前が前のデプロイメントと同じ場合は、移行中に問題が発生する可能性があります。したがって、同じ namespace に新規自動化コントローラーインスタンスをデプロイする前に、古い PVC を手動で削除することが推奨されます。詳細は、PVC の検索および削除 を参照してください。

3.1. 前提条件

  • Operator Hub に Red Hat Ansible Automation Platform カタログがインストールされている。

3.2. 自動化コントローラー Operator のインストール

  1. OperatorsInstalled Operators に移動し、 をクリックします。Ansible Automation Platform Operator。
  2. を見つけます。Automation controller タブをクリックし、Create instance をクリックします。

Form View または YAML ビューのいずれかを使用してインスタンスの設定を続行できます。

3.2.1. 自動化コントローラー Operator ルートオプションの設定

Red Hat Ansible Automation Platform オペレーターのインストールフォームでは、Automation controller オペレーターのルートオプションをさらに設定できます。Advanced configuration をクリックします。

  1. Advanced configuration をクリックします。
  2. の下でIngress type でドロップダウンメニューをクリックして選択します。Route をクリックします。
  3. の下でRoute DNS hostで、ルートが応答する一般的なホスト名を入力します。
  4. の下でRoute TLS termination mechanism でドロップダウンメニューをクリックして選択します。Edge または Passthrough をクリックします。
  5. の下でRoute TLS credential secret でドロップダウンメニューをクリックして、リストからシークレットを選択します。

3.2.2. Automation Hub Operator の Ingress タイプの設定

Red Hat Ansible Automation Platform オペレーターのインストールフォームを使用すると、Automation Hub オペレーターの イングレスをさらに設定できます。Advanced configuration をクリックします。

手順

  1. Advanced Configuration をクリックします。
  2. の下でIngress type でドロップダウンメニューをクリックして選択します。Ingress をクリックします。
  3. の下でIngress annotations で、イングレスに追加するアノテーションを入力します。
  4. の下でIngress TLS secret でドロップダウンメニューをクリックして、リストからシークレットを選択します。

Automation Hub Operator を設定したら、フォームビューの下部にある Create をクリックします。Red Hat OpenShift Container Platform は Pod を作成します。これには数分の時間がかかる場合があります。

WorkloadsPod に移動し、新たに作成されたインスタンスを見つけることで、進捗を表示できます。

検証

Automation Hub から Ansible Automation Platform Operator のインストールによって提供される以下の Operator Pod が実行されていることを確認します。

Operator マネージャーコントローラーautomation controllerautomation hub

3 つの各 Operator の Operator マネージャーコントローラーには、以下が含まれます。

  • automation-controller-operator-controller-manager
  • automation-hub-operator-controller-manager
  • resource-operator-controller-manager

自動化コントローラーのデプロイ後に、これらの Pod が追加されていることを確認できます。

  • controller
  • controller-postgres

Automation Hub のデプロイ後に、これらの Pod が追加されていることを確認できます。

  • hub-api
  • hub-content
  • hub-postgres
  • hub-redis
  • hub-worker
注記

Pod が見つからない場合は、プルシークレットが必要であることを示している可能性があります。プルシークレットは、保護されたイメージレジストリーまたはプライベートイメージレジストリーに必要です。詳細は、イメージプルシークレットの使用 を参照してください。oc describe pod <pod-name> を実行して、その Pod に ImagePullBackOff エラーがあるかどうかを確認することで、この問題をさらに診断できます。

自動化コントローラー Operator を設定したら、フォームビューの下部にある Create をクリックします。Red Hat OpenShift Container Platform は Pod を作成します。これには数分の時間がかかる場合があります。

  • WorkloadsPods に移動し、新たに作成されたインスタンスの場所を特定して、進捗を表示します。

3.3. Red Hat Ansible Automation Platform オペレーターでの自動化コントローラー用の外部データベースの設定

外部データベースを使用して Ansible Automation Platform をデプロイすることを希望するユーザーは、インスタンスの認証情報と接続情報を使用してシークレットを設定し、oc create コマンドを使用してクラスターに適用するとデプロイできるようになります。

デフォルトでは、Red Hat Ansible Automation Platform オペレーターは、Ansible Automation Platform デプロイメントと同じ名前空間でマネージド PostgreSQLPod を自動的に作成および設定します。Red Hat Ansible Automation Platform Operator が自動作成するマネージド PostgreSQL Pod ではなく、外部データベースで Ansible Automation Platform をデプロイできます。

外部データベースを使用すると、リソースを共有して再利用でき、バックアップ、アップグレード、およびパフォーマンスの最適化を手動で管理できます。

注記

データベース名が異なる限り、Automation Hub と自動化コントローラーの両方に同じ外部データベース (PostgreSQL インスタンス) を使用できます。つまり、単一の PostgreSQL インスタンス内に異なる名前のデータベースを複数指定できます。

次のセクションでは、Ansible Automation Platform オペレーターで自動化コントローラーの外部データベースを設定する手順の概要を説明します。

前提条件

外部データベースは、Ansible Automation Platform の現在のリリースでサポートされているバージョンの PostgreSQL データベースである必要があります。

注記

Ansible Automation Platform 2.0 および 2.1 は PostgreSQL 12 をサポートしています。

手順

外部の postgres インスタンスのクレデンシャルと接続情報はシークレットに保存する必要があります。シークレットは自動化コントローラーの仕様に設定されます。

  1. 以下のテンプレートに従って、.yaml ファイル postgres_configuration_secret を作成します。

    apiVersion: v1
    kind: Secret
    metadata:
      name: external-postgres-configuration
      namespace: <target_namespace> 1
    stringData:
      host: "<external_ip_or_url_resolvable_by_the_cluster>" 2
      port: "<external_port>" 3
      database: "<desired_database_name>"
      username: "<username_to_connect_as>"
      password: "<password_to_connect_with>" 4
      sslmode: "prefer" 5
      type: "unmanaged"
    type: Opaque
    1
    シークレットを作成する名前空間。これは、デプロイ先の名前空間と同じにする必要があります。
    2
    データベースノードの解決可能なホスト名。
    3
    外部ポートのデフォルトは 5432 です。
    4
    変数 password の値には、デプロイメント、バックアップ、または復元中の問題を回避するために、一重引用符 (') 、二重引用符 (")、またはバックスラッシュ (\) を含めないでください。
    5
    変数 sslmode は、external データベースに対してのみ有効です。許可される値は次のとおりです。preferdisableallowrequireverify-ca、および verify-full
  2. oc create コマンドを使用して、external-postgres-configuration-secret.yml をクラスターに適用します。

    $ oc create -f external-postgres-configuration-secret.yml
  3. AutomationController カスタムリソースオブジェクトを作成するときは、以下の例に従って、仕様にシークレットを指定します。

    apiVersion: awx.ansible.com/v1beta1
    kind: AutomationController
    metadata:
      name: controller-dev
    spec:
      postgres_configuration_secret: external-postgres-configuration

3.4. PVC の検索および削除

Persistent Volume Claim (PVC) は、Automation Hub および自動化コントローラーアプリケーションが使用するデータを保存するために使用されるストレージボリュームです。これらの PVC はアプリケーションから独立しており、アプリケーションが削除されてもそのまま残ります。PVC が必要なくなるか、PVC のバックアップを別の場所に保存している場合は手動で削除できます。

手順

  1. デプロイメント namespace にある既存 PVC を一覧表示します。

    oc get pvc -n <namespace>
  2. 以前のデプロイメント名と PVC 名を比較して、以前のデプロイメントに関連付けられている PVC を特定します。
  3. 以前の PVC を削除します。

    oc delete pvc -n <namespace> <pvc-name>

    追加リソース

第4章 Red Hat OpenShift Container Platform Web コンソールへの Automation Hub のインストールおよび設定

これらの手順を使用して、Automation Hub Operator を Red Hat OpenShift Container Platform にインストールし、カスタムリソースを指定し、外部データベースを使用して Ansible Automation Platform をデプロイできます。

注記

Automation Hub のインスタンスが削除されると、PVC は自動的に削除されません。これにより、新しいデプロイメントの名前が前のデプロイメントと同じ場合は、移行中に問題が発生する可能性があります。したがって、同じ namespace に新規 Automation Hub インスタンスをデプロイする前に、古い PVC を手動で削除することが推奨されます。詳細は、PVC の検索および削除 を参照してください。

4.1. 前提条件

  • Red Hat Ansible Automation Platform オペレーターを Operator Hub にインストールしている。

4.2. Automation Hub Operator のインストール

  1. OperatorsInstalled Operators に移動します。
  2. を見つけます。Automation hub エントリーを選択してから、Create instance をクリックします。

4.2.1. Red Hat OpenShift Container Platform への Ansible Automation Platform Operator インストールのストレージオプション

ファイルベースのストレージを使用し、インストールシナリオに Automation Hub が含まれる場合は、Ansible Automation Platform Operator の ReadWriteOnce デフォルトストレージオプションを ReadWriteMany に変更してください。

Automation Hub には、複数の Pod がコレクションなどの共有コンテンツにアクセスできるように、ReadWriteMany ファイルベースのストレージ、Azure Blob ストレージ、または Amazon S3 準拠のストレージが必要です。

さらに、OpenShift Data Foundation は ReadWriteMany または S3 準拠の実装を提供します。また、ReadWriteMany をサポートするように NFS ストレージ設定をセットアップすることもできます。ただし、これが原因で、NFS サーバーが単一障害点となる可能性があります。

4.2.1.1. ReadWriteMany アクセスモードを使用した OCP ストレージのプロビジョニング

Ansible Automation Platform Operator を正常にインストールするには、最初に Automation Hub のストレージタイプを ReadWriteMany アクセスモードにプロビジョニングする必要があります。

手順

  1. プロビジョニング をクリックして、アクセスモードを更新します。
  2. 最初のステップでは、accessModes をデフォルトの ReadWriteOnce から ReadWriteMany に更新します。
  3. 永続ボリューム要求 (PVC) を作成するには、本セクションの追加手順を実施します。

4.2.2. Automation Hub Operator ルートオプションの設定

Red Hat Ansible Automation Platform オペレーターインストールフォームを使用すると、Automation Hub オペレーターのルートオプションをさらに設定することができます。Advanced configuration をクリックします。

  1. Advanced configuration をクリックします。
  2. の下でIngress type でドロップダウンメニューをクリックして選択します。Route をクリックします。
  3. の下でRoute DNS hostで、ルートが応答する一般的なホスト名を入力します。
  4. の下でRoute TLS termination mechanism でドロップダウンメニューをクリックして選択します。Edge または Passthrough をクリックします。
  5. の下でRoute TLS credential secret でドロップダウンメニューをクリックして、リストからシークレットを選択します。

4.2.3. Automation Hub Operator の Ingress タイプの設定

Red Hat Ansible Automation Platform オペレーターのインストールフォームを使用すると、Automation Hub オペレーターの イングレスをさらに設定できます。Advanced configuration をクリックします。

手順

  1. Advanced Configuration をクリックします。
  2. の下でIngress type でドロップダウンメニューをクリックして選択します。Ingress をクリックします。
  3. の下でIngress annotations で、イングレスに追加するアノテーションを入力します。
  4. の下でIngress TLS secret でドロップダウンメニューをクリックして、リストからシークレットを選択します。

Automation Hub Operator を設定したら、フォームビューの下部にある Create をクリックします。Red Hat OpenShift Container Platform は Pod を作成します。これには数分の時間がかかる場合があります。

WorkloadsPod に移動し、新たに作成されたインスタンスを見つけることで、進捗を表示できます。

検証

Automation Hub から Ansible Automation Platform Operator のインストールによって提供される以下の Operator Pod が実行されていることを確認します。

Operator マネージャーコントローラーautomation controllerautomation hub

3 つの各 Operator の Operator マネージャーコントローラーには、以下が含まれます。

  • automation-controller-operator-controller-manager
  • automation-hub-operator-controller-manager
  • resource-operator-controller-manager

自動化コントローラーのデプロイ後に、これらの Pod が追加されていることを確認できます。

  • controller
  • controller-postgres

Automation Hub のデプロイ後に、これらの Pod が追加されていることを確認できます。

  • hub-api
  • hub-content
  • hub-postgres
  • hub-redis
  • hub-worker
注記

Pod が見つからない場合は、プルシークレットが必要であることを示している可能性があります。プルシークレットは、保護されたイメージレジストリーまたはプライベートイメージレジストリーに必要です。詳細は、イメージプルシークレットの使用 を参照してください。oc describe pod <pod-name> を実行して、その Pod に ImagePullBackOff エラーがあるかどうかを確認することで、この問題をさらに診断できます。

Automation Hub Operator を設定したら、フォームビューの下部にある Create をクリックします。Red Hat OpenShift Container Platform は Pod を作成します。これには数分の時間がかかる場合があります。

  • WorkloadsPods に移動し、新たに作成されたインスタンスの場所を特定して、進捗を表示します。

4.3. Automation Hub ユーザーインターフェイスへのアクセス

すべての Pod が正常に起動されると、Automation Hub インターフェイスにアクセスできます。

  1. NetworkingRoutes に移動します。
  2. の下でLocation で、Automation Hub インスタンスの URL をクリックします。

Automation Hub のユーザーインターフェイスが起動し、Operator の設定プロセス中に指定された管理者の認証情報を使用してサインインできます。

注記

設定中に管理者パスワードを指定しなかった場合は、自動的に作成されます。このパスワードを確認するには、プロジェクトに移動し、WorkloadsSecrets を選択して、controller-admin-password を開きます。そこからパスワードをコピーして、Automation Hub のパスワードフィールドに貼り付けることができます。

4.4. Red Hat Ansible Automation Platform オペレーターでの Automation Hub 用の外部データベースの設定

外部データベースを使用して Ansible Automation Platform をデプロイすることを希望するユーザーは、インスタンスの認証情報と接続情報を使用してシークレットを設定し、oc create コマンドを使用してクラスターに適用するとデプロイできるようになります。

デフォルトでは、Red Hat Ansible Automation Platform オペレーターは、Ansible Automation Platform デプロイメントと同じ名前空間でマネージド PostgreSQLPod を自動的に作成および設定します。

専用のノードを使用して専用のリソースを確保する場合や、バックアップ、アップグレード、またはパフォーマンス調整を手動で管理する場合は、代わりに外部データベースを選択できます。

注記

データベース名が異なる限り、Automation Hub と自動化コントローラーの両方に同じ外部データベース (PostgreSQL インスタンス) を使用できます。つまり、単一の PostgreSQL インスタンス内に異なる名前のデータベースを複数指定できます。

次のセクションでは、Ansible Automation Platform オペレーターで Automation Hub の外部データベースを設定する手順の概要を説明します。

前提条件

外部データベースは、Ansible Automation Platform の現在のリリースでサポートされているバージョンの PostgreSQL データベースである必要があります。

注記

Ansible Automation Platform 2.0 および 2.1 は PostgreSQL 12 をサポートしています。

手順

外部の postgres インスタンスのクレデンシャルと接続情報はシークレットに保存する必要があります。シークレットは Automation Hub の仕様に設定されます。

  1. 以下のテンプレートに従って、.yaml ファイル postgres_configuration_secret を作成します。

    apiVersion: v1
    kind: Secret
    metadata:
      name: external-postgres-configuration
      namespace: <target_namespace> 1
    stringData:
      host: "<external_ip_or_url_resolvable_by_the_cluster>" 2
      port: "<external_port>" 3
      database: "<desired_database_name>"
      username: "<username_to_connect_as>"
      password: "<password_to_connect_with>" 4
      sslmode: "prefer" 5
      type: "unmanaged"
    type: Opaque
    1
    シークレットを作成する名前空間。これは、デプロイ先の名前空間と同じにする必要があります。
    2
    データベースノードの解決可能なホスト名。
    3
    外部ポートのデフォルトは 5432 です。
    4
    変数 password の値には、デプロイメント、バックアップ、または復元中の問題を回避するために、一重引用符 (') 、二重引用符 (")、またはバックスラッシュ (\) を含めないでください。
    5
    変数 sslmode は、external データベースに対してのみ有効です。許可される値は次のとおりです。preferdisableallowrequireverify-ca、および verify-full
  2. oc create コマンドを使用して、external-postgres-configuration-secret.yml をクラスターに適用します。

    $ oc create -f external-postgres-configuration-secret.yml
  3. AutomationHub カスタムリソースオブジェクトを作成するときは、以下の例に従って、仕様にシークレットを指定します。

    apiVersion: awx.ansible.com/v1beta1
    kind: AutomationHub
    metadata:
      name: hub-dev
    spec:
      postgres_configuration_secret: external-postgres-configuration

4.5. PVC の検索および削除

Persistent Volume Claim (PVC) は、Automation Hub および自動化コントローラーアプリケーションが使用するデータを保存するために使用されるストレージボリュームです。これらの PVC はアプリケーションから独立しており、アプリケーションが削除されてもそのまま残ります。PVC が必要なくなるか、PVC のバックアップを別の場所に保存している場合は手動で削除できます。

手順

  1. デプロイメント namespace にある既存 PVC を一覧表示します。

    oc get pvc -n <namespace>
  2. 以前のデプロイメント名と PVC 名を比較して、以前のデプロイメントに関連付けられている PVC を特定します。
  3. 以前の PVC を削除します。

    oc delete pvc -n <namespace> <pvc-name>

    追加リソース

第5章 OpenShift Container Platform CLI からの Ansible Automation Platform Operator のインストール

以下の手順に従って、oc コマンドを使用して、OpenShift Container Platform コマンドラインインターフェイス (CLI) から Red Hat OpenShift Container Platform に Ansible Automation Platform Operator をインストールします。

5.1. 前提条件

  • Operator をインストールするパーミッションを持つアカウントを使用して Red Hat OpenShift Container Platform にアクセスできる。
  • OpenShift Container Platform CLI oc コマンドがローカルシステムにインストールされている。詳細は、Red Hat OpenShift Container Platform の製品ドキュメントの Installing the OpenShift CLI を参照してください。

5.2. OpenShift Container Platform CLI を使用した namespace の Operator へのサブスクライブ

  1. Operator にプロジェクトを作成します。

    oc new-project ansible-automation-platform
  2. sub.yaml という名前のファイルを作成します。
  3. 以下の YAML コードを sub.yaml ファイルに追加します。

    ---
    apiVersion: v1
    kind: Namespace
    metadata:
      labels:
        openshift.io/cluster-monitoring: "true"
      name: ansible-automation-platform
    ---
    apiVersion: operators.coreos.com/v1
    kind: OperatorGroup
    metadata:
      name: ansible-automation-platform-operator
      namespace: ansible-automation-platform
    spec:
      targetNamespaces:
        - ansible-automation-platform
    ---
    apiVersion: operators.coreos.com/v1alpha1
    kind: Subscription
    metadata:
      name: ansible-automation-platform
      namespace: ansible-automation-platform
    spec:
      channel: 'stable-2.1'
      installPlanApproval: Automatic
      name: ansible-automation-platform-operator
      source: redhat-operators
      sourceNamespace: openshift-marketplace
    ---
    apiVersion: automationcontroller.ansible.com/v1beta1
    kind: AutomationController
    metadata:
      name: example
      namespace: ansible-automation-platform
    spec:
      replicas: 1

    このファイルは、Subscription オブジェクトを作成します。ansible-automation-platformansible-automation-platform namespace を ansible-automation-platform-operator Operator にサブスクライブします。

    次に、AutomationController オブジェクトを作成します。exampleansible-automation-platform namespace で。

    Automation Controller 名を変更するには、examplenamesub.yamlkind: AutomationController セクションのフィールドを編集し、<automation_controller_name> を使用する名前に置き換えます。

    apiVersion: automationcontroller.ansible.com/v1beta1
    kind: AutomationController
    metadata:
      name: <automation_controller_name>
      namespace: ansible-automation-platform
  4. 実行します。oc applysub.yaml ファイルで指定されたオブジェクトを作成するコマンド:

    oc apply -f sub.yaml

namespace が ansible-automation-platform-operator Operator に正常にサブスクライブされたことを確認するには、次のコマンドを実行します。oc get subs コマンド:

$ oc get subs -n ansible-automation-platform

namespace を Operator にサブスクライブする方法の詳細については、Red Hat OpenShift Container Platform で CLI を使用して OperatorHub からインストールする を参照してください。Operators ガイド。

OpenShift Container Platform CLI を使用して、作成した自動化コントローラーの Web アドレスとパスワードを取得できます。

5.3. OpenShift Container Platform CLI からの自動化コントローラーログインの詳細の取得

自動化コントローラーにログインするには、Web アドレスとパスワードが必要です。

5.3.1. 自動化コントローラーの Web アドレスの取得

Red Hat OpenShift Container Platform ルートは、外部クライアントが名前でサービスに到達できるように、ホスト名でサービスを公開します。自動化コントローラーインスタンスを作成した時に、そのルートが作成されました。ルートは、YAML ファイルで自動化コントローラーオブジェクトに割り当てた名前を継承します。

以下のコマンドを使用してルートを取得します。

oc get routes -n <controller_namespace>

次の例では、exampleAutomation Controller は で実行されています。ansible-automation-platform namespace。

$ oc get routes -n ansible-automation-platform

NAME      HOST/PORT                                              PATH   SERVICES          PORT   TERMINATION     WILDCARD
example   example-ansible-automation-platform.apps-crc.testing          example-service   http   edge/Redirect   None

自動化コントローラーインスタンスのアドレスは、example-ansible-automation-platform.apps-crc.testing です。

5.3.2. 自動化コントローラーのパスワードの取得

sub.yaml の Automation Controller インスタンスの YAML ブロックは、 に値を割り当てます。name および admin_user キー。以下のコマンドのこれらの値を使用して、自動化コントローラーインスタンスのパスワードを取得します。

oc get secret/<controller_name>-<admin_user>-password -o yaml

のデフォルト値admin_useradminsub.yaml で admin ユーザー名を変更した場合は、コマンドを変更します。

次の例では、Automation Controller オブジェクトのパスワードを取得します。example:

oc get secret/example-admin-password -o yaml

自動化コントローラーインスタンスのパスワードは、出力の metadata フィールドに表示されます。

$ oc get secret/example-admin-password -o yaml

apiVersion: v1
data:
  password: ODzLODzLODzLODzLODzLODzLODzLODzLODzLODzLODzL
kind: Secret
metadata:
  annotations:
    kubectl.kubernetes.io/last-applied-configuration: '{"apiVersion":"v1","kind":"Secret","metadata":{"labels":{"app.kubernetes.io/component":"automationcontroller","app.kubernetes.io/managed-by":"automationcontroller-operator","app.kubernetes.io/name":"example","app.kubernetes.io/operator-version":"","app.kubernetes.io/part-of":"example"},"name":"example-admin-password","namespace":"ansible-automation-platform"},"stringData":{"password":"88TG88TG88TG88TG88TG88TG88TG88TG"}}'
  creationTimestamp: "2021-11-03T00:02:24Z"
  labels:
    app.kubernetes.io/component: automationcontroller
    app.kubernetes.io/managed-by: automationcontroller-operator
    app.kubernetes.io/name: example
    app.kubernetes.io/operator-version: ""
    app.kubernetes.io/part-of: example
  name: example-admin-password
  namespace: ansible-automation-platform
  resourceVersion: "185185"
  uid: 39393939-5252-4242-b929-665f665f665f

この例では、パスワードは 88TG88TG88TG88TG88TG88TG88TG88TG です。

5.4. 関連情報

第6章 Automation Hub での Red Hat Single Sign-On Operator の使用

Private Automation Hub は、認証に Red Hat Single Sign-On を使用します。

Red Hat Single Sign-On Operator はリソースを作成および管理します。この Operator を使用してカスタムリソースを作成し、Openshift で Red Hat Single Sign-On 管理を自動化します。

  • Ansible Automation Platform をインストールする場合 Virtual Machines (VM) インストーラーは、Private Automation Hub で使用する Red Hat Single Sign-On を自動的にインストールおよび設定できます。
  • Ansible Automation Platform を Red Hat OpenShift Container Platform にインストールする場合は、Single Sign-On を個別にインストールする必要があります。

この章では、Red Hat Single Sign-On を設定し、Ansible Automation Platform が OpenShift Container Platform にインストールされている場合に Private Automation Hub と統合するプロセスについて説明します。

前提条件

  • Operator をインストールするパーミッションを持つアカウントを使用して Red Hat OpenShift Container Platform にアクセスできる。
  • Red Hat Ansible Automation Platform Operator が含まれるカタログをインストールしている。
  • Red Hat Single Sign-On Operator をインストールしている。Red Hat Single Sign-On Operator をインストールするには、Red Hat Single Sign-On ドキュメントの カスタムリソースを使用した Red Hat Single Sign-On のインストール の手順に従います。

6.1. Keycloak インスタンスの作成

Red Hat Single Sign-On Operator のインストール時に、Ansible Automation Platform で使用する Keycloak インスタンスを作成できます。

ここから、外部の Postgres を指定するか、指定しないは作成されます。

手順

  1. OperatorInstalled Operators に移動します。
  2. rh-sso プロジェクトを選択します。
  3. 上でRed Hat Single Sign-On Operator をクリックします。
  4. Red Hat Single Sign-On Operator の詳細ページで、Keycloak を選択します。
  5. Create instance をクリックします。
  6. YAML ビュー をクリックします。

    デフォルトの Keycloak カスタムリソースは次のとおりです。

    apiVersion: keycloak.org/v1alpha1
    kind: Keycloak
    metadata:
      name: example-keycloak
      labels:
    	app: sso
      namespace: aap
    spec:
      externalAccess:
    	enabled: true
      instances: 1
  7. Createをクリックします。
  8. デプロイメントが完了すると、この認証情報を使用して管理コンソールにログインできます。
  9. 管理者の認証情報は、namespace の credential-<custom-resource> (keycloak の例) シークレットにあります。

6.2. Ansible Automation Platform の Keycloak レルムの作成

ユーザー、認証情報、ロール、およびグループのセットを管理するレルムを作成します。ユーザーはレルムに属し、レルムにログインします。レルムは相互に分離され、制御するユーザーのみを管理および認証できます。

手順

  1. OperatorInstalled Operators に移動します。
  2. 上でRed Hat Single Sign-On Operator プロジェクト。
  3. 上でKeycloak Realm タブをクリックし、Create Keycloak Realm をクリックします。
  4. 上でKeycloak Realm フォームで、YAML ビュー を選択します。YAML ファイルを次のように編集します。

    kind: KeycloakRealm
    apiVersion: keycloak.org/v1alpha1
    metadata:
      name: ansible-automation-platform-keycloakrealm
      namespace: rh-sso
      labels:
        app: sso
        realm: ansible-automation-platform
    spec:
      realm:
        id: ansible-automation-platform
        realm: ansible-automation-platform
        enabled: true
        displayName: {PlatformNameShort}
      instanceSelector:
        matchLabels:
          app: sso

    Field

    Description

    metadata.name

    設定リソース (CR) の名前のメタデータに一意の値を設定します。

    metadata.namespace

    設定リソース (CR) の名前のメタデータに一意の値を設定します。

    metadata.labels.app

    ラベルを一意の値に設定します。これは、クライアント CR を作成するときに使用されます。

    metadata.labels.realm

    ラベルを一意の値に設定します。これは、クライアント CR を作成するときに使用されます。

    spec.realm.id

    レルム名と ID を設定します。同じものを設定する必要があります。

    spec.realm.realm

    レルム名と ID を設定します。同じものを設定する必要があります。

    spec.realm.displayname

    表示する名前を設定します。

  5. Create をクリックし、プロセスが完了するまで待ちます。

6.3. Keycloak クライアントの作成

Keycloak クライアントは、Red Hat Single Sign-On を使用してハブユーザーを認証します。ユーザーが認証すると、リクエストは Keycloak クライアントを通過します。Single Sign-On が OAuth トークンを検証または発行すると、クライアントは Automation Hub に応答を提供し、ユーザーはログインできるようになります。

手順

  1. OperatorInstalled Operators に移動します。
  2. Red Hat Single Sign-On Operator プロジェクトを選択します。
  3. 上でKeycloak Client タブをクリックし、Create Keycloak Client をクリックします。
  4. Keycloak Realm フォームで、YAML view を選択します。
  5. デフォルトの YAML ファイルを次のものに置き換えます。

    kind: KeycloakClient
    apiVersion: keycloak.org/v1alpha1
    metadata:
      name: automation-hub-client-secret
      labels:
        app: sso
        realm: ansible-automation-platform
      namespace: rh-sso
    spec:
      realmSelector:
        matchLabels:
          app: sso
          realm: ansible-automation-platform
      client:
        name: Automation Hub
        clientId: automation-hub
        secret: <client-secret>                        1
        clientAuthenticatorType: client-secret
        description: Client for {HubNameStart}
        attributes:
          user.info.response.signature.alg: RS256
          request.object.signature.alg: RS256
        directAccessGrantsEnabled: true
        publicClient: true
        protocol: openid-connect
        standardFlowEnabled: true
        protocolMappers:
          - config:
              access.token.claim: "true"
              claim.name: "family_name"
              id.token.claim: "true"
              jsonType.label: String
              user.attribute: lastName
              userinfo.token.claim: "true"
            consentRequired: false
            name: family name
            protocol: openid-connect
            protocolMapper: oidc-usermodel-property-mapper
          - config:
              userinfo.token.claim: "true"
              user.attribute: email
              id.token.claim: "true"
              access.token.claim: "true"
              claim.name: email
              jsonType.label: String
            name: email
            protocol: openid-connect
            protocolMapper: oidc-usermodel-property-mapper
            consentRequired: false
          - config:
              multivalued: "true"
              access.token.claim: "true"
              claim.name: "resource_access.${client_id}.roles"
              jsonType.label: String
            name: client roles
            protocol: openid-connect
            protocolMapper: oidc-usermodel-client-role-mapper
            consentRequired: false
          - config:
              userinfo.token.claim: "true"
              user.attribute: firstName
              id.token.claim: "true"
              access.token.claim: "true"
              claim.name: given_name
              jsonType.label: String
            name: given name
            protocol: openid-connect
            protocolMapper: oidc-usermodel-property-mapper
            consentRequired: false
          - config:
              id.token.claim: "true"
              access.token.claim: "true"
              userinfo.token.claim: "true"
            name: full name
            protocol: openid-connect
            protocolMapper: oidc-full-name-mapper
            consentRequired: false
          - config:
              userinfo.token.claim: "true"
              user.attribute: username
              id.token.claim: "true"
              access.token.claim: "true"
              claim.name: preferred_username
              jsonType.label: String
            name: <username>
            protocol: openid-connect
            protocolMapper: oidc-usermodel-property-mapper
            consentRequired: false
          - config:
              access.token.claim: "true"
              claim.name: "group"
              full.path: "true"
              id.token.claim: "true"
              userinfo.token.claim: "true"
            consentRequired: false
            name: group
            protocol: openid-connect
            protocolMapper: oidc-group-membership-mapper
          - config:
              multivalued: 'true'
              id.token.claim: 'true'
              access.token.claim: 'true'
              userinfo.token.claim: 'true'
              usermodel.clientRoleMapping.clientId:  '{HubName}'
              claim.name: client_roles
              jsonType.label: String
            name: client_roles
            protocolMapper: oidc-usermodel-client-role-mapper
            protocol: openid-connect
          - config:
              id.token.claim: "true"
              access.token.claim: "true"
              included.client.audience: '{HubName}'
            protocol: openid-connect
            name: audience mapper
            protocolMapper: oidc-audience-mapper
      roles:
        - name: "hubadmin"
          description: "An administrator role for {HubNameStart}"
    1
    これを一意の値に置き換えます。
  6. Create をクリックし、プロセスが完了するまで待ちます。

Automation Hub がデプロイされたら、Red Hat Single Sign-On クライアントの更新 で説明されているように、有効なリダイレクト URI と Web オリジンでクライアントを更新する必要があります。さらに、クライアントにはトークンマッパーが事前設定されています。認証プロバイダーがグループデータを Red Hat SSO に提供しない場合は、その情報がどのように渡されるかを反映するようにグループマッピングを更新する必要があります。これは通常、ユーザー属性によるものです。

6.4. Keycloak ユーザーの作成

この手順では、スーパー管理者権限で Automation Hub にログインできる、hubadmin ロールを持つ Keycloak ユーザーを作成します。

手順

  1. OperatorInstalled Operators に移動します。
  2. Red Hat Single Sign-On Operator プロジェクトを選択します。
  3. 上でKeycloak Realm タブをクリックし、Create Keycloak User をクリックします。
  4. 上でKeycloak User フォームで、YAML ビュー を選択します。
  5. デフォルトの YAML ファイルを次のものに置き換えます。

    apiVersion: keycloak.org/v1alpha1
    kind: KeycloakUser
    metadata:
      name: hubadmin-user
      labels:
        app: sso
        realm: ansible-automation-platform
      namespace: rh-sso
    spec:
      realmSelector:
        matchLabels:
          app: sso
          realm: ansible-automation-platform
      user:
        username: hub_admin
        firstName: Hub
        lastName: Admin
        email: hub_admin@example.com
        enabled: true
        emailVerified: false
        credentials:
          - type: password
            value: <ch8ngeme>
        clientRoles:
          automation-hub:
            - hubadmin
  6. Create をクリックし、プロセスが完了するまで待ちます。

ユーザーが作成されると、Operator は credential-<realm name>-<username>-<namespace> という命名パターンを使用してユーザー名とパスワードの両方を含む Secret を作成します。この例では、認証情報は credential-ansible-automation-platform-hub-admin-rh-sso と呼ばれます。ユーザーが作成されると、Operator はユーザーのパスワードを更新しません。パスワードの変更はシークレットに反映されません。

6.5. Ansible Automation Platform Operator のインストール

手順

  1. OperatorOperator Hub に移動し、Ansible Automation Platform Operator を検索します。
  2. Ansible Automation Platform Operator プロジェクトを選択します。
  3. Operator タイルをクリックします。
  4. Install をクリックします。
  5. Operator をインストールするプロジェクトを選択します。Red Hat は、Operator が推奨するネームスペース名を使用することを推奨しています。

    1. Operator を推奨プロジェクト以外のプロジェクトにインストールする場合は、 を選択します。Create Project ドロップダウンメニューから。
    2. プロジェクト名を入力します。
    3. Create をクリックします。
  6. Install をクリックします。
  7. Operator がインストールされたら、View Operator をクリックします。

6.6. Red Hat Single Sign-On 接続シークレットの作成

手順

  1. https://<sso_host>/auth/realms/ansible-automation-platform に移動します。
  2. public_key 値をコピーします。
  3. OpenShift Web UI で、WorkloadsSecrets に移動します。
  4. 上でansible-automation-platform プロジェクト。
  5. Create をクリックし、From YAML を選択します。
  6. 次の YAML を編集してシークレットを作成します。

    apiVersion: v1
    kind: Secret
    metadata:
      name: automation-hub-sso                       1
      namespace: ansible-automation-platform
    type: Opaque
    stringData:
      keycloak_host: "keycloak-rh-sso.apps-crc.testing"
      keycloak_port: "443"
      keycloak_protocol: "https"
      keycloak_realm: "ansible-automation-platform"
      keycloak_admin_role: "hubadmin"
      social_auth_keycloak_key: "automation-hub"
      social_auth_keycloak_secret: "client-secret"   2
      social_auth_keycloak_public_key: >-            3
    1
    この名前は、Automation Hub インスタンスを作成する際の次のステップで使用されます。
    2
    Automation Hub 用の Keycloak クライアントを作成するときにシークレットが変更した場合は、必ずこの値を変更して一致させます。
    3
    Ansible Automation Platform Operator のインストール でコピーした public_key の値を入力します。
  7. Create をクリックし、プロセスが完了するまで待ちます。

6.7. Operator を使用した Automation Hub のインストール

Operator を使用して Automation Hub をインストールするには、以下の手順を使用します。

手順

  1. OperatorInstalled Operators に移動します。
  2. Ansible Automation Platform を選択します。
  3. Automation Hub タブを選択し、Automation Hub の作成をクリックします。
  4. YAML view を選択します。YAML は次のようになります。

    apiVersion: automationhub.ansible.com/v1beta1
    kind: AutomationHub
    metadata:
      name: private-ah                              1
      namespace: ansible-automation-platform
    spec:
      sso_secret: automation-hub-sso                2
      pulp_settings:
        verify_ssl: false
      route_tls_termination_mechanism: Edge
      ingress_type: Route
      loadbalancer_port: 80
      file_storage_size: 100Gi
      image_pull_policy: IfNotPresent
      web:
        replicas: 1
      file_storage_access_mode: ReadWriteMany
      content:
        log_level: INFO
        replicas: 2
      postgres_storage_requirements:
        limits:
          storage: 50Gi
        requests:
          storage: 8Gi
      api:
        log_level: INFO
        replicas: 1
      postgres_resource_requirements:
        limits:
          cpu: 1000m
          memory: 8Gi
        requests:
          cpu: 500m
          memory: 2Gi
      loadbalancer_protocol: http
      resource_manager:
        replicas: 1
      worker:
        replicas: 2
    1
    インスタンスに使用する名前に metadata.name を設定します。
    2
    spec.sso_secret を、Red Hat Single Sign On 接続の詳細を保持するためにシークレットを作成 で作成したシークレットの名前に設定します。
    注記

    この YAML は SSL 検証をオフにします (ssl_verify: false)。OpenShift に自己署名証明書を使用していない場合は、この設定を削除できます。

  5. Create をクリックし、プロセスが完了するまで待ちます。

6.8. Automation Hub ルートの決定

ハブルートを決定するには、次の手順を使用します。

手順

  1. NetworkingRoutes に移動します。
  2. インストールに使用したプロジェクトを選択します。
  3. private-ah-web-svc サービスの場所をコピーします。Automation Hub インスタンスの作成時に別の名前を使用した場合は、サービスの名前が異なります。これは、後で Red Hat Single Sign-On クライアントを更新するために使用されます。

6.9. Red Hat Single Sign-On クライアントの更新

Automation Hub がインストールされ、インスタンスの URL がわかっている場合は、Red Hat Single Sign-On を更新して、有効なリダイレクト URI と Web オリジンの設定を設定する必要があります。

手順

  1. OperatorInstalled Operators に移動します。
  2. RH-SSO プロジェクトを選択します。
  3. Red Hat Single Sign-On Operator をクリックします。
  4. Keycloak クライアント を選択します。
  5. Automation-hub-client-secret クライアントをクリックします。
  6. YAML を選択します。
  7. クライアント YAML を更新して、有効なリダイレクト URI と Web オリジンの設定を追加します。

    redirectUris:
      - 'https://private-ah-ansible-automation-platform.apps-crc.testing/*'
    webOrigins:
      - 'https://private-ah-ansible-automation-platform.apps-crc.testing'

    Field

    Description

    redirectURIs

    これは、Automation Hub ルート の決定 で決定された場所です。/* を redirectUris 設定の末尾に必ず追加してください。

    webOrigins

    これは、Automation Hub ルート の決定 で決定された場所です。

    注記

    これらの設定を入力するときは、インデントが正しいことを確認してください。

  8. Save をクリックします。

接続を確認するには

  1. Automation Hub ルートに移動します。
  2. hub_admin ユーザー認証情報を入力してサインインします。
  3. Red Hat Single Sign-On は認証を処理し、Automation Hub にリダイレクトします。

6.10. 関連情報

法律上の通知

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.