puppet-logrotate/manifests/file.pp
Andrey Nikitin 1f6efd534c Order of the class parameters is refactored
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: I4dd4727f94132ce066d42aa87a246dd39c13553e
2016-03-21 13:09:04 +03:00

31 lines
709 B
Puppet

# == Define: logrotate::file
#
define logrotate::file (
$log,
$options,
$ensure = present,
$firstaction = 'undef',
$lastaction = 'undef',
$postrotate = 'undef',
$prerotate = 'undef',
) {
# $options should be an array containing 1 or more logrotate
# directives (e.g. missingok, compress).
validate_string($options[0])
include ::logrotate
# This allows us to handle fully pathed files
$escaped_path = regsubst($name, '/', '_', 'G')
file { "/etc/logrotate.d/${escaped_path}":
ensure => $ensure,
owner => 'root',
group => 'root',
mode => '0644',
content => template('logrotate/config.erb'),
require => File['/etc/logrotate.d'],
}
}