AAP Backup

The ability to backup and restore your system is integrated into the platform setup playbook.

TL;DR

Summary:

# ./setup.sh -b 															// backup
# ./setup.sh -r // restore
# ./setup.sh -e 'backup_dest=/path/to/backup_dir/' -b // backup in a specific folder
# ./setup.sh -e 'restore_backup_file=/path/to/nondefault/backup.tar.gz' -r // restore from a speficic file

Make a backup

Simple Backup

You make a backup using the same setup.sh script that you use to install AAP:

# ./setup.sh -b

Backup in a specific file

Backup files will be created on the same path that setup.sh script exists. It can be changed by specifying the following EXTRA_VARS:

./setup.sh -e ‘backup_dest=/path/to/backup_dir/‘ -b

Output :

You will see:

Using /etc/ansible/ansible.cfg as config file
running playbook inside collection ansible.automation_platform_installer

PLAY [localhost] ***************************************************************

TASK [Gathering Facts] *********************************************************
ok: [localhost]

[...]

The setup process completed successfully.

And in your folder:

-rw------- 1 root         root  364053 Mar  7 09:49 automation-platform-backup-2024-03-07-09:48:20.tar.gz
lrwxrwxrwx 1 root root 114 Mar 7 09:49 automation-platform-backup-latest.tar.gz -> /home/john/ansible-automation-platform-setup-2.4-4/./automation-platform-backup-2024-03-07-09:48:20.tar.gz
[...]
-rwxr-xr-x 1 john wheel 14866 Dec 20 14:21 setup.sh

As an example in your .tar.gz:
![](IMAGE A FLOUTER.jpg)

Elaborate Backup

Here is a more elaborate scenario:

$ ./setup.sh -b -- -b -u admin [email protected] --ask-vault-password
  • ./setup.sh -b : runs the backup
  • -- : way to pass arguments to the internal playbook that setup.sh calls
  • -b : tells Ansible to “become“ root
  • -u admin : informs the playbook to connect as the user “admin
  • [email protected] : reads variables from a file encrypted with the ansible-vault
  • --ask-vault-password : tells Ansible to prompt for the password to decrypt vault.yml

You will see the same with the Vault passwort to provide at the begining:

Using /etc/ansible/ansible.cfg as config file
Vault password: <YourVaultPass>


Using /etc/ansible/ansible.cfg as config file
running playbook inside collection ansible.automation_platform_installer

PLAY [localhost] ***************************************************************

TASK [Gathering Facts] *********************************************************
ok: [localhost]

[...]

The setup process completed successfully.

And in your folder:

-rw------- 1 root         root  364053 Mar  7 09:49 automation-platform-backup-2024-03-07-09:48:20.tar.gz
lrwxrwxrwx 1 root root 114 Mar 7 09:49 automation-platform-backup-latest.tar.gz -> /home/john/ansible-automation-platform-setup-2.4-4/./automation-platform-backup-2024-03-07-09:48:20.tar.gz
[...]
-rwxr-xr-x 1 john wheel 14866 Dec 20 14:21 setup.sh

As an example in your .tar.gz:
![](IMAGE A FLOUTER.jpg)

Backup your backup .

Just place your .tar.gz file in an other place of your network…

Restore a backup

The last backup

You just need to run the setup.sh again, but with the argument -r. The command automatically uses the “latest”

# ./setup.sh -r

Restore from a specific file .

A default restore path is used unless EXTRA_VARS are provided with a non-default path, as shown in the example below:

# ./setup.sh -e 'restore_backup_file=/path/to/nondefault/backup.tar.gz' -r

Other backup

To restore from an older backup, you have two options:

Point the link automation-platform-backup-latest.tar.gz to the file you want, and then run setup.sh -r. This makes the selected file the official “latest“ one:

# unlink automation-platform-backup-latest.tar.gz
# ln -s <your-other-backup-file> automation-platform-backup-latest.tar.gz
# ./setup.sh -r

Restart service

After the restoration is done, you may need to restart the AAP services on your controller(s) before you can log in again:

# automation-controller-service start

Documentations

https://www.redhat.com/sysadmin/ansible-backup-restore
https://docs.ansible.com/automation-controller/latest/html/administration/backup_restore.html

> Partager <