-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathzone.j2
74 lines (72 loc) · 1.81 KB
/
zone.j2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
{#
Copyright (c) 2019 WAHED Shah Mohsin
This code is under MIT licence, you can find the complete file here: https://github.com/shahwahed/BindZoneMaker/blob/master/LICENSE
This jinja2 template generate proper bind zone file
-#}
; Zone: {{ origin }}
; Exported (yyyy-mm-ddThh:mm:ss.sssZ): {{ now }}
$ORIGIN {{ origin }}
$TTL {{ ttl }}
; SOA Record
@ IN SOA {{ soa['mname'] }} {{ soa['rname'] }}(
{{ soa['serial'] }} ;serial
{{ soa['refresh'] }} ;refresh
{{ soa['retry'] }} ;retry
{{ soa['expire'] }} ;expire
{{ soa['minimum'] }} ;minimum ttl
)
{% if ns is defined -%}
; NS Records
{% for entry in ns -%}
@ IN NS {{ entry['host'] }}
{% endfor %}
{% endif %}
{%- if mx is defined -%}
; MX Records
{% for entry in mx -%}
@ IN MX {{ entry['preference'] }} {{ entry['host'] }}
{% endfor %}
{% endif %}
{%- if spf is defined -%}
; SPF Records
{% for entry in spf -%}
{{ entry['domain'] }} IN TXT "{{ entry['record'] }}"
{% endfor %}
{% endif %}
{%- if a is defined -%}
; A Records
{% for entry in a -%}
{{ entry['name'] }} IN A {{ entry['ip'] }}
{% endfor %}
{% endif %}
{%- if aaaa is defined -%}
; AAAA Records
{%- for entry in aaaa -%}
{{ entry['name'] }} IN A {{ entry['ip'] }}
{% endfor %}
{% endif %}
{%- if cname is defined -%}
; CNAME Records
{% for entry in cname -%}
{{ entry['name'] }} IN CNAME {{ entry['alias'] }}
{% endfor %}
{% endif %}
{%- if ptr is defined -%}
; PTR Records
{% for entry in ptr -%}
{{ entry['name'] }} IN PTR "{{ entry['host'] }}"
{% endfor %}
{% endif %}
{%- if txt is defined -%}
; TXT Records
{% for entry in txt -%}
{{ entry['name'] }} IN TXT "{{ entry['txt'] }}"
{% endfor %}
{% endif %}
{%- if srv is defined -%}
; SRV Records
{% for entry in srv -%}
{{ entry['name'] }} IN SRV {{ entry['priority'] }} {{ entry['weight'] }} {{ entry['port'] }} {{ entry['target'] }}
{% endfor %}
{%- endif %}
; End of Zone