# vars\_files query

**URL:** <https://forum.ansible.com/t/vars-files-query/14247>\
**Category:** Ansible Project\
**Created:** [January 1, 2014, 11:10pm UTC](https://forum.ansible.com/t/vars-files-query/14247 "2014-01-01T23:10:57Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![nirik](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/nirik/32/686_2.png) [@nirik](https://forum.ansible.com/u/nirik)\
**Post date:** [January 1, 2014, 11:10pm UTC](https://forum.ansible.com/t/vars-files-query/14247/1 "2014-01-01T23:10:57Z")

</div>

Greetings.

I'm running into something weird with vars\_files and I thought I would  
ask the list if it's a bug I should file or if I am just doing  
something wrong. 😉

I had:

&nbsp;&nbsp;vars\_files:  
&nbsp;&nbsp;&nbsp;&nbsp;- /srv/web/infra/ansible/vars/global.yml  
&nbsp;&nbsp;&nbsp;&nbsp;- $private/vars.yml  
&nbsp;&nbsp;&nbsp;&nbsp;- $vars/$ansible\_distributiion.yml

and private and vars were both defined in global.yml and all worked.

Switching to new syntax:

&nbsp;&nbsp;vars\_files:  
&nbsp;&nbsp;&nbsp;- /srv/web/infra/ansible/vars/global.yml  
&nbsp;&nbsp;&nbsp;- "{{ private }}/vars.yml"  
&nbsp;&nbsp;&nbsp;- "{{ vars }}/{{ ansible\_distribution }}.yml"

results in the last vars file never loading. If I replace {{ vars }} by  
the path it loads fine. If I replace the {{ ansible\_distribution }}with  
a hard coded one it loads ok. It's like it's not expanding multiple  
variables in the same import line?

As a side note, at some points I see it mentioning that the distro vars  
file is being imported, but not other times. When does ansible-playbook  
note "importing ..." ?

Thanks for any thoughts...

kevin

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan2](https://avatars.discourse-cdn.com/v4/letter/m/da6949/32.png) [@Michael\_DeHaan2](https://forum.ansible.com/u/Michael_DeHaan2)\
**Post date:** [January 1, 2014, 11:26pm UTC](https://forum.ansible.com/t/vars-files-query/14247/2 "2014-01-01T23:26:18Z")

</div>

There should be nothing about the different variable syntaxes making a difference here, fact loading is exactly the same and templating runs the same for each.

What I have caught though is a typo in your original:

- $vars/$ansible\_distributiion.yml

And also that vars is reserved.

[https://github.com/ansible/ansible/blob/devel/lib/ansible/runner/ **init**.py#L454](https://github.com/ansible/ansible/blob/devel/lib/ansible/runner/ __init__.py#L454)

---

<div class="post-metadata">

**Author:** ![nirik](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/nirik/32/686_2.png) [@nirik](https://forum.ansible.com/u/nirik)\
**Post date:** [January 2, 2014, 12:07am UTC](https://forum.ansible.com/t/vars-files-query/14247/3 "2014-01-02T00:07:46Z")

</div>

Ah, so it is... I was looking at:

[http://www.ansibleworks.com/docs/playbooks\_variables.html#id22](http://www.ansibleworks.com/docs/playbooks_variables.html#id22)  
which doesn't mention vars as being reserved. ;(

I got it working... something was wacky with my git checkout I was  
running from. I did a clean checkout and reconverted and everything  
seems to be working now.

Thanks and sorry for the noise.

kevin

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan2](https://avatars.discourse-cdn.com/v4/letter/m/da6949/32.png) [@Michael\_DeHaan2](https://forum.ansible.com/u/Michael_DeHaan2)\
**Post date:** [January 2, 2014, 12:32am UTC](https://forum.ansible.com/t/vars-files-query/14247/4 "2014-01-02T00:32:51Z")

</div>

No problem.

And as for the docs error, while you can file a ticket on the docs, pull requests to the documentation source would also be accepted.

(In other news, we hope to make the newly restructured docs page site the default in a few days or less)
