summaryrefslogtreecommitdiff
path: root/manifests/setup.pp
blob: 4715fb6c29e7f22dcc461e58719ef795b9f83bad (plain)
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
# @summary Prepare for periodic rules to be loaded.
#
# @param periodic_dir
#   Directory in which periodic rules should be kept
# @param purge
#   Should the periodic directory be purged.
#   This means that unreferenced files will be deleted.
# @param suffix
#   Suffix of all "active" files in the periodic dir.
# @param ensure
#   Should the periodic dir be enabled.
class periodic::setup (
  Stdlib::Path $periodic_dir = '/usr/local/etc/periodic.conf.d',
  Boolean $purge = true,
  String $suffix = '.periodic',
  Enum['present', 'absent'] $ensure = 'present',
) {
  $content = @("EOF"/$)
    periodic_conf_files="${periodic_dir}/*${suffix} \${periodic_conf_files}"
    | EOF

  file_line { 'Periodic - Enable sourcing of files in directory':
    ensure => $ensure,
    path   => '/etc/periodic.conf',
    line   => $content,
  }

  file { $periodic_dir:
    ensure => if $ensure == 'present' { 'directory' } else { 'absent' },
    purge  => $purge,
  }
}