I'm trying to loop over a simple list of strings & insert each of them into an ansible jinja template, but when looping over the variable in the template file, I get
AnsibleUndefinedVariable: 'item' is undefined
-- vars.yml services: - "service 1" - "service 2" -- main.yml win_template: with_items: "{{ services }}" -- jinja template (% for item in services %) {{ item }} (% endfor %)
OK, this turned out to be really simple in the end, no array loops, purely
{{ services|join(" ") }}
in the template file.
1.4m articles
1.4m replys
5 comments
57.0k users