Ce contenu n'est pas disponible dans la langue sélectionnée.
Chapter 3. Backup and restore Ansible Automation Platform
You can protect your Ansible Automation Platform environment by backing up the database, configuration files, and keys. Use the ./setup.sh script or playbooks to create compressed artifacts. This ensures a recovery path for single nodes or clusters, including restores, to secondary instances.
Use the installation program matching your current Ansible Automation Platform version for backups, and always use the latest available version for restores. Ensure your PostgreSQL version is supported by checking the System requirements in Planning your installation.
3.1. Backup and restoration considerations Copier lienLien copié sur presse-papiers!
Consider the following points when you backup and restore your system:
- Disk space
Review your disk space requirements to ensure you have enough room to backup configuration files, keys, other relevant files, and the database of the Ansible Automation Platform installation.
NoteThe Ansible Automation Platform database backups are staged on each node at
/var/backups/automation-platformthrough the variablebackup_dir. You might need to mount a new volume to/var/backupsor change the staging location with the variablebackup_dirto prevent issues with disk space before running the./setup.sh -bscript.- System credentials
-
Confirm you have the required system credentials when working with a local database or a remote database. On local systems, you might need
rootorsudoaccess, depending on how credentials are set up. On remote systems, you might need different credentials to grant you access to the remote system you are trying to backup or restore. - Version
- You must always use the most recent minor version of a release to backup or restore your Ansible Automation Platform installation version. For example, if the current platform version you are on is 2.6.x, only use the latest 2.6 installer.
- Backup file location
-
Default location: If the backup file is placed in the same directory as the
./setup.shinstaller, the restore playbook locates it automatically. -
Non-default location: If your backup file is stored in a different directory, you must specify the path using the
restore_backup_fileextra variable when running the restore command.
-
Default location: If the backup file is placed in the same directory as the
3.2. Back up the Ansible Automation Platform Copier lienLien copié sur presse-papiers!
Back up your instance using the setup.sh script to save your environment content and configuration. Use the optional backup_dest flag only to change the default save location. Apply compression flags to reduce artifact size before transmission.
3.2.1. Backup playbook Copier lienLien copié sur presse-papiers!
The Ansible Automation Platform installer (install.yml) includes the backup.yml playbook, which automates the backup and restoration of your environment. You can use this playbook to capture critical configuration data and databases for the following components:
Platform gateway:
- The database
-
The
SECRET_KEYfile
Automation controller:
- The database
-
The
SECRET_KEYfile -
The
RESOURCE_SERVER`key - The per-host custom configuration files
Automation hub:
- The database
- The database_fields.symmetric.key file
-
The
SECRET_KEY`file -
The
RESOURCE_SERVERkey - Automation hub pulp content
Event-Driven Ansible controller:
- The database
-
The
SECRET_KEYfile -
The
RESOURCE_SERVERkey
3.2.2. Back up the platform using automation installer Copier lienLien copié sur presse-papiers!
Run the setup script to create a verified archive of your platform database, configurations, and secrets. This ensures your instance is captured in a compatible format for reliable restoration during a system failure or migration.
Procedure
- Navigate to your Ansible Automation Platform installation directory.
Run the
./setup.shscript following the example below:./setup.sh -e 'backup_dest=/ansible/mybackup' -e 'use_archive_compression=true' 'use_db_compression=true @credentials.yml -b
$ ./setup.sh -e 'backup_dest=/ansible/mybackup' -e 'use_archive_compression=true' 'use_db_compression=true @credentials.yml -bCopy to Clipboard Copied! Toggle word wrap Toggle overflow Where:
-
backup_dest: Specifies a directory to save your backup to. -
backup_dir: Specifies the directory used on the host staging backup files before they are transferred tobackup_destlocally. use_archive_compression=trueanduse_db_compression=true: Compresses the backup artifacts before they are sent to the host running the backup operation.You can use the following variables to customize the compression:
-
For global control of compression for filesystem related backup files:
use_archive_compression=true -
For component-level control of compression for filesystem related backup files:
<componentName>_use_archive_compression -
For global control of compression for database related backup files:
use_db_compression=true -
For component-level control of compression for database related backup files:
<componentName>_use_db_compression=true
-
For global control of compression for filesystem related backup files:
-
Result
After a successful backup, a backup file is created at /ansible/mybackup/automation-platform-backup-<date/time>.tar.gz.
3.3. Restore Ansible Automation Platform Copier lienLien copié sur presse-papiers!
Restoring your instance using the setup.sh script helps you safely reinstate your environment content and configuration. Use the optional restore_backup_file flag only to change the TAR file location.
3.3.1. Restore playbook Copier lienLien copié sur presse-papiers!
Automation controller includes playbooks to backup and restore your installation.
In addition to the install.yml file included with your setup.sh setup playbook, there are also restore.yml files.
The restore backup restores the backed up files and data to a freshly installed and working second instance of automation controller.
When restoring your system, installation program checks to see that the backup file exists before beginning the restoration. If the backup file is not available, your restoration fails.
Make sure that your automation controller hosts are properly set up with SSH keys, user or pass variables in the hosts file, and that the user has sudo access.
3.3.2. Restore the platform to its original state Copier lienLien copié sur presse-papiers!
Restore your environment by running the setup.sh script to recover platform data and configurations. Ensure the backup TAR file is available in the default location, or use the optional restore_backup_file flag to specify a custom path before starting.
Procedure
- Navigate to your Ansible Automation Platform installation directory.
Run the ./setup.sh script following the example:
root@localhost:~# ./setup.sh -e 'restore_backup_file=/path/to/nondefault/backup.tar.gz' -r
root@localhost:~# ./setup.sh -e 'restore_backup_file=/path/to/nondefault/backup.tar.gz' -rCopy to Clipboard Copied! Toggle word wrap Toggle overflow Where:
restore_backup_file: Path to the TAR file used for the platform restore.