53 lines
1.5 KiB
Django/Jinja
53 lines
1.5 KiB
Django/Jinja
$ORIGIN {{ item.name }}.
|
|
$TTL 3600
|
|
|
|
; SOA Record
|
|
@ IN SOA {{ item.name_servers[0] }} hostmaster.{{ item.name }}. (
|
|
{{ ansible_date_time.epoch }} ; Serial
|
|
10800 ; Refresh
|
|
3600 ; Retry
|
|
604800 ; Expire
|
|
3600 ) ; Negative Cache TTL
|
|
|
|
; Name Servers
|
|
{% for ns in item.name_servers %}
|
|
@ IN NS {{ ns }}
|
|
{% endfor %}
|
|
|
|
; MX Records
|
|
{% if item.mail_servers is defined %}
|
|
{% for mx in item.mail_servers %}
|
|
@ IN MX {{ mx.preference }} {{ mx.name }}
|
|
{% endfor %}
|
|
{% endif %}
|
|
|
|
; A Records
|
|
{% if item.hosts is defined %}
|
|
{% for host in item.hosts %}
|
|
{{ host.name }} IN A {{ host.ip }}
|
|
{% endfor %}
|
|
{% endif %}
|
|
|
|
; TXT Records
|
|
{% if item.text is defined %}
|
|
{% for txt in item.text %}
|
|
{% set txt_value = txt.text.strip('"') %}
|
|
{% if txt_value | length > 255 %}
|
|
{{ txt.name }} IN TXT ( "{{ txt_value[:255] }}"
|
|
{% set remaining = txt_value[255:] %}
|
|
{% for i in range(0, remaining | length, 255) %}
|
|
"{{ remaining[i:i+255] }}"{% if not loop.last %} {% endif %}
|
|
|
|
{% endfor %} )
|
|
{% else %}
|
|
{{ txt.name }} IN TXT "{{ txt_value }}"
|
|
{% endif %}
|
|
{% endfor %}
|
|
{% endif %}
|
|
|
|
; Other Records (CNAME, SRV, etc.)
|
|
{% if item.other_name_servers is defined %}
|
|
{% for record in item.other_name_servers %}
|
|
{{ record }}
|
|
{% endfor %}
|
|
{% endif %}
|