mirror of
https://github.com/saltstack-formulas/sudoers-formula.git
synced 2024-11-28 02:57:52 +01:00
b925a00048
Add "makedirs: True" to the included.sls file as suggested by @tjuup
32 lines
1003 B
Plaintext
32 lines
1003 B
Plaintext
{% from "sudoers/map.jinja" import sudoers with context %}
|
|
|
|
include:
|
|
- sudoers
|
|
|
|
{% do sudoers.update(pillar.get('sudoers', {})) %}
|
|
{% set includedir = sudoers.get('includedir', '/etc/sudoers.d') %}
|
|
{% set included_files = sudoers.get('included_files', {}) %}
|
|
{% for included_file,spec in included_files.items() -%}
|
|
sudoers include {{ included_file }}:
|
|
file.managed:
|
|
{% if '/' in included_file %}
|
|
- name: {{ included_file }}
|
|
{% else %}
|
|
- name: {{ includedir }}/{{ included_file }}
|
|
{% endif %}
|
|
- user: root
|
|
- group: {{ sudoers.get('group', 'root') }}
|
|
- mode: 440
|
|
- makedirs: True
|
|
- template: jinja
|
|
- source: salt://sudoers/files/sudoers
|
|
- check_cmd: {{ sudoers.get('execprefix', '/usr/sbin') }}/visudo -c -f
|
|
- context:
|
|
included: True
|
|
sudoers: {{ spec|json }}
|
|
{% if salt['pillar.get']('sudoers:manage_main_config', True) %}
|
|
- require:
|
|
- file: {{ sudoers.get('configpath', '/etc') }}/sudoers
|
|
{% endif %}
|
|
{% endfor %}
|