using an inventory file created from previous inventory

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 ?

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