From a715d03a832032562f16f07cc1833414982bd051 Mon Sep 17 00:00:00 2001 From: Brian Coca Date: Tue, 22 Nov 2016 16:16:55 -0500 Subject: [PATCH] dont fail on missing service during check mode --- lib/ansible/module_utils/service.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/ansible/module_utils/service.py b/lib/ansible/module_utils/service.py index ac41b6e3a0..383716055c 100644 --- a/lib/ansible/module_utils/service.py +++ b/lib/ansible/module_utils/service.py @@ -47,4 +47,7 @@ def sysv_exists(name): def fail_if_missing(module, found, service, msg=''): if not found: - module.fail_json(msg='Could not find the requested service %s: %s' % (service, msg)) + if module.check_mode: + module.exit_json(msg="Service %s not found on %s, assuming it will exist on full run" % (service, msg), changed=True) + else: + module.fail_json(msg='Could not find the requested service %s: %s' % (service, msg))