Dieser Inhalt ist in der von Ihnen ausgewählten Sprache nicht verfügbar.
Chapter 6. Source environment
Prepare and export data from your existing Ansible Automation Platform deployment. The exported data forms a critical migration artifact, which you use to configure your new environment.
6.1. RPM-based Ansible Automation Platform Link kopierenLink in die Zwischenablage kopiert!
Prepare and export data from your RPM-based Ansible Automation Platform deployment.
6.1.1. Preparing and assessing the source environment Link kopierenLink in die Zwischenablage kopiert!
Before beginning your migration, document your current RPM deployment. This documentation serves as a reference throughout the migration process and is critical for properly configuring your target environment.
Procedure
Document the full topology of your current RPM deployment:
- Map out all servers, nodes, and their roles (for example control nodes, execution nodes, database servers).
- Note the hostname, IP address, and function of each server in your deployment.
- Document the network configuration between components.
Ansible Automation Platform version information:
- Record the exact Ansible Automation Platform version (X.Y) currently deployed.
Document the specific version of each component:
- Automation controller version
- Automation hub version
- Platform gateway version
Database configuration:
- Database names for each component
- Database users and roles
- Connection parameters and authentication methods
- Any custom PostgreSQL configurations or optimizations
6.1.2. Exporting the source environment Link kopierenLink in die Zwischenablage kopiert!
From your source environment, export the data and configurations needed for migration.
Procedure
Verify the PostgreSQL database version is PostgreSQL version 15.
You can verify your current PostgreSQL version by connecting to your database server and running the following command as the
postgresuser:psql -c 'SELECT version();'
$ psql -c 'SELECT version();'Copy to Clipboard Copied! Toggle word wrap Toggle overflow ImportantPostgreSQL version 15 is a strict requirement for the migration process to succeed. If running PostgreSQL 13 or earlier, upgrade to version 15 before proceeding with the migration.
If using an Ansible Automation Platform managed database, re-run the installation program to upgrade the PostgreSQL version. If using a customer provided (external) database, contact your database administrator or service provider to confirm the version and arrange for an upgrade if required.
Create a complete backup of the source environment:
./setup.sh -e 'backup_dest=/path/to/backup_dir/' -b
$ ./setup.sh -e 'backup_dest=/path/to/backup_dir/' -bCopy to Clipboard Copied! Toggle word wrap Toggle overflow Get the connection settings from one node from each of the component groups.
For each command, access the host and become the
rootuser.Access the automation controller node and run:
awx-manage print_settings | grep '^DATABASES'
# awx-manage print_settings | grep '^DATABASES'Copy to Clipboard Copied! Toggle word wrap Toggle overflow Access the automation hub node and run:
grep '^DATABASES' /etc/pulp/settings.py
# grep '^DATABASES' /etc/pulp/settings.pyCopy to Clipboard Copied! Toggle word wrap Toggle overflow Access the platform gateway node and run:
aap-gateway-manage print_settings | grep '^DATABASES'
# aap-gateway-manage print_settings | grep '^DATABASES'Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Stage the manually created artifact on the platform gateway node.
mkdir -p /tmp/backups/artifact/{controller,gateway,hub}# mkdir -p /tmp/backups/artifact/{controller,gateway,hub}Copy to Clipboard Copied! Toggle word wrap Toggle overflow mkdir -p /tmp/backups/artifact/controller/custom_configs
# mkdir -p /tmp/backups/artifact/controller/custom_configsCopy to Clipboard Copied! Toggle word wrap Toggle overflow touch /tmp/backups/artifact/secrets.yml
# touch /tmp/backups/artifact/secrets.ymlCopy to Clipboard Copied! Toggle word wrap Toggle overflow cd /tmp/backups/artifact/
# cd /tmp/backups/artifact/Copy to Clipboard Copied! Toggle word wrap Toggle overflow Validate the database size and make sure you have enough space on the filesystem for the
pg_dump.You can verify the database sizes by connecting to your database server and running the following command as the
postgresuser:psql -c '\l+'
$ psql -c '\l+'Copy to Clipboard Copied! Toggle word wrap Toggle overflow Adjust the filesystem size or mount an external filesystem as needed before performing the next step.
NoteThis procedure assumes that all target files will be sent to the
/tmpfilesystem. You must adjust the commands to match your environment’s needs.Perform database dumps of all components on the platform gateway node within the artifact you created.
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 databaseCopy to Clipboard Copied! Toggle word wrap Toggle overflow 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>.pgcCopy to Clipboard Copied! Toggle word wrap Toggle overflow ls -ld <component>/<component>.pgc
# ls -ld <component>/<component>.pgcCopy to Clipboard Copied! Toggle word wrap Toggle overflow 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 fileCopy to Clipboard Copied! Toggle word wrap Toggle overflow Export secrets from the RPM environment from one node of each component group.
For each of the following steps, use the
rootuser to run the commands.Access the automation controller node, gather the secret key, and add it to the
controller_secret_keyvalue in thesecrets.ymlfile.cat /etc/tower/SECRET_KEY
# cat /etc/tower/SECRET_KEYCopy to Clipboard Copied! Toggle word wrap Toggle overflow Access the automation hub node, gather the secret key, and add it to the
hub_secret_keyvalue in thesecrets.ymlfile.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! Toggle word wrap Toggle overflow Access the automation hub node, gather the
database_fields.symmetric.keyvalue, and add it to thehub_db_fields_encryption_keyvalue in thesecrets.ymlfile.cat /etc/pulp/certs/database_fields.symmetric.key
# cat /etc/pulp/certs/database_fields.symmetric.keyCopy to Clipboard Copied! Toggle word wrap Toggle overflow Access the platform gateway node, gather the secret key, and add it to the
gateway_secret_keyvalue in thesecrets.ymlfile.cat /etc/ansible-automation-platform/gateway/SECRET_KEY
# cat /etc/ansible-automation-platform/gateway/SECRET_KEYCopy to Clipboard Copied! Toggle word wrap Toggle overflow
Export automation controller custom configurations.
If any custom settings exist on the
/etc/tower/conf.d, copy them to/tmp/backups/artifact/controller/custom_configs.Configuration files on automation controller that are managed by the installation program and not considered custom:
-
/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
-
Package the artifact.
cd /tmp/backups/artifact/
# cd /tmp/backups/artifact/Copy to Clipboard Copied! Toggle word wrap Toggle overflow [ -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.txtCopy to Clipboard Copied! Toggle word wrap Toggle overflow cat sha256sum.txt
# cat sha256sum.txtCopy to Clipboard Copied! Toggle word wrap Toggle overflow cd ..
# cd ..Copy to Clipboard Copied! Toggle word wrap Toggle overflow tar cf artifact.tar artifact
# tar cf artifact.tar artifactCopy to Clipboard Copied! Toggle word wrap Toggle overflow sha256sum artifact.tar > artifact.tar.sha256
# sha256sum artifact.tar > artifact.tar.sha256Copy to Clipboard Copied! Toggle word wrap Toggle overflow sha256sum --check artifact.tar.sha256
# sha256sum --check artifact.tar.sha256Copy to Clipboard Copied! Toggle word wrap Toggle overflow tar tvf artifact.tar
# tar tvf artifact.tarCopy to Clipboard Copied! Toggle word wrap Toggle overflow Example output of
tar tvf artifact.tar:Copy to Clipboard Copied! Toggle word wrap Toggle overflow -
Download the
artifact.tarandartifact.tar.sha256to your local machine or transfer to the target node with thescpcommand.
6.1.3. Creating and verifying the migration artifact Link kopierenLink in die Zwischenablage kopiert!
To create and verify the migration artifact, follow the instructions in Migration artifact structure and verification.
6.2. Container-based Ansible Automation Platform Link kopierenLink in die Zwischenablage kopiert!
Prepare and export data from your container-based Ansible Automation Platform deployment.
6.2.1. Preparing and assessing the source environment Link kopierenLink in die Zwischenablage kopiert!
Before beginning your migration, document your current containerized deployment. This documentation serves as a reference throughout the migration process and is critical for properly configuring your target environment.
Procedure
Document the full topology of your current containerized deployment:
- Map out all servers, nodes, and their roles (for example control nodes, execution nodes, database servers).
- Note the hostname, IP address, and function of each server in your deployment.
- Document the network configuration between components.
Ansible Automation Platform version information:
- Record the exact Ansible Automation Platform version (X.Y) currently deployed.
Document the specific version of each component:
- Automation controller version
- Automation hub version
- Platform gateway version
Database configuration:
- Database names for each component
- Database users and roles
- Connection parameters and authentication methods
- Any custom PostgreSQL configurations or optimizations
- Identify all custom configurations and settings
- Document container resource allocations and volumes
6.2.2. Exporting the source environment Link kopierenLink in die Zwischenablage kopiert!
From your source environment, export the data and configurations needed for migration.
Procedure
Verify the PostgreSQL database version is PostgreSQL version 15.
You can verify your current PostgreSQL version by connecting to your database server and running the following command as the
postgresuser:podman exec -it postgresql bash -c 'psql -c "SELECT version();"'
$ podman exec -it postgresql bash -c 'psql -c "SELECT version();"'Copy to Clipboard Copied! Toggle word wrap Toggle overflow ImportantPostgreSQL version 15 is a strict requirement for the migration process to succeed. If running PostgreSQL 13 or earlier, upgrade to version 15 before proceeding with the migration.
If using an Ansible Automation Platform managed database, re-run the installation program to upgrade the PostgreSQL version. If using a customer provided (external) database, contact your database administrator or service provider to confirm the version and arrange for an upgrade if required.
Create a complete backup of the source environment:
ansible-playbook -i <path_to_inventory> ansible.containerized_installer.backup
$ ansible-playbook -i <path_to_inventory> ansible.containerized_installer.backupCopy to Clipboard Copied! Toggle word wrap Toggle overflow Get the connection settings from one node in each of the component groups.
Access the automation controller node and run:
podman exec -it automation-controller-task bash -c 'awx-manage print_settings | grep '^DATABASES'
$ podman exec -it automation-controller-task bash -c 'awx-manage print_settings | grep '^DATABASES'Copy to Clipboard Copied! Toggle word wrap Toggle overflow Access the automation hub node and run:
podman exec -it automation-hub-api bash -c "pulpcore-manager diffsettings | grep '^DATABASES'"
$ podman exec -it automation-hub-api bash -c "pulpcore-manager diffsettings | grep '^DATABASES'"Copy to Clipboard Copied! Toggle word wrap Toggle overflow Access the platform gateway node and run:
podman exec -it automation-gateway bash -c "aap-gateway-manage print_settings | grep '^DATABASES'"
$ podman exec -it automation-gateway bash -c "aap-gateway-manage print_settings | grep '^DATABASES'"Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Validate the database size and make sure you have enough space on the filesystem for the
pg_dump.You can verify the database sizes by connecting to your database server and running the following command as the
postgresuser:podman exec -it postgresql bash -c 'psql -c "\l+"'
$ podman exec -it postgresql bash -c 'psql -c "\l+"'Copy to Clipboard Copied! Toggle word wrap Toggle overflow Adjust the filesystem size or mount an external filesystem as needed before performing the next step.
NoteThis procedure assumes that all target files will be sent to the
/tmpfilesystem. You might want to adjust the commands to match your environment’s needs.Stage the manually created artifact on the platform gateway node.
mkdir -p /tmp/backups/artifact/{controller,gateway,hub}# mkdir -p /tmp/backups/artifact/{controller,gateway,hub}Copy to Clipboard Copied! Toggle word wrap Toggle overflow mkdir -p /tmp/backups/artifact/controller/custom_configs
# mkdir -p /tmp/backups/artifact/controller/custom_configsCopy to Clipboard Copied! Toggle word wrap Toggle overflow touch /tmp/backups/artifact/secrets.yml
# touch /tmp/backups/artifact/secrets.ymlCopy to Clipboard Copied! Toggle word wrap Toggle overflow cd /tmp/backups/artifact/
# cd /tmp/backups/artifact/Copy to Clipboard Copied! Toggle word wrap Toggle overflow Perform database dumps of all components on the platform gateway node within the artifact created previously.
To run the
psqlandpg_restorecommands, you must create a temporary container and run the commands inside of it. This command must be run from the database node.podman run -it --rm --name postgresql_restore_temp --network host --volume ~/aap/tls/extracted:/etc/pki/ca-trust/extracted:z --volume ~/aap/postgresql/server.crt:/var/lib/pgsql/server.crt:ro,z --volume ~/aap/postgresql/server.key:/var/lib/pgsql/server.key:ro,z --volume /tmp/backups/artifact:/var/lib/pgsql/backups:ro,z registry.redhat.io/rhel8/postgresql-15:latest bash
$ podman run -it --rm --name postgresql_restore_temp --network host --volume ~/aap/tls/extracted:/etc/pki/ca-trust/extracted:z --volume ~/aap/postgresql/server.crt:/var/lib/pgsql/server.crt:ro,z --volume ~/aap/postgresql/server.key:/var/lib/pgsql/server.key:ro,z --volume /tmp/backups/artifact:/var/lib/pgsql/backups:ro,z registry.redhat.io/rhel8/postgresql-15:latest bashCopy to Clipboard Copied! Toggle word wrap Toggle overflow NoteThis command assumes the image
registry.redhat.io/rhel8/postgresql-15:latest. If you are missing the image, check the available images for the user withpodman images ls.The command above opens a shell inside the container named
postgresql_restore_tempand has the artifact mounted into/var/lib/pgsql/backups. Also, this command is mounting the PostgreSQL certificates to ensure that you can resolve the correct certificates.bash-4.4$ cd /var/lib/pgsql/backups bash-4.4$ psql -h <pg_hostname> -U <component_pg_user> -d <database_name> -t -c 'SHOW server_version;' # ensure connectivity to db bash-4.4$ pg_dump -h <pg_hostname> -U <component_pg_user> -d <component_pg_name> --clean --create -Fc -f <component>/<component>.pgc bash-4.4$ ls -ld <component>/<component>.pgc bash-4.4$ echo "<component>_pg_database: <database_name>" >> secrets.yml ## Add the DB name for the component to the secrets file
bash-4.4$ cd /var/lib/pgsql/backups bash-4.4$ psql -h <pg_hostname> -U <component_pg_user> -d <database_name> -t -c 'SHOW server_version;' # ensure connectivity to db bash-4.4$ pg_dump -h <pg_hostname> -U <component_pg_user> -d <component_pg_name> --clean --create -Fc -f <component>/<component>.pgc bash-4.4$ ls -ld <component>/<component>.pgc bash-4.4$ echo "<component>_pg_database: <database_name>" >> secrets.yml ## Add the DB name for the component to the secrets fileCopy to Clipboard Copied! Toggle word wrap Toggle overflow After collecting this data, exit from this temporary container.
Export the secrets from the containerized environment from one node of each component group.
For each step below, use the
rootuser to run the commands.Access the automation controller node and gather the secret key and add to the
controller_secret_keyvalue insecrets.yamlfile.podman secret inspect --showsecret --format "{{.SecretData}}" controller_secret_key$ podman secret inspect --showsecret --format "{{.SecretData}}" controller_secret_keyCopy to Clipboard Copied! Toggle word wrap Toggle overflow Access the automation hub node and gather the secret key and add to the
hub_secret_keyvalue insecrets.yamlfile.podman secret inspect --showsecret --format "{{.SecretData}}" hub_secret_key$ podman secret inspect --showsecret --format "{{.SecretData}}" hub_secret_keyCopy to Clipboard Copied! Toggle word wrap Toggle overflow Access the automation hub node and gather the
database_fields.symmetric.keyvalue and add to thehub_db_fields_encryption_keyvalue insecrets.yamlfile.podman secret inspect --showsecret --format "{{.SecretData}}" hub_database_fields$ podman secret inspect --showsecret --format "{{.SecretData}}" hub_database_fieldsCopy to Clipboard Copied! Toggle word wrap Toggle overflow Access the platform gateway node and gather the secret key and add to the
gateway_secret_keyvalue insecrets.yamlfile.podman secret inspect --showsecret --format "{{.SecretData}}" gateway_secret_key$ podman secret inspect --showsecret --format "{{.SecretData}}" gateway_secret_keyCopy to Clipboard Copied! Toggle word wrap Toggle overflow
Export automation controller custom configurations.
If any
extra_settingsexist in your containerized installation inventory, copy them into a new file and saving them under/tmp/backups/artifact/controller/custom_configs.Package the artifact.
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example output of
tar tvf artifact.tar:Copy to Clipboard Copied! Toggle word wrap Toggle overflow -
Download the
artifact.tarandartifact.tar.sha256to your local machine or transfer to the target node with thescpcommand.
6.2.3. Creating and verifying the migration artifact Link kopierenLink in die Zwischenablage kopiert!
To create and verify the migration artifact, follow the instructions in Migration artifact structure and verification.