From 14e8bf39685f043889a04fc62d3e657bb8ec26c4 Mon Sep 17 00:00:00 2001 From: Lars Vogdt Date: Aug 09 2021 08:57:30 +0000 Subject: Merge branch 'disable_logrotate_for_wiki' into 'production' Disable duplicate entry errors in logrotate See merge request infra/salt!494 --- diff --git a/salt/profile/countdown/apache.sls b/salt/profile/countdown/apache.sls index 062acc6..367ce9c 100644 --- a/salt/profile/countdown/apache.sls +++ b/salt/profile/countdown/apache.sls @@ -22,7 +22,14 @@ sysconfig_apache2_countdown: - listen_in: - service: apache2 + + +# This is handled in /etc/logrotate.d/apache2 since Leap 15.x (same/duplicate entry there) +# removing the file on newer Leap versions to avoid errors in logrotate (duplicate entry...) /etc/logrotate.d/apache2-vhosts: +{% if salt['grains.get']('osfullname') == "Leap" and salt['grains.get']('osmajorrelease')|int >= 15 %} + file.absent +{% else %} file.managed: - # same file as used for the wikis, no need to duplicate it - source: salt://profile/wiki/files/apache2-wiki.logrotate +{% endif %} diff --git a/salt/profile/wiki/apache.sls b/salt/profile/wiki/apache.sls index b00cade..38fba05 100644 --- a/salt/profile/wiki/apache.sls +++ b/salt/profile/wiki/apache.sls @@ -26,6 +26,12 @@ apache2_running: - listen_in: - service: apache2 +# This is handled in /etc/logrotate.d/apache2 since Leap 15.x (same/duplicate entry there) +# removing the file on newer Leap versions to avoid errors in logrotate (duplicate entry...) /etc/logrotate.d/apache2-wiki: +{% if salt['grains.get']('osfullname') == "Leap" and salt['grains.get']('osmajorrelease')|int >= 15 %} + file.absent +{% else %} file.managed: - source: salt://profile/wiki/files/apache2-wiki.logrotate +{% endif %} diff --git a/salt/profile/wiki/files/apache2-wiki.logrotate b/salt/profile/wiki/files/apache2-wiki.logrotate index 0f95953..77e9011 100644 --- a/salt/profile/wiki/files/apache2-wiki.logrotate +++ b/salt/profile/wiki/files/apache2-wiki.logrotate @@ -1,15 +1,21 @@ -/var/log/apache2/*-access_log { - compress - dateext - maxage 365 - rotate 99 - size=+4096k - notifempty - missingok - create 644 root root - sharedscripts - postrotate - systemctl reload apache2.service - sleep 60 - endscript -} +# +# This is handled in /etc/logrotate.d/apache2 +# since Leap 15.2 (same/duplicate entry there) +# disabling here for reference and to avoid +# errors in logrotate (duplicate entry...) +# +#/var/log/apache2/*-access_log { +# compress +# dateext +# maxage 365 +# rotate 99 +# size=+4096k +# notifempty +# missingok +# create 644 root root +# sharedscripts +# postrotate +# systemctl reload apache2.service +# sleep 60 +# endscript +#}