From eb51237183a7ec34946ff08a5313121974097969 Mon Sep 17 00:00:00 2001 From: Alexander Weidinger Date: Fri, 2 Apr 2021 00:22:15 +0200 Subject: [PATCH] feat(nsd): configure NSD based on TOFS pattern --- docs/README.rst | 10 ++++-- docs/map.jinja.rst | 2 +- nsd/config/config_files.sls | 34 +++++++++++++++++++ nsd/config/file.sls | 4 ++- nsd/config/include.sls | 13 +++++++ nsd/config/init.sls | 2 ++ nsd/files/default/example.tmpl | 6 ---- nsd/files/default/example.tmpl.jinja | 11 ------ .../default/local-nsd-for-unbound.conf.jinja | 18 ++++++++++ nsd/files/default/nsd.conf.jinja | 20 +++++++++++ nsd/parameters/defaults.yaml | 4 ++- nsd/parameters/os/Fedora.yaml | 6 +--- nsd/parameters/os/Ubuntu.yaml | 5 +-- nsd/parameters/os_family/Arch.yaml | 6 +--- nsd/parameters/os_family/Debian.yaml | 5 +-- nsd/parameters/os_family/FreeBSD.yaml | 2 ++ nsd/parameters/os_family/Gentoo.yaml | 4 +-- nsd/parameters/os_family/RedHat.yaml | 5 +-- nsd/parameters/os_family/Suse.yaml | 4 +-- nsd/parameters/osfinger/CentOS-6.yaml | 5 +-- nsd/parameters/osfinger/Ubuntu-18.04.yaml | 3 +- pillar.example | 21 +++++++----- test/integration/default/controls/config.rb | 16 ++++++--- test/integration/default/controls/services.rb | 2 +- .../default/files/_mapdata/amazonlinux-1.yaml | 8 +++-- .../default/files/_mapdata/amazonlinux-2.yaml | 12 ++++--- .../files/_mapdata/arch-base-latest.yaml | 12 ++++--- .../default/files/_mapdata/centos-6.yaml | 8 +++-- .../default/files/_mapdata/centos-7.yaml | 12 ++++--- .../default/files/_mapdata/centos-8.yaml | 12 ++++--- .../default/files/_mapdata/debian-10.yaml | 12 ++++--- .../default/files/_mapdata/debian-9.yaml | 12 ++++--- .../default/files/_mapdata/fedora-31.yaml | 12 ++++--- .../default/files/_mapdata/fedora-32.yaml | 12 ++++--- .../default/files/_mapdata/fedora-33.yaml | 12 ++++--- .../default/files/_mapdata/gentoo-2-sysd.yaml | 12 ++++--- .../default/files/_mapdata/gentoo-2-sysv.yaml | 12 ++++--- .../default/files/_mapdata/opensuse-15.yaml | 12 ++++--- .../files/_mapdata/opensuse-tumbleweed.yaml | 12 ++++--- .../default/files/_mapdata/oraclelinux-7.yaml | 12 ++++--- .../default/files/_mapdata/oraclelinux-8.yaml | 12 ++++--- .../default/files/_mapdata/ubuntu-16.yaml | 12 ++++--- .../default/files/_mapdata/ubuntu-18.yaml | 12 ++++--- .../default/files/_mapdata/ubuntu-20.yaml | 12 ++++--- test/salt/pillar/gentoo.sls | 4 +-- test/salt/pillar/upstart.sls | 4 +-- 46 files changed, 297 insertions(+), 151 deletions(-) create mode 100644 nsd/config/config_files.sls create mode 100644 nsd/config/include.sls delete mode 100644 nsd/files/default/example.tmpl delete mode 100644 nsd/files/default/example.tmpl.jinja create mode 100644 nsd/files/default/local-nsd-for-unbound.conf.jinja create mode 100644 nsd/files/default/nsd.conf.jinja diff --git a/docs/README.rst b/docs/README.rst index 347f444..9838f27 100644 --- a/docs/README.rst +++ b/docs/README.rst @@ -18,8 +18,14 @@ nsd-formula :scale: 100% :target: https://github.com/pre-commit/pre-commit -A SaltStack formula that is empty. It has dummy content to help with a quick -start on a new formula and it serves as a style guide. +A SaltStack formula that manages NSD. + +It intentionally provides only minimalistic configuration. +Use the `TOFS pattern` to alter the configuration to your needs. + +You'll need to write the zone files yourself, obviously. +This formula will tell NSD to compile them into it's DB and provide a configuration file for you to include. + .. contents:: **Table of Contents** :depth: 1 diff --git a/docs/map.jinja.rst b/docs/map.jinja.rst index 7e1f678..1d644dd 100644 --- a/docs/map.jinja.rst +++ b/docs/map.jinja.rst @@ -489,7 +489,7 @@ Here is an example based on `template-formula/nsd/config/file.sls`_: nsd-config-file-file-managed: file.managed: - name: {{ nsd.config }} - - source: {{ files_switch(['example.tmpl'], + - source: {{ files_switch(['nsd.conf'], lookup='nsd-config-file-file-managed' ) }} diff --git a/nsd/config/config_files.sls b/nsd/config/config_files.sls new file mode 100644 index 0000000..51d0dad --- /dev/null +++ b/nsd/config/config_files.sls @@ -0,0 +1,34 @@ +# -*- coding: utf-8 -*- +# vim: ft=sls + +{#- Get the `tplroot` from `tpldir` #} +{%- set tplroot = tpldir.split('/')[0] %} +{%- set sls_package_install = tplroot ~ '.package.install' %} +{%- from tplroot ~ "/map.jinja" import mapdata as nsd with context %} +{%- from tplroot ~ "/libtofs.jinja" import files_switch with context %} + +{%- for name, template in nsd.get('config_files', {}).items() %} + +{%- set identifier = 'nsd-config-config_files-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 }} + - check_cmd: nsd-checkconf + +{%- endfor %} diff --git a/nsd/config/file.sls b/nsd/config/file.sls index 1c7a510..da1bc20 100644 --- a/nsd/config/file.sls +++ b/nsd/config/file.sls @@ -13,7 +13,7 @@ include: nsd-config-file-file-managed: file.managed: - name: {{ nsd.config }} - - source: {{ files_switch(['example.tmpl'], + - source: {{ files_switch(['nsd.conf', 'nsd.conf.jinja'], lookup='nsd-config-file-file-managed' ) }} @@ -24,5 +24,7 @@ nsd-config-file-file-managed: - template: jinja - require: - sls: {{ sls_package_install }} + - file: nsd-config-include-file-directory - context: nsd: {{ nsd | json }} + - check_cmd: nsd-checkconf diff --git a/nsd/config/include.sls b/nsd/config/include.sls new file mode 100644 index 0000000..99e2a38 --- /dev/null +++ b/nsd/config/include.sls @@ -0,0 +1,13 @@ +# -*- coding: utf-8 -*- +# vim: ft=sls + +{#- Get the `tplroot` from `tpldir` #} +{%- set tplroot = tpldir.split('/')[0] %} +{%- set sls_package_install = tplroot ~ '.package.install' %} +{%- from tplroot ~ "/map.jinja" import mapdata as nsd with context %} +{%- from tplroot ~ "/libtofs.jinja" import files_switch with context %} + +nsd-config-include-file-directory: + file.directory: + - name: "{{ nsd.config_include_dir }}" + - makedirs: true diff --git a/nsd/config/init.sls b/nsd/config/init.sls index 465ddfe..29032d3 100644 --- a/nsd/config/init.sls +++ b/nsd/config/init.sls @@ -2,4 +2,6 @@ # vim: ft=sls include: + - .include + - .config_files - .file diff --git a/nsd/files/default/example.tmpl b/nsd/files/default/example.tmpl deleted file mode 100644 index 2c9c60f..0000000 --- a/nsd/files/default/example.tmpl +++ /dev/null @@ -1,6 +0,0 @@ -######################################################################## -# File managed by Salt at <{{ source }}>. -# Your changes will be overwritten. -######################################################################## - -This is an example file from SaltStack template-formula. diff --git a/nsd/files/default/example.tmpl.jinja b/nsd/files/default/example.tmpl.jinja deleted file mode 100644 index 60ea013..0000000 --- a/nsd/files/default/example.tmpl.jinja +++ /dev/null @@ -1,11 +0,0 @@ -######################################################################## -# File managed by Salt at <{{ source }}>. -# Your changes will be overwritten. -######################################################################## - -This is another example file from SaltStack template-formula. - -# This is here for testing purposes -{{ nsd | json }} - -winner of the merge: {{ nsd['winner'] }} diff --git a/nsd/files/default/local-nsd-for-unbound.conf.jinja b/nsd/files/default/local-nsd-for-unbound.conf.jinja new file mode 100644 index 0000000..f352ebb --- /dev/null +++ b/nsd/files/default/local-nsd-for-unbound.conf.jinja @@ -0,0 +1,18 @@ +######################################################################## +# File managed by Salt at <{{ source }}>. +# Your changes will be overwritten. +######################################################################## + +# This is just a minimal example for using NSD together with a locally +# running unbound resolver. (See unbound-forula) +# If you need different configuration, use the TOFS pattern! + +# (We're using IPv4 here, because the Kitchen CI configuration had no IPv6 at the time of development.) + +server: + server-count: 1 + ip-address: 127.0.0.1 + port: 53530 + +remote-control: + control-interface: 127.0.0.1 diff --git a/nsd/files/default/nsd.conf.jinja b/nsd/files/default/nsd.conf.jinja new file mode 100644 index 0000000..455a4c3 --- /dev/null +++ b/nsd/files/default/nsd.conf.jinja @@ -0,0 +1,20 @@ +######################################################################## +# File managed by Salt at <{{ source }}>. +# Your changes will be overwritten. +######################################################################## + + +# All configuration is loaded from here: +include: "{{ nsd.config_include_dir }}/{{ nsd.config_include_glob }}" + + +######################################################################## +# +# This section is for testing only. You can safely ignore it and delete +# it from your templates. +# +# winner of the merge: {{ nsd.winner }} +# +# {{ nsd | json}} +# +######################################################################## diff --git a/nsd/parameters/defaults.yaml b/nsd/parameters/defaults.yaml index 04325df..93ab8ca 100644 --- a/nsd/parameters/defaults.yaml +++ b/nsd/parameters/defaults.yaml @@ -7,7 +7,9 @@ values: pkg: name: nsd rootgroup: root - config: '/etc/nsd' + config: '/etc/nsd/nsd.conf' + config_include_dir: '/etc/nsd/nsd.conf.d' + config_include_glob: '*.conf' service: name: nsd # Just here for testing diff --git a/nsd/parameters/os/Fedora.yaml b/nsd/parameters/os/Fedora.yaml index 857e3eb..322dd36 100644 --- a/nsd/parameters/os/Fedora.yaml +++ b/nsd/parameters/os/Fedora.yaml @@ -11,9 +11,5 @@ # you can remove this file or provide at least an empty dict, e.g. # values: {} --- -values: - pkg: - name: nsd-fedora - service: - name: service-fedora +values: {} ... diff --git a/nsd/parameters/os/Ubuntu.yaml b/nsd/parameters/os/Ubuntu.yaml index 358f87a..3c35cb7 100644 --- a/nsd/parameters/os/Ubuntu.yaml +++ b/nsd/parameters/os/Ubuntu.yaml @@ -11,8 +11,5 @@ # you can remove this file or provide at least an empty dict, e.g. # values: {} --- -values: - pkg: - name: nsd-ubuntu - config: /etc/nsd.d/custom-ubuntu.conf +values: {} ... diff --git a/nsd/parameters/os_family/Arch.yaml b/nsd/parameters/os_family/Arch.yaml index 2a645c7..f999a14 100644 --- a/nsd/parameters/os_family/Arch.yaml +++ b/nsd/parameters/os_family/Arch.yaml @@ -11,9 +11,5 @@ # you can remove this file or provide at least an empty dict, e.g. # values: {} --- -values: - pkg: - name: nsd-arch - service: - name: service-arch +values: {} ... diff --git a/nsd/parameters/os_family/Debian.yaml b/nsd/parameters/os_family/Debian.yaml index 30cb664..0d579c7 100644 --- a/nsd/parameters/os_family/Debian.yaml +++ b/nsd/parameters/os_family/Debian.yaml @@ -11,8 +11,5 @@ # you can remove this file or provide at least an empty dict, e.g. # values: {} --- -values: - pkg: - name: nsd-debian - config: /etc/nsd.d/custom.conf +values: {} ... diff --git a/nsd/parameters/os_family/FreeBSD.yaml b/nsd/parameters/os_family/FreeBSD.yaml index 5f8fc25..591be57 100644 --- a/nsd/parameters/os_family/FreeBSD.yaml +++ b/nsd/parameters/os_family/FreeBSD.yaml @@ -13,4 +13,6 @@ --- values: rootgroup: wheel + config: '/usr/local/etc/nsd/nsd.conf' + config_include_dir: '/usr/local/etc/nsd/nsd.conf.d' ... diff --git a/nsd/parameters/os_family/Gentoo.yaml b/nsd/parameters/os_family/Gentoo.yaml index bc9ed37..7c92b1d 100644 --- a/nsd/parameters/os_family/Gentoo.yaml +++ b/nsd/parameters/os_family/Gentoo.yaml @@ -11,7 +11,5 @@ # you can remove this file or provide at least an empty dict, e.g. # values: {} --- -values: - pkg: - name: nsd-gentoo +values: {} ... diff --git a/nsd/parameters/os_family/RedHat.yaml b/nsd/parameters/os_family/RedHat.yaml index 7aa8cf0..350d565 100644 --- a/nsd/parameters/os_family/RedHat.yaml +++ b/nsd/parameters/os_family/RedHat.yaml @@ -11,8 +11,5 @@ # you can remove this file or provide at least an empty dict, e.g. # values: {} --- -values: - pkg: - name: nsd-redhat - config: /etc/nsd.conf +values: {} ... diff --git a/nsd/parameters/os_family/Suse.yaml b/nsd/parameters/os_family/Suse.yaml index cae0a90..a608845 100644 --- a/nsd/parameters/os_family/Suse.yaml +++ b/nsd/parameters/os_family/Suse.yaml @@ -11,7 +11,5 @@ # you can remove this file or provide at least an empty dict, e.g. # values: {} --- -values: - pkg: - name: nsd-suse +values: {} ... diff --git a/nsd/parameters/osfinger/CentOS-6.yaml b/nsd/parameters/osfinger/CentOS-6.yaml index 2886880..808b828 100644 --- a/nsd/parameters/osfinger/CentOS-6.yaml +++ b/nsd/parameters/osfinger/CentOS-6.yaml @@ -11,8 +11,5 @@ # you can remove this file or provide at least an empty dict, e.g. # values: {} --- -values: - pkg: - name: nsd-centos-6 - config: /etc/nsd.d/custom-centos-6.conf +values: {} ... diff --git a/nsd/parameters/osfinger/Ubuntu-18.04.yaml b/nsd/parameters/osfinger/Ubuntu-18.04.yaml index 8b5ee2b..5a279ca 100644 --- a/nsd/parameters/osfinger/Ubuntu-18.04.yaml +++ b/nsd/parameters/osfinger/Ubuntu-18.04.yaml @@ -11,6 +11,5 @@ # you can remove this file or provide at least an empty dict, e.g. # values: {} --- -values: - config: /etc/nsd.d/custom-ubuntu-18.04.conf +values: {} ... diff --git a/pillar.example b/pillar.example index ba4c908..802f7f2 100644 --- a/pillar.example +++ b/pillar.example @@ -8,14 +8,17 @@ nsd: winner: lookup added_in_lookup: lookup_value - # Using bash package and udev service as an example. This allows us to - # test the template formula itself. You should set these parameters to - # examples that make sense in the contexto of the formula you're writing. - pkg: - name: bash - service: - name: systemd-journald - config: /etc/template-formula.conf + # pkg: + # name: nsd + # service: + # name: nsd + # config: /etc/nsd/nsd.conf + # config_include_dir: /etc/nsd/nsd.conf.d + # config_include_glob: *.conf + + # Configuration is separated into several files which have their own templates + config_files: + 10-server: local-nsd-for-unbound tofs: # The files_switch key serves as a selector for alternative @@ -48,7 +51,7 @@ nsd: # For testing purposes source_files: nsd-config-file-file-managed: - - 'example.tmpl.jinja' + - 'nsd.conf.jinja' # Just for testing purposes winner: pillar diff --git a/test/integration/default/controls/config.rb b/test/integration/default/controls/config.rb index 1f6b0e4..5a426f8 100644 --- a/test/integration/default/controls/config.rb +++ b/test/integration/default/controls/config.rb @@ -3,20 +3,20 @@ control 'nsd.config.file' do title 'Verify the configuration file' - describe file('/etc/template-formula.conf') do + describe file('/etc/nsd/nsd.conf') do it { should be_file } it { should be_owned_by 'root' } it { should be_grouped_into 'root' } its('mode') { should cmp '0644' } its('content') do should include( - 'This is another example file from SaltStack template-formula.' + 'Your changes will be overwritten.' ) end its('content') { should include '"added_in_pillar": "pillar_value"' } its('content') { should include '"added_in_defaults": "defaults_value"' } its('content') { should include '"added_in_lookup": "lookup_value"' } - its('content') { should include '"config": "/etc/template-formula.conf"' } + its('content') { should include '"config": "/etc/nsd/nsd.conf"' } its('content') { should include '"lookup": {"added_in_lookup": "lookup_value",' } its('content') { should include '"pkg": {"name": "' } its('content') { should include '"service": {"name": "' } @@ -26,13 +26,19 @@ control 'nsd.config.file' do should include( '"tofs": {"files_switch": ["any/path/can/be/used/here", "id", '\ '"roles", "osfinger", "os", "os_family"], "source_files": '\ - '{"nsd-config-file-file-managed": ["example.tmpl.jinja"]}' + '{"nsd-config-file-file-managed": ["nsd.conf.jinja"]}' ) # rubocop:enable Layout/LineLength # rubocop:enable Lint/RedundantCopDisableDirective end its('content') { should include '"arch": "amd64"' } - its('content') { should include '"winner": "pillar"}' } + its('content') { should include '"winner": "pillar"' } its('content') { should include 'winner of the merge: pillar' } end + + describe file('/etc/nsd/nsd.conf.d') do + it { should be_directory } + it { should be_owned_by 'root' } + it { should be_grouped_into 'root' } + end end diff --git a/test/integration/default/controls/services.rb b/test/integration/default/controls/services.rb index 0bf6cc6..0cf22f4 100644 --- a/test/integration/default/controls/services.rb +++ b/test/integration/default/controls/services.rb @@ -12,7 +12,7 @@ control 'nsd.service.running' do when 'centos-6', 'amazonlinux-1' 'crond' else - 'systemd-journald' + 'nsd' end describe service(service_name) do diff --git a/test/integration/default/files/_mapdata/amazonlinux-1.yaml b/test/integration/default/files/_mapdata/amazonlinux-1.yaml index 9446fe4..f07a221 100644 --- a/test/integration/default/files/_mapdata/amazonlinux-1.yaml +++ b/test/integration/default/files/_mapdata/amazonlinux-1.yaml @@ -6,7 +6,11 @@ values: added_in_lookup: lookup_value added_in_pillar: pillar_value arch: amd64 - config: /etc/template-formula.conf + config: /etc/nsd/nsd.conf + config_files: + 10-server: local-nsd-for-unbound + config_include_dir: "/etc/nsd/nsd.conf.d" + config_include_glob: "*.conf" lookup: added_in_lookup: lookup_value master: template-master @@ -36,5 +40,5 @@ values: - os_family source_files: nsd-config-file-file-managed: - - example.tmpl.jinja + - nsd.conf.jinja winner: pillar diff --git a/test/integration/default/files/_mapdata/amazonlinux-2.yaml b/test/integration/default/files/_mapdata/amazonlinux-2.yaml index 9695c83..3e92886 100644 --- a/test/integration/default/files/_mapdata/amazonlinux-2.yaml +++ b/test/integration/default/files/_mapdata/amazonlinux-2.yaml @@ -6,7 +6,11 @@ values: added_in_lookup: lookup_value added_in_pillar: pillar_value arch: amd64 - config: /etc/template-formula.conf + config: /etc/nsd/nsd.conf + config_files: + 10-server: local-nsd-for-unbound + config_include_dir: "/etc/nsd/nsd.conf.d" + config_include_glob: "*.conf" lookup: added_in_lookup: lookup_value master: template-master @@ -22,10 +26,10 @@ values: - Y:G@id master: template-master pkg: - name: bash + name: nsd rootgroup: root service: - name: systemd-journald + name: nsd tofs: files_switch: - any/path/can/be/used/here @@ -36,5 +40,5 @@ values: - os_family source_files: nsd-config-file-file-managed: - - example.tmpl.jinja + - nsd.conf.jinja winner: pillar diff --git a/test/integration/default/files/_mapdata/arch-base-latest.yaml b/test/integration/default/files/_mapdata/arch-base-latest.yaml index eb05967..3f39a70 100644 --- a/test/integration/default/files/_mapdata/arch-base-latest.yaml +++ b/test/integration/default/files/_mapdata/arch-base-latest.yaml @@ -6,7 +6,11 @@ values: added_in_lookup: lookup_value added_in_pillar: pillar_value arch: amd64 - config: /etc/template-formula.conf + config: /etc/nsd/nsd.conf + config_files: + 10-server: local-nsd-for-unbound + config_include_dir: "/etc/nsd/nsd.conf.d" + config_include_glob: "*.conf" lookup: added_in_lookup: lookup_value master: template-master @@ -22,10 +26,10 @@ values: - Y:G@id master: template-master pkg: - name: bash + name: nsd rootgroup: root service: - name: systemd-journald + name: nsd tofs: files_switch: - any/path/can/be/used/here @@ -36,5 +40,5 @@ values: - os_family source_files: nsd-config-file-file-managed: - - example.tmpl.jinja + - nsd.conf.jinja winner: pillar diff --git a/test/integration/default/files/_mapdata/centos-6.yaml b/test/integration/default/files/_mapdata/centos-6.yaml index 41a4d04..2c9394f 100644 --- a/test/integration/default/files/_mapdata/centos-6.yaml +++ b/test/integration/default/files/_mapdata/centos-6.yaml @@ -6,7 +6,11 @@ values: added_in_lookup: lookup_value added_in_pillar: pillar_value arch: amd64 - config: /etc/template-formula.conf + config: /etc/nsd/nsd.conf + config_files: + 10-server: local-nsd-for-unbound + config_include_dir: "/etc/nsd/nsd.conf.d" + config_include_glob: "*.conf" lookup: added_in_lookup: lookup_value master: template-master @@ -36,5 +40,5 @@ values: - os_family source_files: nsd-config-file-file-managed: - - example.tmpl.jinja + - nsd.conf.jinja winner: pillar diff --git a/test/integration/default/files/_mapdata/centos-7.yaml b/test/integration/default/files/_mapdata/centos-7.yaml index b097247..64bb34e 100644 --- a/test/integration/default/files/_mapdata/centos-7.yaml +++ b/test/integration/default/files/_mapdata/centos-7.yaml @@ -6,7 +6,11 @@ values: added_in_lookup: lookup_value added_in_pillar: pillar_value arch: amd64 - config: /etc/template-formula.conf + config: /etc/nsd/nsd.conf + config_files: + 10-server: local-nsd-for-unbound + config_include_dir: "/etc/nsd/nsd.conf.d" + config_include_glob: "*.conf" lookup: added_in_lookup: lookup_value master: template-master @@ -22,10 +26,10 @@ values: - Y:G@id master: template-master pkg: - name: bash + name: nsd rootgroup: root service: - name: systemd-journald + name: nsd tofs: files_switch: - any/path/can/be/used/here @@ -36,5 +40,5 @@ values: - os_family source_files: nsd-config-file-file-managed: - - example.tmpl.jinja + - nsd.conf.jinja winner: pillar diff --git a/test/integration/default/files/_mapdata/centos-8.yaml b/test/integration/default/files/_mapdata/centos-8.yaml index 578a0a6..85c3dcc 100644 --- a/test/integration/default/files/_mapdata/centos-8.yaml +++ b/test/integration/default/files/_mapdata/centos-8.yaml @@ -6,7 +6,11 @@ values: added_in_lookup: lookup_value added_in_pillar: pillar_value arch: amd64 - config: /etc/template-formula.conf + config: /etc/nsd/nsd.conf + config_files: + 10-server: local-nsd-for-unbound + config_include_dir: "/etc/nsd/nsd.conf.d" + config_include_glob: "*.conf" lookup: added_in_lookup: lookup_value master: template-master @@ -22,10 +26,10 @@ values: - Y:G@id master: template-master pkg: - name: bash + name: nsd rootgroup: root service: - name: systemd-journald + name: nsd tofs: files_switch: - any/path/can/be/used/here @@ -36,5 +40,5 @@ values: - os_family source_files: nsd-config-file-file-managed: - - example.tmpl.jinja + - nsd.conf.jinja winner: pillar diff --git a/test/integration/default/files/_mapdata/debian-10.yaml b/test/integration/default/files/_mapdata/debian-10.yaml index e90b014..977f934 100644 --- a/test/integration/default/files/_mapdata/debian-10.yaml +++ b/test/integration/default/files/_mapdata/debian-10.yaml @@ -6,7 +6,11 @@ values: added_in_lookup: lookup_value added_in_pillar: pillar_value arch: amd64 - config: /etc/template-formula.conf + config: /etc/nsd/nsd.conf + config_files: + 10-server: local-nsd-for-unbound + config_include_dir: "/etc/nsd/nsd.conf.d" + config_include_glob: "*.conf" lookup: added_in_lookup: lookup_value master: template-master @@ -22,10 +26,10 @@ values: - Y:G@id master: template-master pkg: - name: bash + name: nsd rootgroup: root service: - name: systemd-journald + name: nsd tofs: files_switch: - any/path/can/be/used/here @@ -36,5 +40,5 @@ values: - os_family source_files: nsd-config-file-file-managed: - - example.tmpl.jinja + - nsd.conf.jinja winner: pillar diff --git a/test/integration/default/files/_mapdata/debian-9.yaml b/test/integration/default/files/_mapdata/debian-9.yaml index 041e4dc..c720c50 100644 --- a/test/integration/default/files/_mapdata/debian-9.yaml +++ b/test/integration/default/files/_mapdata/debian-9.yaml @@ -6,7 +6,11 @@ values: added_in_lookup: lookup_value added_in_pillar: pillar_value arch: amd64 - config: /etc/template-formula.conf + config: /etc/nsd/nsd.conf + config_files: + 10-server: local-nsd-for-unbound + config_include_dir: "/etc/nsd/nsd.conf.d" + config_include_glob: "*.conf" lookup: added_in_lookup: lookup_value master: template-master @@ -22,10 +26,10 @@ values: - Y:G@id master: template-master pkg: - name: bash + name: nsd rootgroup: root service: - name: systemd-journald + name: nsd tofs: files_switch: - any/path/can/be/used/here @@ -36,5 +40,5 @@ values: - os_family source_files: nsd-config-file-file-managed: - - example.tmpl.jinja + - nsd.conf.jinja winner: pillar diff --git a/test/integration/default/files/_mapdata/fedora-31.yaml b/test/integration/default/files/_mapdata/fedora-31.yaml index 2b73533..86436dd 100644 --- a/test/integration/default/files/_mapdata/fedora-31.yaml +++ b/test/integration/default/files/_mapdata/fedora-31.yaml @@ -6,7 +6,11 @@ values: added_in_lookup: lookup_value added_in_pillar: pillar_value arch: amd64 - config: /etc/template-formula.conf + config: /etc/nsd/nsd.conf + config_files: + 10-server: local-nsd-for-unbound + config_include_dir: "/etc/nsd/nsd.conf.d" + config_include_glob: "*.conf" lookup: added_in_lookup: lookup_value master: template-master @@ -22,10 +26,10 @@ values: - Y:G@id master: template-master pkg: - name: bash + name: nsd rootgroup: root service: - name: systemd-journald + name: nsd tofs: files_switch: - any/path/can/be/used/here @@ -36,5 +40,5 @@ values: - os_family source_files: nsd-config-file-file-managed: - - example.tmpl.jinja + - nsd.conf.jinja winner: pillar diff --git a/test/integration/default/files/_mapdata/fedora-32.yaml b/test/integration/default/files/_mapdata/fedora-32.yaml index b3b4061..d152d44 100644 --- a/test/integration/default/files/_mapdata/fedora-32.yaml +++ b/test/integration/default/files/_mapdata/fedora-32.yaml @@ -6,7 +6,11 @@ values: added_in_lookup: lookup_value added_in_pillar: pillar_value arch: amd64 - config: /etc/template-formula.conf + config: /etc/nsd/nsd.conf + config_files: + 10-server: local-nsd-for-unbound + config_include_dir: "/etc/nsd/nsd.conf.d" + config_include_glob: "*.conf" lookup: added_in_lookup: lookup_value master: template-master @@ -22,10 +26,10 @@ values: - Y:G@id master: template-master pkg: - name: bash + name: nsd rootgroup: root service: - name: systemd-journald + name: nsd tofs: files_switch: - any/path/can/be/used/here @@ -36,5 +40,5 @@ values: - os_family source_files: nsd-config-file-file-managed: - - example.tmpl.jinja + - nsd.conf.jinja winner: pillar diff --git a/test/integration/default/files/_mapdata/fedora-33.yaml b/test/integration/default/files/_mapdata/fedora-33.yaml index 1af96df..9915475 100644 --- a/test/integration/default/files/_mapdata/fedora-33.yaml +++ b/test/integration/default/files/_mapdata/fedora-33.yaml @@ -6,7 +6,11 @@ values: added_in_lookup: lookup_value added_in_pillar: pillar_value arch: amd64 - config: /etc/template-formula.conf + config: /etc/nsd/nsd.conf + config_files: + 10-server: local-nsd-for-unbound + config_include_dir: "/etc/nsd/nsd.conf.d" + config_include_glob: "*.conf" lookup: added_in_lookup: lookup_value master: template-master @@ -22,10 +26,10 @@ values: - Y:G@id master: template-master pkg: - name: bash + name: nsd rootgroup: root service: - name: systemd-journald + name: nsd tofs: files_switch: - any/path/can/be/used/here @@ -36,5 +40,5 @@ values: - os_family source_files: nsd-config-file-file-managed: - - example.tmpl.jinja + - nsd.conf.jinja winner: pillar diff --git a/test/integration/default/files/_mapdata/gentoo-2-sysd.yaml b/test/integration/default/files/_mapdata/gentoo-2-sysd.yaml index 6da7b6d..754c05e 100644 --- a/test/integration/default/files/_mapdata/gentoo-2-sysd.yaml +++ b/test/integration/default/files/_mapdata/gentoo-2-sysd.yaml @@ -6,7 +6,11 @@ values: added_in_lookup: lookup_value added_in_pillar: pillar_value arch: amd64 - config: /etc/template-formula.conf + config: /etc/nsd/nsd.conf + config_files: + 10-server: local-nsd-for-unbound + config_include_dir: "/etc/nsd/nsd.conf.d" + config_include_glob: "*.conf" lookup: added_in_lookup: lookup_value master: template-master @@ -22,10 +26,10 @@ values: - Y:G@id master: template-master pkg: - name: app-shells/bash + name: nsd rootgroup: root service: - name: systemd-journald + name: nsd tofs: files_switch: - any/path/can/be/used/here @@ -36,5 +40,5 @@ values: - os_family source_files: nsd-config-file-file-managed: - - example.tmpl.jinja + - nsd.conf.jinja winner: pillar diff --git a/test/integration/default/files/_mapdata/gentoo-2-sysv.yaml b/test/integration/default/files/_mapdata/gentoo-2-sysv.yaml index b95640e..754c05e 100644 --- a/test/integration/default/files/_mapdata/gentoo-2-sysv.yaml +++ b/test/integration/default/files/_mapdata/gentoo-2-sysv.yaml @@ -6,7 +6,11 @@ values: added_in_lookup: lookup_value added_in_pillar: pillar_value arch: amd64 - config: /etc/template-formula.conf + config: /etc/nsd/nsd.conf + config_files: + 10-server: local-nsd-for-unbound + config_include_dir: "/etc/nsd/nsd.conf.d" + config_include_glob: "*.conf" lookup: added_in_lookup: lookup_value master: template-master @@ -22,10 +26,10 @@ values: - Y:G@id master: template-master pkg: - name: app-shells/bash + name: nsd rootgroup: root service: - name: mtab + name: nsd tofs: files_switch: - any/path/can/be/used/here @@ -36,5 +40,5 @@ values: - os_family source_files: nsd-config-file-file-managed: - - example.tmpl.jinja + - nsd.conf.jinja winner: pillar diff --git a/test/integration/default/files/_mapdata/opensuse-15.yaml b/test/integration/default/files/_mapdata/opensuse-15.yaml index c5dd6fd..61597cb 100644 --- a/test/integration/default/files/_mapdata/opensuse-15.yaml +++ b/test/integration/default/files/_mapdata/opensuse-15.yaml @@ -6,7 +6,11 @@ values: added_in_lookup: lookup_value added_in_pillar: pillar_value arch: amd64 - config: /etc/template-formula.conf + config: /etc/nsd/nsd.conf + config_files: + 10-server: local-nsd-for-unbound + config_include_dir: "/etc/nsd/nsd.conf.d" + config_include_glob: "*.conf" lookup: added_in_lookup: lookup_value master: template-master @@ -22,10 +26,10 @@ values: - Y:G@id master: template-master pkg: - name: bash + name: nsd rootgroup: root service: - name: systemd-journald + name: nsd tofs: files_switch: - any/path/can/be/used/here @@ -36,5 +40,5 @@ values: - os_family source_files: nsd-config-file-file-managed: - - example.tmpl.jinja + - nsd.conf.jinja winner: pillar diff --git a/test/integration/default/files/_mapdata/opensuse-tumbleweed.yaml b/test/integration/default/files/_mapdata/opensuse-tumbleweed.yaml index 457c2c4..6d98ed0 100644 --- a/test/integration/default/files/_mapdata/opensuse-tumbleweed.yaml +++ b/test/integration/default/files/_mapdata/opensuse-tumbleweed.yaml @@ -6,7 +6,11 @@ values: added_in_lookup: lookup_value added_in_pillar: pillar_value arch: amd64 - config: /etc/template-formula.conf + config: /etc/nsd/nsd.conf + config_files: + 10-server: local-nsd-for-unbound + config_include_dir: "/etc/nsd/nsd.conf.d" + config_include_glob: "*.conf" lookup: added_in_lookup: lookup_value master: template-master @@ -22,10 +26,10 @@ values: - Y:G@id master: template-master pkg: - name: bash + name: nsd rootgroup: root service: - name: systemd-journald + name: nsd tofs: files_switch: - any/path/can/be/used/here @@ -36,5 +40,5 @@ values: - os_family source_files: nsd-config-file-file-managed: - - example.tmpl.jinja + - nsd.conf.jinja winner: pillar diff --git a/test/integration/default/files/_mapdata/oraclelinux-7.yaml b/test/integration/default/files/_mapdata/oraclelinux-7.yaml index 3b6a365..f7ab208 100644 --- a/test/integration/default/files/_mapdata/oraclelinux-7.yaml +++ b/test/integration/default/files/_mapdata/oraclelinux-7.yaml @@ -6,7 +6,11 @@ values: added_in_lookup: lookup_value added_in_pillar: pillar_value arch: amd64 - config: /etc/template-formula.conf + config: /etc/nsd/nsd.conf + config_files: + 10-server: local-nsd-for-unbound + config_include_dir: "/etc/nsd/nsd.conf.d" + config_include_glob: "*.conf" lookup: added_in_lookup: lookup_value master: template-master @@ -22,10 +26,10 @@ values: - Y:G@id master: template-master pkg: - name: bash + name: nsd rootgroup: root service: - name: systemd-journald + name: nsd tofs: files_switch: - any/path/can/be/used/here @@ -36,5 +40,5 @@ values: - os_family source_files: nsd-config-file-file-managed: - - example.tmpl.jinja + - nsd.conf.jinja winner: pillar diff --git a/test/integration/default/files/_mapdata/oraclelinux-8.yaml b/test/integration/default/files/_mapdata/oraclelinux-8.yaml index 3e32b57..febbbb2 100644 --- a/test/integration/default/files/_mapdata/oraclelinux-8.yaml +++ b/test/integration/default/files/_mapdata/oraclelinux-8.yaml @@ -6,7 +6,11 @@ values: added_in_lookup: lookup_value added_in_pillar: pillar_value arch: amd64 - config: /etc/template-formula.conf + config: /etc/nsd/nsd.conf + config_files: + 10-server: local-nsd-for-unbound + config_include_dir: "/etc/nsd/nsd.conf.d" + config_include_glob: "*.conf" lookup: added_in_lookup: lookup_value master: template-master @@ -22,10 +26,10 @@ values: - Y:G@id master: template-master pkg: - name: bash + name: nsd rootgroup: root service: - name: systemd-journald + name: nsd tofs: files_switch: - any/path/can/be/used/here @@ -36,5 +40,5 @@ values: - os_family source_files: nsd-config-file-file-managed: - - example.tmpl.jinja + - nsd.conf.jinja winner: pillar diff --git a/test/integration/default/files/_mapdata/ubuntu-16.yaml b/test/integration/default/files/_mapdata/ubuntu-16.yaml index 06ea8c5..260e1e2 100644 --- a/test/integration/default/files/_mapdata/ubuntu-16.yaml +++ b/test/integration/default/files/_mapdata/ubuntu-16.yaml @@ -6,7 +6,11 @@ values: added_in_lookup: lookup_value added_in_pillar: pillar_value arch: amd64 - config: /etc/template-formula.conf + config: /etc/nsd/nsd.conf + config_files: + 10-server: local-nsd-for-unbound + config_include_dir: "/etc/nsd/nsd.conf.d" + config_include_glob: "*.conf" lookup: added_in_lookup: lookup_value master: template-master @@ -22,10 +26,10 @@ values: - Y:G@id master: template-master pkg: - name: bash + name: nsd rootgroup: root service: - name: systemd-journald + name: nsd tofs: files_switch: - any/path/can/be/used/here @@ -36,5 +40,5 @@ values: - os_family source_files: nsd-config-file-file-managed: - - example.tmpl.jinja + - nsd.conf.jinja winner: pillar diff --git a/test/integration/default/files/_mapdata/ubuntu-18.yaml b/test/integration/default/files/_mapdata/ubuntu-18.yaml index bcd02c7..2b037f0 100644 --- a/test/integration/default/files/_mapdata/ubuntu-18.yaml +++ b/test/integration/default/files/_mapdata/ubuntu-18.yaml @@ -6,7 +6,11 @@ values: added_in_lookup: lookup_value added_in_pillar: pillar_value arch: amd64 - config: /etc/template-formula.conf + config: /etc/nsd/nsd.conf + config_files: + 10-server: local-nsd-for-unbound + config_include_dir: "/etc/nsd/nsd.conf.d" + config_include_glob: "*.conf" lookup: added_in_lookup: lookup_value master: template-master @@ -22,10 +26,10 @@ values: - Y:G@id master: template-master pkg: - name: bash + name: nsd rootgroup: root service: - name: systemd-journald + name: nsd tofs: files_switch: - any/path/can/be/used/here @@ -36,5 +40,5 @@ values: - os_family source_files: nsd-config-file-file-managed: - - example.tmpl.jinja + - nsd.conf.jinja winner: pillar diff --git a/test/integration/default/files/_mapdata/ubuntu-20.yaml b/test/integration/default/files/_mapdata/ubuntu-20.yaml index 38fd30a..bbc0d27 100644 --- a/test/integration/default/files/_mapdata/ubuntu-20.yaml +++ b/test/integration/default/files/_mapdata/ubuntu-20.yaml @@ -6,7 +6,11 @@ values: added_in_lookup: lookup_value added_in_pillar: pillar_value arch: amd64 - config: /etc/template-formula.conf + config: /etc/nsd/nsd.conf + config_files: + 10-server: local-nsd-for-unbound + config_include_dir: "/etc/nsd/nsd.conf.d" + config_include_glob: "*.conf" lookup: added_in_lookup: lookup_value master: template-master @@ -22,10 +26,10 @@ values: - Y:G@id master: template-master pkg: - name: bash + name: nsd rootgroup: root service: - name: systemd-journald + name: nsd tofs: files_switch: - any/path/can/be/used/here @@ -36,5 +40,5 @@ values: - os_family source_files: nsd-config-file-file-managed: - - example.tmpl.jinja + - nsd.conf.jinja winner: pillar diff --git a/test/salt/pillar/gentoo.sls b/test/salt/pillar/gentoo.sls index 356d6a9..a7db963 100644 --- a/test/salt/pillar/gentoo.sls +++ b/test/salt/pillar/gentoo.sls @@ -5,6 +5,6 @@ portage: sync_wait_one_day: true nsd: pkg: - name: 'app-shells/bash' + name: 'nsd' service: - name: "{{ 'systemd-journald' if grains.init == 'systemd' else 'mtab' }}" + name: 'nsd' diff --git a/test/salt/pillar/upstart.sls b/test/salt/pillar/upstart.sls index abe37c2..bec4c81 100644 --- a/test/salt/pillar/upstart.sls +++ b/test/salt/pillar/upstart.sls @@ -15,7 +15,7 @@ nsd: name: cronie service: name: crond - config: /etc/template-formula.conf + config: /etc/nsd/nsd.conf tofs: # The files_switch key serves as a selector for alternative @@ -46,7 +46,7 @@ nsd: # For testing purposes source_files: nsd-config-file-file-managed: - - 'example.tmpl.jinja' + - 'nsd.conf.jinja' # Just for testing purposes winner: pillar