7.2. OpenShift Container Platform
移行先の OpenShift Container Platform 環境を準備および評価し、移行したコンテンツをインポートして調整します。
7.2.1. 移行先環境の準備と評価 リンクのコピーリンクがクリップボードにコピーされました!
移行アーティファクトを転送し、OpenShift Container Platform プロジェクトを作成して、移行元環境に一致する設定で Operator を使用して Ansible Automation Platform をデプロイします。
手順
- Ansible Automation Platform をデプロイするために Ansible Automation Platform Operator を設定します。
- データベース設定 (内部または外部) をセットアップします。
- Redis 設定 (内部または外部) をセットアップします。
- Ansible Automation Platform Operator を使用して Ansible Automation Platform をインストールします。
- 初期の OpenShift Container Platform デプロイメントのバックアップを作成します。
- 新規インストールが正しく機能することを確認します。
7.2.2. 移行先環境への移行コンテンツのインポート リンクのコピーリンクがクリップボードにコピーされました!
環境をインポートするには、Ansible Automation Platform コンポーネントをスケールダウンし、データベースを復元して、暗号化シークレットを置き換え、サービスを再びスケールアップします。
インポートプロセスには、デフォルトの aap 名前空間内の aap という名前の最新バージョンの Ansible Automation Platform と、すべてのデフォルトのデータベース名およびデータベースユーザーが必要です。
手順
Ansible Automation Platform コンポーネントをスケールダウンします。
まず、
idle_aapを使用して Ansible Automation Platform のデプロイメントをスケールダウンします。oc patch ansibleautomationplatform aap --type merge -p '{"spec":{"idle_aap":true}}'コンポーネント Pod が停止するまで待機します。稼働し続けるのは 6 つの Operator Pod のみです。
NAME READY STATUS RESTARTS AGE pod/aap-controller-migration-4.6.13-5swc6 0/1 Completed 0 160m pod/aap-gateway-operator-controller-manager-6b75c95458-4zrxv 2/2 Running 0 26h pod/ansible-lightspeed-operator-controller-manager-b674c55b8-qncjp 2/2 Running 0 45h pod/automation-controller-operator-controller-manager-6b79d48d4cchn 2/2 Running 0 45h pod/automation-hub-operator-controller-manager-5cd674c984-5njfj 2/2 Running 0 45h pod/eda-server-operator-controller-manager-645f4db5-d2flt 2/2 Running 0 45h pod/resource-operator-controller-manager-86b8f7bb54-cvz6d 2/2 Running 0 45hAnsible Automation Platform Gateway Operator と Ansible Automation Platform Controller Operator をスケールダウンします。
oc scale --replicas=0 deployment aap-gateway-operator-controller-manager automation-controller-operator-controller-manager出力例:
deployment.apps/aap-gateway-operator-controller-manager scaled deployment.apps/automation-controller-operator-controller-manager scaled
アイドル状態の Postgres
StatefulSetをスケールアップします。oc scale --replicas=1 statefulset.apps/aap-postgres-15データベースの復元用に一時的な環境を準備します。
適切な設定とサイズで一時的な永続ボリューム要求 (PVC) を作成します。
aap-temp-pvc.yaml--- apiVersion: v1 kind: PersistentVolumeClaim metadata: name: aap-temp-pvc namespace: aap spec: accessModes: - ReadWriteOnce resources: requests: storage: 200Gioc create -f aap-temp-pvc.yaml一時的なデプロイメントに使用する既存の PostgreSQL イメージを取得します。
echo $(oc get pod/aap-postgres-15-0 -o jsonpath="{.spec.containers[].image}")マウントされた一時的な PVC を使用して一時的な PostgreSQL デプロイメントを作成します。
aap-temp-postgres.yaml--- kind: Deployment apiVersion: apps/v1 metadata: name: aap-temp-postgres spec: replicas: 1 selector: matchLabels: app: aap-temp-postgres template: metadata: labels: app: aap-temp-postgres spec: containers: - name: aap-temp-postgres image: <postgres image from previous step> command: - /bin/sh - '-c' - sleep infinity imagePullPolicy: Always securityContext: runAsNonRoot: true allowPrivilegeEscalation: false volumeMounts: - name: aap-temp-pvc mountPath: /tmp/aap-temp-pvc volumes: - name: aap-temp-pvc persistentVolumeClaim: claimName: aap-temp-pvcoc create -f aap-temp-postgres.yaml
エクスポートアーティファクトを一時的な PostgreSQL Pod にコピーします。
まず、Pod 名を取得し、それを環境変数として設定します。
export AAP_TEMP_POSTGRES=$(oc get pods --no-headers -o custom-columns="metadata.name" | grep aap-temp-postgres)環境変数をテストします。
echo $AAP_TEMP_POSTGRES出力例:
aap-temp-postgres-7b6c57f87f-s2ldpアーティファクトとチェックサムを PVC にコピーします。
oc cp artifact.tar $AAP_TEMP_POSTGRES:/tmp/aap-temp-pvc/ oc cp artifact.tar.sha256 $AAP_TEMP_POSTGRES:/tmp/aap-temp-pvc/
一時的な PostgreSQL Pod を使用して、データベースを Ansible Automation Platform の PostgreSQL に復元します。
まず、3 つのデータベースすべての PostgreSQL パスワードと PostgreSQL 管理者パスワードを取得します。
echo "" && for secret in aap-controller-postgres-configuration aap-hub-postgres-configuration aap-gateway-postgres-configuration do echo $secret echo "PASSWORD: `oc get secrets $secret -o jsonpath="{.data['password']}" | base64 -d`" echo "USER: `oc get secrets $secret -o jsonpath="{.data['username']}" | base64 -d`" echo "DATABASE: `oc get secrets $secret -o jsonpath="{.data['database']}" | base64 -d`" echo "" done && echo "POSTGRES ADMIN PASSWORD: `oc get secrets aap-gateway-postgres-configuration -o jsonpath="{.data['postgres_admin_password']}" | base64 -d`"一時的な PostgreSQL デプロイメントに入り、コピーしたアーティファクトを含むマウントされた PVC にディレクトリーを変更します。
oc exec -it deployment.apps/aap-temp-postgres -- /bin/bashPod 内で、ディレクトリーを
/tmp/aap-temp-pvcに変更し、その内容をリスト表示します。cd /tmp/aap-temp-pvc && ls -l出力例:
total 2240 -rw-r--r--. 1 1000900000 1000900000 2273280 Jun 13 17:41 artifact.tar -rw-r--r--. 1 1000900000 1000900000 79 Jun 13 17:42 artifact.tar.sha256 drwxrws---. 2 root 1000900000 16384 Jun 13 17:40 lost+foundアーカイブを検証します。
sha256sum --check artifact.tar.sha256出力例:
artifact.tar: OKアーティファクトを抽出し、その内容を確認します。
tar xf artifact.tar && cd artifact && sha256sum --check sha256sum.txt出力例:
./controller/controller.pgc: OK ./gateway/gateway.pgc: OK ./hub/hub.pgc: OKAutomation Controller のデータベースを削除します。
dropdb -h aap-postgres-15 automationcontrollerCREATEDBロールを使用してユーザーを一時的に変更します。postgres=# ALTER USER automationcontroller WITH CREATEDB;データベースを作成します。
createdb -h aap-postgres-15 -U automationcontroller automationcontroller一時的なユーザー権限を元に戻します。
postgres=# ALTER USER automationcontroller NOCREATEDB;Automation Controller のデータベースを復元します。
pg_restore --clean --create --no-owner -h aap-postgres-15 -U automationcontroller -d automationcontroller controller/controller.pgcAutomation Hub のデータベースを復元します。
pg_restore --clean --create --no-owner -h aap-postgres-15 -U automationhub -d automationhub hub/hub.pgcプラットフォームゲートウェイのデータベースを復元します。
pg_restore --clean --create --no-owner -h aap-postgres-15 -U gateway -d gateway gateway/gateway.pgcPod を終了します。
exit
データベースフィールドの暗号化シークレットを置き換え、一時リソースをクリーンアップします。
データベースフィールドの暗号化シークレットを置き換えます。
oc set data secret/aap-controller-secret-key secret_key="<unencoded controller_secret_key value from secrets.yml>"oc set data secret/aap-db-fields-encryption-secret secret_key="<unencoded gateway_secret_key value from secrets.yml>"oc set data secret/aap-hub-db-fields-encryption database_fields.symmetric.key="<unencoded hub_db_fields_encryption_key value from secrets.yml>"一時的な PostgreSQL と PVC をクリーンアップします。
oc delete -f aap-temp-postgres.yamloc delete -f aap-temp-pvc.yaml
Ansible Automation Platform コンポーネントをスケールアップして元の状態に戻します。
プラットフォームゲートウェイと Automation Controller Operator をスケールアップし、プラットフォームゲートウェイ Operator のリコンシリエーションループが完了するまで待機します。
PostgreSQL の
StatefulSetがアイドル状態に戻ります。oc scale --replicas=1 deployment aap-gateway-operator-controller-manager automation-controller-operator-controller-manager出力例:
deployment.apps/aap-gateway-operator-controller-manager scaled deployment.apps/automation-controller-operator-controller-manager scaledoc logs -f $(oc get pods --no-headers -o custom-columns=":metadata.name" | grep aap-gateway-operator)リコンシリエーションが停止するまで待ちます。
出力例:
META: ending play {"level":"info","ts":"2025-06-12T15:41:29Z","logger":"runner","msg":"Ansible-runner exited successfully","job":"5672263053238024330","name":"aap","namespace":"aap"} ----- Ansible Task Status Event StdOut (aap.ansible.com/v1alpha1, Kind=AnsibleAutomationPlatform, aap/aap) ----- PLAY RECAP ********************************************************************* localhost : ok=45 changed=0 unreachable=0 failed=0 skipped=63 rescued=0 ignored=0idle_aapを使用して Ansible Automation Platform をスケールアップして元に戻します。oc patch ansibleautomationplatform aap --type=merge -p '{"spec":{"idle_aap":false}}'出力例:
ansibleautomationplatform.aap.ansible.com/aap patched
aap-gatewayPod が実行されるまで待って、古いサービスエンドポイントをクリーンアップします。出力例:
pod/aap-gateway-6c989b846c-47b91 2/2 Running 0 45sfor i in HTTPPort Route ServiceNode; do; oc exec -it deployment.apps/aap-gateway -- aap-gateway-manage shell -c 'from aap_gateway_api.models import '$i';print('$i'.objects.all().delete())'; done出力例:
(23, {'aap_gateway_api.ServiceAPIRoute': 4, 'aap_gateway_api.AdditionalRoute': 7, 'aap_gateway_api.Route': 11, 'aap_gateway_api.HTTPPort': 1}) (0, {}) (4, {'aap_gateway_api.ServiceNode': 4})awx-manageを実行してインスタンスのプロビジョニングを解除します。Automation Controller Pod を取得します。
export AAP_CONTROLLER_POD=$(oc get pods --no-headers -o custom-columns=":metadata.name" | grep aap-controller-task)環境変数をテストします。
echo $AAP_CONTROLLER_POD出力例:
aap-controller-task-759b6d9759-r59q9Automation Controller Pod に入ります。
oc exec -it $AAP_CONTROLLER_POD -- /bin/bash awx-manage list_instances出力例:
bash-4.4$ [controlplane capacity=642 policy=100%] aap-controller-task-759b6d9759-r59q9 capacity=642 node_type=control version=4.6.15 heartbeat="2025-06-12 21:39:48" node1.example.org capacity=0 node_type=hybrid version=4.6.13 heartbeat="2025-05-30 17:22:11" [default capacity=0 policy=100%] node1.example.org capacity=0 node_type=hybrid version=4.6.13 heartbeat="2025-05-30 17:22:11" node2.example.org capacity=0 node_type=execution version=ansible-runner-2.4.1 heartbeat="2025-05-30 17:22:08"awx-manageを使用して古いノードを削除し、aap-controller-taskのみを残します。awx-manage deprovision_instance --host=node1.example.org awx-manage deprovision_instance --host=node2.example.org
curlコマンドを実行して、Automation Hub ファイルシステムのデータを修復します。curl -d '{\"verify_checksums\": true }' -X POST -k https://<aap url>/api/galaxy/pulp/api/v3/repair/ -u <admin_user>:<restored_admin_password>
7.2.3. インポート後の移行先環境の調整 リンクのコピーリンクがクリップボードにコピーされました!
移行アーティファクトをインポートした後、次の手順を実行して移行先環境を調整します。
手順
-
Django
SECRET_KEYシークレットをソースプラットフォームに合わせて変更します。 - プラットフォームゲートウェイのサービスノードをプロビジョニング解除し、再設定します。
- プラットフォームゲートウェイのノードとサービスの登録ロジックを再実行します。
- コンテナー固有の設定を OpenShift Container Platform に適した形式に変換します。
- コンテナーリソースの割り当てを、OpenShift Container Platform のリソースに合わせて調整します。
7.2.4. 移行先環境の検証 リンクのコピーリンクがクリップボードにコピーされました!
すべての Ansible Automation Platform サービスが実行されていること、認証情報が正しく機能していること、プロジェクト、インベントリー、ジョブテンプレートなどの移行されたコンテンツが OpenShift Container Platform でアクセス可能であることを確認します。
手順
- 移行したすべてのコンポーネントが機能していることを確認します。
- ワークフローと自動化プロセスをテストします。
- ユーザーのアクセスと権限を検証します。
- コンテンツの同期と利用可能性を確認します。
- OpenShift Container Platform 固有の機能との統合をテストします。