Skip to content

Commit

Permalink
feat(ordering): optionally append includefiles to main config
Browse files Browse the repository at this point in the history
  • Loading branch information
noelmcloughlin committed Aug 18, 2021
1 parent 25cd2cf commit 751eff7
Show file tree
Hide file tree
Showing 29 changed files with 41 additions and 1 deletion.
2 changes: 1 addition & 1 deletion docs/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ Set up the sudoers file
``sudoers.included``
^^^^^^^^^^^^^^^^^^^^

Set up an additional sudoers included file
Set up an additional sudoers included file.


Testing
Expand Down
6 changes: 6 additions & 0 deletions pillar.example
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,9 @@ sudoers:
netgroups:
other_netgroup:
- 'ALL=(ALL) ALL'
# ordering is important. The sudoers manpage says when multiple
# entries match, the last match is used. However, if we do not
# manage the main config, our included files may not match last.
# To guarantee included files match last, set 'true' below to append
# each '#include <includefile>' to sudoers file.
append_included_files_to_endof_main_config: true
1 change: 1 addition & 0 deletions sudoers/defaults.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ sudoers:
execprefix: /usr/sbin
includedir: /etc/sudoers.d
included_files: {}
append_included_files_to_endof_main_config: false
5 changes: 5 additions & 0 deletions sudoers/included/init.sls
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# -*- coding: utf-8 -*-
# vim: ft=sls

