Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions provisioning/roles/common/files/logrotate-apache
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/var/log/apache2/*.log {
size 100M
missingok
rotate 10
compress
delaycompress
notifempty
create 640 root adm
sharedscripts
postrotate
/etc/init.d/apache2 reload > /dev/null
endscript
prerotate
if [ -d /etc/logrotate.d/httpd-prerotate ]; then \
run-parts /etc/logrotate.d/httpd-prerotate; \
fi; \
endscript
}
11 changes: 11 additions & 0 deletions provisioning/roles/common/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,17 @@
with_items: lamp_packages
sudo: yes

- name: Configure apache log rotation
copy: src=logrotate-apache dest=/etc/logrotate.d/apache2 owner=root group=root mode=644
sudo: yes

- name: Ensure logrotate runs hourly
command: mv /etc/cron.daily/logrotate /etc/cron.hourly/logrotate
args:
creates: /etc/cron.hourly/logrotate
removes: /etc/cron.daily/logrotate
sudo: yes

- name: Install PHP packages
apt: pkg={{item}}
with_items: php_packages
Expand Down