I want to separate vars in a role structure from vars/main.yml into different files using vars_files or include_vars as per Variable File Separation, with something like
---
- vars_files: external_vars.ymlbut I get this message
ERROR! The vars/main.yml file for role 'foo' must contain a dictionary of variablesIf I omit the dash for the list it still doesn't work and get another message, which I haven't saved for this post.
I use ansible 2.3.2.0.
Shouldn't either work in such a case? Is there any other way to accomplish this?
The vars/main.yml cannot contain keywords, it (like all vars files) MUST be a dictionary, not a list.
There is no way to do 'includes' inside a vars file. What you are doing is just not supported.