16 lines
713 B
Django/Jinja
16 lines
713 B
Django/Jinja
#jinja2: trim_blocks: True, lstrip_blocks: True
|
|
{% for item in groups[dnsmasq_managed_group] | sort %}
|
|
{% set client = hostvars[item] %}
|
|
{% if 'dnsmasq' in client and client.dnsmasq %}
|
|
{% set default_ip = client.container_ip | default(client.ansible_host | default(none)) %}
|
|
{% set domains = client.dnsmasq if (client.dnsmasq is iterable and client.dnsmasq is not string) else [client.dnsmasq] %}
|
|
{% for d in domains %}
|
|
{% set entry = d if (d is mapping) else {'name': d} %}
|
|
{% set ip = entry.ip | default(default_ip) %}
|
|
{% if ip %}
|
|
host-record={{ entry.name }},{{ ip }}
|
|
{% endif %}
|
|
{% endfor %}
|
|
{% endif %}
|
|
{% endfor %}
|