# How to get details about a user running an Ansible Tower job

**URL:** <https://forum.ansible.com/t/how-to-get-details-about-a-user-running-an-ansible-tower-job/30518>\
**Category:** Ansible Project\
**Created:** [June 9, 2019, 4:47pm UTC](https://forum.ansible.com/t/how-to-get-details-about-a-user-running-an-ansible-tower-job/30518 "2019-06-09T16:47:31Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dmitrii\_M](https://avatars.discourse-cdn.com/v4/letter/d/f475e1/32.png) [@Dmitrii\_M](https://forum.ansible.com/u/Dmitrii_M)\
**Post date:** [June 9, 2019, 4:47pm UTC](https://forum.ansible.com/t/how-to-get-details-about-a-user-running-an-ansible-tower-job/30518/1 "2019-06-09T16:47:31Z")

</div>

Hi all,

I’ve two questions:

1. Is there a way to know the details about a user who runs playbooks (job template/workflow)? I’d propose that module “tower\_user” might do that, it just can be extended with some output like it does “stat” module.

`

## playbook.yml

- tower\_user:  
username: jobowner  
register: jobowner\_stat

- debug:  
msg: |  
Username: {{ jobowner\_stat.username }}  
Email: {{ jobowner\_stat.email }}  
Is\_superuser: {{ jobowner\_stat.superuser }}  
First name: {{ jobowner\_stat.first\_name }}  
Last name: {{ jobowner\_stat.last\_name }}

`

Or if there is something already implemented, it would be great to know about this.

1. How can I know that a playbook is run by Ansible Tower? For example, I’m writing a playbook on a local machine and I need to run additional tasks like “Get the owner of a job which runs the playbook” above.

Thank you,  
Dmitrii

---

<div class="post-metadata">

**Author:** ![Cade\_Lambert](https://avatars.discourse-cdn.com/v4/letter/c/278dde/32.png) [@Cade\_Lambert](https://forum.ansible.com/u/Cade_Lambert)\
**Post date:** [June 12, 2019, 4:32pm UTC](https://forum.ansible.com/t/how-to-get-details-about-a-user-running-an-ansible-tower-job/30518/2 "2019-06-12T16:32:48Z")

</div>

Tower returns a handful of variables containing info about a job execution:

[https://docs.ansible.com/ansible-tower/latest/html/userguide/job\_templates.html](https://docs.ansible.com/ansible-tower/latest/html/userguide/job_templates.html)

- `tower_job_id`: The Job ID for this job run
- `tower_job_launch_type`: The description to indicate how the job was started:
  - **manual** : Job was started manually by a user.
  - **relaunch** : Job was started via relaunch.
  - **callback** : Job was started via host callback.
  - **scheduled** : Job was started from a schedule.
  - **dependency** : Job was started as a dependency of another job.
  - **workflow** : Job was started from a workflow job.
  - **sync** : Job was started from a project sync.
  - **scm** : Job was created as an Inventory SCM sync.
  - `tower_job_template_id`: The Job Template ID that this job run uses

- `tower_job_template_name`: The Job Template name that this job uses
- `tower_user_id`: The user ID of the Tower user that started this job. This is not available for callback or scheduled jobs.
- `tower_user_name`: The user name of the Tower user that started this job. This is not available for callback or scheduled jobs.
- `tower_schedule_id`: If applicable, the ID of the schedule that launched this job
- `tower_schedule_name`: If applicable, the name of the schedule that launched this job
- `tower_workflow_job_id`: If applicable, the ID of the workflow job that launched this job
- `tower_workflow_job_name`: If applicable, the name of the workflow job that launched this job. Note this is also the same as the workflow job template.  
Is this what you’re looking for?
