You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
772 B
Python
29 lines
772 B
Python
|
|
import traceback
|
|
import sys
|
|
|
|
from ansible.plugins.strategy import StrategyBase
|
|
from ansible.plugins.action import ActionBase
|
|
|
|
|
|
class ActionModule(ActionBase):
|
|
def run(self, tmp=None, task_vars=None):
|
|
try:
|
|
method = getattr(self, self._task.args['method'])
|
|
args = tuple(self._task.args.get('args', ()))
|
|
kwargs = self._task.args.get('kwargs', {})
|
|
|
|
return {
|
|
'changed': False,
|
|
'failed': False,
|
|
'result': method(*args, **kwargs)
|
|
}
|
|
except Exception as e:
|
|
traceback.print_exc()
|
|
return {
|
|
'changed': False,
|
|
'failed': True,
|
|
'msg': str(e),
|
|
'result': e,
|
|
}
|