From 4cbb7ca382f3d329aab21e5fdeec7d099eb660ea Mon Sep 17 00:00:00 2001 From: Radovan Sroka Date: Thu, 16 May 2024 16:38:42 +0200 Subject: [PATCH] xyz Signed-off-by: Radovan Sroka --- tasks/main.yml | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/tasks/main.yml b/tasks/main.yml index 49d46f7..b799de8 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -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: @@ -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: