Improved ways to store host and group variables

New minor feature.

I really wanted to be able to store structured group and host variables separate from my inventory.

Assume your inventory file is /etc/ansible/hosts and looks like this:

===== START =====
[webservers]
pinky
brain

[dbservers]
pinky
snowball
===== STOP =====

With this new feature, for the host Pinky, ansible will load variables from these places, in order:

    /etc/ansible/group_vars/webservers
    /etc/ansible/group_vars/dbservers
    /etc/ansible/host_vars/pinky

If these files don't exist, nothing happens.
If your host file was in a different location, the path would still be relative to that file, so it still works for non-root/checkout users

(This is also, incidentally, how I'm going to enable removal of the YAML inventory format. We'll auto-convert any variables stored into an inventory
file into this structure.)

So yeah, with this, you can totally happily use the INI file format to describe your hosts and groups -- because it's a lot simpler -- and then if you
need for store a hash or a list or something in a group or host variable, you have a very easy way to do that.

Will include this in the docs section when 0.6 rolls out, but it's available on the development branch now.

--Michael

With this new feature, for the host Pinky, ansible will load variables from these places, in order:

    /etc/ansible/group_vars/webservers
    /etc/ansible/group_vars/dbservers
    /etc/ansible/host_vars/pinky

Way cool!

        -JP

What format are the group_vars/* and host_vars/* files in? Are those YAML?

Yep.

Hmm. With a hosts file like this:

PS: Removing the ‘if’ condition in playbook/init.py has the group_vars file working as expected for task actions (bar untested side effects), but the variables are not used in the task names. If I change the playbook to