Fixed: Linters error

This commit is contained in:
Stupéflo 2024-05-17 12:28:23 +02:00
parent 2a01f9e57d
commit bcd528f951
Signed by: stupeflo
GPG key ID: 873D883BD359DEE2
4 changed files with 61 additions and 61 deletions

1
.gitignore vendored
View file

@ -1,2 +1,3 @@
/.vscode/
/inventory/
/ansible_collections/

View file

@ -1,3 +1,3 @@
[defaults]
inventory = inventory/hosts.yml
inventory = inventory
collections_path = .

View file

@ -1,44 +1,45 @@
- hosts: dns-hosts
name: Configuration of ns zones
tasks:
- name: Use variables
include_vars: vars.yml
- name: Ensure bind is installed
package:
name: bind9
state: latest
- name: Ensure dnssec-tools is installed
package:
name: dnsutils
state: latest
- name: Ensure required master zone directory is present
file:
path: "{{ dns.paths.primary_zones }}"
state: directory
owner: "{{ root.user }}"
group: "{{ dns.group }}"
- name: Ensure required keys zone directory is present
file:
path: "{{ dns.paths.keys }}"
state: directory
owner: "{{ dns.user }}"
group: "{{ dns.group }}"
- name: Prymary Zones
- name: Configuration of ns zones
hosts: primarydns
vars:
zones:
- zome:
domain_name: trans13nrv.eu.org
include_tasks: tasks/ns/primary-zone.yml
tasks:
- name: Use variables
ansible.builtin.include_vars: vars.yml
- name: Ensure bind is installed
ansible.builtin.package:
name: bind9
state: present
- name: Ensure dnssec-tools is installed
ansible.builtin.package:
name: dnsutils
state: present
- name: Ensure required master zone directory is present
ansible.builtin.file:
path: "{{ dns.paths.primary_zones }}"
state: directory
owner: "{{ root.user }}"
group: "{{ dns.group }}"
mode: "660"
- name: Ensure required keys zone directory is present
ansible.builtin.file:
path: "{{ dns.paths.keys }}"
state: directory
owner: "{{ dns.user }}"
group: "{{ dns.group }}"
mode: "660"
- name: Prymary Zones
ansible.builtin.include_tasks: tasks/ns/primary-zone.yml
loop: "{{ zones }}"
- name: Reload bind9 service
service:
ansible.builtin.service:
name: bind9
state: reloaded

View file

@ -1,26 +1,24 @@
---
- name: "Setup variable for zone {{ zone.domain_name }}"
register:
domain_name: "{{ zone.domain_name }}"
transfer_hosts: "{{ zone.transfer_hosts }}"
zone_config_file: "{{ dns.paths.etc }}/named.conf.{{ domain_name }}"
zone_db_file: "{{ dns.paths.dns.paths.primary_zones }}/db.{{ zone.domain_zone }}"
- 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: Updating primary zone db file
file:
src: "file/ns/zone/db.{{ domain_name }}"
ansible.builtin.file:
src: "file/ns/zone/db.{{ zone.domain_name }}"
dest: "{{ zone_db_file }}"
- name: "Creating zone {{ domain_name }}"
template:
ansible.builtin.template:
src: templates/ns/zone/named.conf.primary-zone.j2
dest: "{{ zone_config_file }}"
mode: "644"
- name: "Including zone configuration to global configuration"
blockinfile:
ansible.builtin.blockinfile:
path: "{{ dns.path.etc }}/named.conf.local"
state: present
marker: "// {mark} ANSIBLE MANAGED BLOCK FOR {{ domain_name }} ZONE" # not required. The marker line template. C({mark}) will be replaced with the values C(in marker_begin) (default="BEGIN") and C(marker_end) (default="END"). Using a custom marker without the C({mark}) variable may result in the block being repeatedly inserted on subsequent playbook runs.
marker: "// {mark} ANSIBLE MANAGED BLOCK FOR {{ domain_name }} ZONE"
block: |
"include \"{{ zone_config_file }}\"";
marker_begin: BEGIN