Get Ansible Job ID inside playbook

Hello;

How can I retrieve the current job id? Want to create a Jira Issue using the jira module and add the ansible job ID as description…

Thank you very much

Ivo

Hi Ivo, is this a Tower question? In ansible core, the “job id” only exists for async tasks.

Thanks!

Hello James;

Yes, in tower, each job has its ID in the joblist. If a job results in creating a Jira-Issue, it would be nice to link in the Jira Issue to the ansible Job. Is there a way to realize this?

Thank you very much

Ivo

Hi Ivo,

For future tower queries can you please post it at ‘support.ansible.com’ as this list is for core ansible. following are variables exposed by tower to an ansible playbook.

{“tower_job_template_name”, “tower_job_id”, “tower_user_id”, “tower_job_template_id”, “tower_user_name”, “tower_job_launch_type”}

  • Benno

Hi Benno, thank you very much, works fine, also thanks for support.ansible.com

Ivo