26 lines
756 B
Django/Jinja
26 lines
756 B
Django/Jinja
$ORIGIN {{ item }}.
|
|
$TTL {{ powerdns.config["default-ttl"] }}
|
|
@ SOA {{ powerdns.zones[item].SOA }}
|
|
{% macro generate_records(records, scope='@') %}
|
|
{% for k, v in records.items() %}
|
|
{% if v is string %}
|
|
{% if k != 'SOA' %}
|
|
{{ scope }} {{ k }} {{ v }}
|
|
{% endif %}
|
|
{% elif v is not mapping %}
|
|
{% for v2 in v %}
|
|
{{ scope }} {{ k }} {{ v2 }}
|
|
{% endfor %}
|
|
{% endif %}
|
|
{% endfor %}
|
|
{% for k, v in records.items() %}
|
|
{% if v is mapping %}
|
|
{% if not (k|string).endswith('.') %}
|
|
{{ generate_records(v, (k|string) + ('.' + scope if scope != '@' else '')) }}
|
|
{%- elif (k|string).endswith('.' + item + '.') or (k|string) == (item + '.') %}
|
|
{{ generate_records(v, k) }}
|
|
{%- endif %}
|
|
{%- endif %}
|
|
{% endfor %}
|
|
{% endmacro %}
|
|
{{ generate_records(powerdns.zones[item]) }}
|