Re: [ansible-project] host_vars/all does not work anymore?

2016-07-21 Thread Kai Stian Olstad

On 21. juli 2016 18:40, Do Hoang Khiem wrote:

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.


--
Kai Stian Olstad

--
You received this message because you are subscribed to the Google Groups "Ansible 
Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/5790FF3C.9000705%40olstad.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] host_vars/all does not work anymore?

2016-07-21 Thread Do Hoang Khiem
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=1changed=0unreachable=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?

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/04008fe7-c479-4acf-aec4-2d9175176f6b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.