I'm trying to get a variable which will contain comma separated items from with_itmes
loop as follow:
- hosts: localhost
connection: local
gather_facts: no
tasks:
- name: set_fact
set_fact:
foo: "{{ foo }}{{ item }},"
with_items:
- "one"
- "two"
- "three"
vars:
foo: ""
- name: Print the var
debug:
var: foo
It works as expected but what I'm getting at the end is trailing comma.
Is there any way to remove it?
question from:https://stackoverflow.com/questions/65852013/ansibe-concatenation-of-items-from-with-items