From fb8aa5637ab033713f0078f115f3f4a450c8bb59 Mon Sep 17 00:00:00 2001 From: Pierre-Louis Bonicoli Date: Wed, 1 Feb 2017 11:35:53 +0100 Subject: [PATCH] systemd: return an error when systemctl command isn't available --- lib/ansible/modules/system/systemd.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/ansible/modules/system/systemd.py b/lib/ansible/modules/system/systemd.py index ff79fa6acbd..1cbdfeac658 100644 --- a/lib/ansible/modules/system/systemd.py +++ b/lib/ansible/modules/system/systemd.py @@ -334,6 +334,9 @@ def main(): # Check for loading error if is_systemd and 'LoadError' in result['status']: module.fail_json(msg="Error loading unit file '%s': %s" % (unit, result['status']['LoadError'])) + else: + # Check for systemctl command + module.run_command(systemctl, check_rc=True) # Does service exist? found = is_systemd or is_initd