# How to save stdout at awx-host filesystem

**URL:** <https://forum.ansible.com/t/how-to-save-stdout-at-awx-host-filesystem/36523>\
**Category:** AWX Project\
**Tags:** awx\
**Created:** [April 11, 2022, 5:11pm UTC](https://forum.ansible.com/t/how-to-save-stdout-at-awx-host-filesystem/36523 "2022-04-11T17:11:17Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![Guilherme\_Torres](https://avatars.discourse-cdn.com/v4/letter/g/8dc957/32.png) [@Guilherme\_Torres](https://forum.ansible.com/u/Guilherme_Torres)\
**Post date:** [April 11, 2022, 5:11pm UTC](https://forum.ansible.com/t/how-to-save-stdout-at-awx-host-filesystem/36523/1 "2022-04-11T17:11:17Z")

</div>

Hello,  
I’m trying to save an output of switch configuration at my awx-host filesystem without success. I’m using awx 20. It used to work at awx 17 version. Now, it seems that the playbook is trying to create the file at a “temporary” pod that exists only at execution time.

Sample of playbook:

---

<div class="post-metadata">

**Author:** ![yeowtiong\_tan](https://avatars.discourse-cdn.com/v4/letter/y/bc79bd/32.png) [@yeowtiong\_tan](https://forum.ansible.com/u/yeowtiong_tan)\
**Post date:** [April 16, 2023, 2:05pm UTC](https://forum.ansible.com/t/how-to-save-stdout-at-awx-host-filesystem/36523/2 "2023-04-16T14:05:57Z")

</div>

Anyone got a solution to this so far?

I am also trying to solve this issue…  
Thx!

---

<div class="post-metadata">

**Author:** ![Avinash\_Jadhav](https://avatars.discourse-cdn.com/v4/letter/a/958977/32.png) [@Avinash\_Jadhav](https://forum.ansible.com/u/Avinash_Jadhav)\
**Post date:** [April 16, 2023, 2:35pm UTC](https://forum.ansible.com/t/how-to-save-stdout-at-awx-host-filesystem/36523/3 "2023-04-16T14:35:53Z")

</div>

Replace “/path/to/awx-host/filesystem” with the actual path to the directory where you want to save the output file.

Alternatively, you could use the “copy” module to copy the output file from the temporary pod to the AWX host’s filesystem.

- name: Save switch configuration shell: command to save switch configuration \> switch\_config.txt delegate\_to: localhost register: switch\_config\_output - name: Copy switch configuration output to AWX host copy: content: “{{ switch\_config\_output.stdout }}” dest: /path/to/awx-host/filesystem/switch\_config.txt

---

<div class="post-metadata">

**Author:** ![yeowtiong\_tan](https://avatars.discourse-cdn.com/v4/letter/y/bc79bd/32.png) [@yeowtiong\_tan](https://forum.ansible.com/u/yeowtiong_tan)\
**Post date:** [April 16, 2023, 3:50pm UTC](https://forum.ansible.com/t/how-to-save-stdout-at-awx-host-filesystem/36523/4 "2023-04-16T15:50:28Z")

</div>

Hi

Thanks for your reply. As i pretty new to this, i like to share my setup. Basically i have setup a custom execution image and loaded into a docker on localhost. My AWX is installed on Ks3.

In my playbook, I have this:

- name: cisco\_sh\_ver  
hosts: awx-cisco-ios-r1 [This is a cisco router]  
gather\_facts: true

tasks:

- name: run show ip interface brief on remote devices  
ios\_command:  
commands: show ip interface brief  
register: ip\_int\_output

- name: Print IP Interface brief  
debug:  
var: ip\_int\_output.stdout\_lines

- name: set fact for date and time  
shell: date +“%Y-%m-%d-%H-%M”  
register: date\_time

- name: save IP Interface brief to file  
delegate\_to: localhost  
copy:  
content: “{{ ip\_int\_output.stdout }}”  
dest: “/runner/project/ip\_interface\_brief\_{{ date\_time.stdout }}.txt”

But once i run the job template from AWX, although successful i cannot find the file at all.

EXEC /bin/sh -c ‘/usr/bin/python3 /root/.ansible/tmp/ansible-tmp-1681660001.381904-78-44273424326509/AnsiballZ\_stat.py && sleep 0’  
 PUT /home/runner/.ansible/tmp/ansible-local-191tqi55nq/tmpu8el6gja TO /root/.ansible/tmp/ansible-tmp-1681660001.381904-78-44273424326509/source  
 EXEC /bin/sh -c ‘chmod u+x /root/.ansible/tmp/ansible-tmp-1681660001.381904-78-44273424326509/ /root/.ansible/tmp/ansible-tmp-1681660001.381904-78-44273424326509/source && sleep 0’  
Using module file /usr/local/lib/python3.8/site-packages/ansible/modules/copy.py  
 PUT /home/runner/.ansible/tmp/ansible-local-191tqi55nq/tmpxu921f4m TO /root/.ansible/tmp/ansible-tmp-1681660001.381904-78-44273424326509/AnsiballZ\_copy.py  
 EXEC /bin/sh -c ‘chmod u+x /root/.ansible/tmp/ansible-tmp-1681660001.381904-78-44273424326509/ /root/.ansible/tmp/ansible-tmp-1681660001.381904-78-44273424326509/AnsiballZ\_copy.py && sleep 0’  
 EXEC /bin/sh -c ‘/usr/bin/python3 /root/.ansible/tmp/ansible-tmp-1681660001.381904-78-44273424326509/AnsiballZ\_copy.py && sleep 0’  
 EXEC /bin/sh -c ‘rm -f -r /root/.ansible/tmp/ansible-tmp-1681660001.381904-78-44273424326509/ \> /dev/null 2\>&1 && sleep 0’  
changed: [awx-cisco-ios-r1 → localhost] =\> {  
“changed”: true,  
“checksum”: “f41d04c0206136d7feca531350a1b4fce31d5e5d”,  
“dest”: “/runner/project/ip\_interface\_brief\_2023-04-16-15-46.txt”,  
“diff”: ,  
“gid”: 0,  
“group”: “root”,  
“invocation”: {  
“module\_args”: {  
“\_original\_basename”: “tmpu8el6gja”,  
“attributes”: null,  
“backup”: false,  
“checksum”: “f41d04c0206136d7feca531350a1b4fce31d5e5d”,  
“content”: null,  
“dest”: “/runner/project/ip\_interface\_brief\_2023-04-16-15-46.txt”,  
“directory\_mode”: null,  
“follow”: false,  
“force”: true,  
“group”: null,  
“local\_follow”: null,  
“mode”: null,  
…  
META: ran handlers  
META: ran handlers

---

<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:** [April 19, 2023, 6:56pm UTC](https://forum.ansible.com/t/how-to-save-stdout-at-awx-host-filesystem/36523/5 "2023-04-19T18:56:40Z")

</div>

On AWX the jobs are running a pod separate from the control plane, so files saved in the pod filesystem would likely get cleaned up after the job runs.

You can use the settings Paths to expose to isolated jobs, which allows you to mount folders on the control node to the running pods. Then in your playbook you can write the files to that location

see these docs on configuring that option [https://docs.ansible.com/automation-controller/4.3.0/html/userguide/execution\_environments.html#execution-environment-mount-options](https://docs.ansible.com/automation-controller/4.3.0/html/userguide/execution_environments.html#execution-environment-mount-options)

AWX Team

---

<div class="post-metadata">

**Author:** ![yeowtiong\_tan](https://avatars.discourse-cdn.com/v4/letter/y/bc79bd/32.png) [@yeowtiong\_tan](https://forum.ansible.com/u/yeowtiong_tan)\
**Post date:** [April 20, 2023, 1:36pm UTC](https://forum.ansible.com/t/how-to-save-stdout-at-awx-host-filesystem/36523/6 "2023-04-20T13:36:04Z")

</div>

Hi AWX team,

Thanks for sharing. I am currently running AWX version 22. Under job settings, I dont see exposed host path for container group this option. I tried to specify my ubuntu path under Paths to expose to isolated jobs

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

However, though the playbook is successful, but I couldnt get the studout file.

I have changed ownership to root for both user and group but not really help.

Seek your advice again,.

Tracelog:  
changed: [awx-cisco-ios-r1] =\> {  
“changed”: true,  
“checksum”: “f41d04c0206136d7feca531350a1b4fce31d5e5d”,  
“dest”: “/tmp/ip\_interface\_brief.txt”,  
“diff”: [  
{  
“after”: "["Interface IP-Address OK? Method Status Protocol\nFastEthernet0/0 192.168.11.60 YES NVRAM up up \nSerial0/0 unassigned YES NVRAM administratively down down \nFastEthernet0/1 unassigned YES NVRAM administratively down down \nSerial0/1 unassigned YES NVRAM administratively down down \nSerial0/2 unassigned YES NVRAM administratively down down \nFastEthernet1/0 unassigned YES NVRAM administratively down down \nSerial2/0 unassigned YES NVRAM administratively down down \nSerial2/1 unassigned …  
TASK [fetch file from remote device to local Ubuntu machine] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
task path: /runner/project/fetch4.yml:23  
redirecting (type: connection) ansible.builtin.network\_cli to ansible.netcommon.network\_cli  
redirecting (type: terminal) ansible.builtin.ios to cisco.ios.ios  
redirecting (type: cliconf) ansible.builtin.ios to cisco.ios.ios  
\<192.168.11.60\> ESTABLISH LOCAL CONNECTION FOR USER: root  
\<192.168.11.60\> EXEC /bin/sh -c ‘( umask 77 && mkdir -p “`echo /home/runner/.ansible/tmp/ansible-local-19ah400x6z`”&& mkdir “`echo /home/runner/.ansible/tmp/ansible-local-19ah400x6z/ansible-tmp-1681997446.7857811-88-241249696992527`” && echo ansible-tmp-1681997446.7857811-88-241249696992527=“`echo /home/runner/.ansible/tmp/ansible-local-19ah400x6z/ansible-tmp-1681997446.7857811-88-241249696992527`” ) && sleep 0’  
Using module file /usr/local/lib/python3.8/site-packages/ansible/modules/stat.py  
\<192.168.11.60\> PUT /home/runner/.ansible/tmp/ansible-local-19ah400x6z/tmp9fjsms6f TO /home/runner/.ansible/tmp/ansible-local-19ah400x6z/ansible-tmp-1681997446.7857811-88-241249696992527/AnsiballZ\_stat.py  
\<192.168.11.60\> EXEC /bin/sh -c ‘chmod u+x /home/runner/.ansible/tmp/ansible-local-19ah400x6z/ansible-tmp-1681997446.7857811-88-241249696992527/ /home/runner/.ansible/tmp/ansible-local-19ah400x6z/ansible-tmp-1681997446.7857811-88-241249696992527/AnsiballZ\_stat.py && sleep 0’  
\<192.168.11.60\> EXEC /bin/sh -c ‘/usr/bin/python3 /home/runner/.ansible/tmp/ansible-local-19ah400x6z/ansible-tmp-1681997446.7857811-88-241249696992527/AnsiballZ\_stat.py && sleep 0’  
\<192.168.11.60\> FETCH /tmp/ip\_interface\_brief.txt TO /data/projects/first-project/output/ip\_interface\_brief.txt  
\<192.168.11.60\> PUT /tmp/ip\_interface\_brief.txt TO /data/projects/first-project/output/ip\_interface\_brief.txt  
\<192.168.11.60\> EXEC /bin/sh -c ‘rm -f -r /home/runner/.ansible/tmp/ansible-local-19ah400x6z/ansible-tmp-1681997446.7857811-88-241249696992527/ \> /dev/null 2\>&1 && sleep 0’  
changed: [awx-cisco-ios-r1] =\> {  
“changed”: true,  
“checksum”: “f41d04c0206136d7feca531350a1b4fce31d5e5d”,  
“dest”: “/data/projects/first-project/output/ip\_interface\_brief.txt”,  
“md5sum”: “d18193eb730c6371c716328ebc687a04”,  
“remote\_checksum”: “f41d04c0206136d7feca531350a1b4fce31d5e5d”,  
“remote\_md5sum”: null  
}  
META: ran handlers  
META: ran handlers  
PLAY RECAP \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
awx-cisco-ios-r1 : ok=5 changed=2 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0

---

<div class="post-metadata">

**Author:** ![Wei-Yen\_Tan](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/wei-yen_tan/32/4111_2.png) [@Wei-Yen\_Tan](https://forum.ansible.com/u/Wei-Yen_Tan)\
**Post date:** [April 20, 2023, 1:50pm UTC](https://forum.ansible.com/t/how-to-save-stdout-at-awx-host-filesystem/36523/7 "2023-04-20T13:50:51Z")

</div>

Yoy can also download the job output from the ui iirc

> **(attachments)**
>
> ![image.png](https://us1.discourse-cdn.com/ansible/original/2X/7/7f416c4a67228f3fed982da2d856f6e881e79322.png)

---

<div class="post-metadata">

**Author:** ![yeowtiong\_tan](https://avatars.discourse-cdn.com/v4/letter/y/bc79bd/32.png) [@yeowtiong\_tan](https://forum.ansible.com/u/yeowtiong_tan)\
**Post date:** [April 21, 2023, 1:35pm UTC](https://forum.ansible.com/t/how-to-save-stdout-at-awx-host-filesystem/36523/8 "2023-04-21T13:35:22Z")

</div>

Hi Weiye,

Many thanks. However, if i have multiple network equipment to sort them out according to different text file based on IP address, it will be better if i can actually create a txt file for each of them.

---

<div class="post-metadata">

**Author:** ![yeowtiong\_tan](https://avatars.discourse-cdn.com/v4/letter/y/bc79bd/32.png) [@yeowtiong\_tan](https://forum.ansible.com/u/yeowtiong_tan)\
**Post date:** [May 1, 2023, 7:20am UTC](https://forum.ansible.com/t/how-to-save-stdout-at-awx-host-filesystem/36523/9 "2023-05-01T07:20:12Z")

</div>

Hi anyone or kind souls able to advise?

Somehow the enable job isolation option is also not available to be disabled unlike ansible tower.

[https://docs.ansible.com/ansible-tower/latest/html/userguide/security.html](https://docs.ansible.com/ansible-tower/latest/html/userguide/security.html)

Has anyone else used AWX\_PROOT\_HIDE\_PATHS = [‘/list/of/’, ‘/paths’] before? Not sure if it helps

This kub container is the hosted on the same machine as my ubuntu.

kubectl exec -it awx-task-6667fc866f-abcde -n awx --container awx-task – /bin/bash

bash-5.1$ whoami

awx  
bash-5.1$ pwd  
/tmp  
bash-5.1$ ls

Inside the kub container i have a mounted volume where i can see the playbooks on my local machine.  
bash-5.1$ pwd  
/var/lib/awx/projects/first-project

is it then possible for the awx job template to copy into this path since it can see the files?

Thanks!

---

<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:** [May 3, 2023, 6:46pm UTC](https://forum.ansible.com/t/how-to-save-stdout-at-awx-host-filesystem/36523/10 "2023-05-03T18:46:41Z")

</div>

can you provide your exact settings for exposed isolated paths? also can you paste the playbook that you are running, or at least the portion that writes the file to this mounted in location?

AWX Team

---

<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:** [May 3, 2023, 6:53pm UTC](https://forum.ansible.com/t/how-to-save-stdout-at-awx-host-filesystem/36523/11 "2023-05-03T18:53:41Z")

</div>

Hi, also be sure to use the latest Controller docs. The doc you linked was for v3.8, which is pretty old and doesn’t align with newer AWX versions

you can use this link [https://docs.ansible.com/automation-controller/latest/html/userguide/security.html#isolation-functionality-and-variables](https://docs.ansible.com/automation-controller/latest/html/userguide/security.html#isolation-functionality-and-variables)

---

<div class="post-metadata">

**Author:** ![vivek\_shete](https://avatars.discourse-cdn.com/v4/letter/v/48db29/32.png) [@vivek\_shete](https://forum.ansible.com/u/vivek_shete)\
**Post date:** [July 18, 2023, 5:51pm UTC](https://forum.ansible.com/t/how-to-save-stdout-at-awx-host-filesystem/36523/12 "2023-07-18T17:51:18Z")

</div>

Hi OP, were you able to resolve this? I am also trying to save output locally and eventually copy it to remote server.
