Bug in include_vars or jinja2

For the last month I have been trying convert my v1 action plugin to v2 with no luck.
https://groups.google.com/forum/#!topic/ansible-devel/9-i8uIj9E5g

So Brian suggested to use default include_vars with a loop. So decided to try to use ansible built in modules. but the same issue came up that I had in my custom module.

test.yml

`

I'm not sure that what you are doing is right, no need to access
through facts, which would prevent it from templating (security
issue).
This example shows that the variable substitution DOES work, as long
as you access it directly.

vars.yml
composed_var: "{{test1}}"

play:

Thank you for your reply.

The objective is to compile a list of variables from files in a directory without using the merge behaviour. In my example I use with_items but it should be with_fileglob

var1.yml
myvar: “example1”

var2.yml
myvar: “example2”

var3.yml
myvar: “example3”

compiled_list:

  • myvar: “example1”
  • myvar: “example2”
  • myvar: “example3”

Since the templating does not happen facts any more. And I dont have the option to enable merge behaviour.
Any other alternative ?