Trouble with output from script module task

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.