# AWX V19 - Backup and  Restore

**URL:** <https://forum.ansible.com/t/awx-v19-backup-and-restore/35540>\
**Category:** AWX Project\
**Tags:** awx\
**Created:** [July 23, 2021, 1:07pm UTC](https://forum.ansible.com/t/awx-v19-backup-and-restore/35540 "2021-07-23T13:07:21Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![The\_Vandyy\_Vines](https://avatars.discourse-cdn.com/v4/letter/t/7993a0/32.png) [@The\_Vandyy\_Vines](https://forum.ansible.com/u/The_Vandyy_Vines)\
**Post date:** [July 23, 2021, 1:07pm UTC](https://forum.ansible.com/t/awx-v19-backup-and-restore/35540/1 "2021-07-23T13:07:21Z")

</div>

AWX V19 - Backup and Restore.

Hello experts, I have setup AWX v19 following this  
[https://github.com/ansible/awx-operator](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

---

<div class="post-metadata">

**Author:** ![Christian\_Adams](https://avatars.discourse-cdn.com/v4/letter/c/ba8739/32.png) [@Christian\_Adams](https://forum.ansible.com/u/Christian_Adams)\
**Post date:** [July 23, 2021, 1:23pm UTC](https://forum.ansible.com/t/awx-v19-backup-and-restore/35540/2 "2021-07-23T13:23:41Z")

</div>

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](https://github.com/ansible/awx-operator/blob/devel/roles/backup/README.md)
- [Restore docs](https://github.com/ansible/awx-operator/blob/devel/roles/restore/README.md)  
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

---

<div class="post-metadata">

**Author:** ![The\_Vandyy\_Vines](https://avatars.discourse-cdn.com/v4/letter/t/7993a0/32.png) [@The\_Vandyy\_Vines](https://forum.ansible.com/u/The_Vandyy_Vines)\
**Post date:** [August 2, 2021, 1:19pm UTC](https://forum.ansible.com/t/awx-v19-backup-and-restore/35540/3 "2021-08-02T13:19:58Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Christian\_Adams](https://avatars.discourse-cdn.com/v4/letter/c/ba8739/32.png) [@Christian\_Adams](https://forum.ansible.com/u/Christian_Adams)\
**Post date:** [August 2, 2021, 1:36pm UTC](https://forum.ansible.com/t/awx-v19-backup-and-restore/35540/4 "2021-08-02T13:36:01Z")

</div>

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

Thanks,  
Christian

---

<div class="post-metadata">

**Author:** ![The\_Vandyy\_Vines](https://avatars.discourse-cdn.com/v4/letter/t/7993a0/32.png) [@The\_Vandyy\_Vines](https://forum.ansible.com/u/The_Vandyy_Vines)\
**Post date:** [August 2, 2021, 1:55pm UTC](https://forum.ansible.com/t/awx-v19-backup-and-restore/35540/5 "2021-08-02T13:55:49Z")

</div>

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 ~]$

---

<div class="post-metadata">

**Author:** ![The\_Vandyy\_Vines](https://avatars.discourse-cdn.com/v4/letter/t/7993a0/32.png) [@The\_Vandyy\_Vines](https://forum.ansible.com/u/The_Vandyy_Vines)\
**Post date:** [August 3, 2021, 10:49am UTC](https://forum.ansible.com/t/awx-v19-backup-and-restore/35540/6 "2021-08-03T10:49:03Z")

</div>

Hello Experts ,

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

 ![image.png](https://us1.discourse-cdn.com/ansible/original/2X/7/7175c6b87b7782fb24dcfb2e022408f27612b708.png)

=====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:

```auto
---
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`

```auto
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](https://githubmemory.com/repo/ansible/awx-operator/issues/274)

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

BR//

---

<div class="post-metadata">

**Author:** ![The\_Vandyy\_Vines](https://avatars.discourse-cdn.com/v4/letter/t/7993a0/32.png) [@The\_Vandyy\_Vines](https://forum.ansible.com/u/The_Vandyy_Vines)\
**Post date:** [August 3, 2021, 2:16pm UTC](https://forum.ansible.com/t/awx-v19-backup-and-restore/35540/7 "2021-08-03T14:16:55Z")

</div>

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

> **(attachments)**
>
> ![image.png](https://us1.discourse-cdn.com/ansible/original/2X/7/7175c6b87b7782fb24dcfb2e022408f27612b708.png)  
> ![image.png](https://us1.discourse-cdn.com/ansible/original/2X/0/085c8f1c39aa178d4412633ef3b7f25283d07f01.png)  
> ![image.png](https://us1.discourse-cdn.com/ansible/original/2X/c/c09821d67de2cae77fb6e1d173510e5f4a02d886.png)  
> ![image.png](https://us1.discourse-cdn.com/ansible/original/2X/0/064f496d1224792d1ab0349634066153ed8967d8.png)

---

<div class="post-metadata">

**Author:** ![agenttank](https://avatars.discourse-cdn.com/v4/letter/a/779978/32.png) [@agenttank](https://forum.ansible.com/u/agenttank)\
**Post date:** [September 14, 2021, 9:55am UTC](https://forum.ansible.com/t/awx-v19-backup-and-restore/35540/8 "2021-09-14T09:55:24Z")

</div>

hi!

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

---

<div class="post-metadata">

**Author:** ![HG1](https://avatars.discourse-cdn.com/v4/letter/h/b782af/32.png) [@HG1](https://forum.ansible.com/u/HG1)\
**Post date:** [July 21, 2022, 9:46am UTC](https://forum.ansible.com/t/awx-v19-backup-and-restore/35540/9 "2022-07-21T09:46:00Z")

</div>

Hello all,

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

Regards Hans-Peter

---

<div class="post-metadata">

**Author:** ![AWX\_Project](https://avatars.discourse-cdn.com/v4/letter/a/eada6e/32.png) [@AWX\_Project](https://forum.ansible.com/u/AWX_Project)\
**Post date:** [July 27, 2022, 8:31pm UTC](https://forum.ansible.com/t/awx-v19-backup-and-restore/35540/10 "2022-07-27T20:31:35Z")

</div>

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](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
