There is surprisingly (and sometime frustratingly) little documentation on
Ansible action_plugins. I am trying to write an action plugin for a module
that uses delegation. Is there a way to accomplish this? Would greatly
appreciate any input
This is an example of a module I have:-
- name: "create database user"
db_user:
host: "{{ groups['servers'].0 }}"
user: "{{ root_user }}"
password: "{{ root_password }}"
delegate_to: "{{ groups['servers'].0 }}"
And my action plugin is:-
class ActionModule(object):
def __init__(self, runner):
self.runner = runner
def run(self, conn, tmp, module_name, module_args, inject,
complex_args=None, **kwargs):
parsed_args = parse_kv(module_args)
options = {
key: parsed_args.get(key) for key in ["host", "user",
"password"]
}
args = " ".join(
"{}='{}'".format(key, value) for key, value in options.items()
)
return self.runner._execute_module( conn, tmp, 'db_user', args,
inject=inject,)
Thanks
--
You received this message because you are subscribed to the Google Groups
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/a33eb59f-05a7-4a93-8621-a88890add0a7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.