Restore AWX using AWX Operator
The AWX Operator has the ability to restore AWX in an easy way.
This guide is specifically designed to use with the AWX which deployed using Ubiquity from the platform folder.
You can also refer to the official instructions for more information.
Table of Contents
Instruction
To perform restoration, you need to have AWX Operator running on Kubernetes. If you are planning to restore to a new environment, first prepare Kubernetes and AWX Operator via Ubiquity's ArgoCD environment.
It is strongly recommended that the version of AWX Operator is the same as the version when the backup was taken. This is because the structure of the backup files differs between versions and may not be compatible. If you have upgraded AWX Operator after taking the backup, it is recommended to downgrade AWX Operator first before performing the restore. To deploy 0.13.0
or earlier version of AWX Operator, refer πTips: Deploy older version of AWX Operator
Prepare for Restore
If your AWX instance is running, it is recommended that it be deleted along with PVC and PV for the PostgreSQL first, in order to restore to be succeeded.
# Delete AWX resource, PVC, and PV
kubectl -n awx delete awx awx
kubectl -n awx delete pvc postgres-13-awx-postgres-13-0
kubectl delete pv awx-postgres-13-volume
# Delete any data in the PV
sudo rm -rf /data/postgres-13
Then prepare directories for your PVs. /data/projects
is required if you are restoring the entire AWX to a new environment.
sudo mkdir -p /data/postgres-13
sudo mkdir -p /data/projects
sudo chmod 755 /data/postgres-13
sudo chown 1000:0 /data/projects
Then deploy PV and PVC. It is recommended that making the size of PVs and PVCs same as the PVs which your AWX used when the backup was taken.
kubectl apply -k restore
Restore Manually
Modify the name of the AWXRestore object in restore/awxrestore.yaml
.
...
kind: AWXRestore
metadata:
name: awxrestore-2021-06-06 πππ
namespace: awx
...
If you want to restore from AWXBackup object, specify its name in restore/awxrestore.yaml
.
...
# Parameters to restore from AWXBackup object
backup_name: awxbackup-2021-06-06 πππ
...
If the AWXBackup object no longer exists, place the backup files and specify the name of the PVC and directory in restore/awxrestore.yaml
.
...
# Parameters to restore from existing files on PVC (without AWXBackup object)
backup_pvc: awx-backup-claim πππ
backup_dir: /backups/tower-openshift-backup-2021-06-06-10:51:49 πππ
...
Then invoke restore by applying this manifest file.
kubectl apply -f restore/awxrestore.yaml
To monitor the progress of the deployment, check the logs of deployments/awx-operator-controller-manager
:
kubectl -n awx logs -f deployments/awx-operator-controller-manager
When the restore complete successfully, the logs end with:
$ kubectl -n awx logs -f deployments/awx-operator-controller-manager
...
----- Ansible Task Status Event StdOut (awx.ansible.com/v1beta1, Kind=AWX, awx/awx) -----
PLAY RECAP *********************************************************************
localhost : ok=82 changed=0 unreachable=0 failed=0 skipped=76 rescued=0 ignored=1
This will create AWXRestore object in the namespace, and now your AWX is restored.
$ kubectl -n awx get awxrestore
NAME AGE
awxrestore-2021-06-06 137m