Suppose I have this list:
hosts:
- {"ip": "1.2.3.4", "hostname": "www.example.com"}
- {"ip": "42.42.42.42", "hostname": "www.wikipedia.com"}
I want to obtain a string like this (to put it into a template):
'1.2.3.4,42.42.42.42'
It's similar to what I'd obtain with hosts|join(',')
, but I only want to concatenate the values of ip
, so probably I should obtain a list of IPs first... but how?