Improove the logrotate state with the map

This commit is contained in:
Bogdan Radulescu 2016-01-07 20:54:10 +02:00 committed by Bogdan Rădulescu
parent d7b28dd4fb
commit ee1208d5c7
2 changed files with 8 additions and 4 deletions

View File

@ -1,8 +1,10 @@
/etc/logrotate.d/apache2:
{% from "apache/map.jinja" import apache with context %}
{{ apache.logrotatedir }}:
file:
- managed
- contents: |
/var/log/apache2/*.log {
{{ apache.logdir }}/*.log {
daily
missingok
rotate 14
@ -12,8 +14,8 @@
create 640 root adm
sharedscripts
postrotate
if /etc/init.d/apache2 status > /dev/null ; then \
/etc/init.d/apache2 reload > /dev/null; \
if /etc/init.d/{{ apache.service }} status > /dev/null ; then \
/etc/init.d/{{ apache.service }} reload > /dev/null; \
fi;
endscript
prerotate

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,
},