From a0c114f90c7e336539733859a6eb04e9e04ac33f Mon Sep 17 00:00:00 2001 From: Matt Birkholz Date: Sun, 11 Jan 2026 14:55:09 -0700 Subject: [PATCH] Fix the editing of /etc/logrotate.d/apache2. --- README.org | 6 ++++-- roles_t/abbey-front/tasks/main.yml | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/README.org b/README.org index 63bcb59..28f9af1 100644 --- a/README.org +++ b/README.org @@ -553,8 +553,10 @@ The replacement =logrotate-mailer= does, and includes it in a path: /etc/logrotate.d/apache2 regexp: "{{ item.regexp }}" line: "{{ item.line }}" + insertbefore: "^ *}" loop: - - { regexp: '^ *daily', line: "\tweekly" } + - regexp: '^ *(hourly|daily|weekly|monthly|yearly)' + line: "\tweekly" - { regexp: '^ *rotate', line: "\trotate 2" } - name: Configure Apache log email. @@ -563,7 +565,7 @@ The replacement =logrotate-mailer= does, and includes it in a path: /etc/logrotate.d/apache2 regexp: "{{ item.regexp }}" line: "{{ item.line }}" - insertbefore: " *}" + insertbefore: "^ *}" firstmatch: yes loop: - { regexp: "^\tmail ", line: "\tmail webmaster" } diff --git a/roles_t/abbey-front/tasks/main.yml b/roles_t/abbey-front/tasks/main.yml index 2615f65..1f66749 100644 --- a/roles_t/abbey-front/tasks/main.yml +++ b/roles_t/abbey-front/tasks/main.yml @@ -169,8 +169,10 @@ path: /etc/logrotate.d/apache2 regexp: "{{ item.regexp }}" line: "{{ item.line }}" + insertbefore: "^ *}" loop: - - { regexp: '^ *daily', line: "\tweekly" } + - regexp: '^ *(hourly|daily|weekly|monthly|yearly)' + line: "\tweekly" - { regexp: '^ *rotate', line: "\trotate 2" } - name: Configure Apache log email. @@ -179,7 +181,7 @@ path: /etc/logrotate.d/apache2 regexp: "{{ item.regexp }}" line: "{{ item.line }}" - insertbefore: " *}" + insertbefore: "^ *}" firstmatch: yes loop: - { regexp: "^\tmail ", line: "\tmail webmaster" } -- 2.47.3