diff --git a/plugins/action/icinga2_object.py b/plugins/action/icinga2_object.py index 56afca96..fab91f49 100644 --- a/plugins/action/icinga2_object.py +++ b/plugins/action/icinga2_object.py @@ -46,10 +46,10 @@ def run(self, tmp=None, task_vars=None): tmp=tmp ) - if 'failed' in obj and obj['failed']: - raise AnsibleError('Call to module failed: %s' % obj['msg']) - if 'skipped' in obj and obj['skipped']: - raise AnsibleError('Call to module was skipped: %s' % obj['msg']) + if obj.get('failed', False): + raise AnsibleError('Call to module failed: %s' % obj.get('msg', obj)) + if obj.get('skipped', False): + raise AnsibleError('Call to module was skipped: %s' % obj.get('msg', obj)) # # file path handling for assemble