| 1 |
# Internal: Configure a host for hourly logrotate jobs. |
| 2 |
# |
| 3 |
# ensure - The desired state of hourly logrotate support. Valid values are |
| 4 |
# 'absent' and 'present' (default: 'present'). |
| 5 |
# |
| 6 |
# Examples |
| 7 |
# |
| 8 |
# # Set up hourly logrotate jobs |
| 9 |
# include logrotate::hourly |
| 10 |
# |
| 11 |
# # Remove hourly logrotate job support |
| 12 |
# class { 'logrotate::hourly': |
| 13 |
# ensure => absent, |
| 14 |
# } |
| 15 |
class logrotate::hourly($ensure='present') { |
| 16 |
case $ensure { |
| 17 |
'absent': { |
| 18 |
$dir_ensure = $ensure |
| 19 |
} |
| 20 |
'present': { |
| 21 |
$dir_ensure = 'directory' |
| 22 |
} |
| 23 |
default: { |
| 24 |
fail("Class[Logrotate::Hourly]: Invalid ensure value '${ensure}'") |
| 25 |
} |
| 26 |
} |
| 27 |
|
| 28 |
file { |
| 29 |
'/etc/logrotate.d/hourly': |
| 30 |
ensure => $dir_ensure, |
| 31 |
owner => 'root', |
| 32 |
group => 'root', |
| 33 |
mode => '0755'; |
| 34 |
'/etc/cron.hourly/logrotate': |
| 35 |
ensure => $ensure, |
| 36 |
owner => 'root', |
| 37 |
group => 'root', |
| 38 |
mode => '0555', |
| 39 |
source => 'puppet:///modules/logrotate/etc/cron.hourly/logrotate', |
| 40 |
require => [ |
| 41 |
File['/etc/logrotate.d/hourly'], |
| 42 |
Package['logrotate'], |
| 43 |
]; |
| 44 |
} |
| 45 |
} |