ansible/ansible — pull request #2675 by sergevanginderachter (2013-04-13 18:48:43+00:00)
Title: UPDATE: Allow subdirs in host/group_vars and vars files extensions

Update to Morgan Hamill's patch that allows subdirs in host/group_vars, originally in https://github.com/ansible/ansible/pull/2664

Only 1 file per host or group is allowed.
Files can be named to the host or group name, or have optionally an extension .yml or .yaml

If more than one file is found for a given host or group, an error is raised for it.

```
serge@cyberlab:~/tmp$ cat inventory
[group]
localhost

[project1]
localghost ansible_ssh_host=localhost

[staging[
localpc ansible_ssh_host=localhost
localdev ansible_ssh_host=localhost
```

```
serge@cyberlab:~/tmp$ tree
.
├── group_vars
│ ├── group
│ ├── group.yml
│ ├── production
│ │ └── project1
│ └── project1
├── host_vars
│ ├── localpc.yaml
│ └── project1
│ └── localpc
│ └── localdev
├── inventory
└── vars_plugins -> ../src/ansible/lib/ansible/inventory/vars_plugins/
```
```
serge@cyberlab:~/tmp$ ../src/ansible/bin/ansible -i inventory all -m debug -o

localpc | FAILED => Found more than one file for host 'localpc': ['host_vars/localpc.yaml', 'host_vars/project1/localpc']
localghost | FAILED => Found more than one file for group 'project1': ['group_vars/production/project1', 'group_vars/project1']
localhost | FAILED => Found more than one file for group 'group': ['group_vars/group', 'group_vars/group.yml']
localdev | success >> {"msg": "Hello world!"}
```