I am trying to extract the IP addresses of the hosts that are part of two groups and use them in a .xml config file.
The problem I'm facing here is the output generated by the expression used into the jinja template. What I want to achieve is an output like 10.3.5.1,10.3.5.2,10.3.5.2
but instead of this I'm obtaining something like [u'10.3.5.1],[u'10.3.5.2],[u'10.3.5.2]
.
This is the expression used into the jinja template:
<member1>{{ (groups['group_one']+groups['group_two']) | map('extract',hostvars,'ansible_ip_addresses') | list | unique | join(',') }}</member1>
I have also tried some other filters but I could not get the expected result.
What filters should I use for this? (I couldn't find the right ones)