I have tried include_vars and vars_files but maybe in the wrong context, because it doesn’t seem to work although i did not receive an error from Ansible:
I have tried these two options, both did not seem to work:
option 1:
I have tried include_vars and vars_files but maybe in the wrong context, because it doesn’t seem to work although i did not receive an error from Ansible:
I have tried these two options, both did not seem to work:
option 1:
Please reference the ansible documentation for how include_vars and vars_files work.
Using a variable name passed to a role is not one of those examples
Thanks Michael, I have figured that out,
But what is Ansible way to load var file for a role?
I would like to execute the same role, each time with a different var file. (The motivation is override)
You could use include_vars as a module call from the tasks file if you wanted to do this, and pass in the variable name of the file to load, possibly setting it in defaults.
Though a more frequently used technique would be set values in roles/foo/defaults.yml and pass in override values directly to the role.