Download Ansible Tower log output directly to a output file on managed remote server

Could someone please help on "How to download Ansible Tower execution result to a log file on a particular remote server?".

I couldn't find much results on "How to automatically download the result of execution?".


Solution 1:

I understand your question similar to Ansible Tower REST API: Is there any way to get the logs/output of a job?

According the Tower API Reference Guide: Jobs, the following call might work from or on your remote server.

curl --silent -u ${TOWER_USER}:${TOWER_PASSWORD} -JL https://${TOWER_URL}/api/v2/jobs/${JobID}/stdout?format=txt_download -o job_${JobID}.log

resulting into the output of a file called job_${JobID}.log.

You may transfer this in to an Ansible task, ideally by not using the shell module.