I have a list:
list1 - value1 - value2 and I want to use set_fact create a new variable that contains these variables with a label in front of them, so that this debug task: - debug: msg: "{{var1}}" would result in output that looks like this: label value1 label value2 This gives me the expected results: - set_fact: var1: |+ "{{'label ' ~ list1[0]}}" "{{'label ' ~ list1[1]}}" But I need more flexibility than that. I need to be able to add or remove values to or from the list and not have to modify the set_fact task each time to accommodate the modification. I tried using the join filter: - set_fact: var1: "{{'label ' ~ list1 | join('\n')}}" And that got me: label value1 value2 Close, but not quite. So what is the best method of achieving what I want? -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and stop receiving emails from it, send an email to ansible-project+unsubscr...@googlegroups.com. To post to this group, send email to ansible-project@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/187f4905-d04b-4d64-9163-4e6a263742cc%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.