1
0
Fork 0
mirror of synced 2024-12-21 21:51:09 -05:00

Merge pull request #46 from netzvieh/main_sudoers_optional

Make management of the main sudoers config optional
This commit is contained in:
Niels Abspoel 2018-10-27 23:43:00 +02:00 committed by GitHub
commit 398398f793
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 15 additions and 0 deletions

View file

@ -1,4 +1,6 @@
sudoers:
# By default the main sudoers file is managed by this formula (False to skip)
manage_main_config: True
users:
johndoe:
- 'ALL=(ALL) ALL'

View file

@ -23,6 +23,8 @@ sudoers include {{ included_file }}:
- context:
included: True
sudoers: {{ spec|json }}
{% if salt['pillar.get']('sudoers:manage_main_config', True) %}
- require:
- file: {{ sudoers.get('configpath', '/etc') }}/sudoers
{% endif %}
{% endfor %}

View file

@ -4,6 +4,8 @@ sudo:
pkg.installed:
- name: {{ sudoers.pkg }}
{% if salt['pillar.get']('sudoers:manage_main_config', True) %}
{{ sudoers.get('configpath', '/etc') }}/sudoers:
file.managed:
- user: root
@ -16,3 +18,12 @@ sudo:
included: False
- require:
- pkg: sudo
{% else %}
{{ sudoers.get('configpath', '/etc') }}/sudoers:
test.show_notification:
- name: Skipping management of main sudoers file
- text: Pillar manage_main_config is False
{% endif %}