include:
- .install
4 changes: 4 additions & 0 deletions sudoers/included.sls → sudoers/included/install.sls
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,9 @@ sudoers include {{ included_file }}:
- file: {{ sudoers.configpath }}/sudoers
- require_in:
- file: {{ sudoers.includedir }}
{% elif sudoers.append_included_files_to_endof_main_config %}
file.append:
- name: {{ sudoers.configpath }}/sudoers
- text: '#include {{ sudoers.configpath }}/sudoers.d/{{ included_file }}'
{% endif %}
{% endfor %}
1 change: 1 addition & 0 deletions test/integration/default/files/_mapdata/almalinux-8.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ values:
- millert
- dowdy
- mikef
append_included_files_to_endof_main_config: false
arch: amd64
configpath: /etc
defaults:
Expand Down
1 change: 1 addition & 0 deletions test/integration/default/files/_mapdata/amazonlinux-1.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ values:
- millert
- dowdy
- mikef
append_included_files_to_endof_main_config: false
arch: amd64
configpath: /etc
defaults:
Expand Down
1 change: 1 addition & 0 deletions test/integration/default/files/_mapdata/amazonlinux-2.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ values:
- millert
- dowdy
- mikef
append_included_files_to_endof_main_config: false
arch: amd64
configpath: /etc
defaults:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ values:
- millert
- dowdy
- mikef
append_included_files_to_endof_main_config: false
arch: amd64
configpath: /etc
defaults:
Expand Down
1 change: 1 addition & 0 deletions test/integration/default/files/_mapdata/centos-6.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ values:
- millert
- dowdy
- mikef
append_included_files_to_endof_main_config: false
arch: amd64
configpath: /etc
defaults:
Expand Down
1 change: 1 addition & 0 deletions test/integration/default/files/_mapdata/centos-7.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ values:
- millert
- dowdy
- mikef
append_included_files_to_endof_main_config: false
arch: amd64
configpath: /etc
defaults:
Expand Down
1 change: 1 addition & 0 deletions test/integration/default/files/_mapdata/centos-8.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ values:
- millert
- dowdy
- mikef
append_included_files_to_endof_main_config: false
arch: amd64
configpath: /etc
defaults:
Expand Down
1 change: 1 addition & 0 deletions test/integration/default/files/_mapdata/debian-10.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ values:
- millert
- dowdy
- mikef
append_included_files_to_endof_main_config: false
arch: amd64
configpath: /etc
defaults:
Expand Down
1 change: 1 addition & 0 deletions test/integration/default/files/_mapdata/debian-11.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ values:
- millert
- dowdy
- mikef
append_included_files_to_endof_main_config: false
arch: amd64
configpath: /etc
defaults:
Expand Down
1 change: 1 addition & 0 deletions test/integration/default/files/_mapdata/debian-9.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ values:
- millert
- dowdy
- mikef
append_included_files_to_endof_main_config: false
arch: amd64
configpath: /etc
defaults:
Expand Down
1 change: 1 addition & 0 deletions test/integration/default/files/_mapdata/fedora-31.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ values:
- millert
- dowdy
- mikef
append_included_files_to_endof_main_config: false
arch: amd64
configpath: /etc
defaults:
Expand Down
1 change: 1 addition & 0 deletions test/integration/default/files/_mapdata/fedora-32.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ values:
- millert
- dowdy
- mikef
append_included_files_to_endof_main_config: false
arch: amd64
configpath: /etc
defaults:
Expand Down
1 change: 1 addition & 0 deletions test/integration/default/files/_mapdata/fedora-33.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ values:
- millert
- dowdy
- mikef
append_included_files_to_endof_main_config: false
arch: amd64
configpath: /etc
defaults:
Expand Down
1 change: 1 addition & 0 deletions test/integration/default/files/_mapdata/fedora-34.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ values:
- millert
- dowdy
- mikef
append_included_files_to_endof_main_config: false
arch: amd64
configpath: /etc
defaults:
Expand Down
1 change: 1 addition & 0 deletions test/integration/default/files/_mapdata/gentoo-2-sysd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ values:
- millert
- dowdy
- mikef
append_included_files_to_endof_main_config: false
arch: amd64
configpath: /etc
defaults:
Expand Down
1 change: 1 addition & 0 deletions test/integration/default/files/_mapdata/gentoo-2-sysv.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ values:
- millert
- dowdy
- mikef
append_included_files_to_endof_main_config: false
arch: amd64
configpath: /etc
defaults:
Expand Down
1 change: 1 addition & 0 deletions test/integration/default/files/_mapdata/opensuse-15.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ values:
- millert
- dowdy
- mikef
append_included_files_to_endof_main_config: false
arch: amd64
configpath: /etc
defaults:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ values:
- millert
- dowdy
- mikef
append_included_files_to_endof_main_config: false
arch: amd64
configpath: /etc
defaults:
Expand Down
1 change: 1 addition & 0 deletions test/integration/default/files/_mapdata/oraclelinux-7.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ values:
- millert
- dowdy
- mikef
append_included_files_to_endof_main_config: false
arch: amd64
configpath: /etc
defaults:
Expand Down
1 change: 1 addition & 0 deletions test/integration/default/files/_mapdata/oraclelinux-8.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ values:
- millert
- dowdy
- mikef
append_included_files_to_endof_main_config: false
arch: amd64
configpath: /etc
defaults:
Expand Down
1 change: 1 addition & 0 deletions test/integration/default/files/_mapdata/rockylinux-8.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ values:
- millert
- dowdy
- mikef
append_included_files_to_endof_main_config: false
arch: amd64
configpath: /etc
defaults:
Expand Down
1 change: 1 addition & 0 deletions test/integration/default/files/_mapdata/ubuntu-16.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ values:
- millert
- dowdy
- mikef
append_included_files_to_endof_main_config: false
arch: amd64
configpath: /etc
defaults:
Expand Down
1 change: 1 addition & 0 deletions test/integration/default/files/_mapdata/ubuntu-18.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ values:
- millert
- dowdy
- mikef
append_included_files_to_endof_main_config: false
arch: amd64
configpath: /etc
defaults:
Expand Down
1 change: 1 addition & 0 deletions test/integration/default/files/_mapdata/ubuntu-20.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ values:
- millert
- dowdy
- mikef
append_included_files_to_endof_main_config: false
arch: amd64
configpath: /etc
defaults:
Expand Down

0 comments on commit 751eff7

Please sign in to comment.