diff options
author | Hugo Hörnquist <hugo@lysator.liu.se> | 2023-10-19 00:59:23 +0200 |
---|---|---|
committer | Hugo Hörnquist <hugo@lysator.liu.se> | 2023-10-19 00:59:23 +0200 |
commit | 7d20a1e6a1d66d9611d197d777bd1aa9082269c0 (patch) | |
tree | 2691f0488695d34edd0ffb173c3857aa7c3daeeb /manifests/setup.pp | |
parent | Initial commit. (diff) | |
download | periodic-7d20a1e6a1d66d9611d197d777bd1aa9082269c0.tar.gz periodic-7d20a1e6a1d66d9611d197d777bd1aa9082269c0.tar.xz |
Initial add.
Diffstat (limited to '')
-rw-r--r-- | manifests/setup.pp | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/manifests/setup.pp b/manifests/setup.pp new file mode 100644 index 0000000..4715fb6 --- /dev/null +++ b/manifests/setup.pp @@ -0,0 +1,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, + } +} |