0
0
mirror of https://github.com/saltstack-formulas/sudoers-formula.git synced 2024-12-18 08:22:54 +01:00
sudoers-formula/sudoers/included.sls

43 lines
1.1 KiB
Plaintext
Raw Normal View History

2020-08-24 17:26:54 +02:00
# -*- coding: utf-8 -*-
# vim: ft=sls
{#- Get the `tplroot` from `tpldir` #}
{%- set tplroot = tpldir.split('/')[0] %}
{%- set sls_config_file = tplroot ~ '.config.file' %}
{%- from tplroot ~ "/map.jinja" import sudoers with context %}
2014-10-02 09:29:40 +02:00
include:
- sudoers
{{ sudoers.includedir }}:
file.directory:
- user: root
- group: {{ sudoers.group }}
- mode: 750
- clean: {{ sudoers.purge_includedir }}
2020-08-24 17:26:54 +02:00
{% set included_files = sudoers.included_files %}
{% for included_file, spec in included_files.items() -%}
sudoers include {{ included_file }}:
file.managed:
{% if '/' in included_file %}
- name: {{ included_file }}
{% else %}
2020-08-24 17:26:54 +02:00
- name: {{ sudoers.includedir }}/{{ included_file }}
{% endif %}
- user: root
2020-08-24 17:26:54 +02:00
- group: {{ sudoers.group }}
- mode: 440
- makedirs: True
- template: jinja
- source: salt://sudoers/files/sudoers
2020-08-24 17:26:54 +02:00
- check_cmd: {{ sudoers.execprefix }}/visudo -c -f
- context:
included: True
2015-01-09 16:14:09 +01:00
sudoers: {{ spec|json }}
2020-08-24 17:26:54 +02:00
{% if sudoers.manage_main_config %}
- require:
2020-08-24 17:26:54 +02:00
- file: {{ sudoers.configpath }}/sudoers
{% endif %}
{% endfor %}