]> git.phdru.name Git - ansible.git/commitdiff
Feat(apache): Configure logrotate
authorOleg Broytman <phd@phdru.name>
Thu, 25 Jul 2019 23:46:28 +0000 (02:46 +0300)
committerOleg Broytman <phd@phdru.name>
Thu, 25 Jul 2019 23:46:28 +0000 (02:46 +0300)
playbooks/debian/roles/apache/files/apache2 [new file with mode: 0644]
playbooks/debian/roles/apache/tasks/main.yml

diff --git a/playbooks/debian/roles/apache/files/apache2 b/playbooks/debian/roles/apache/files/apache2
new file mode 100644 (file)
index 0000000..6f97ef6
--- /dev/null
@@ -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
+}
index 1c6bd2f7848262a3ac5f25e126ad9caa08d39516..f0481d91e1c0a80fcef3672125f20fc8d3602edd 100644 (file)
   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'