Merge pull request #39 from jasonvoor/master

added includedir as variable (mostly for FreeBSD)
This commit is contained in:
N 2018-03-07 00:01:57 +00:00 committed by GitHub
commit 1a46975212
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 1 deletions

View File

@ -45,6 +45,7 @@ sudoers:
users:
foo:
- 'ALL=(ALL) ALL'
extra-file-2:
groups:
bargroup:
- 'ALL=(ALL) NOPASSWD: ALL'

View File

@ -4,10 +4,16 @@ 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() -%}
{{ included_file }}:
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

View File

@ -11,6 +11,7 @@
'Suse': {'pkg': 'sudo'},
'FreeBSD': {'pkg': 'sudo',
'configpath': '/usr/local/etc',
'includedir': '/usr/local/etc/sudoers.d',
'execprefix': '/usr/local/sbin',
'group': 'wheel'},
}, merge=salt['pillar.get']('sudoers:lookup')) %}