From: Matt Birkholz Date: Sun, 11 Jan 2026 21:55:09 +0000 (-0700) Subject: Fix the editing of /etc/logrotate.d/apache2. X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=a0c114f90c7e336539733859a6eb04e9e04ac33f;p=Network.git Fix the editing of /etc/logrotate.d/apache2. --- 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" }