From: Oleg Broytman Date: Thu, 25 Jul 2019 23:46:28 +0000 (+0300) Subject: Feat(apache): Configure logrotate X-Git-Url: https://git.phdru.name/?a=commitdiff_plain;h=9801f9b6a2732043a4643d02554defdd474ce63e;hp=abc22b217f6839eed28281b95b25e035e3b99579;p=ansible.git Feat(apache): Configure logrotate --- 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'