# host\_vars/all does not work anymore?

**URL:** <https://forum.ansible.com/t/host-vars-all-does-not-work-anymore/22077>\
**Category:** Ansible Project\
**Tags:** ubuntu\
**Created:** [July 21, 2016, 4:40pm UTC](https://forum.ansible.com/t/host-vars-all-does-not-work-anymore/22077 "2016-07-21T16:40:07Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Do\_Hoang\_Khiem](https://avatars.discourse-cdn.com/v4/letter/d/3d9bf3/32.png) [@Do\_Hoang\_Khiem](https://forum.ansible.com/u/Do_Hoang_Khiem)\
**Post date:** [July 21, 2016, 4:40pm UTC](https://forum.ansible.com/t/host-vars-all-does-not-work-anymore/22077/1 "2016-07-21T16:40:07Z")

</div>

My simple test case:

**ubuntu@ansible-tower-server:~/temp/ansible$ ansible --version**

ansible 1.9.4

configured module search path = None

**ubuntu@ansible-tower-server:~/temp/ansible$ tree .**

**.**

├── **env**

│ └── **staging**

│ └── **th**

│ ├── hosts

│ └── **host\_vars**

│ └── all

├── **host\_vars**

│ └── all

└── test\_host\_vars.yml

**ubuntu@ansible-tower-server:~/temp/ansible$ cat test\_host\_vars.yml**

- hosts: all

gather\_facts: yes

tasks:

- debug: msg=“var1={{var1}} var2={{var2}}”

**ubuntu@ansible-tower-server:~/temp/ansible$ cat env/staging/th/hosts**

localhost

**ubuntu@ansible-tower-server:~/temp/ansible$ cat env/staging/th/host\_vars/all**

# variables for all th staging hosts

var1: value1

var2: value2

**ubuntu@ansible-tower-server:~/temp/ansible$ ansible-playbook -i env/staging/th/hosts test\_host\_vars.yml**

PLAY [all] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*

GATHERING FACTS \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*

ok: [localhost]

TASK: [debug msg=“var1={{var1}} venture={{venture}} nr\_key={{nr\_key}} timezone={{timezone}}”] \*\*\*

fatal: [localhost] =\> One or more undefined variables: ‘var1’ is undefined

FATAL: all hosts have already failed – aborting

PLAY RECAP \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*

to retry, use: --limit @/home/ubuntu/test\_host\_vars.retry

localhost : ok=1 changed=0 unreachable=1 failed=0

So from what I see, host\_vars/all does not work even if it’s located at same directory as playbook or same directory as inventory.

From Ansible: [http://docs.ansible.com/ansible/intro\_inventory.html](http://docs.ansible.com/ansible/intro_inventory.html)

_Tip: In Ansible 1.2 or later the group\_vars/ and host\_vars/ directories can exist in the playbook directory OR the inventory directory. If both paths exist, variables in the playbook directory will override variables set in the inventory directory._

Is it correct anymore or am I wrong somewhere?

---

<div class="post-metadata">

**Author:** ![Kai\_Stian\_Olstad](https://avatars.discourse-cdn.com/v4/letter/k/e19adc/32.png) [@Kai\_Stian\_Olstad](https://forum.ansible.com/u/Kai_Stian_Olstad)\
**Post date:** [July 21, 2016, 4:58pm UTC](https://forum.ansible.com/t/host-vars-all-does-not-work-anymore/22077/2 "2016-07-21T16:58:36Z")

</div>

all is only supported in group\_vars.
