Puppet Class: lsys::cron::cronjobs_directory

Defined in:
manifests/cron/cronjobs_directory.pp

Summary

A short summary of the purpose of this class

Overview

A description of what this class does

Examples:

include lsys::cron::cronjobs_directory

Parameters:

  • manage (Boolean) (defaults to: true)

    Whether to manage cron jobs directories or not

  • items (Array[Stdlib::Unixpath]) (defaults to: [ '/etc/cron.d', '/etc/cron.hourly', '/etc/cron.daily', '/etc/cron.weekly', '/etc/cron.monthly', ])

    Whether to mange cron jobs directories which are /etc/cron.d /etc/cron.hourly, /etc/cron.daily, /etc/cron.weekly are /etc/cron.monthly

  • mode (String) (defaults to: '0750')

    Directory mode for cron jobs directories

  • purge (Boolean) (defaults to: true)

    Whether to purge all non-managed cron jobs



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
46
47
48
49
50
51
52
# File 'manifests/cron/cronjobs_directory.pp', line 21

class lsys::cron::cronjobs_directory (
  Array[Stdlib::Unixpath] $items = [
    '/etc/cron.d',
    '/etc/cron.hourly',
    '/etc/cron.daily',
    '/etc/cron.weekly',
    '/etc/cron.monthly',
  ],
  Boolean $manage = true,
  String $mode = '0750',
  Boolean $purge = true,
) {
  if $manage {
    file { $items:
      ensure  => directory,
      mode    => $mode,
      recurse => $purge,
      purge   => $purge,
    }

    # keep system default cron jobs
    if $purge {
      file {
        '/etc/cron.d/0hourly': ;
        '/etc/cron.hourly/0anacron': ;
        default:
          ensure => file,
          ;
      }
    }
  }
}