Merge "Add logrotate class to Apache"

This commit is contained in:
Jenkins 2015-09-22 19:17:49 +00:00 committed by Gerrit Code Review
commit f0d478b4f9
1 changed files with 39 additions and 0 deletions

39
manifests/logrotate.pp Normal file
View File

@ -0,0 +1,39 @@
# == Class: httpd::logrotate
#
class httpd::logrotate (
$options = [
'daily',
'missingok',
'rotate 30',
'compress',
'delaycompress',
'notifempty',
'create 640 root adm',
],
$prerotate = [
"if [ -d /etc/logrotate.d/${::httpd::params::apache_name}-prerotate ]; then \\",
" run-parts /etc/logrotate.d/${::httpd::params::apache_name}-prerotate; \\",
'fi; \\',
],
$postrotate = [
"if service ${::httpd::params::apache_name} status > /dev/null ; then \\",
" service ${::httpd::params::apache_name} reload > /dev/null; \\",
'fi; \\',
],
$firstaction = 'undef',
$lastaction = 'undef',
) inherits httpd::params {
include ::logrotate
$apache_logdir = "/var/log/${::httpd::params::apache_name}"
$logrotate_name = $::httpd::params::apache_name
::logrotate::file { $logrotate_name:
log => "${apache_logdir}/*.log",
options => $options,
prerotate => $prerotate,
postrotate => $postrotate,
firstaction => $firstaction,
lastaction => $lastaction,
}
}