Skip to content

Commit

Permalink
xyz
Browse files Browse the repository at this point in the history
Signed-off-by: Radovan Sroka <[email protected]>
  • Loading branch information
radosroka committed May 16, 2024
1 parent 273f61d commit 4cbb7ca
Showing 1 changed file with 6 additions and 11 deletions.
17 changes: 6 additions & 11 deletions tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@

- name: Set include directories variable
set_fact:
sudo_include_dirs: {{ sudo_sudoers_files
sudo_include_dirs: "{{ sudo_sudoers_files
| selectattr('include_directories', 'defined')
| map(attribute='include_directories') | flatten }}
| map(attribute='include_directories') | flatten }}"

- name: Set sudoer file paths variable
set_fact:
sudo_file_paths: {{ sudo_sudoers_files
sudo_file_paths: "{{ sudo_sudoers_files
| selectattr('path', 'defined')
| map(attribute='path') | flatten }}
| map(attribute='path') | flatten }}"

- name: Ensure include directories are created
file:
Expand Down Expand Up @@ -71,14 +71,9 @@

- name: Set unauthorized included sudoers files variable
set_fact:
sudo_unauthorized_files: {{ sudo_existing_included_files['files']
sudo_unauthorized_files: "{{ sudo_existing_included_files['files']
| selectattr('path', 'defined') | map(attribute='path')
| flatten | difference(sudo_file_paths) }}

- name: Display unauthorized sudoers include files to be removed
debug:
var: sudo_unauthorized_files
verbosity: 1
| flatten | difference(sudo_file_paths) }}"

- name: Remove unauthorized included sudoers files
file:
Expand Down

0 comments on commit 4cbb7ca

Please sign in to comment.