Hi Brian

Thanks for the tips. So the custom module on it's own wont be able to 
transfer files to remotes, a custom action plugin would be required for 
this. 
And it turns out creating a custom action plugin and re-use existing 
actions/modules in the custom action plugin is pretty straight forward and 
didn't require lots of boilerplate.
For anyone that's looking for code example. see the code here 
<https://github.com/hangsu-ma/ansible-template/blob/master/action_plugins/hello-world.py>
.

Best Regards,
Hangsu Ma

On Wednesday, 3 October 2018 19:41:53 UTC+1, Brian Coca wrote:
>
> >zipped up with copy.py and sent over to remote before copy.py is called 
> by ansible on remote.  Which make complete sense, the modules are only 
> executing on remotes, the files they use must be made available to them by 
> ansible framework before they are invoked. 
>
> This is incorrect, the copy action plugin asks the connection plugin 
> to push the file to the remote before executing the module (which is 
> part of the zip as well as any dependencies it has in module_utils). 
> Both of these transfers should be using the same directory though, we 
> try to limit the number of temp dirs created/used. 
>
>
> > I did come cross _transfer_file from normal action ActionBase, looks 
> like action is where it happens, but developing an custom actions seem to 
> be an overkill for such a common user case, and i dont want to reinvent 
> wheels. 
>
> This is the correct method to use, this in turn calls the connection 
> plugin method for file transfers. 
> If you don't want to use directly, look at the template action plugin, 
> it just calls the copy action plugin when it needs to copy the files, 
> you could do the same in this case. 
>
> ---------- 
> Brian Coca 
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-devel+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to