# Trouble with output from script module task

**URL:** <https://forum.ansible.com/t/trouble-with-output-from-script-module-task/27760>\
**Category:** Ansible Project\
**Created:** [June 10, 2018, 1:22pm UTC](https://forum.ansible.com/t/trouble-with-output-from-script-module-task/27760 "2018-06-10T13:22:58Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ab\_Generette](https://avatars.discourse-cdn.com/v4/letter/a/aca169/32.png) [@Ab\_Generette](https://forum.ansible.com/u/Ab_Generette)\
**Post date:** [June 10, 2018, 1:22pm UTC](https://forum.ansible.com/t/trouble-with-output-from-script-module-task/27760/1 "2018-06-10T13:22:58Z")

</div>

Hi,

I have a python script “expect\_again.py” that is meant to support a minimal amount of operator input, when that script in turn runs an expect script, “run\_primary.exp”. I’m not seeing all of the output, though, from the execution of that secondary script. This is a problem, because I need for the person who runs the Python script to be able to see the full output of each run.

Running the Python script, manually, I see:

> MacBook-Pro:playbooks anthony$ ~/scripts/expect\_again.py --admin jenkins --target 172.18.75.15 --exp\_call “c:/admin/run\_master.exp -steps ‘pass’” --csa\_response c --ca\_response c --ru\_response r
> 
> Warning: Permanently added ‘[172.18.75.15]:2121’ (ECDSA) to the list of known hosts.
> 
> Using server workserver1
> 
> 2018-06-09 17:55:08
> 
> c:/admin/run\_master.exp
> 
> -steps pass
> 
> Step pass: Process PASS files
> 
> Looking for files /cygdrive/data/Claims\_\*
> 
> Looking for files /cygdrive/d/data/Medicare\_\*
> 
> Looking for files /cygdrive/d/data/Groups\_\*
> 
> file processing completed

Running the playbook, though, I don’t see the output of the run\_master.exp call:

> TASK [debug] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
> 
> ok: [workserver1-ssh] =\>
> 
> result:
> 
> changed: true
> 
> failed: false
> 
> rc: 0
> 
> stderr: ‘’
> 
> stdout: |-
> 
> Warning: Permanently added ‘[172.18.75.15]:2121’ (ECDSA) to the list of known hosts.
> 
> Using server workserver1
> 
> 2018-06-09 17:47:03
> 
> c:/admin/run\_master.exp
> 
> stdout\_lines:
> 
> - ‘Warning: Permanently added ‘’[172.18.75.15]:2121’’ (ECDSA) to the list of known hosts.’
> 
> - ‘’
> 
> - Using server workserver1
> 
> - ‘2018-06-09 17:47:03’
> 
> - c:admin/run\_master.exp
> 
> - ‘’

That’s it. I don’t see any of the output that I’ve highlighted in red, from the manual run of the python script. I see that a connection is successfully made to the target host and that execution of the exp script starts.

Here’s what the Ansible task looks like:

> tasks:
> 
> - name: Run “{{ job\_name }}” script for “{{ customer }}”
> 
> script: ~/scripts/expect\_again.py --admin {{ admin }} --target {{ target }} --exp\_call {{ exp\_call }} --csa\_response {{ csa\_response }} --ca\_response {{ ca\_response }} --ru\_response {{ ru\_response }}
> 
> delegate\_to: 127.0.0.1
> 
> register: result
> 
> ignore\_errors: yes
> 
> - debug: var=result

I’ve pasted a copy of the python script, below.
