In all ansible docs I have found, the [role]/vars/main.yml
file is referenced as the place for role variables.
There is some customization possible by using [role]/defaults/main.yml
which then can be overwritten by [role]/vars/main.yml
.
What if I'd want to address a multitude of scenarios, and say load a group of vars based on a main variable, and then place the grouped vars in each file like
[role]/vars/main.yml
[role]/vars/scenario1.yml
[role]/vars/scenario2.yml
[role]/vars/scenario3.yml
[role]/vars/scenario4.yml
In other words, is there any use for the [role]/vars
directory to contain more than just the main.yml
file?
The concrete challenge is, define sets of users with their public keys, so depending on which machine I am, create the appropriate user accounts
question from:https://stackoverflow.com/questions/65602775/ansible-multiple-var-files-for-roles