A quick question:
Is it possible for a user-made action plugin to be called with the
shorthand task syntax (module: arg=argval ...)?
The built-in action plugins (like fail, debug, etc.) are able to be
called this way, but I think figuring out how that's managed will take
longer than asking the list.
I can call my action plugin with the regular 'action: module args...'
syntax if necessary, but consistency is a fun thing.
A quick question:
Is it possible for a user-made action plugin to be called with the
shorthand task syntax (module: arg=argval ...)?
Yes.
The built-in action plugins (like fail, debug, etc.) are able to be
called this way, but I think figuring out how that's managed will take
longer than asking the list.
I can call my action plugin with the regular 'action: module args...'
syntax if necessary, but consistency is a fun thing.
Is there a reason it didn't seem to work for you?
Excerpts from Michael DeHaan's message of 2013-03-27 13:46:22 -0400:
Is there a reason it didn't seem to work for you?
ansible.cfg includes:
action_plugins = ansible_plugins/action_plugins
I've got a mock action plugin in:
$PWD/ansible_plugins/action_plugins/testaction.py
It's a tiny mock module:
from ansible.runner.return_data import ReturnData
class ActionModule(object):
def __init__(self, runner):
self.runner = runner
def run(self, conn, tmp, module_name, module_args, inject,
complex_args=None, **kwargs):
return ReturnData(conn=conn, result={'failed': False,
'msg': 'foo'})
A playbook, test.yml:
- hosts: testhost
tasks:
- testaction: hi=foo
Then I run:
$ ansible-playbook -i test_hosts test.yml -u root -v
ERROR: testaction is not a legal parameter in an Ansible task or handler
I'm running devel from git as of 15 minutes ago or so.
Perhaps I'm missing something?
Thanks for the help!
IIRC, you need documentation stub in the ansible library directory.
Excerpts from Michael DeHaan's message of 2013-03-27 14:28:39 -0400:
IIRC, you need documentation stub in the ansible library directory.
Ahh, there we go.
Thank you very much.