|
|
|
@ -20,6 +20,7 @@ __metaclass__ = type
|
|
|
|
|
from ansible.errors import AnsibleError
|
|
|
|
|
from ansible.playbook.conditional import Conditional
|
|
|
|
|
from ansible.plugins.action import ActionBase
|
|
|
|
|
from ansible.module_utils.six import string_types
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class ActionModule(ActionBase):
|
|
|
|
@ -38,8 +39,11 @@ class ActionModule(ActionBase):
|
|
|
|
|
raise AnsibleError('conditional required in "that" string')
|
|
|
|
|
|
|
|
|
|
msg = None
|
|
|
|
|
if 'msg' in self._task.args:
|
|
|
|
|
success_msg = None
|
|
|
|
|
if 'msg' in self._task.args and isinstance(self._task.args['msg'], string_types):
|
|
|
|
|
msg = self._task.args['msg']
|
|
|
|
|
if 'success_msg' in self._task.args and isinstance(self._task.args['success_msg'], string_types):
|
|
|
|
|
success_msg = self._task.args['success_msg']
|
|
|
|
|
|
|
|
|
|
# make sure the 'that' items are a list
|
|
|
|
|
thats = self._task.args['that']
|
|
|
|
@ -67,5 +71,8 @@ class ActionModule(ActionBase):
|
|
|
|
|
return result
|
|
|
|
|
|
|
|
|
|
result['changed'] = False
|
|
|
|
|
if success_msg is not None:
|
|
|
|
|
result['msg'] = success_msg
|
|
|
|
|
else:
|
|
|
|
|
result['msg'] = 'All assertions passed'
|
|
|
|
|
return result
|
|
|
|
|