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/init.pp | |
parent | Initial commit. (diff) | |
download | periodic-7d20a1e6a1d66d9611d197d777bd1aa9082269c0.tar.gz periodic-7d20a1e6a1d66d9611d197d777bd1aa9082269c0.tar.xz |
Initial add.
Diffstat (limited to 'manifests/init.pp')
-rw-r--r-- | manifests/init.pp | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/manifests/init.pp b/manifests/init.pp new file mode 100644 index 0000000..313c1fd --- /dev/null +++ b/manifests/init.pp @@ -0,0 +1,38 @@ +# @summary Enable a pre-existing periodic rule +# @param value +# Target value for parameter. +# Strings will be double quoted, meaning that shell expansions will +# be done in them at the time of use. Integers will be interpreted +# inserted literally. +# +# This is most often set to "YES" or "NO" +# +# @param key +# The actually name to set. Valid values depen on available +# periodic files. +# @param ensure +# Should the resource be added or removed. +# Note that if `periodic::setup::purge` is true then simply removing +# the puppet declaratipurges the rule. +define periodic ( + Variant[String, Integer] $value, + String $key = $name, + Enum['present', 'absent'] $ensure = 'present', +) { + include periodic::setup + + $file = "${periodic::setup::periodic_dir}/${key}${periodic::setup::suffix}" + + $value_ = $value ? { + Integer => $value, + String => "\"${value}\"", + } + + file { $file: + ensure => $ensure, + contents => epp("${module_name}/periodic-entry", { + key => $key, + value => $value_ + }), + } +} |