From d03a23530d979251e1009f4e642aef8168fba450 Mon Sep 17 00:00:00 2001 From: clime Date: Mon, 18 Dec 2017 13:02:40 +0100 Subject: [PATCH] copr-backend: update logrotate config for lighttpd --- roles/copr/backend/tasks/main.yml | 6 +++--- .../logrotate/lighttpd => templates/logrotate/lighttpd.j2} | 6 +++++- 2 files changed, 8 insertions(+), 4 deletions(-) rename roles/copr/backend/{files/logrotate/lighttpd => templates/logrotate/lighttpd.j2} (60%) diff --git a/roles/copr/backend/tasks/main.yml b/roles/copr/backend/tasks/main.yml index 8d6c5a884b..cfbc8174da 100644 --- a/roles/copr/backend/tasks/main.yml +++ b/roles/copr/backend/tasks/main.yml @@ -105,6 +105,9 @@ - name: install custom lighttpd template for directory listings template: src="lighttpd/dir-generator.php.j2" dest="/var/lib/copr/public_html/dir-generator.php" owner=copr group=copr mode=0755 +- name: install custom logrotate config for lighttpd + template: src="logrotate/lighttpd.j2" dest=/etc/logrotate.d/lighttpd owner=root group=root mode=644 + - name: start webserver service: state=started enabled=yes name=lighttpd @@ -186,9 +189,6 @@ - copy: src="cleanup_vms.sh" dest=/etc/cron.hourly/copr_cleanup_vms.sh mode=755 when: not devel -- name: install lighttpd logrotate config - copy: src="logrotate/lighttpd" dest=/etc/logrotate.d/lighttpd owner=root group=root mode=644 - - name: setup monitoring import_tasks: "monitoring.yml" diff --git a/roles/copr/backend/files/logrotate/lighttpd b/roles/copr/backend/templates/logrotate/lighttpd.j2 similarity index 60% rename from roles/copr/backend/files/logrotate/lighttpd rename to roles/copr/backend/templates/logrotate/lighttpd.j2 index fc77db2c89..9e5dc6477f 100644 --- a/roles/copr/backend/files/logrotate/lighttpd +++ b/roles/copr/backend/templates/logrotate/lighttpd.j2 @@ -4,7 +4,11 @@ missingok notifempty prerotate - /usr/bin/copr_log_hitcounter.py /var/log/lighttpd/access.log &>/var/log/copr-backend/hitcounter-logrotate.log +{% if devel %} + /usr/bin/copr_log_hitcounter.py /var/log/lighttpd/access.log --ignore-subnet 172.25.144.0/20 &>/var/log/copr-backend/hitcounter-logrotate.log +{% else %} + /usr/bin/copr_log_hitcounter.py /var/log/lighttpd/access.log --ignore-subnet 172.25.80.0/20 &>/var/log/copr-backend/hitcounter-logrotate.log +{% endif %} endscript postrotate /usr/bin/killall -HUP lighttpd &>/dev/null || :