Is it possible to pass extra variables via a file?

Greetings everyone,

I am ramping up on AWX and find it great so far. The UI is clean and I can see there was a lot of thought to map on how Ansible is run across organizations.

I am using Ansible to deploy infrastructure via multiple roles here where our ansible-playbook command makes use of the --extra-vars @/path/to/var_file.yaml syntax.

I have looked in the AWX UI but cannot find any trace of that in the job templates.

A search on this mailing list archives got me one hit[1] but no definitive answer other than using awx-cli to create the template. I got nothing scouring the open Github issues.

Is such a scheme supported? It looks strange to me it is not. Passing variables via a file is standard Ansible practice IMHO and using individual --extra-vars does not scale (our var file contains 100+ of them). I might have overlooked something hence this question.

Thanks to all of you for your help!

Vincent

[1] https://groups.google.com/g/awx-project/c/Tka-8GQzKhQ/m/Ijh-ep7DAgAJ

If not using the cli tool, how would you intend to get the file into the system?

We use the awx API from a different internal tool that generates our extra_vars as a YAML document, based on collected requirements and applies it as the "variables" field of a job template that has "prompt on launch" for that field. You definitely can push hundreds of vars this way - we do that. I assume this is what the cli tool is doing in the background too.

Hi Howard,

A search on this mailing list archives got me one hit[1] but no
definitive answer other than using awx-cli to create the template. I
got nothing scouring the open Github issues.

Is such a scheme supported? It looks strange to me it is not. Passing
variables via a file is standard Ansible practice IMHO and using
individual --extra-vars does not scale (our var file contains 100+ of
them). I might have overlooked something hence this question.

If not using the cli tool, how would you intend to get the file into the
system?

Sorry I was not clear enough. We are looking primarily at using the UI to launch jobs.
I would get the var file into the system the same way I get my inventory and playbook files in: from a repository.
I would have expected a similar mechanism here as for the inventory: the ability to define a ‘source’ for the file, taking it from the project I created.

We use the awx API from a different internal tool that generates our
extra_vars as a YAML document, based on collected requirements and
applies it as the “variables” field of a job template that has “prompt
on launch” for that field. You definitely can push hundreds of vars this
way - we do that. I assume this is what the cli tool is doing in the
background too.

Thanks for sharing your usecase. I assume the ‘prompt on launch’ means ‘user-supplied’ in the context of the API (i.e. there is no busy wait for input), is that right?

Vincent