role_dnsmasq/templates/auto.conf.j2

18 lines
627 B
Django/Jinja
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# {{ ansible_managed }}
{% for host in groups[dnsmasq_ansible_group] %}
{%- set ipv4 = hostvars[host]['ansible_host'] %}
{%- set ipv6_suffix = hostvars[host]['ansible_host'] | split('.') | last %}
{%- set aliases = [host] + hostvars[host].get('dnsmasq_host_aliases', []) %}
# {{ host }}
{{ ipv4 }} {{ aliases | join(' ') }}
{% if (ipv6_suffix | int) < 10 %}
2a01:e0a:ee5:8b0::d00{{ ipv6_suffix }} {{ aliases | join(' ') }}
{% elif (ipv6_suffix | int) < 100 %}
2a01:e0a:ee5:8b0::d0{{ ipv6_suffix }} {{ aliases | join(' ') }}
{% else %}
2a01:e0a:ee5:8b0::d{{ ipv6_suffix }} {{ aliases | join(' ') }}
{% endif %}
{% endfor %}