Not loading host_vars

131 views
Skip to first unread message

Jason Sarrells

unread,
Jul 31, 2014, 12:21:09 PM7/31/14
to ansible...@googlegroups.com
I cannot get anything in host_vars to load when running a playbook.  I am using Ansible 1.4.3.  What am I doing wrong?




~/test.yml
---
-hosts: test
 tasks
:
   
- name: debug
      debug
: var={{ foo }}

/etc/ansible/hosts
[test]
10.1.0.241




/etc/ansible/host_vars/test
---
foo
: bar


or


~/host_vars/test
---
foo
: baz


Michael DeHaan

unread,
Jul 31, 2014, 6:42:39 PM7/31/14
to ansible...@googlegroups.com
Well, you're using a terribly ancient version of Ansible, unrelated to your question.

Upgrade to 1.6.10 first, you're missing some security fixes and numerous other upgrades.

What you have in the first "host_vars" should be fine, however.




--
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-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/9fe7e8ae-8621-4cbe-84c7-3e7e67303c87%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Jason Sarrells

unread,
Aug 4, 2014, 12:32:03 PM8/4/14
to ansible...@googlegroups.com
I finally figured out what I was doing wrong and thought I would share. The host is 10.1.0.241, not "test" (that is the group name).  My host_vars file should be /etc/ansible/host_vars/10.1.0.241.  Once I corrected the file name, everything worked as expected.
Reply all
Reply to author
Forward
0 new messages