![Andrey Nikitin](/assets/img/avatar_default.png)
Order and intendation of those parameters are changed to follow Puppet Style Guide recommendation [0]. Moreover, it will allow to an user to find much faster a variable in a list of variables. [0]. https://docs.puppetlabs.com/guides/style_guide.html Change-Id: If2443cbc57671784cfcb31bbe0ada0c09f78c996
38 lines
1.0 KiB
Puppet
38 lines
1.0 KiB
Puppet
# == Class: httpd::logrotate
|
|
#
|
|
class httpd::logrotate (
|
|
$firstaction = 'undef',
|
|
$lastaction = 'undef',
|
|
$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; \\",
|
|
],
|
|
) 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,
|
|
}
|
|
}
|