Enhancement: Structure

This commit is contained in:
Stupéflo 2024-05-17 19:10:03 +02:00
parent ea74e0b246
commit 2b6c1ed108
Signed by: stupeflo
GPG key ID: 873D883BD359DEE2
5 changed files with 22 additions and 20 deletions

View file

@ -0,0 +1,31 @@
$ORIGIN trans13nrv.eu.org.
$TTL 300s
@ SOA ns1 postmaster (
2024051400 ; Serial
8h ; Refresh
30m ; Retry
1w ; Expire
1h ) ; Negative Cache TTL
; name servers
NS ns1
ns1 A 137.74.82.130
; mailing
@ MX 10 mail.hebergemoi.fr.
;;; XMPP ;;;
; server IP / name
;_jabber A 0.0.0.1
;xmpp CNAME _jabber
; ports
;_xmpp-server._tcp IN SRV 0 0 5269 _jabber
;_xmpp-client._tcp IN SRV 0 0 5222 _jabber
; multi-user-chat
;muc CNAME _jabber
; web UI
;chat CNAME _jabber

View file

@ -1,25 +1,28 @@
---
- vars:
zone_config_file: "{{ dns.patch.etc }}/named.conf.{{ zone.domain_name }}"
zone_db_file: "{{ dns.patch.primary_zones }}/db.{{ zone.domain_name }}.zone"
- name: "Setting facts for zone {{ item.zone.domain_name }}"
ansible.builtin.set_fact:
zone_config_file: "{{ dns.paths.etc }}/named.conf.{{ item.zone.domain_name }}"
zone_db_file: "{{ dns.paths.primary_zones }}/db.{{ item.zone.domain_name }}.zone"
domain_name: "{{ item.zone.domain_name }}"
- name: Updating primary zone db file
ansible.builtin.file:
src: "file/ns/zone/db.{{ zone.domain_name }}"
ansible.builtin.copy:
src: "tasks/ns/files/db.{{ domain_name }}.zone"
dest: "{{ zone_db_file }}"
mode: "644"
- name: "Creating zone {{ domain_name }}"
ansible.builtin.template:
src: templates/ns/zone/named.conf.primary-zone.j2
src: tasks/ns/templates/named.conf.primary-zone.j2
dest: "{{ zone_config_file }}"
mode: "644"
- name: "Including zone configuration to global configuration"
ansible.builtin.blockinfile:
path: "{{ dns.path.etc }}/named.conf.local"
path: "{{ dns.paths.etc }}/named.conf.local"
state: present
marker: "// {mark} ANSIBLE MANAGED BLOCK FOR {{ domain_name }} ZONE"
block: |
"include \"{{ zone_config_file }}\"";
include "{{ zone_config_file }}";
marker_begin: BEGIN
marker_end: END

View file

@ -0,0 +1,22 @@
acl "{{ domain_name }}-acl" {
{% if transfer_hosts is defined and transfer_hosts|length %}
{% for ip in transfer_hosts %}
{{ ip }};
{% endfor %}
{% else %}
none;
{% endif %}
};
zone "{{ domain_name }}" IN {
type master;
file "{{ dns.paths.primary_zones }}/db.{{ domain_name }}.zone";
#auto-dnssec maintain;
inline-signing yes;
dnssec-policy default;
serial-update-method increment;
allow-update { none; };
allow-transfer { {{ domain_name }}-acl; };
notify yes;
key-directory "{{ dns.paths.keys_dir }}";
};