view remote shell script output to the controller node terminal screen

Hi,

Is there a way to see the remote shell script output to the controller node terminal screen (stdout) ? I have the below shell script on a remote node.

  • name: Execute the script
    #command: sh /opt/installaio.sh
    raw: /opt/installaio.sh
    #script: /opt/installaio.sh
    register: out

  • debug:
    var: out.stdout_lines

On Remote client nodes

cat /opt/installaio.sh

curl http://software.internalreposandbox.com/bootstrap_4.17.09.sh -o /tmp/bootstrap_4.17.09.sh
bash /tmp/bootstrap_4.17.09.sh user=“deployuser” password=“password”

/opt/apigee/apigee-service/bin/apigee-service apigee-setup install
/opt/apigee/apigee-setup/bin/setup.sh -p aio -f /opt/configfile

Any help will be highly appreciable.

Thanks in Advance.

Best Regards,

Kaushal

Hi,

I will appreciate if someone can pitch in for my earlier post to this group. Thanks in Advance.

Best Regards,

Kaushal

If the log file is generated in the /tmp/ folder you can use the fetch command to copy the log back to the ansible controller and use whatever method you want to display the content (maybe shell module with cat command)

An example of the fetch module is sohwn below

  • name: Copy /tmp/cluster_api_status back for troubleshooting
    fetch:
    src: /tmp/cluster_api_status
    dest: fetch/cluster_api_status_{{ inventory_hostname }}.log
    validate_checksum: no
    flat: yes
    changed_when: false