salt.master: manage extension modules

Signed-off-by: Georg Pfuetzenreuter <mail@georg-pfuetzenreuter.net>
This commit is contained in:
Georg Pfuetzenreuter 2023-01-22 14:29:19 +01:00
parent 689eb5c676
commit 928809b267
Signed by: Georg
GPG Key ID: 1ED2F138E7E6FF57
2 changed files with 34 additions and 2 deletions

View File

@ -2,9 +2,12 @@ salt:
gpg_keydir: ${'secret_salt:master:gpg_keydir'}
interface: ${'secret_salt:master:interface'}
master_remove_config: True
extmods: {'modules': ['nbroles.py'], 'pillar': ['lookup.py']}
master:
cache: redis
cli_summary: True
# to-do: package extension modules
extension_modules: /opt/extmods
ipv6: True
file_ignore_glob:
- '*.pyc'
@ -38,7 +41,7 @@ salt:
- root: ${'secret_salt:master:ext_pillar:git:Lysergic:root'}
- user: ${'secret_salt:master:ext_pillar:git:Lysergic:user'}
- password: ${'secret_salt:master:ext_pillar:git:Lysergic:password'}
- lookup:
- lookup: {}
ext_pillar_first: True
pillar_merge_lists: True
pillar_source_merging_strategy: smart

View File

@ -1,10 +1,39 @@
{%- set master_pillar = pillar['salt']['master'] -%}
{%- set salt_pillar = pillar['salt'] -%}
{%- set master_pillar = salt_pillar['master'] -%}
{%- set redis_config = '/etc/redis/salt.conf' -%}
{%- set redis_service = 'redis@salt' -%}
{%- set extmods = salt_pillar['extmods'] -%}
{%- set extmoddir = master_pillar['extension_modules'] -%}
include:
- salt.master
salt_master_extension_modules_dirs:
file.directory:
- names:
- {{ extmoddir }}
{%- for modtype in extmods %}
- {{ extmoddir }}/{{ modtype }}
{%- endfor %}
- user: root
- group: salt
- mode: 0755
salt_master_extension_modules_bins:
file.managed:
- names:
{%- for modtype, modnames in extmods.items() %}
{%- for modname in modnames %}
- {{ extmoddir }}/{{ modtype }}/{{ modname }}:
- source: salt://extmods/{{ modtype }}/{{ modname }}
{%- endfor %}
{%- endfor %}
- user: root
- group: salt
- mode: 0640
- require:
- file: salt_master_extension_modules_dirs
salt_master_extra_packages:
pkg.installed:
- names: