# Vars output differences during ansible run when vars located in /defaults or /vars

**URL:** <https://forum.ansible.com/t/vars-output-differences-during-ansible-run-when-vars-located-in-defaults-or-vars/17497>\
**Category:** Ansible Project\
**Created:** [February 11, 2015, 12:18am UTC](https://forum.ansible.com/t/vars-output-differences-during-ansible-run-when-vars-located-in-defaults-or-vars/17497 "2015-02-11T00:18:21Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Walter\_Dolce](https://avatars.discourse-cdn.com/v4/letter/w/6bbea6/32.png) [@Walter\_Dolce](https://forum.ansible.com/u/Walter_Dolce)\
**Post date:** [February 11, 2015, 12:18am UTC](https://forum.ansible.com/t/vars-output-differences-during-ansible-run-when-vars-located-in-defaults-or-vars/17497/1 "2015-02-11T00:18:21Z")

</div>

Hi,

I’ve fairly new to Ansible and I’ve been trying things out with it.  
I’m trying to write a simple playbook. As I’d like to have the ability to [let others] decide what to put in some vars and by following the docs on vars override rules I came up with something like the following:

> roles/  
> php-composer/  
> defaults/main.xml  
> tasks/main.xml

Where defaults/main.xml contains:

---

<div class="post-metadata">

**Author:** ![sivel](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/sivel/32/1198_2.png) [@sivel](https://forum.ansible.com/u/sivel)\
**Post date:** [February 11, 2015, 2:29am UTC](https://forum.ansible.com/t/vars-output-differences-during-ansible-run-when-vars-located-in-defaults-or-vars/17497/2 "2015-02-11T02:29:17Z")

</div>

Just so that we are clear. Are your files really named with a .xml extension? It was it just a typo and you meant .yml?

.yml is the appropriate file extension.

In general it is not straightforward to get var expansion in the name of a task, mainly due to scope. I would however expect defaults and cars to be in the same scope, but without the code in front of me I can’t say. Although in general is recommend staying away from cars in the task names.

---

<div class="post-metadata">

**Author:** ![Walter\_Dolce](https://avatars.discourse-cdn.com/v4/letter/w/6bbea6/32.png) [@Walter\_Dolce](https://forum.ansible.com/u/Walter_Dolce)\
**Post date:** [February 11, 2015, 8:10am UTC](https://forum.ansible.com/t/vars-output-differences-during-ansible-run-when-vars-located-in-defaults-or-vars/17497/3 "2015-02-11T08:10:59Z")

</div>

Argh! Sorry that was a typo.  
They have .yml extension.
