{% set iface_lo = hostvars[inventory_hostname].interfaces | selectattr('name', 'equalto', 'lo') | first %}
auto lo
iface lo inet loopback
{% for ip in iface_lo.ip_addresses %}
address {{ ip.address }}
{% endfor %}