Back up AWX using AWX Operator
The AWX Operator has the ability to back up AWX in an easy way - Because... We're good to you!
This guide is specifically designed to use with AWX deployed using ubiquity, inside the platform folder.
You can also refer to the official instructions for more information.
Table of Contents
Instruction
Prepare for Backup
Prepare directories for Persistent Volumes to store backup files that defined in backup/pv.yaml
. This guide use the hostPath
based PV to make it easy to understand, but you can just as easily back up to anywhere.
sudo mkdir -p /data/backup
Then deploy Persistent Volume and Persistent Volume Claim.
kubectl apply -k backup
Back up AWX manually
Modify the name of the AWXBackup object in backup/awxbackup.yaml
.
...
kind: AWXBackup
metadata:
name: awxbackup-2021-06-06 👈👈👈
namespace: awx
...
Then invoke backup by applying this manifest file.
kubectl apply -f backup/awxbackup.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 backup completes 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=AWXBackup, awxbackup-2021-06-06/awx) -----
PLAY RECAP *********************************************************************
localhost : ok=7 changed=0 unreachable=0 failed=0 skipped=9 rescued=0 ignored=0
This will create AWXBackup object in the namespace and also create backup files in the Persistent Volume. In this example those files are available at /data/backup
.
$ kubectl -n awx get awxbackup
NAME AGE
awxbackup-2021-06-06 6m47s
$ ls -l /data/backup/
total 0
drwxr-xr-x. 2 root root 59 Jun 5 06:51 tower-openshift-backup-2021-06-06-10:51:49
$ ls -l /data/backup/tower-openshift-backup-2021-06-06-10\:51\:49/
total 736
-rw-------. 1 1001 root 1093 Jun 6 06:51 awx_object
-rw-------. 1 1001 root 17085 Jun 6 06:51 secrets.yml
-rw-rw----. 1 root root 833184 Jun 6 06:51 tower.db
Appendix: Back up AWX using Ansible
An example simple playbook for Ansible is also provided in this repository. This can be used with ansible-playbook
, ansible-runner
, and AWX. It can be also used with the scheduling feature on AWX too.
Refer 📁 Appendix: Back up AWX using Ansible for details.