2021-04-01 23:00:17 +02:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
# vim: ft=sls
|
|
|
|
|
|
|
|
{#- Get the `tplroot` from `tpldir` #}
|
|
|
|
{%- set tplroot = tpldir.split('/')[0] %}
|
|
|
|
{%- set sls_package_install = tplroot ~ '.package.install' %}
|
2023-02-17 00:07:24 +01:00
|
|
|
{%- from tplroot ~ "/macros.jinja" import config_file with context %}
|
2021-04-01 23:00:17 +02:00
|
|
|
{%- from tplroot ~ "/map.jinja" import mapdata as nsd with context %}
|
2021-04-01 23:00:17 +02:00
|
|
|
{%- from tplroot ~ "/libtofs.jinja" import files_switch with context %}
|
|
|
|
|
|
|
|
include:
|
|
|
|
- {{ sls_package_install }}
|
|
|
|
|
2021-04-01 23:00:17 +02:00
|
|
|
nsd-config-file-file-managed:
|
2021-04-01 23:00:17 +02:00
|
|
|
file.managed:
|
2021-04-01 23:00:17 +02:00
|
|
|
- name: {{ nsd.config }}
|
2021-04-02 00:22:15 +02:00
|
|
|
- source: {{ files_switch(['nsd.conf', 'nsd.conf.jinja'],
|
2021-04-01 23:00:17 +02:00
|
|
|
lookup='nsd-config-file-file-managed'
|
2021-04-01 23:00:17 +02:00
|
|
|
)
|
|
|
|
}}
|
|
|
|
- mode: 644
|
|
|
|
- user: root
|
2021-04-01 23:00:17 +02:00
|
|
|
- group: {{ nsd.rootgroup }}
|
2021-04-01 23:00:17 +02:00
|
|
|
- makedirs: True
|
|
|
|
- template: jinja
|
|
|
|
- require:
|
|
|
|
- sls: {{ sls_package_install }}
|
2021-04-02 00:22:15 +02:00
|
|
|
- file: nsd-config-include-file-directory
|
2021-04-01 23:00:17 +02:00
|
|
|
- context:
|
2021-04-01 23:00:17 +02:00
|
|
|
nsd: {{ nsd | json }}
|
2021-04-02 00:22:15 +02:00
|
|
|
- check_cmd: nsd-checkconf
|
2023-02-17 00:07:24 +01:00
|
|
|
|
|
|
|
{%- set config_data = nsd.get('config_data', {}) %}
|
|
|
|
|
|
|
|
{%- if config_data | length > 0 %}
|
|
|
|
|
|
|
|
{{ config_file('10-salt', 'pillar-configuration') }}
|
|
|
|
|
|
|
|
{%- endif %}
|
|
|
|
|