nsd-formula/nsd/macros.jinja
Georg Pfuetzenreuter 5023b5e0a3
fix(checkconf): only check main config
Included configurations in nsd.conf.d tend to depend on each other. For
example when referring a TSIG key from 80-generates-keys in
90-generated-zones, running nsd-checkconf on these individual files
would cause an error.
It is sufficient and better to just check the main nsd.conf file, as it
combines all included configurations in the check.

Signed-off-by: Georg Pfuetzenreuter <mail@georg-pfuetzenreuter.net>
2023-02-18 16:12:58 +01:00

35 lines
1.0 KiB
Django/Jinja

# -*- coding: utf-8 -*-
# vim: ft=sls
{%- set tplroot = 'nsd' %}
{%- from tplroot ~ "/map.jinja" import mapdata as nsd with context %}
{%- from tplroot ~ "/libtofs.jinja" import files_switch with context %}
{%- macro config_file(name, template) %}
{%- set identifier = 'nsd-config-config_file-file-managed-'+name %}
"{{ identifier }}":
file.managed:
- name: "{{ nsd.config_include_dir }}/{{ name }}.conf"
- source: {{ files_switch([template+'.conf', template+'.conf.jinja'],
lookup=identifier
)
}}
- mode: 644
- user: root
- group: {{ nsd.rootgroup }}
- makedirs: True
- template: jinja
- require:
- file: nsd-config-include-file-directory
- require_in:
- file: nsd-config-file-file-managed
- context:
nsd: {{ nsd | json }}
- watch_in:
- service: nsd-service-running-service-running
{%- endmacro %}
{%- macro zonefile_name(zone_name, zone_config) -%}
{{ zone_config.get('zonefile', zone_name+'.zone') }}
{%- endmacro %}