# Is it possible to pass extra variables via a file?

**URL:** <https://forum.ansible.com/t/is-it-possible-to-pass-extra-variables-via-a-file/35877>\
**Category:** AWX Project\
**Tags:** awx\
**Created:** [October 15, 2021, 9:18am UTC](https://forum.ansible.com/t/is-it-possible-to-pass-extra-variables-via-a-file/35877 "2021-10-15T09:18:14Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Vincent\_Rubiolo](https://avatars.discourse-cdn.com/v4/letter/v/a183cd/32.png) [@Vincent\_Rubiolo](https://forum.ansible.com/u/Vincent_Rubiolo)\
**Post date:** [October 15, 2021, 9:18am UTC](https://forum.ansible.com/t/is-it-possible-to-pass-extra-variables-via-a-file/35877/1 "2021-10-15T09:18:14Z")

</div>

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](https://groups.google.com/g/awx-project/c/Tka-8GQzKhQ/m/Ijh-ep7DAgAJ)

---

<div class="post-metadata">

**Author:** ![howardjones](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/howardjones/32/4169_2.png) [@howardjones](https://forum.ansible.com/u/howardjones)\
**Post date:** [October 15, 2021, 9:34am UTC](https://forum.ansible.com/t/is-it-possible-to-pass-extra-variables-via-a-file/35877/2 "2021-10-15T09:34:58Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Vincent\_Rubiolo](https://avatars.discourse-cdn.com/v4/letter/v/a183cd/32.png) [@Vincent\_Rubiolo](https://forum.ansible.com/u/Vincent_Rubiolo)\
**Post date:** [October 15, 2021, 1:58pm UTC](https://forum.ansible.com/t/is-it-possible-to-pass-extra-variables-via-a-file/35877/3 "2021-10-15T13:58:19Z")

</div>

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
