ansible/ansible — pull request #3891 by smoothify (2013-08-20 09:26:14+00:00)
Title: Add support for role defaults. Lowest precedence variables per role.

This is a pull request based on this topic:

https://groups.google.com/d/msg/ansible-project/vZlI6sB1kRU/ChpDNz-cwXsJ

>We are open to inserting something like a
>
>roles/foo/defaults/main.yml
>
>If somebody can send me a *nice* patch and it might get in sooner :)

It works by collecting all the defaults files for roles, and then one by one populating a default_vars dict. Then when complete, this dict is merged with the the playbooks vars, but with those vars taking priority.

My intention was to make anything set in these defaults overrideable by any other variable setting method. Hopefully this is the case.