Merge pull request #107 from cloud-hero/master

Added state for configuring logrotate
This commit is contained in:
puneet kandhari 2016-01-07 13:33:27 -06:00
commit e10b2f59d1
2 changed files with 28 additions and 0 deletions

26
apache/logrotate.sls Normal file
View File

@ -0,0 +1,26 @@
{% from "apache/map.jinja" import apache with context %}
{{ apache.logrotatedir }}:
file:
- managed
- contents: |
{{ apache.logdir }}/*.log {
daily
missingok
rotate 14
compress
delaycompress
notifempty
create 640 root adm
sharedscripts
postrotate
if /etc/init.d/{{ apache.service }} status > /dev/null ; then \
/etc/init.d/{{ apache.service }} reload > /dev/null; \
fi;
endscript
prerotate
if [ -d /etc/logrotate.d/httpd-prerotate ]; then \
run-parts /etc/logrotate.d/httpd-prerotate; \
fi; \
endscript
}

View File

@ -17,6 +17,7 @@
'default_site': 'default',
'default_site_ssl': 'default-ssl',
'logdir': '/var/log/apache2',
'logrotatedir': '/etc/logrotate.d/apache2',
'wwwdir': '/srv',
'use_require': False,
},
@ -35,6 +36,7 @@
'default_site': 'default',
'default_site_ssl': 'default-ssl',
'logdir': '/var/log/httpd',
'logrotatedir': '/etc/logrotate.d/httpd',
'wwwdir': '/var/www',
'use_require': False,
},