I define a include_var task playbook, it use local facts to determine which file to load
include_vars: "{{ ansible_local[preference][role].yml }}"
it failed with an error message like
The task includes an option with an undefined variable.
I should put the file extension .yml
outside of the curly braces
include_vars: "{{ ansible_local['preferences']['role'] }}.yml"
Top comments (0)