I have a Ansible job started by another Process. Now I need to check the status of the current running job in Ansible Tower.
I am able to track the status whether it is running/success/failed/canceled with /jobs/{id}
using REST API.
But I would also need the information of the console logs/ouputs of the task for processing as well. Is there any direct API call for the same?
Some user operations may not be supported in the modules, however you can use the Ansible URI module to make direct calls to any API including the PowerMax REST API which will ensure that even your corner case can be supported in an Ansible playbook.
Validating Ansible Tower metricsTo generate the token, access the Ansible Tower console and click on your username that appears at the top of the page. From there, click on “Tokens” and then on the + sign. A new window pops up where you can define the specifics of the token and finally create it, see the image below.
ansible. cfg (in the home directory) /etc/ansible/ansible. cfg.
You can access the job log via a link similar to:
https://tower.yourcompany.com/api/v1/jobs/12345/stdout?format=txt_download
Your curl command would be similar to:
curl -O -k -J -L -u ${username):${password} https://tower.company.com/api/v1/jobs/${jobnumber}/stdout?format=txt_download
obviously replacing ${username}, ${password}, and ${jobnumber} with your own values
The curl flags used:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With