# {{ ansible_managed }} # ansible inventory {%- for host in (groups[dnsmasq_ansible_group] | sort) %} {%- set ipv4 = hostvars[host]['ansible_host'] %} {%- set ipv6_prefix = dnsmasq_ipv6_subnet | split('/') | first %} {%- set ipv6_suffix = hostvars[host]['ansible_host'] | split('.') | last %} {%- set aliases = [host] + hostvars[host].get('dnsmasq_host_aliases', []) %} ## {{ host }} {{ ipv4 }} {{ aliases | join(' ') }} {{ ipv6_prefix }}{{ ipv6_suffix }} {{ aliases | join(' ') }} {% endfor %} # role specifics {%- for specific in dnsmasq_specifics %} ## {{ specific.hostname }} {% for ip in specific.ips %} {{ ip }} {{ specific.hostname }} {% endfor %} {% endfor %}