# Simple template/vars file issue

**URL:** <https://forum.ansible.com/t/simple-template-vars-file-issue/13436>\
**Category:** Ansible Project\
**Created:** [September 9, 2013, 6:06am UTC](https://forum.ansible.com/t/simple-template-vars-file-issue/13436 "2013-09-09T06:06:23Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![James\_Reece](https://avatars.discourse-cdn.com/v4/letter/j/8edcca/32.png) [@James\_Reece](https://forum.ansible.com/u/James_Reece)\
**Post date:** [September 9, 2013, 6:06am UTC](https://forum.ansible.com/t/simple-template-vars-file-issue/13436/1 "2013-09-09T06:06:23Z")

</div>

I apologise now for the simplicity of this query… I’ve read a lot of related posts but I am still no closer to understanding the problem.

I have a very simple play.

The specific issue I am stuck on only started on Friday. I must have ‘tweaked’ something and I am darned if I can work out what - this step worked on Thursday after we upgraded to latest version.

Anyway - it’s a template step.

- name: Templates to appropriate HNAS share  
template: src=$environmentDirectory/templates/$model/Munich.yaml dest=/mnt/brlhnas/workgroup\_cfg/$env/$model/Munich.yaml

The calling play references vars here:

vars:  
env: UAT  
model: GLORIA

vars\_files:

- …/global\_vars.yml
- …/vars/SetupConfigVars\_$env\_$model.yml

My global\_vars file contains this;

environmentDirectory: /home/sysadmin

My file vars/SetupConfigVars\_UAT\_GLORIA.yml, contains the following;

---

<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:** [September 9, 2013, 2:45pm UTC](https://forum.ansible.com/t/simple-template-vars-file-issue/13436/2 "2013-09-09T14:45:02Z")

</div>

Can you share the template?

BTW, I should point out you are using old style variables ($foo).

Change $environment to {{ environment }} and this will be more consistent with up to date playbooks.

At some point in the future support for this will be removed so it makes sense to get in the habit now.

Old style variables can also be disabled in ansible.cfg to make this easier.

---

<div class="post-metadata">

**Author:** ![Brian\_Coca1](https://avatars.discourse-cdn.com/v4/letter/b/278dde/32.png) [@Brian\_Coca1](https://forum.ansible.com/u/Brian_Coca1)\
**Post date:** [September 9, 2013, 2:47pm UTC](https://forum.ansible.com/t/simple-template-vars-file-issue/13436/3 "2013-09-09T14:47:31Z")

</div>

I would also avoid using 'environment' as it is an ansible reserved keyword.

---

<div class="post-metadata">

**Author:** ![James\_Reece](https://avatars.discourse-cdn.com/v4/letter/j/8edcca/32.png) [@James\_Reece](https://forum.ansible.com/u/James_Reece)\
**Post date:** [September 9, 2013, 11:26pm UTC](https://forum.ansible.com/t/simple-template-vars-file-issue/13436/4 "2013-09-09T23:26:47Z")

</div>

Thank you both.

I think I misread the jinja document on the variables - {{env}} works nicely!

Fortunately, we’re not too far along in our little demo project here so I can make your recommended changes in no time.

I appreciate the help.
