# Is an AWXRestore with PVC only possible? (without the AWXBackup resource)

**URL:** <https://forum.ansible.com/t/is-an-awxrestore-with-pvc-only-possible-without-the-awxbackup-resource/1828>\
**Category:** Get Help\
**Tags:** awx\
**Created:** [October 20, 2023, 7:49am UTC](https://forum.ansible.com/t/is-an-awxrestore-with-pvc-only-possible-without-the-awxbackup-resource/1828 "2023-10-20T07:49:46Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![fuggla](https://avatars.discourse-cdn.com/v4/letter/f/ad7895/32.png) [@fuggla](https://forum.ansible.com/u/fuggla)\
**Post date:** [October 20, 2023, 7:49am UTC](https://forum.ansible.com/t/is-an-awxrestore-with-pvc-only-possible-without-the-awxbackup-resource/1828/1 "2023-10-20T07:49:46Z")

</div>

Hi,

- We backup AWX using AWXBackup.
- This results in a PVC and an AWXBackup.
- All PVCs are backed up to another site. The AWXBackup resource is not, and will be lost if complete dataloss/disaster occurs.

Can I run a AWXRestore without the AWXBackup, and only the PVC?

Hope this makes sense! Please tell me if I further details are needed.

```auto
$ ka get awxbackup
NAME AGE
awx-backup-2023-10-19-1458 18h
$ ka get pvc
NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGE
postgres-13-awx-postgres-13-0 Bound pvc-9b686407-a5d8-4c96-b0e8-4451546fc27a 8Gi RWO longhorn 8d
pvc-awx-backup Bound pvc-e677c5ed-b799-4588-863d-aa0b378bf660 10Gi RWO longhorn 18h

```

awx-backup.bash

```bash
manifest="
apiVersion: awx.ansible.com/v1beta1
kind: AWXBackup
metadata:
  name: awx-backup-$(date +%Y-%m-%d-%H%M)
  namespace: awx
spec:
  deployment_name: awx
  backup_pvc: pvc-awx-backup
  backup_storage_class: longhorn
  backup_pvc_namespace: awx
  clean_backup_on_delete: true
"
kubectl apply -f - <<< $manifest

```

awx-restore.bash (this wouldn’t work[?] since the AWXBackup doesn’t exist)

```bash
manifest="
apiVersion: awx.ansible.com/v1beta1
kind: AWXRestore
metadata:
  name: restore-$1
  namespace: awx
spec:
  deployment_name: awx
  backup_name: $1
  backup_pvc_namespace: awx
  backup_pvc: pvc-awx-backup
"

kubectl apply -f - <<< $manifest

```

---

<div class="post-metadata">

**Author:** ![kurokobo](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/kurokobo/32/182_2.png) [@kurokobo](https://forum.ansible.com/u/kurokobo)\
**Post date:** [October 20, 2023, 11:44am UTC](https://forum.ansible.com/t/is-an-awxrestore-with-pvc-only-possible-without-the-awxbackup-resource/1828/2 "2023-10-20T11:44:24Z")

</div>

Hi,

You can achieve restoring without AWXBackup by specifying `backup_pvc` and `backup_dir`. See: [https://github.com/ansible/awx-operator/tree/devel/roles/restore](https://github.com/ansible/awx-operator/tree/devel/roles/restore)

As documented, the path for `backup_dir` can be gathered by:

```bash
$ kubectl get awxbackup awxbackup1 -o jsonpath="{.items[0].status.backupDirectory}"
/backups/tower-openshift-backup-2021-04-02-03:25:08

```

Or if you can dig into the PVC, there should be backup directory that named `tower-openshift-backup-*` and you can use this name for `backup_dir` as `/backups/<backup directory>`.

---

<div class="post-metadata">

**Author:** ![fuggla](https://avatars.discourse-cdn.com/v4/letter/f/ad7895/32.png) [@fuggla](https://forum.ansible.com/u/fuggla)\
**Post date:** [October 23, 2023, 6:47am UTC](https://forum.ansible.com/t/is-an-awxrestore-with-pvc-only-possible-without-the-awxbackup-resource/1828/3 "2023-10-23T06:47:35Z")

</div>

Cool, that’s easier than I thought it would be. Thanks again for helping out, very much appreciated.

For anyone else dropping by here, there’s another somewhat similar discussion on Github: [Documentation: AWX backup secheduled job · Issue #1605 · ansible/awx-operator · GitHub](https://github.com/ansible/awx-operator/issues/1605)

---

<div class="post-metadata">

**Author:** ![fuggla](https://avatars.discourse-cdn.com/v4/letter/f/ad7895/32.png) [@fuggla](https://forum.ansible.com/u/fuggla)\
**Post date:** [October 23, 2023, 12:15pm UTC](https://forum.ansible.com/t/is-an-awxrestore-with-pvc-only-possible-without-the-awxbackup-resource/1828/4 "2023-10-23T12:15:52Z")

</div>

@kurokobo actually, I can’t seem to get this to work. I create an AWXRestore, but it never processes beyond this step:

EDIT: backup **S** not backup!

```auto
  backup_dir: /backups/tower-openshift-backup-2023-10-19-135407

```

```auto
TASK [restore : Check provided PVC exists] *************************************
task path: /opt/ansible/roles/restore/tasks/init.yml:40

-------------------------------------------------------------------------------
{"level":"info","ts":"2023-10-23T12:14:56Z","logger":"logging_event_handler","msg":"[playbook task start]","name":"pvc-awx-backup","namespace":"awx","gvk":"awx.ansible.com/v1beta1, Kind=AWXRestore","event_type":"playbook_on_task_start","job":"7174255286884531933","EventData.Name":"restore : Check provided PVC exists"}
{"level":"info","ts":"2023-10-23T12:14:57Z","logger":"proxy","msg":"Read object from cache","resource":{"IsResourceRequest":true,"Path":"/api/v1/namespaces/awx/persistentvolumeclaims/pvc-awx-backup","Verb":"get","APIPrefix":"api","APIGroup":"","APIVersion":"v1","Namespace":"awx","Resource":"persistentvolumeclaims","Subresource":"","Name":"pvc-awx-backup","Parts":["persistentvolumeclaims","pvc-awx-backup"]}}
{"level":"info","ts":"2023-10-23T12:14:57Z","logger":"logging_event_handler","msg":"[playbook task start]","name":"pvc-awx-backup","namespace":"awx","gvk":"awx.ansible.com/v1beta1, Kind=AWXRestore","event_type":"playbook_on_task_start","job":"7174255286884531933","EventData.Name":"restore : Emit ocp event with error"}

--------------------------- Ansible Task StdOut -------------------------------

TASK [restore : Emit ocp event with error] *************************************
task path: /opt/ansible/roles/restore/tasks/error_handling.yml:7

-------------------------------------------------------------------------------
{"level":"info","ts":"2023-10-23T12:14:57Z","logger":"logging_event_handler","msg":"[playbook task start]","name":"pvc-awx-backup","namespace":"awx","gvk":"awx.ansible.com/v1beta1, Kind=AWXRestore","event_type":"playbook_on_task_start","job":"7174255286884531933","EventData.Name":"restore : Fail early if pvc is defined but does not exist"}

--------------------------- Ansible Task StdOut -------------------------------

TASK [restore : Fail early if pvc is defined but does not exist] ***************
task path: /opt/ansible/roles/restore/tasks/init.yml:58

```

I mounted the PVC in a tmeporary pod, to verify the dir name.

```auto
ka exec persistent-volume -- ls /data
lost+found
tower-openshift-backup-2023-10-19-135407

```

Restore manifest:

```auto
kind: AWXRestore
metadata:
  name: pvc-awx-backup
  namespace: awx
spec:
  deployment_name: awx
  backup_dir: /backup/tower-openshift-backup-2023-10-19-135407
  backup_pvc_namespace: awx
  backup_pvc: pvc-awx-backup

```

Any idea what I’m doing wrong here?

---

<div class="post-metadata">

**Author:** ![kurokobo](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/kurokobo/32/182_2.png) [@kurokobo](https://forum.ansible.com/u/kurokobo)\
**Post date:** [October 25, 2023, 5:38am UTC](https://forum.ansible.com/t/is-an-awxrestore-with-pvc-only-possible-without-the-awxbackup-resource/1828/5 "2023-10-25T05:38:41Z")

</div>

Hi, could you provide full logs of Operator?

---

<div class="post-metadata">

**Author:** ![kurokobo](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/kurokobo/32/182_2.png) [@kurokobo](https://forum.ansible.com/u/kurokobo)\
**Post date:** [October 25, 2023, 5:39am UTC](https://forum.ansible.com/t/is-an-awxrestore-with-pvc-only-possible-without-the-awxbackup-resource/1828/6 "2023-10-25T05:39:59Z")

</div>

> [@fuggla](#):
>
> EDIT: backup **S** not backup!

Ah, is this root cause for you? Ignore my comment if it’s already solved.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/ansible/original/1X/1882d9a01da5d8996a862359b0913cc568a39b84.svg) [@system](https://forum.ansible.com/u/system)\
**Post date:** [November 24, 2023, 5:40am UTC](https://forum.ansible.com/t/is-an-awxrestore-with-pvc-only-possible-without-the-awxbackup-resource/1828/7 "2023-11-24T05:40:31Z")

</div>

Closed on November 24, 2023, 5:40am UTC

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
