# get variables after a job is finished

**URL:** <https://forum.ansible.com/t/get-variables-after-a-job-is-finished/34798>\
**Category:** AWX Project\
**Tags:** awx\
**Created:** [March 17, 2021, 1:50pm UTC](https://forum.ansible.com/t/get-variables-after-a-job-is-finished/34798 "2021-03-17T13:50:46Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Manuel\_Sopena\_Balles](https://avatars.discourse-cdn.com/v4/letter/m/13edae/32.png) [@Manuel\_Sopena\_Balles](https://forum.ansible.com/u/Manuel_Sopena_Balles)\
**Post date:** [March 17, 2021, 1:50pm UTC](https://forum.ansible.com/t/get-variables-after-a-job-is-finished/34798/1 "2021-03-17T13:50:46Z")

</div>

Hi,

I am new to AWX, I have a template which runs through a job submission. This templates runs a playbook which setups some nodes and generates a random ssh port to connect to the nodes. I need to get this port number because I need it somewhere else.

How could I do this?

thank you

---

<div class="post-metadata">

**Author:** ![Manuel\_Sopena\_Balles](https://avatars.discourse-cdn.com/v4/letter/m/13edae/32.png) [@Manuel\_Sopena\_Balles](https://forum.ansible.com/u/Manuel_Sopena_Balles)\
**Post date:** [March 17, 2021, 2:25pm UTC](https://forum.ansible.com/t/get-variables-after-a-job-is-finished/34798/2 "2021-03-17T14:25:53Z")

</div>

Maybe I should paraphrase.

Is it possible to get the variables from a job submission once the job is finished?

---

<div class="post-metadata">

**Author:** ![Mike\_Charchuk](https://avatars.discourse-cdn.com/v4/letter/m/e47774/32.png) [@Mike\_Charchuk](https://forum.ansible.com/u/Mike_Charchuk)\
**Post date:** [March 17, 2021, 2:45pm UTC](https://forum.ansible.com/t/get-variables-after-a-job-is-finished/34798/3 "2021-03-17T14:45:03Z")

</div>

I set variables with the set\_stats: data: in jobs for use in subsequent jobs in the same workflow.

I have also used the cacheable: true option with set\_fact to persist the variable in the host cache.
