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

@ -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