# AWX/Tower and git integration - Post a comment with AWX/Tower job information

**URL:** <https://forum.ansible.com/t/awx-tower-and-git-integration-post-a-comment-with-awx-tower-job-information/25872>\
**Category:** AWX Project\
**Tags:** awx\
**Created:** [October 31, 2017, 10:01am UTC](https://forum.ansible.com/t/awx-tower-and-git-integration-post-a-comment-with-awx-tower-job-information/25872 "2017-10-31T10:01:26Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Valerio\_Galantini](https://avatars.discourse-cdn.com/v4/letter/v/3ab097/32.png) [@Valerio\_Galantini](https://forum.ansible.com/u/Valerio_Galantini)\
**Post date:** [October 31, 2017, 10:01am UTC](https://forum.ansible.com/t/awx-tower-and-git-integration-post-a-comment-with-awx-tower-job-information/25872/1 "2017-10-31T10:01:26Z")

</div>

Hi guys,

At work we are testing Tower and AWX and in particular we use it to produce configurations templates that we then push to git.  
The whole process works fine and we are trying to automate it using as follows:  
- a web frontend calling AWX/Tower API  
- APIs call will start a job/playbook in tower that will create/apply the new configuration  
- the last task of the playbook will commit and push the configuration to git.  
What I would like to do is to include in the git commit comment, the reference to AWX/Tower job that was spun but I can't find  
that information anywhere in the ansible\_facts that the playbook is running with.  
Do you know if it is possible to get it somewhere? Or even a way to pass it as an extra-var at the time the job is started?

Thanks

Valerio

---

<div class="post-metadata">

**Author:** ![matburt](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/matburt/32/3612_2.png) [@matburt](https://forum.ansible.com/u/matburt)\
**Post date:** [October 31, 2017, 1:32pm UTC](https://forum.ansible.com/t/awx-tower-and-git-integration-post-a-comment-with-awx-tower-job-information/25872/2 "2017-10-31T13:32:22Z")

</div>

Yep, we have a few extra vars that we pass to playbook execution:

tower\_job\_id  
awx\_job\_id (same as before)  
tower\_job\_launch\_type  
awx\_job\_launch\_type  
tower\_job\_template\_id  
awx\_job\_template\_id  
tower\_user\_id  
awx\_user\_id  
tower\_user\_name  
awx\_user\_name

We also pass some more details in the job environment.

You can check out everything we do by visiting the api endpoint for the job (it’s viewable in your browser!) **_towerhost/api/v2/jobs/n/_**

---

<div class="post-metadata">

**Author:** ![rpetrell](https://avatars.discourse-cdn.com/v4/letter/r/b4bc9f/32.png) [@rpetrell](https://forum.ansible.com/u/rpetrell)\
**Post date:** [October 31, 2017, 1:34pm UTC](https://forum.ansible.com/t/awx-tower-and-git-integration-post-a-comment-with-awx-tower-job-information/25872/3 "2017-10-31T13:34:47Z")

</div>

Hey Valerio,

Job Templates launched in awx inject a few additional extra\_vars that should give you what you need:

[https://github.com/ansible/awx/blob/90f63774f4e83a80dc2612c3277879c1cfe57a7f/awx/main/tasks.py#L1123](https://github.com/ansible/awx/blob/90f63774f4e83a80dc2612c3277879c1cfe57a7f/awx/main/tasks.py#L1123)

Some that you might find useful are:

awx\_job\_id  
awx\_job\_launch\_type - see [https://github.com/ansible/awx/blob/90f63774f4e83a80dc2612c3277879c1cfe57a7f/awx/main/models/unified\_jobs.py#L427](https://github.com/ansible/awx/blob/90f63774f4e83a80dc2612c3277879c1cfe57a7f/awx/main/models/unified_jobs.py#L427) for options  
awx\_job\_template\_id  
awx\_job\_template\_name

These two represent the awx user that launched the job:  
awx\_user\_id  
awx\_user\_name

If you wanted to build direct link to a job, it would be something like:

“[https://your-tower-host.example.org/api/v2/jobs/](https://your-tower-host.example.org/api/v2/jobs/){{ awx\_job\_id }}”

---

<div class="post-metadata">

**Author:** ![rpetrell](https://avatars.discourse-cdn.com/v4/letter/r/b4bc9f/32.png) [@rpetrell](https://forum.ansible.com/u/rpetrell)\
**Post date:** [October 31, 2017, 1:35pm UTC](https://forum.ansible.com/t/awx-tower-and-git-integration-post-a-comment-with-awx-tower-job-information/25872/4 "2017-10-31T13:35:24Z")

</div>

Oh no, it looks like Matt Jones beat me to it :D!

---

<div class="post-metadata">

**Author:** ![Valerio\_Galantini](https://avatars.discourse-cdn.com/v4/letter/v/3ab097/32.png) [@Valerio\_Galantini](https://forum.ansible.com/u/Valerio_Galantini)\
**Post date:** [November 7, 2017, 10:41am UTC](https://forum.ansible.com/t/awx-tower-and-git-integration-post-a-comment-with-awx-tower-job-information/25872/5 "2017-11-07T10:41:16Z")

</div>

Thank you both guys!
