Prepare and export data from a container-based environment
Prepare and export data from your container-based Ansible Automation Platform deployment.
Prepare and assess the source environment
Document your current containerized deployment configuration, topology, and components to create a comprehensive reference for migration.
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
Export the source environment
Export databases, secrets, and custom configurations from your source containerized Ansible Automation Platform deployment to create the migration artifact.
Procedure
Create a complete backup of the source environment:
Perform database dumps of all components on the platform gateway node within the artifact created previously.
To run the psql and pg_restore commands, you must create a temporary container and run the commands inside of it. This command must be run from the database node.
This command assumes the image registry.redhat.io/rhel9/postgresql-15:latest. If you are missing the image, check the available images for the user with podman images ls.
The command above opens a shell inside the container named postgresql_restore_temp and 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
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 root user to run the commands.
Access the automation controller node and gather the secret key and add to the controller_secret_key value in secrets.yaml file.
Access the automation hub node and gather the database_fields.symmetric.key value and add to the hub_db_fields_encryption_key value in secrets.yaml file.
If any extra_settings exist in your containerized installation inventory, copy them into a new file and saving them under /tmp/backups/artifact/controller/custom_configs.
Package the artifact.
# cd /tmp/backups/artifact/
# [ -f sha256sum.txt ] && rm -f sha256sum.txt; find . -type f -name "*.pgc" -exec sha256sum {} \; >> sha256sum.txt
# cat sha256sum.txt
# cd ..
# tar cf artifact.tar artifact
# sha256sum artifact.tar > artifact.tar.sha256
# sha256sum --check artifact.tar.sha256
# tar tvf artifact.tar