From 6e4c84719637aecdb4c5a8160a17fe66dd03b037 Mon Sep 17 00:00:00 2001 From: William Marshall <62070150+marshallwp@users.noreply.github.com> Date: Fri, 17 Oct 2025 15:45:33 -0500 Subject: [PATCH 1/2] fix(logrotate): handler no longer fails if all errors are about skipping rotation The print logrotate error handler no longer fails if *all* errors are about rotation failing due to preexisting log files. If any of the errors are about something else, failure will occur as usual. This resolves #913 --- handlers/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/handlers/main.yml b/handlers/main.yml index 20fd6e924..46a1ca208 100644 --- a/handlers/main.yml +++ b/handlers/main.yml @@ -59,7 +59,7 @@ - name: (Handler) Print logrotate error if config check fails ansible.builtin.debug: - var: logrotate_check['stderr_lines'] + var: logrotate_check['stderr_lines'] and logrotate_check['stderr_lines'] | select('search','already exists, skipping rotation$') != logrotate_check['stderr_lines'] failed_when: logrotate_check['rc'] != 0 when: - logrotate_check['stderr_lines'] is defined From f05a43ebb3d8f07e7ddd8130881359d139788cdf Mon Sep 17 00:00:00 2001 From: William Marshall <62070150+marshallwp@users.noreply.github.com> Date: Fri, 17 Oct 2025 16:03:25 -0500 Subject: [PATCH 2/2] fix(logrotate): fix added to the wrong line Moved the edit down one line to the `failed_when` line. --- handlers/main.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/handlers/main.yml b/handlers/main.yml index 46a1ca208..6a80c94fe 100644 --- a/handlers/main.yml +++ b/handlers/main.yml @@ -59,8 +59,8 @@ - name: (Handler) Print logrotate error if config check fails ansible.builtin.debug: - var: logrotate_check['stderr_lines'] and logrotate_check['stderr_lines'] | select('search','already exists, skipping rotation$') != logrotate_check['stderr_lines'] - failed_when: logrotate_check['rc'] != 0 + var: logrotate_check['stderr_lines'] + failed_when: logrotate_check['rc'] != 0 and logrotate_check['stderr_lines'] | select('search','already exists, skipping rotation$') != logrotate_check['stderr_lines'] when: - logrotate_check['stderr_lines'] is defined - logrotate_check['stderr_lines'] != []