AWX V19 - Backup and Restore

AWX V19 - Backup and Restore.

Hello experts, I have setup AWX v19 following this
https://github.com/ansible/awx-operator

Not sure how to perform the backup and restore of AWX v19 .
i tried below steps:

  1. Export Docker DB like: pg_dump --username awx awx --format=c" > ./psql_dump.sql

  2. Drop AWX-Operator DB: minikube kubectl – exec -it awx-postgres-0 – dropdb -U awx awx ( failed here since the db was currently being used)

  3. Create new DB: minikube kubectl – exec -it awx-postgres-0 – createdb -U awx awx

  4. Restore DB: minikube kubectl – exec -it awx-postgres-0 – pg_restore -U awx -d awx < psql_dump.sql

BR//
Vandana Thakur

Hi Vandana,

It sounds like you have AWX installed via the awx-operator in minikube. You can use the backup and restore roles in the awx-operator to accomplish this.

  • Backup docs
  • Restore docs
    At a high level, you create a AWXBackup CR (custom resource) object in your minikube cluster, which runs the backup role. This will back up your deployment’s AWX object, Postgresql database, and secrets into a persistent volume claim in your cluster. This can then be restored to a new deployment by creating a AWXRestore object referencing your backup.

Sidenote, in your approach, you would need to stop the application containers before dropping the database to avoid the error you are running into.

Thanks,
Christian

So, I added a CRD for backup and applied as a pod.

[test@k8s]$ k get po -A
NAMESPACE NAME READY STATUS RESTARTS AGE
default awx-demo-7d5777dcd6-c6nxk 4/4 Running 0 5d23h
default awx-demo-postgres-0 1/1 Running 0 7d
default awx-operator-5dd757f594-c2snd 1/1 Running 5 7d
default awxbackup-2021-07-27-db-management 1/1 Running 0 30s
ingress-nginx ingress-nginx-admission-create-4mb4x 0/1 Completed 0 7d

All pods are running and I can access th eAWX GUI ,but unfortunately I can’t see the PVC in Output.

[test@k8s]$ k get awxbackup awxbackup-2021-07-27 -o jsonpath=“{.items[0].status.backupDirectory}”
[test@k8s]$ docker exec -it 6b87ee77cebc /bin/bash
root@awxbackup-2021-07-27-db-management:/# cd /backups/
root@awxbackup-2021-07-27-db-management:/backups# ls
root@awxbackup-2021-07-27-db-management:/backups#

BR//
Vandana

Adding AWX Project group back to thread to provide other’s context/info.

Thanks,
Christian

Yes there is an error… But cant see any errors in operator logs.

name: awxbackup-2021-07-27
namespace: default
spec:
deployment_name: awx-demo
status:
conditions:

  • ansibleResult:
    changed: 2
    completion: 2021-08-02T13:52:10.856248
    failures: 1
    ok: 14
    skipped: 6
    lastTransitionTime: “2021-08-02T13:52:11Z”
    message: unknown playbook failure
    reason: Failed
    status: “False”
    type: Failure
  • lastTransitionTime: “2021-08-02T13:52:12Z”
    message: Running reconciliation
    reason: Running
    status: “True”
    type: Running
    [test@vuhplabgtdbg001 ~]$

Hello Experts ,

I searched a lot on the issue i am facing, Got a related discussion.

=====logs

Once I manually change awx-operator deployment to use [quay.io/ansible/awx-operator:devel](http://quay.io/ansible/awx-operator:devel) I have PVC awx-backup-claim created. I have pod awxbackup-db-management created and mounted this PV awx-backup-claim, but folder backups inside pod awxbackup-db-management is empty, and no backups created.

I also created a new backup with:

---
apiVersion: [awx.ansible.com/v1beta1](http://awx.ansible.com/v1beta1)
kind: AWXBackup
metadata:
  name: awxbackup2
  namespace: default
spec:
  deployment_name: awx

But still no backup created.

And this is the status of this awxbackup2

status:                                                                                                                                                                                       │
│   conditions:                                                                                                                                                                                 │
│   - lastTransitionTime: "2021-05-20T13:58:25Z"                                                                                                                                                │
│     message: Running reconciliation                                                                                                                                                           │
│     reason: Running                                                                                                                                                                           │
│     status: "False"                                                                                                                                                                           │
│     type: Running                                                                                                                                                                             │
│   - ansibleResult:                                                                                                                                                                            │
│       changed: 3                                                                                                                                                                              │
│       completion: 2021-05-20T14:04:40.55262                                                                                                                                                   │
│       failures: 1                                                                                                                                                                             │
│       ok: 14                                                                                                                                                                                  │
│       skipped: 6                                                                                                                                                                              │
│     lastTransitionTime: "2021-05-20T14:04:40Z"                                                                                                                                                │
│     message: unknown playbook failure                                                                                                                                                         │
│     reason: Failed                                                                                                                                                                            │
│     status: "True"                                                                                                                                                                            │
│     type: Failure

======link https://githubmemory.com/repo/ansible/awx-operator/issues/274

Exactly the same issue that I am facing.
Can someone help here?

BR//

I managed to perform the backup ( not sure its correct)
But restoration is still failing with:

(attachments)



image.png
image.png

hi!

why does nobody seem to know how to backup and restore this overcomplicated awx/awx-operator on kubernetes-thing!?
this is needed!

Hello all,

Anyone to help on this issue??
I have the same.

Regards Hans-Peter

Vandana,

The restore role had a bug causing it to not be compatible with external databases. The fix has been merged here - https://github.com/ansible/awx-operator/pull/877

If you still have your backup, you could try restoring with the an awx-operator built from the devel branch. The fix will be available in the next AWX release.

Thanks,
AWX Team