Reference AWX Username

In AWX, I’m looking for a way to reference the details of the user who executes a job.

Specifically, I want to get either their username or email address. Then, during one of my playbooks that creates records in ServiceNow I can associate those new records to them instead of me.

Right now, all records that my playbooks create in SNOW (Changes, INC, REQ, etc.) get assigned to me and then I look to see who created the job and manually change ownership.

If there is nothing built in, I’m thinking of using the AWX API:

  1. Look for the current running Job
  2. Find who executed the job
  3. Pull the details of the user who executed the job
  4. Lookup the user in SNOW based on info pulled from AWX API

Thoughts? Recommendations?

Thank you,


There are awx_meta_vars that I think you can leverage. I haven’t actually tried this, but it was mentioned by @fosterseth in another thread. Looking at what’s there, I think you can get awx_* vars for the job/workflow, schedule, user, and inventory as shown here:

1 Like

Thank you. While searching, all I could find were references to AWX/Tower/AAP Credentials; which is not what I wanted.

I’ll give this a try and report back.

Both {{ awx_user_id }} and {{ awx_user_email }} work as well as the others @Denney-tech refers to, but beware the two I mention are specifically not set when the job template is triggered by an incoming Webhook.

1 Like

I have not yet gotten time to go back and start playing with this. I appreciate the followup and when I get time, I’ll definitely get to it.

The laundry list is too big!!!

"{{ tower_user_email }}" worked perfectly. I finally got a chance to test this one last night.

After finding the variable name, I was able to find the documentations here:
Ansible Tower Documentation

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.