When writing a custom role for an Ansible playbook, it's possible to specify defaults. I would like to do the same when using a role from Ansible Galaxy (the Ansible “package manager”).
For example, when using the popular redis role, I'd like to be able to specify a default redis_version
, so that anyone importing that role will get the same.
Without centralizing this, I would put the redis version into the variable section in every playbook when using the role. That's not ideal. Other ways I can think of:
- Create a new role, put the default variable there, and then make the Galaxy-role a dependency. (Not sure if variables are passed down.)
- Put the default into
ansible.cfg[defaults]
.
What's the best-practice?