Hi all,
I have a question regarding role default variables. First, this is my use case: I want to develop reusable, redistributable and configurable roles supporting different operating systems. Some variables differ on the different operating systems. In addition to the defaults/main.yml file that is always automatically loaded, I would like to have a variable file for each operating system, something like rhel.yml, debian.yml etc. As the roles should be redistributable, it should be easy to override these variables, e.g. in the inventory or the playbook.
I really like the approach mentioned in the Ansible Best Practices here: http://docs.ansible.com/ansible/playbooks_best_practices.html#operating-system-and-distribution-variance, but it’s not on role level. If I would use include_vars, it would be very hard to overwrite those role default variables. So the question is
Is there any built-in mechanism to load more files than the main.yml from a role defaults/ folder which keeps the variable precedence? And if yes, is it possible to load them dynamically based on the operating system?
Of course, I’m open to other ideas how to satisfy the use case and keep roles portable, reusable and configurable without always having to modify them.
Thanks in advance,
Patrick