File: hourly.pp

package info (click to toggle)
puppet-module-rodjek-logrotate 1.1.1%2Bds1-5
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 224 kB
  • sloc: ruby: 906; sh: 22; makefile: 10
file content (45 lines) | stat: -rw-r--r-- 1,098 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# Internal: Configure a host for hourly logrotate jobs.
#
# ensure - The desired state of hourly logrotate support.  Valid values are
#          'absent' and 'present' (default: 'present').
#
# Examples
#
#   # Set up hourly logrotate jobs
#   include logrotate::hourly
#
#   # Remove hourly logrotate job support
#   class { 'logrotate::hourly':
#     ensure => absent,
#   }
class logrotate::hourly($ensure='present') {
  case $ensure {
    'absent': {
      $dir_ensure = $ensure
    }
    'present': {
      $dir_ensure = 'directory'
    }
    default: {
      fail("Class[Logrotate::Hourly]: Invalid ensure value '${ensure}'")
    }
  }

  file {
    '/etc/logrotate.d/hourly':
      ensure => $dir_ensure,
      owner  => 'root',
      group  => 'root',
      mode   => '0755';
    '/etc/cron.hourly/logrotate':
      ensure  => $ensure,
      owner   => 'root',
      group   => 'root',
      mode    => '0555',
      source  => 'puppet:///modules/logrotate/etc/cron.hourly/logrotate',
      require => [
        File['/etc/logrotate.d/hourly'],
        Package['logrotate'],
      ];
  }
}