feat: implement option to purge included files directory

This commit is contained in:
Eric Veiras Galisson 2020-08-24 17:58:35 +02:00
parent 153ac6ea48
commit c5acbc696a
3 changed files with 10 additions and 0 deletions

View File

@ -4,6 +4,8 @@
sudoers: sudoers:
# By default the main sudoers file is managed by this formula (False to skip) # By default the main sudoers file is managed by this formula (False to skip)
manage_main_config: true manage_main_config: true
# By default the included directory is not purged from unwanted files
purge_includedir: false
users: users:
johndoe: johndoe:
- 'ALL=(ALL) ALL' - 'ALL=(ALL) ALL'

View File

@ -4,6 +4,7 @@
sudoers: sudoers:
pkg: sudo pkg: sudo
manage_main_config: true manage_main_config: true
purge_includedir: false
configpath: /etc configpath: /etc
group: root group: root
execprefix: /usr/sbin execprefix: /usr/sbin

View File

@ -9,6 +9,13 @@
include: include:
- sudoers - sudoers
{{ sudoers.includedir }}:
file.directory:
- user: root
- group: {{ sudoers.group }}
- mode: 440
- clean: {{ sudoers.purge_includedir }}
{% set included_files = sudoers.included_files %} {% set included_files = sudoers.included_files %}
{% for included_file, spec in included_files.items() -%} {% for included_file, spec in included_files.items() -%}
sudoers include {{ included_file }}: sudoers include {{ included_file }}: