[bind] Add master configuration

certbot_on_virtu
Alexandre Iooss 2020-04-25 20:22:26 +02:00
parent bdd6eb0345
commit d1911ff6ad
No known key found for this signature in database
GPG Key ID: 6C79278F3FCDCC02
4 changed files with 41 additions and 14 deletions

View File

@ -39,14 +39,12 @@
# Deplay authoritative DNS server # Deplay authoritative DNS server
- hosts: sputnik.adm.crans.org - hosts: sputnik.adm.crans.org
vars: vars:
certbot_dns_secret: "{{ vault_certbot_dns_secret }}"
bind: bind:
master: false master: false
master_ip: 10.231.136.118 master_ip: 10.231.136.118
dnssec: false slaves: [] # TODO
zones: zones: "{{ lookup('re2oapi', 'dnszones', api_hostname='intranet.crans.org') }}"
- crans.org
- crans.eu
- crans.fr
roles: roles:
- bind-authoritative - bind-authoritative

View File

@ -0,0 +1,5 @@
---
- name: Reload Bind9
systemd:
name: bind9
state: reloaded

View File

@ -11,15 +11,11 @@
template: template:
src: bind/{{ item }}.j2 src: bind/{{ item }}.j2
dest: /etc/bind/{{ item }} dest: /etc/bind/{{ item }}
mode: 0644 mode: 0640
owner: root owner: root
group: bind group: bind
loop: loop:
- named.conf - named.conf
- named.conf.local - named.conf.local
- named.conf.options - named.conf.options
notify: Reload Bind9
- name: Reload Bind9
systemd:
name: bind9
state: reloaded

View File

@ -4,15 +4,43 @@
// organization // organization
//include "/etc/bind/zones.rfc1918"; //include "/etc/bind/zones.rfc1918";
{% if not bind.master %} {% if bind.master %}
// Let's Encrypt Challenge DNS-01
key "certbot_challenge." {
algorithm hmac-sha512;
secret "{{ certbot_dns_secret }}";
};
{% endif %}
// Crans zones
{% for zone in bind.zones %} {% for zone in bind.zones %}
zone "{{ zone }}" { zone "{{ zone }}" {
{% if bind.master %}
type master;
file "/var/local/re2o-services/dns/generated/dns.{{ zone }}.zone";
forwarders {
{% for slave in bind.slaves -%}
{{ slave }};
{% endfor -%}
};
allow-transfer {
{% for slave in bind.slaves -%}
{{ slave }};
{% endfor -%}
};
update-policy {
grant certbot_challenge. name _acme-challenge.{{ zone }} txt;
};
notify yes;
{% else %}
type slave; type slave;
masters { {{ bind.master_ip }}; };
file "bak.{{ zone }}"; file "bak.{{ zone }}";
masters {
{{ bind.master_ip }};
};
allow-transfer { "none"; }; allow-transfer { "none"; };
notify no; notify no;
{% endif %}
}; };
{% endfor %} {% endfor %}
{% endif %}