first commit
This commit is contained in:
commit
04d35ca0a3
6 changed files with 118 additions and 0 deletions
41
roles/bind/templates/named.conf.j2
Normal file
41
roles/bind/templates/named.conf.j2
Normal file
|
@ -0,0 +1,41 @@
|
|||
options {
|
||||
directory "/var/cache/bind";
|
||||
recursion no;
|
||||
};
|
||||
|
||||
key "acme-key" {
|
||||
algorithm hmac-sha512;
|
||||
secret "{{ bind_acme_key }}";
|
||||
};
|
||||
key "update-key" {
|
||||
algorithm hmac-sha512;
|
||||
secret "{{ bind_update_key }}";
|
||||
};
|
||||
|
||||
{% for domain in bind_zones.keys() %}
|
||||
zone "{{ domain }}" in {
|
||||
type {{ 'master' if inventory_hostname in groups.bindmaster else 'slave' }};
|
||||
file "{{ domain }}.zone";
|
||||
|
||||
{% if inventory_hostname in groups.bindmaster %}
|
||||
update-policy {
|
||||
grant acme-key name _acme-challenge.{{ domain }}. txt;
|
||||
};
|
||||
also-notify {
|
||||
{% for server in groups.bindslave %}
|
||||
{{ hostvars[server].ansible_default_ipv6.address }};
|
||||
{% endfor %}
|
||||
};
|
||||
allow-transfer {
|
||||
key update-key;
|
||||
};
|
||||
{% else %}
|
||||
masters {
|
||||
{% for server in groups.bindmaster %}
|
||||
{{ hostvars[server].ansible_default_ipv6.address }} key "update-key";
|
||||
{% endfor %}
|
||||
};
|
||||
{% endif %}
|
||||
|
||||
};
|
||||
{% endfor %}
|
18
roles/bind/templates/zone.j2
Normal file
18
roles/bind/templates/zone.j2
Normal file
|
@ -0,0 +1,18 @@
|
|||
$ORIGIN {{ item.key }}.
|
||||
$TTL 300
|
||||
|
||||
@ IN SOA {{ bind_nameservers | first }}. noc.{{ item.key }} (
|
||||
{{ ansible_date_time.epoch }} ; serial
|
||||
7200 ; refresh
|
||||
3600 ; retry
|
||||
1209600 ; expire
|
||||
3600 ; min
|
||||
)
|
||||
|
||||
{% for ns in bind_nameservers %}
|
||||
@ IN NS {{ ns }}{{ '.' if not ns.endswith('.') else '' }}
|
||||
{% endfor %}
|
||||
|
||||
{% for record in item.value -%}
|
||||
{{ record.name }} IN {{ record.type }} {{ record.value }}
|
||||
{% endfor %}
|
Loading…
Add table
Add a link
Reference in a new issue