From f18f5378e91de9af68050e8b12ac836a13143916 Mon Sep 17 00:00:00 2001
From: Thomas Bellman <bellman@lysator.liu.se>
Date: Sat, 27 Mar 2021 18:53:32 +0100
Subject: [PATCH] Add class for reloading systemd.

This adds the class 'systemd::daemon_reload', which can be used
to tell systemd to re-read its service configuration files.
---
 manifests/daemon_reload.pp | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)
 create mode 100644 manifests/daemon_reload.pp

diff --git a/manifests/daemon_reload.pp b/manifests/daemon_reload.pp
new file mode 100644
index 0000000..bf9a39d
--- /dev/null
+++ b/manifests/daemon_reload.pp
@@ -0,0 +1,26 @@
+# Copyright © 2021   Thomas Bellman, Linköping, Sweden
+# Licensed under the GNU LGPL v3+; see the README file for more information.
+
+
+/*
+ * Tell systemd to re-read its service configuration files.
+ *
+ * If you change any systemd service configuration files, you should
+ * include and notify this class.  Example:
+ *
+ *     include systemd::daemon_reload
+ *     file {
+ *         '/etc/systemd/system/foo.service.d/bar.conf':
+ *             ensure => absent,
+ *             notify => Class['systemd::daemon_reload'];
+ *     }
+ */
+class systemd::daemon_reload
+{
+    exec {
+	'systemd::daemon_reload::do-reload':
+	    command => 'systemctl daemon-reload',
+	    path => [ '/bin', '/usr/bin', '/sbin', '/usr/sbin', ],
+	    refreshonly => true;
+    }
+}
-- 
GitLab