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: file:
- managed - managed
- contents: | - contents: |
/var/log/apache2/*.log { {{ apache.logdir }}/*.log {
daily daily
missingok missingok
rotate 14 rotate 14
@ -12,8 +14,8 @@
create 640 root adm create 640 root adm
sharedscripts sharedscripts
postrotate postrotate
if /etc/init.d/apache2 status > /dev/null ; then \ if /etc/init.d/{{ apache.service }} status > /dev/null ; then \
/etc/init.d/apache2 reload > /dev/null; \ /etc/init.d/{{ apache.service }} reload > /dev/null; \
fi; fi;
endscript endscript
prerotate prerotate

View File

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