From 5e4711d87cbaaf383cf0ea5d66ca32bc3b67dbe7 Mon Sep 17 00:00:00 2001 From: Georg Pfuetzenreuter Date: Sun, 19 Feb 2023 21:36:35 +0100 Subject: [PATCH] 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 --- nsd/config/zones.sls | 4 ++++ pillar.example | 3 +++ 2 files changed, 7 insertions(+) diff --git a/nsd/config/zones.sls b/nsd/config/zones.sls index f4f612c..c93ad2d 100644 --- a/nsd/config/zones.sls +++ b/nsd/config/zones.sls @@ -10,11 +10,14 @@ {%- from tplroot ~ "/macros.jinja" import zonefile_name with context %} {%- set zones = nsd.get('zones', {}) %} +{%- set opmode = nsd.get('opmode', 'master') %} {%- if zones | length > 0 %} {{ config_file('90-generated-zones', 'generated-zones') }} +{%- if opmode == 'master' %} + nsd-config-zones-file-directory: file.directory: - name: {{ nsd.zones_dir }} @@ -53,3 +56,4 @@ nsd-config-zones-file-directory: {%- endfor %} {%- endif %} +{%- endif %} diff --git a/pillar.example b/pillar.example index d3ee892..60ad7f0 100644 --- a/pillar.example +++ b/pillar.example @@ -60,6 +60,9 @@ nsd: control-enable: 'yes' control-interface: /run/nsd.sock + # If this option is defined and set to 'slave', no DNS zone files will be installed + # opmode: slave + tofs: # The files_switch key serves as a selector for alternative # directories under the formula files directory. See TOFS pattern