host_vars/all does not work anymore?

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

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?

all is only supported in group_vars.