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/ /.vscode/
/inventory/ /inventory/
/ansible_collections/

View file

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

View file

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

View file

@ -1,27 +1,25 @@
--- ---
- name: "Setup variable for zone {{ zone.domain_name }}" - vars:
register: zone_config_file: "{{ dns.patch.etc }}/named.conf.{{ zone.domain_name }}"
domain_name: "{{ zone.domain_name }}" zone_db_file: "{{ dns.patch.primary_zones }}/db.{{ zone.domain_name }}.zone"
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 }}"
- name: Updating primary zone db file - name: Updating primary zone db file
file: ansible.builtin.file:
src: "file/ns/zone/db.{{ domain_name }}" src: "file/ns/zone/db.{{ zone.domain_name }}"
dest: "{{ zone_db_file }}" dest: "{{ zone_db_file }}"
- name: "Creating zone {{ domain_name }}" - name: "Creating zone {{ domain_name }}"
template: ansible.builtin.template:
src: templates/ns/zone/named.conf.primary-zone.j2 src: templates/ns/zone/named.conf.primary-zone.j2
dest: "{{ zone_config_file }}" dest: "{{ zone_config_file }}"
mode: "644"
- name: "Including zone configuration to global configuration" - name: "Including zone configuration to global configuration"
blockinfile: ansible.builtin.blockinfile:
path: "{{ dns.path.etc }}/named.conf.local" path: "{{ dns.path.etc }}/named.conf.local"
state: present 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: | block: |
"include \"{{ zone_config_file }}\""; "include \"{{ zone_config_file }}\"";
marker_begin: BEGIN marker_begin: BEGIN
marker_end: END marker_end: END