summaryrefslogtreecommitdiff
path: root/manifests/setup.pp
diff options
context:
space:
mode:
Diffstat (limited to 'manifests/setup.pp')
-rw-r--r--manifests/setup.pp32
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,
+ }
+}