role_dnsmasq/templates/auto.conf.j2

24 lines
742 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 }}
# ansible inventory
{%- set hosts = groups[dnsmasq_ansible_group] | sort | reject('equalto', inventory_hostname) %}
{%- for host in hosts %}
{%- 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 %}