{%- set stack_hosts = salt['mine.get']('stack_id:' ~ grains.stack_id, 'grains.items', 'grain') -%}
{%- if grains['os_family'] == 'Debian' -%}
127.0.0.1 localhost

# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts
{%- elif grains['os_family'] == 'RedHat' -%}
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
{% endif %}

{% for items in stack_hosts.values() %}
{{ items['ip_interfaces']['eth0'][0] }} {{ items['fqdn'] }} {{ items['id'] }}
{%- endfor %}
