Compare commits

..

1 Commits

Author SHA1 Message Date
pre-commit-ci[bot]
a02314fd9f
ci(pre-commit.ci): perform pre-commit autoupdate
updates:
- [github.com/rubocop-hq/rubocop: v1.30.1 → v1.42.0](https://github.com/rubocop-hq/rubocop/compare/v1.30.1...v1.42.0)
- [github.com/shellcheck-py/shellcheck-py: v0.8.0.4 → v0.9.0.2](https://github.com/shellcheck-py/shellcheck-py/compare/v0.8.0.4...v0.9.0.2)
- [github.com/adrienverge/yamllint: v1.26.3 → v1.28.0](https://github.com/adrienverge/yamllint/compare/v1.26.3...v1.28.0)
- https://github.com/myint/rstcheckhttps://github.com/rstcheck/rstcheck
- [github.com/rstcheck/rstcheck: 3f929574 → v6.1.1](https://github.com/rstcheck/rstcheck/compare/3f929574...v6.1.1)
2023-01-03 00:30:01 +00:00
14 changed files with 17 additions and 138 deletions

View File

@ -30,7 +30,7 @@ repos:
additional_dependencies: ['@commitlint/config-conventional@8.3.4']
always_run: true
- repo: https://github.com/rubocop-hq/rubocop
rev: v1.30.1
rev: v1.42.0
hooks:
- id: rubocop
name: Check Ruby files with rubocop
@ -38,14 +38,14 @@ repos:
always_run: true
pass_filenames: false
- repo: https://github.com/shellcheck-py/shellcheck-py
rev: v0.8.0.4
rev: v0.9.0.2
hooks:
- id: shellcheck
name: Check shell scripts with shellcheck
files: ^.*\.(sh|bash|ksh)$
types: []
- repo: https://github.com/adrienverge/yamllint
rev: v1.26.3
rev: v1.28.0
hooks:
- id: yamllint
name: Check YAML syntax with yamllint
@ -58,8 +58,8 @@ repos:
- id: salt-lint
name: Check Salt files using salt-lint
files: ^.*\.(sls|jinja|j2|tmpl|tst)$
- repo: https://github.com/myint/rstcheck
rev: 3f929574
- repo: https://github.com/rstcheck/rstcheck
rev: v6.1.1
hooks:
- id: rstcheck
name: Check reST files using rstcheck

View File

@ -4,7 +4,6 @@
{#- Get the `tplroot` from `tpldir` #}
{%- set tplroot = tpldir.split('/')[0] %}
{%- set sls_package_install = tplroot ~ '.package.install' %}
{%- from tplroot ~ "/macros.jinja" import config_file with context %}
{%- from tplroot ~ "/map.jinja" import mapdata as nsd with context %}
{%- from tplroot ~ "/libtofs.jinja" import files_switch with context %}
@ -29,12 +28,3 @@ nsd-config-file-file-managed:
- context:
nsd: {{ nsd | json }}
- check_cmd: nsd-checkconf
{%- set config_data = nsd.get('config_data', {}) %}
{%- if config_data | length > 0 %}
{{ config_file('10-salt', 'pillar-configuration') }}
{%- endif %}

View File

@ -6,4 +6,3 @@ include:
- .config_files
- .file
- .zones
- .keys

View File

@ -1,14 +0,0 @@
# -*- coding: utf-8 -*-
# vim: ft=sls
{%- set tplroot = tpldir.split('/')[0] %}
{%- from tplroot ~ "/map.jinja" import mapdata as nsd with context %}
{%- from tplroot ~ "/macros.jinja" import config_file with context %}
{%- set keys = nsd.get('keys', {}) %}
{%- if keys | length > 0 %}
{{ config_file('80-generated-keys', 'generated-keys') }}
{%- endif %}

View File

@ -10,14 +10,11 @@
{%- 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 }}
@ -31,14 +28,10 @@ nsd-config-zones-file-directory:
"{{ identifier }}":
file.managed:
- name: "{{ nsd.zones_dir }}/{{ zonefile_name(name, config) }}"
{%- if 'zone_source' in config %}
- source: {{ config['zone_source'] }}
{%- else %}
- source: {{ files_switch([template, template+'.jinja'],
lookup=identifier
)
}}
{%- endif %}
- mode: 644
- user: root
- group: {{ nsd.rootgroup }}
@ -56,4 +49,3 @@ nsd-config-zones-file-directory:
{%- endfor %}
{%- endif %}
{%- endif %}

View File

@ -1,11 +0,0 @@
########################################################################
# File managed by Salt at <{{ source }}>.
# Your changes will be overwritten.
########################################################################
{%- for name, config in nsd.get('keys').items() %}
key:
name: "{{ name }}"
algorithm: "{{ config['algorithm'] }}"
secret: "{{ config['secret'] }}"
{%- endfor %}

View File

@ -1,5 +1,4 @@
{%- from "nsd/macros.jinja" import zonefile_name with context -%}
{%- set extraopts = ['allow-notify', 'request-xfr', 'outgoing-interface'] -%}
########################################################################
# File managed by Salt at <{{ source }}>.
# Your changes will be overwritten.
@ -9,9 +8,4 @@
zone:
name: "{{ name }}"
zonefile: "{{ nsd.zones_dir }}/{{ zonefile_name(name, config) }}"
{%- for option in extraopts %}
{%- if option in config %}
{{ option }}: {{ config[option] }}
{%- endif %}
{%- endfor %}
{%- endfor %}

View File

@ -1,12 +0,0 @@
{%- for category, config in nsd.get('config_data').items() %}
{{ category }}:
{%- for option, value in config.items() %}
{%- if value is string or value is number %}
{{ option }}: {{ value }}
{%- elif value is iterable %}
{%- for item in value %}
{{ option }}: {{ item }}
{%- endfor %}
{%- endif %}
{%- endfor %}
{%- endfor %}

View File

@ -25,6 +25,7 @@
- file: nsd-config-file-file-managed
- context:
nsd: {{ nsd | json }}
- check_cmd: nsd-checkconf
- watch_in:
- service: nsd-service-running-service-running
{%- endmacro %}

View File

@ -17,17 +17,9 @@ nsd:
# config_include_glob: *.conf
# Configuration is separated into several files which have their own templates
# config_files:
# 10-server: local-nsd-for-unbound
# # 90-generated-zones is reserved for zones generated by this formula
# # 10-salt is reserved for general configuration generated by this formula
# If this section is present in your Pillar data,
# nsd.conf.d/80-generated-keys will be created and managed
keys:
examplekey:
algorithm: hmac-sha512
secret: encryptme
config_files:
10-server: local-nsd-for-unbound
# 90-generated-zones is reserved for zones generated by this formula
# If this section is present in your Pillar data,
# nsd.conf.d/90-generated-zones will be created and managed.
@ -38,30 +30,6 @@ nsd:
"168.192.in-addr.arpa": {}
# NSD's include-pattern directive may be a better way to share configuration
# across zones than using YAML anchors.
#
# You can load the zone file from a custom source and specify additional configuration options:
# example.com:
# zone_source: salt://zones/example.com.zone
# request-xfr: 192.168.0.1
# If this section is present in your Pillar data,
# nsd.conf.d/10-salt.conf will be created and managed
config_data:
server:
hide-version: 'yes'
ip-address: 127.0.0.1
# to use an option multiple times, make it a list:
# ip-address:
# - 127.0.0.1
# - 192.168.0.1
verbosity: 2
port: 53530
remote-control:
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

View File

@ -7,15 +7,8 @@ values:
added_in_pillar: pillar_value
arch: amd64
config: /etc/nsd/nsd.conf
config_data:
remote-control:
control-enable: 'yes'
control-interface: /run/nsd.sock
server:
hide-version: 'yes'
ip-address: 127.0.0.1
port: 53530
verbosity: 2
config_files:
10-server: local-nsd-for-unbound
config_include_dir: "/etc/nsd/nsd.conf.d"
config_include_glob: "*.conf"
lookup:

View File

@ -7,15 +7,8 @@ values:
added_in_pillar: pillar_value
arch: amd64
config: /etc/nsd/nsd.conf
config_data:
remote-control:
control-enable: 'yes'
control-interface: /run/nsd.sock
server:
hide-version: 'yes'
ip-address: 127.0.0.1
port: 53530
verbosity: 2
config_files:
10-server: local-nsd-for-unbound
config_include_dir: "/etc/nsd/nsd.conf.d"
config_include_glob: "*.conf"
lookup:

View File

@ -7,15 +7,8 @@ values:
added_in_pillar: pillar_value
arch: amd64
config: /etc/nsd/nsd.conf
config_data:
remote-control:
control-enable: 'yes'
control-interface: /run/nsd.sock
server:
hide-version: 'yes'
ip-address: 127.0.0.1
port: 53530
verbosity: 2
config_files:
10-server: local-nsd-for-unbound
config_include_dir: "/etc/nsd/nsd.conf.d"
config_include_glob: "*.conf"
lookup:

View File

@ -7,15 +7,8 @@ values:
added_in_pillar: pillar_value
arch: amd64
config: /etc/nsd/nsd.conf
config_data:
remote-control:
control-enable: 'yes'
control-interface: /run/nsd.sock
server:
hide-version: 'yes'
ip-address: 127.0.0.1
port: 53530
verbosity: 2
config_files:
10-server: local-nsd-for-unbound
config_include_dir: "/etc/nsd/nsd.conf.d"
config_include_glob: "*.conf"
lookup: