# Issue with Folder Creation in AWX: Config Folders Not Visible

**URL:** <https://forum.ansible.com/t/issue-with-folder-creation-in-awx-config-folders-not-visible/7394>\
**Category:** Get Help\
**Tags:** awx\
**Created:** [July 22, 2024, 10:47am UTC](https://forum.ansible.com/t/issue-with-folder-creation-in-awx-config-folders-not-visible/7394 "2024-07-22T10:47:32Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![bayet](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/bayet/32/4268_2.png) [@bayet](https://forum.ansible.com/u/bayet)\
**Post date:** [July 22, 2024, 10:47am UTC](https://forum.ansible.com/t/issue-with-folder-creation-in-awx-config-folders-not-visible/7394/1 "2024-07-22T10:47:32Z")

</div>

Hello AWX Community,

I’m running an Ansible project on AWX and have encountered an issue related to folder creation during task execution. Specifically, I need to create a config folder during the execution of my playbook, which will be used to store router and switch configurations for later application.

While the job execution in AWX shows as successful, the config folders are not visible in the expected location. I have a persistent volume mounted on my AWX server at `/var/lib/awx/projects`, which is also visible within the container pods.

Here’s what I’ve tried:

- Created directories using the Ansible `file` module.
- Verified that the persistent volume is correctly mounted and accessible from within the container.

Despite these efforts, the folders created during the job are not appearing as expected.

Has anyone encountered a similar issue or have suggestions on how to resolve this?

Thank you for your assistance!

Best regards,  
Bayet

## pb\_create\_folder.yml

* * *

- name: Create and persist config directory  
hosts: dc1,dc2  
tasks:
  - name: Create Config Directory  
ansible.builtin.file:  
path={{config\_dir}}  
state=directory  
delegate\_to: localhost  
run\_once: yes

  - name: Create Temp Directory per Node  
ansible.builtin.file:  
path={{tmp\_dir}}/{{inventory\_hostname}}  
state=directory  
delegate\_to: localhost

  - name: SET FACT \>\> Build Directory  
ansible.builtin.set\_fact:  
build\_dir: “{{tmp\_dir}}/{{inventory\_hostname}}”  
delegate\_to: localhost

## all.yml

config\_dir: configs  
tmp\_dir: tmp

## hosts:

[dc1]  
dc1-spine01 ansible\_host=10.10.99.30  
dc1-leaf01 ansible\_host=10.10.99.32  
dc1-leaf02 ansible\_host=10.10.99.33

[dc2]  
dc2-spine01 ansible\_host=10.10.99.31  
dc2-leaf01 ansible\_host=10.10.99.34  
dc2-leaf02 ansible\_host=10.10.99.35

[leaf]  
dc[1:2]-leaf0[1:2]

[spine]  
dc[1:2]-spine0[1:2]

 ![screenshot_8653](https://us1.discourse-cdn.com/ansible/original/2X/4/443a0d682979f075cf41a03e0d2de72561227329.png)

---

<div class="post-metadata">

**Author:** ![Thulium-Drake](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/thulium-drake/32/833_2.png) [@Thulium-Drake](https://forum.ansible.com/u/Thulium-Drake)\
**Post date:** [July 22, 2024, 6:02pm UTC](https://forum.ansible.com/t/issue-with-folder-creation-in-awx-config-folders-not-visible/7394/2 "2024-07-22T18:02:41Z")

</div>

I see you’re using `delegate_to: localhost` in your code, that means the tasks are delegated to the _container_ running your job in AWX.

AWX exclusively uses Execution Environments to run jobs, which means that the folders are created in the ephemeral container and are destroyed with the container after the job has concluded.

If you need/want to have files stored, you’ll need to delegate these tasks to a different machine 🙂

---

<div class="post-metadata">

**Author:** ![bayet](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/bayet/32/4268_2.png) [@bayet](https://forum.ansible.com/u/bayet)\
**Post date:** [July 22, 2024, 6:39pm UTC](https://forum.ansible.com/t/issue-with-folder-creation-in-awx-config-folders-not-visible/7394/3 "2024-07-22T18:39:45Z")

</div>

I solved this issue by creating a Persistent Volume (PV) and a container instance group in AWX. In the job settings, I configured the job to use this new container group while executing. Since the job runs in the new container, which is bound to the PV, the folder and files are created and accessible after job execution.

apiVersion: v1  
kind: Pod  
metadata:  
name: awx-worker-pod  
namespace: awx  
spec:  
serviceAccountName: default  
automountServiceAccountToken: false  
containers:  
- name: worker  
image: [Quay](http://quay.io/ansible/awx-ee:latest)  
args:  
- ansible-runner  
- worker  
- --private-data-dir=/runner  
resources:  
requests:  
cpu: 250m  
memory: 100Mi  
limits:  
cpu: 500m  
memory: 500Mi  
volumeMounts:  
- name: awx-projects-volume  
mountPath: /var/lib/awx/projects  
volumes:  
- name: awx-projects-volume  
persistentVolumeClaim:  
claimName: awx-projects-claim

---

<div class="post-metadata">

**Author:** ![Thulium-Drake](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/thulium-drake/32/833_2.png) [@Thulium-Drake](https://forum.ansible.com/u/Thulium-Drake)\
**Post date:** [July 22, 2024, 6:59pm UTC](https://forum.ansible.com/t/issue-with-folder-creation-in-awx-config-folders-not-visible/7394/4 "2024-07-22T18:59:24Z")

</div>

Well, I also learned something here 😉 I didn’t know that was possible 🙂

---

<div class="post-metadata">

**Author:** ![bayet](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/bayet/32/4268_2.png) [@bayet](https://forum.ansible.com/u/bayet)\
**Post date:** [July 22, 2024, 7:37pm UTC](https://forum.ansible.com/t/issue-with-folder-creation-in-awx-config-folders-not-visible/7394/5 "2024-07-22T19:37:58Z")

</div>

you’re welcome

First create the persitance volume:

## ansible-awx:~$ cat pv.yml

apiVersion: v1  
kind: PersistentVolume  
metadata:  
name: awx-projects-volume  
spec:  
accessModes:  
- ReadWriteOnce  
persistentVolumeReclaimPolicy: Retain  
capacity:  
storage: 2Gi  
storageClassName: awx-projects-volume  
hostPath:  
path: /var/lib/awx/projects

## ansible-awx:~$ cat pvc.yml

apiVersion: v1  
kind: PersistentVolumeClaim  
metadata:  
name: awx-projects-claim  
spec:  
accessModes:  
- ReadWriteOnce  
volumeMode: Filesystem  
resources:  
requests:  
storage: 2Gi  
storageClassName: awx-projects-volume

---

<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:** [August 21, 2024, 7:38pm UTC](https://forum.ansible.com/t/issue-with-folder-creation-in-awx-config-folders-not-visible/7394/6 "2024-08-21T19:38:08Z")

</div>

Closed on August 21, 2024, 7:38pm UTC

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