# Playbook unable to write to persistent volume

**URL:** <https://forum.ansible.com/t/playbook-unable-to-write-to-persistent-volume/2923>\
**Category:** Get Help\
**Tags:** vmware, collections, awx, kubernetes\
**Created:** [December 15, 2023, 12:52pm UTC](https://forum.ansible.com/t/playbook-unable-to-write-to-persistent-volume/2923 "2023-12-15T12:52:42Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![mjksohonet](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/mjksohonet/32/1217_2.png) [@mjksohonet](https://forum.ansible.com/u/mjksohonet)\
**Post date:** [December 15, 2023, 12:52pm UTC](https://forum.ansible.com/t/playbook-unable-to-write-to-persistent-volume/2923/1 "2023-12-15T12:52:42Z")

</div>

AWX 21.12.0 installed using [GitHub - kurokobo/awx-on-k3s: An example implementation of AWX on single node K3s using AWX Operator, with easy-to-use simplified configuration with ownership of data and passwords.](https://github.com/kurokobo/awx-on-k3s/)

````auto
WARNING: This version information is deprecated and will be replaced with the output from kubectl version --short. Use --output=yaml|json to get the full version.
Client Version: version.Info{Major:"1", Minor:"25", GitVersion:"v1.25.6+k3s1", GitCommit:"9176e03c5788e467420376d10a1da2b6de6ff31f", GitTreeState:"clean", BuildDate:"2023-01-26T00:47:47Z", GoVersion:"go1.19.5", Compiler:"gc", Platform:"linux/amd64"}
Kustomize Version: v4.5.7
Server Version: version.Info{Major:"1", Minor:"25", GitVersion:"v1.25.6+k3s1", GitCommit:"9176e03c5788e467420376d10a1da2b6de6ff31f", GitTreeState:"clean", BuildDate:"2023-01-26T00:47:47Z", GoVersion:"go1.19.5", Compiler:"gc", Platform:"linux/amd64"}```

I have a very simple playbook that uses the community.vmware.vmware_cfg_backup module to retrieve ESXi configuration data and save it to disk.
This fails when it tries to save the data to a PV with an error stating that '/data/esxi-configconfig-backups/<FILE>.tgz' does not exist.
The PV and PVC definitions look good and kubectl lists them as 'Bound'

````

$ kubectl -n awx get pvc esxi-config-backups-claim  
NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGE  
esxi-config-backups-claim Bound esxi-config-backups-volume 4Gi RWO esxi-config-backups-volume 20h  
$  
$ kubectl -n awx get pv esxi-config-backups-volume  
NAME CAPACITY ACCESS MODES RECLAIM POLICY STATUS CLAIM STORAGECLASS REASON AGE  
esxi-config-backups-volume 4Gi RWO Retain Bound awx/esxi-config-backups-claim esxi-config-backups-volume 21h  
m

```auto
The playbook look like this

```

* * *

- name: Get the ESXi configuration  
hosts: esxi  
gather\_facts: no

```auto
What do I need to do to make the PV accessible to the playbook.
Please be aware that my knowledge of Kubernetes (k3s) is very very limited.
```

---

<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:** [December 15, 2023, 2:02pm UTC](https://forum.ansible.com/t/playbook-unable-to-write-to-persistent-volume/2923/2 "2023-12-15T14:02:11Z")

</div>

Hi, thanks for using my guide 😃

You’ve created PV and PVC well, but have you created and specified Container Group with customized pod spec that mount your PVC on automation job pods?

---

<div class="post-metadata">

**Author:** ![mjksohonet](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/mjksohonet/32/1217_2.png) [@mjksohonet](https://forum.ansible.com/u/mjksohonet)\
**Post date:** [December 15, 2023, 2:19pm UTC](https://forum.ansible.com/t/playbook-unable-to-write-to-persistent-volume/2923/3 "2023-12-15T14:19:17Z")

</div>

Hi,  
thanks for the quick response.  
As I mentioned earlier, my knowledge of Kubernetes is very limited, can you point me to some examples of creating a Container group.

---

<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:** [December 15, 2023, 2:30pm UTC](https://forum.ansible.com/t/playbook-unable-to-write-to-persistent-volume/2923/4 "2023-12-15T14:30:45Z")

</div>

Container Group is not kubernetes-thing, but AWX-thing.

My guide also provides some guide to use Container Group, I think this guide is a bit excessive for your requirements: [https://github.com/kurokobo/awx-on-k3s/tree/main/containergroup](https://github.com/kurokobo/awx-on-k3s/tree/main/containergroup)

For your use case:

Create new Container Group by `Administration` \> `Instance Group` \> `Add` \> `Add container group`, and enable `Customize pod specification`, then define specification as following:

```yaml
apiVersion: v1
kind: Pod
metadata:
  namespace: awx
spec:
  serviceAccountName: default
  automountServiceAccountToken: false
  containers:
    - image: quay.io/ansible/awx-ee:latest
      name: worker
      args:
        - ansible-runner
        - worker
        - '--private-data-dir=/runner'
      resources:
        requests:
          cpu: 250m
          memory: 100Mi
      volumeMounts:
        - name: demo-volume
          mountPath: /data/esxi-config-backups
  volumes:
    - name: demo-volume
      persistentVolumeClaim:
        claimName: esxi-config-backups-claim

```

Then specify this Container Group as `Instance Groups` in the Job Template.

---

<div class="post-metadata">

**Author:** ![mjksohonet](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/mjksohonet/32/1217_2.png) [@mjksohonet](https://forum.ansible.com/u/mjksohonet)\
**Post date:** [December 15, 2023, 2:51pm UTC](https://forum.ansible.com/t/playbook-unable-to-write-to-persistent-volume/2923/5 "2023-12-15T14:51:50Z")

</div>

That worked!  
Thank you so much.

---

<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:** [January 14, 2024, 2:52pm UTC](https://forum.ansible.com/t/playbook-unable-to-write-to-persistent-volume/2923/6 "2024-01-14T14:52:06Z")

</div>

Closed on January 14, 2024, 2:52pm UTC

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