feat(zones): skip on slave servers

Introduce 'nsd:opmode' pillar option, allowing the zone file management
to be skipped on slave DNS servers.

Signed-off-by: Georg Pfuetzenreuter <mail@georg-pfuetzenreuter.net>
This commit is contained in:
Georg Pfuetzenreuter 2023-02-19 21:36:35 +01:00
parent 5023b5e0a3
commit 5e4711d87c
Signed by: Georg
GPG Key ID: 1ED2F138E7E6FF57
2 changed files with 7 additions and 0 deletions

View File

@ -10,11 +10,14 @@
{%- from tplroot ~ "/macros.jinja" import zonefile_name with context %} {%- from tplroot ~ "/macros.jinja" import zonefile_name with context %}
{%- set zones = nsd.get('zones', {}) %} {%- set zones = nsd.get('zones', {}) %}
{%- set opmode = nsd.get('opmode', 'master') %}
{%- if zones | length > 0 %} {%- if zones | length > 0 %}
{{ config_file('90-generated-zones', 'generated-zones') }} {{ config_file('90-generated-zones', 'generated-zones') }}
{%- if opmode == 'master' %}
nsd-config-zones-file-directory: nsd-config-zones-file-directory:
file.directory: file.directory:
- name: {{ nsd.zones_dir }} - name: {{ nsd.zones_dir }}
@ -53,3 +56,4 @@ nsd-config-zones-file-directory:
{%- endfor %} {%- endfor %}
{%- endif %} {%- endif %}
{%- endif %}

View File

@ -60,6 +60,9 @@ nsd:
control-enable: 'yes' control-enable: 'yes'
control-interface: /run/nsd.sock control-interface: /run/nsd.sock
# If this option is defined and set to 'slave', no DNS zone files will be installed
# opmode: slave
tofs: tofs:
# The files_switch key serves as a selector for alternative # The files_switch key serves as a selector for alternative
# directories under the formula files directory. See TOFS pattern # directories under the formula files directory. See TOFS pattern