From 9801f9b6a2732043a4643d02554defdd474ce63e Mon Sep 17 00:00:00 2001 From: Oleg Broytman Date: Fri, 26 Jul 2019 02:46:28 +0300 Subject: [PATCH] Feat(apache): Configure logrotate --- playbooks/debian/roles/apache/files/apache2 | 22 ++++++++++++++++++++ playbooks/debian/roles/apache/tasks/main.yml | 9 ++++++++ 2 files changed, 31 insertions(+) create mode 100644 playbooks/debian/roles/apache/files/apache2 diff --git a/playbooks/debian/roles/apache/files/apache2 b/playbooks/debian/roles/apache/files/apache2 new file mode 100644 index 0000000..6f97ef6 --- /dev/null +++ b/playbooks/debian/roles/apache/files/apache2 @@ -0,0 +1,22 @@ +/var/log/apache2/*.log +/var/log/apache2/*/*.log +{ + daily + missingok + rotate 14 + compress + delaycompress + notifempty + create 640 root adm + sharedscripts + postrotate + if invoke-rc.d apache2 status > /dev/null 2>&1; then \ + invoke-rc.d apache2 reload > /dev/null 2>&1; \ + fi; + endscript + prerotate + if [ -d /etc/logrotate.d/httpd-prerotate ]; then \ + run-parts /etc/logrotate.d/httpd-prerotate; \ + fi; \ + endscript +} diff --git a/playbooks/debian/roles/apache/tasks/main.yml b/playbooks/debian/roles/apache/tasks/main.yml index 1c6bd2f..f0481d9 100644 --- a/playbooks/debian/roles/apache/tasks/main.yml +++ b/playbooks/debian/roles/apache/tasks/main.yml @@ -42,3 +42,12 @@ command: a2enconf 001-phd notify: Reload apache when: apache.rc != 0 + +- name: Configure logrotate + become: true + copy: + src: apache2 + dest: /etc/logrotate.d + owner: root + group: root + mode: '0640' -- 2.39.2