ansible role, vars / default files
by JIMz
1 min read
overview
given a certain role, there are 2 folders to store variables, namely
[role root]/default
[role root]/vars
by default there is an empty main.yml
there.
storing all vars inside either of them will get messy easily, so it gets natural to group vars by different files.
but, trying to import / include them inside main.yml
won't work.
the trick to load them all
create these folders :
[role root]/default/main/
[role root]/default/vars/
and put relevant files / folder(s) of files inside accordingly.
then, every files and child folders inside will be loaded and included automatically.
the official doc is useless and says nothing on these ( or that exists but the search results are worse than useless ). this solution is found via stakeoverflow instead.