Skip to content

Commit

Permalink
feat: implement option to purge included files directory
Browse files Browse the repository at this point in the history
  • Loading branch information
daks committed Nov 24, 2020
1 parent 153ac6e commit c5acbc6
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
2 changes: 2 additions & 0 deletions pillar.example
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
sudoers:
# By default the main sudoers file is managed by this formula (False to skip)
manage_main_config: true
# By default the included directory is not purged from unwanted files
purge_includedir: false
users:
johndoe:
- 'ALL=(ALL) ALL'
Expand Down
1 change: 1 addition & 0 deletions sudoers/defaults.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
sudoers:
pkg: sudo
manage_main_config: true
purge_includedir: false
configpath: /etc
group: root
execprefix: /usr/sbin
Expand Down
7 changes: 7 additions & 0 deletions sudoers/included.sls
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,13 @@
include:
- sudoers
{{ sudoers.includedir }}:
file.directory:
- user: root
- group: {{ sudoers.group }}
- mode: 440
- clean: {{ sudoers.purge_includedir }}
{% set included_files = sudoers.included_files %}
{% for included_file, spec in included_files.items() -%}
sudoers include {{ included_file }}:
Expand Down

0 comments on commit c5acbc6

Please sign in to comment.