1
0
Fork 0
mirror of synced 2024-11-14 04:48:57 -05:00
formula-sudoers/sudoers/included/install.sls

55 lines
1.4 KiB
Text
Raw Normal View History

2020-08-24 11:26:54 -04: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 03:29:40 -04:00
include:
- sudoers
{{ sudoers.includedir }}:
file.directory:
- user: root
- group: {{ sudoers.group }}
- mode: 750
- clean: {{ sudoers.purge_includedir }}
2020-08-24 11:26:54 -04:00
{% set included_files = sudoers.included_files %}
{% for included_file, spec in included_files.items() -%}
2021-08-18 19:52:57 -04:00
{%- if '/' not in included_file %}
{%- set included_file = sudoers.includedir ~ '/' ~ included_file %}
{%- endif %}
sudoers include {{ included_file }}:
file.managed:
- name: {{ included_file }}
- user: root
2020-08-24 11:26:54 -04:00
- group: {{ sudoers.group }}
- mode: 440
- makedirs: True
- template: jinja
- source: salt://sudoers/files/sudoers
2020-08-24 11:26:54 -04:00
- check_cmd: {{ sudoers.execprefix }}/visudo -c -f
- context:
included: True
2015-01-09 10:14:09 -05:00
sudoers: {{ spec|json }}
2020-08-24 11:26:54 -04:00
{% if sudoers.manage_main_config %}
- require:
2020-08-24 11:26:54 -04:00
- file: {{ sudoers.configpath }}/sudoers
- require_in:
- file: {{ sudoers.includedir }}
2021-08-18 19:52:57 -04:00
{% elif sudoers.append_included_files_to_endof_main_config %}
2021-08-18 19:52:57 -04:00
sudoers append {{ included_file }}:
file.append:
- name: {{ sudoers.configpath }}/sudoers
2021-08-18 19:52:57 -04:00
- text: '#include {{ included_file }}'
- require:
- file: sudoers include {{ included_file }}
{% endif %}
2021-08-18 19:52:57 -04:00
{% endfor %}