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.
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.
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 ?