Browse Source

Merge pull request #107 from cloud-hero/master

Added state for configuring logrotate
master
puneet kandhari 9 years ago
parent
commit
e10b2f59d1
2 changed files with 28 additions and 0 deletions
  1. +26
    -0
      apache/logrotate.sls
  2. +2
    -0
      apache/map.jinja

+ 26
- 0
apache/logrotate.sls 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
}

+ 2
- 0
apache/map.jinja 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,
},

Loading…
Cancel
Save