Sorry if that’s a terrible subject - I couldn’t think of another way to summarize my issue.
What I’m trying to do is create a template that will iterate over a list, to create a few files with different names, with the same variable also being printed inside of those files.
The way I am attempting to do this is with a template and a vars file. The task looks like so:
`
- name: Copy template
template:
src: template.yml.j2
dest: /tmp/template.yml
`
With the vars/main.yml looking like this:
`
variable:
- variable-to-print
`
When I run the playbook, it gives me a file named [u’variable-to-print’], and each time the variable is supposed to be substituted inside the file, it’s printed the same way, as [u’variable-to-print’], instead of as variable-to-print.
If I do it so that there’s no yaml list in the vars/main.yml, like so:
variable: variable-to-print
Then it works just fine, but that kind of defeats the purpose for me.
Can anyone recommend how I might get it to give me the variable substitution that I’m looking for, without the brackets, u, and single quotes?
Thanks,
- ap