# using an inventory file created  from previous inventory

**URL:** <https://forum.ansible.com/t/using-an-inventory-file-created-from-previous-inventory/38096>\
**Category:** AWX Project\
**Created:** [June 13, 2023, 1:59pm UTC](https://forum.ansible.com/t/using-an-inventory-file-created-from-previous-inventory/38096 "2023-06-13T13:59:28Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Veera](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/veera/32/4107_2.png) [@Veera](https://forum.ansible.com/u/Veera)\
**Post date:** [June 13, 2023, 1:59pm UTC](https://forum.ansible.com/t/using-an-inventory-file-created-from-previous-inventory/38096/1 "2023-06-13T13:59:28Z")

</div>

Hi,

I have a workflow which has 2 templates. Using the first template, I am creating a VM and writing the related inventory details to an inventory file /home/runner/temp\_inventory.txt .

However, I cannot use it in my second template as the Execution-environment loses it on the second run.

Is there a way that I can create a temporary inventory (which has dynamic parameters like the IP , hostname changes on every run) and call it in the second template of the workflow ?

---

<div class="post-metadata">

**Author:** ![AWX\_Project](https://avatars.discourse-cdn.com/v4/letter/a/eada6e/32.png) [@AWX\_Project](https://forum.ansible.com/u/AWX_Project)\
**Post date:** [June 14, 2023, 6:55pm UTC](https://forum.ansible.com/t/using-an-inventory-file-created-from-previous-inventory/38096/2 "2023-06-14T18:55:26Z")

</div>

It should be possible for you to utilize the set\_stat module to pass in an extra\_var to the second job template. You’d likely need to have 2 plays in the second job template the first adding hosts/groups and the second play targeting the first.

Alternatively, you could try using the awx.awx collection to create a new inventory which you’d then need to pass into the second job template. Both of these options should work but require some thought around implementation details.

Thanks,

AWX Team
