ansible/ansible — pull request #2664 by chamill (2013-04-12 17:49:19+00:00)
Title: Allow subdirs in host/group_vars and vars files extensions.

Allows directory organization:

host_vars/hostname.ymal
host_vars/project_foo/hostname
host_vars/project_foo/plue/hostname.yaml
group_vars/groupname.ymal
group_vars/project_bar/groupname
group_vars/project_bar/grue/groupname.yaml

Arbitrary levels of nesting is allowed, and the name of the var file can either be the groupname or hostname, or the groupname or hostname with any '.*' file extension (so groupname.txt and groupname.yaml are valid, but not groupname.bar.txt).

Note that if someone did something clever like having groups called 'groupname' and 'groupname.bar' and 'groupname.yaml', all those files would be loaded.

In the case of multiple files meeting those criteria, they are loaded in alphabetical sort order based on the entire path, so the following files would be loaded in the given order:

group_vars/alfie/groupname
group_vars/alfie/groupname.yaml
group_vars/groupname
group_vars/zed/groupname

I'd be more than willing to change that behavior if there are any suggestions.