initial commit
This commit is contained in:
commit
536df4f7dd
5 changed files with 653 additions and 0 deletions
26
templates/zonefile.db.j2
Normal file
26
templates/zonefile.db.j2
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
$ORIGIN {{ item }}.
|
||||
$TTL 60
|
||||
@ SOA {{ dnsserver.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.endswith('.') %}
|
||||
{{ generate_records(v, k + ('.' + scope if scope != '@' else '')) }}
|
||||
{%- elif k.endswith('.' + item + '.') or k == (item + '.') %}
|
||||
{{ generate_records(v, k) }}
|
||||
{%- endif %}
|
||||
{%- endif %}
|
||||
{% endfor %}
|
||||
{% endmacro %}
|
||||
{{ generate_records(dnsserver.zones[item]) }}
|
||||
Loading…
Add table
Add a link
Reference in a new issue