ansible_ipaddresses - select specific IP in template

Hi all,
all my target hosts have 2 or more IP addresses configured:

`

ansible host -m setup

[…]
“ansible_ip_addresses”: [
“192.1.2.3”,
“172.1.2.3”
],
[…]
`

Now I’m lost on how to use/select a specific IP Address from ansible_ip_addresses in a jinja template. I’m not really aware of filters/lookups yet, so a friendly hint would be great!

Thanks in advance
Carsten

use “ip_addr” filter

ansible_ip_addresses[0] gives you the first one, ansible_ip_addresses[1] the second one.

kind regards
Pshem

Ok, got it. Thanks for the hint :slight_smile: