From 3e0cb172221db9203ec077ba138f4835138bf06a Mon Sep 17 00:00:00 2001 From: Sebastian Tobie Date: Wed, 26 Apr 2023 19:01:08 +0200 Subject: [PATCH] added the ability for the author of the module to decide if the module is not restartable/needs restarts --- plugins/module_utils/module.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/plugins/module_utils/module.py b/plugins/module_utils/module.py index 1aed131..f3cef69 100644 --- a/plugins/module_utils/module.py +++ b/plugins/module_utils/module.py @@ -350,13 +350,14 @@ def installable(_class: Type[SystemdUnitModule]): class SystemdReloadMixin: module: basic.AnsibleModule unitfile: pathlib.Path + restartable: bool = True changed: bool def post(self): if not self.changed: return systemctl = self.module.get_bin_path("systemctl", required=True) self.module.run_command([systemctl, "daemon-reload"], check_rc=True) - if self.unitfile.stem.endswith("@"): + if self.unitfile.stem.endswith("@") or not self.restartable: return (rc, _, _) = self.module.run_command([systemctl, "is-enabled", self.unitfile.name], check_rc=False) if rc == 0: