第6章 移行元の環境
既存の Ansible Automation Platform デプロイメントからデータを準備してエクスポートします。エクスポートしたデータは、新しい環境の設定に使用する重要な移行アーティファクトとなります。
6.1. RPM ベースの Ansible Automation Platform
RPM ベースの Ansible Automation Platform デプロイメントからデータを準備してエクスポートします。
6.1.1. 移行元の環境の準備と評価
移行を開始する前に、現在の RPM デプロイメントをドキュメント化します。このドキュメントは、移行プロセス全体を通してリファレンスとして機能し、移行先の環境を適切に設定するために重要です。
手順
現在の RPM デプロイメントのトポロジー全体をドキュメント化します。
- すべてのサーバー、ノード、およびそれらのロール (コントロールノード、実行ノード、データベースサーバーなど) を詳細に描写します。
- デプロイメント内の各サーバーのホスト名、IP アドレス、および機能を記録します。
- コンポーネント間のネットワーク設定をドキュメント化します。
Ansible Automation Platform のバージョン情報:
- 現在デプロイされている Ansible Automation Platform の正確なバージョン (X.Y) を記録します。
各コンポーネントの特定のバージョンをドキュメント化します。
- Automation Controller のバージョン
- Automation Hub のバージョン
- プラットフォームゲートウェイのバージョン
データベースの設定:
- 各コンポーネントのデータベース名
- データベースのユーザーとロール
- 接続パラメーターと認証方法
- カスタムの PostgreSQL 設定または最適化
6.1.2. 移行元の環境のエクスポート
移行元の環境から、移行に必要なデータと設定をエクスポートします。
手順
PostgreSQL データベースのバージョンが PostgreSQL バージョン 15 であることを確認します。
データベースサーバーに接続し、
postgres
ユーザーとして次のコマンドを実行すると、現在の PostgreSQL バージョンを確認できます。psql -c 'SELECT version();'
$ psql -c 'SELECT version();'
Copy to Clipboard Copied! 重要移行プロセスを正常に実行するには、PostgreSQL バージョン 15 が厳密に要求されます。PostgreSQL 13 以前を実行している場合は、移行を続行する前にバージョン 15 にアップグレードしてください。
Ansible Automation Platform によって管理されるデータベースを使用している場合は、インストールプログラムを再実行して PostgreSQL バージョンをアップグレードしてください。お客様提供の (外部) データベースを使用している場合は、データベース管理者またはサービスプロバイダーに連絡してバージョンを確認し、必要に応じてアップグレードの準備をしてください。
移行元の環境の完全なバックアップを作成します。
./setup.sh -e 'backup_dest=/path/to/backup_dir/' -b
$ ./setup.sh -e 'backup_dest=/path/to/backup_dir/' -b
Copy to Clipboard Copied! 各コンポーネントグループの 1 つのノードから接続設定を取得します。
コマンドごとに、ホストにアクセスして
root
ユーザーになります。Automation Controller ノードにアクセスして、次のコマンドを実行します。
awx-manage print_settings | grep '^DATABASES'
# awx-manage print_settings | grep '^DATABASES'
Copy to Clipboard Copied! Automation Hub ノードにアクセスして、次のコマンドを実行します。
grep '^DATABASES' /etc/pulp/settings.py
# grep '^DATABASES' /etc/pulp/settings.py
Copy to Clipboard Copied! プラットフォームゲートウェイノードにアクセスして、次のコマンドを実行します。
aap-gateway-manage print_settings | grep '^DATABASES'
# aap-gateway-manage print_settings | grep '^DATABASES'
Copy to Clipboard Copied!
手動で作成したアーティファクトをプラットフォームゲートウェイノードに一時的に配置します。
mkdir -p /tmp/backups/artifact/{controller,gateway,hub}
# mkdir -p /tmp/backups/artifact/{controller,gateway,hub}
Copy to Clipboard Copied! mkdir -p /tmp/backups/artifact/controller/custom_configs
# mkdir -p /tmp/backups/artifact/controller/custom_configs
Copy to Clipboard Copied! touch /tmp/backups/artifact/secrets.yml
# touch /tmp/backups/artifact/secrets.yml
Copy to Clipboard Copied! cd /tmp/backups/artifact/
# cd /tmp/backups/artifact/
Copy to Clipboard Copied! データベースのサイズを検証し、ファイルシステムに
pg_dump
用の十分な領域があることを確認します。データベースサーバーに接続し、
postgres
ユーザーとして次のコマンドを実行すると、データベースのサイズを確認できます。psql -c '\l+'
$ psql -c '\l+'
Copy to Clipboard Copied! 次のステップを実行する前に、必要に応じてファイルシステムのサイズを調整するか、外部ファイルシステムをマウントします。
注記この手順では、すべてのターゲットファイルが
/tmp
ファイルシステムに送信されることを前提としています。実際の環境のニーズに合わせてコマンドを調整する必要があります。プラットフォームゲートウェイノードで、すべてのコンポーネントのデータベースダンプを実行し、作成したアーティファクト内に保存します。
psql -h <pg_hostname> -U <component_pg_user> -d <database_name> -t -c 'SHOW server_version;' # ensure connectivity to the database
# psql -h <pg_hostname> -U <component_pg_user> -d <database_name> -t -c 'SHOW server_version;' # ensure connectivity to the database
Copy to Clipboard Copied! pg_dump -h <pg_hostname> -U <component_pg_user> -d <component_pg_name> --clean --create -Fc -f <component>/<component>.pgc
# pg_dump -h <pg_hostname> -U <component_pg_user> -d <component_pg_name> --clean --create -Fc -f <component>/<component>.pgc
Copy to Clipboard Copied! ls -ld <component>/<component>.pgc
# ls -ld <component>/<component>.pgc
Copy to Clipboard Copied! echo "<component>_pg_database: <database_name>" >> secrets.yml ## Add the database name for the component to the secrets file
# echo "<component>_pg_database: <database_name>" >> secrets.yml ## Add the database name for the component to the secrets file
Copy to Clipboard Copied! 各コンポーネントグループの 1 つのノードから RPM 環境のシークレットをエクスポートします。
以下の各ステップでは、
root
ユーザーを使用してコマンドを実行します。Automation Controller ノードにアクセスし、シークレットキーを収集して、
secrets.yml
ファイルのcontroller_secret_key
値に追加します。cat /etc/tower/SECRET_KEY
# cat /etc/tower/SECRET_KEY
Copy to Clipboard Copied! Automation Hub ノードにアクセスし、シークレットキーを収集して、
secrets.yml
ファイルのhub_secret_key
値に追加します。grep 'SECRET_KEY' /etc/pulp/settings.py | awk -F'=' '{ print $2}'
# grep 'SECRET_KEY' /etc/pulp/settings.py | awk -F'=' '{ print $2}'
Copy to Clipboard Copied! Automation Hub ノードにアクセスし、
database_fields.symmetric.key
値を収集して、secrets.yml
ファイルのhub_db_fields_encryption_key
値に追加します。cat /etc/pulp/certs/database_fields.symmetric.key
# cat /etc/pulp/certs/database_fields.symmetric.key
Copy to Clipboard Copied! プラットフォームゲートウェイノードにアクセスし、シークレットキーを収集して、
secrets.yml
ファイルのgateway_secret_key
値に追加します。cat /etc/ansible-automation-platform/gateway/SECRET_KEY
# cat /etc/ansible-automation-platform/gateway/SECRET_KEY
Copy to Clipboard Copied!
Automation Controller のカスタム設定をエクスポートします。
/etc/tower/conf.d
にカスタム設定が存在する場合は、それを/tmp/backups/artifact/controller/custom_configs
にコピーします。インストールプログラムによって管理され、カスタムとはみなされない Automation Controller 上の設定ファイル:
-
/etc/tower/conf.d/postgres.py
-
/etc/tower/conf.d/channels.py
-
/etc/tower/conf.d/caching.py
-
/etc/tower/conf.d/cluster_host_id.py
-
アーティファクトをパッケージ化します。
cd /tmp/backups/artifact/
# cd /tmp/backups/artifact/
Copy to Clipboard Copied! [ -f sha256sum.txt ] && rm -f sha256sum.txt; find . -type f -name "*.pgc" -exec sha256sum {} \; >> sha256sum.txt
# [ -f sha256sum.txt ] && rm -f sha256sum.txt; find . -type f -name "*.pgc" -exec sha256sum {} \; >> sha256sum.txt
Copy to Clipboard Copied! cat sha256sum.txt
# cat sha256sum.txt
Copy to Clipboard Copied! cd
# cd
Copy to Clipboard Copied! tar cf artifact.tar artifact
# tar cf artifact.tar artifact
Copy to Clipboard Copied! sha256sum artifact.tar > artifact.tar.sha256
# sha256sum artifact.tar > artifact.tar.sha256
Copy to Clipboard Copied! sha256sum --check artifact.tar.sha256
# sha256sum --check artifact.tar.sha256
Copy to Clipboard Copied! tar tvf artifact.tar
# tar tvf artifact.tar
Copy to Clipboard Copied! tar tvf artifact.tar
の出力例:drwxr-xr-x ansible/ansible 0 2025-05-08 16:48 artifact/ drwxr-xr-x ansible/ansible 0 2025-05-08 16:33 artifact/controller/ -rw-r--r-- ansible/ansible 732615 2025-05-08 16:26 artifact/controller/controller.pgc drwxr-xr-x ansible/ansible 0 2025-05-08 16:33 artifact/controller/custom_configs/ drwxr-xr-x ansible/ansible 0 2025-05-08 16:11 artifact/gateway/ -rw-r--r-- ansible/ansible 231155 2025-05-08 16:28 artifact/gateway/gateway.pgc drwxr-xr-x ansible/ansible 0 2025-05-08 16:26 artifact/hub/ -rw-r--r-- ansible/ansible 29252002 2025-05-08 16:26 artifact/hub/hub.pgc -rw-r--r-- ansible/ansible 614 2025-05-08 16:24 artifact/secrets.yml -rw-r--r-- ansible/ansible 338 2025-05-08 16:48 artifact/sha256sum.txt
drwxr-xr-x ansible/ansible 0 2025-05-08 16:48 artifact/ drwxr-xr-x ansible/ansible 0 2025-05-08 16:33 artifact/controller/ -rw-r--r-- ansible/ansible 732615 2025-05-08 16:26 artifact/controller/controller.pgc drwxr-xr-x ansible/ansible 0 2025-05-08 16:33 artifact/controller/custom_configs/ drwxr-xr-x ansible/ansible 0 2025-05-08 16:11 artifact/gateway/ -rw-r--r-- ansible/ansible 231155 2025-05-08 16:28 artifact/gateway/gateway.pgc drwxr-xr-x ansible/ansible 0 2025-05-08 16:26 artifact/hub/ -rw-r--r-- ansible/ansible 29252002 2025-05-08 16:26 artifact/hub/hub.pgc -rw-r--r-- ansible/ansible 614 2025-05-08 16:24 artifact/secrets.yml -rw-r--r-- ansible/ansible 338 2025-05-08 16:48 artifact/sha256sum.txt
Copy to Clipboard Copied! -
artifact.tar
とartifact.tar.sha256
をローカルマシンにダウンロードするか、scp
コマンドを使用してターゲットノードに転送します。
6.1.3. 移行アーティファクトの作成と検証
移行アーティファクトを作成して検証するには、移行アーティファクトの構造と検証 の手順に従います。