# Developing new module, that includes filetransfer

**URL:** <https://forum.ansible.com/t/developing-new-module-that-includes-filetransfer/32561>\
**Category:** Ansible Developer\
**Tags:** windows\
**Created:** [March 30, 2020, 11:43am UTC](https://forum.ansible.com/t/developing-new-module-that-includes-filetransfer/32561 "2020-03-30T11:43:27Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Alex\_Hoffner](https://avatars.discourse-cdn.com/v4/letter/a/b487fb/32.png) [@Alex\_Hoffner](https://forum.ansible.com/u/Alex_Hoffner)\
**Post date:** [March 30, 2020, 11:43am UTC](https://forum.ansible.com/t/developing-new-module-that-includes-filetransfer/32561/1 "2020-03-30T11:43:27Z")

</div>

Hi

I am currently developing a module (actually for windows over ssh).  
The module requires a filetransfer from the controller. Of course I could just use win\_copy first, but I would like the module to be more self-contained.

But I cannot work out how to achieve a filetransfer. I have looked at copy/win\_copy, but the module code only deals with the steps on the target. The filetransfer itself seems to be happening by magic.  
Further more, I tried to rename the win\_copy module and ran it again with exactly the same parameters. In the latter case the src parameter is just passed as a string, and no magic filetransfers occurs.

The questions are:

What triggers the src parameter to be treated as a file (eligible for filetransfer) and not just a string ?  
Can I find some documentation on the subject ? (I have seen the developing modules doc, and I don’t see anything there)

Regards Alex

---

<div class="post-metadata">

**Author:** ![felixfontein](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/felixfontein/32/7530_2.png) [@felixfontein](https://forum.ansible.com/u/felixfontein)\
**Post date:** [March 30, 2020, 11:51am UTC](https://forum.ansible.com/t/developing-new-module-that-includes-filetransfer/32561/2 "2020-03-30T11:51:39Z")

</div>

Hi Alex,

> I am currently developing a module (actually for windows over ssh).  
> The module requires a filetransfer from the controller. Of course I  
> could just use win\_copy first, but I would like the module to be more  
> self-contained.
> 
> But I cannot work out how to achieve a filetransfer. I have looked at  
> copy/win\_copy, but the module code only deals with the steps on the  
> target. The filetransfer itself seems to be happening by magic.  
> Further more, I tried to rename the win\_copy module and ran it again  
> with exactly the same parameters. In the latter case the src  
> parameter is just passed as a string, and no magic filetransfers  
> occurs.
> 
> The questions are:
> 
> What triggers the src parameter to be treated as a file (eligible for  
> filetransfer) and not just a string ?  
> Can I find some documentation on the subject ? (I have seen the  
> developing modules doc, and I don't see anything there)

you want to look for "action plugins". They run on the controller and  
can copy files from/to the remote nodes, and execute modules (also  
different ones and multiple ones). "copy" is a combination of action  
plugin and module: the action plugin copies the file(s) and then calls  
the module with the temp path the files were copied to.

Cheers,  
Felix

---

<div class="post-metadata">

**Author:** ![Alex\_Hoffner](https://avatars.discourse-cdn.com/v4/letter/a/b487fb/32.png) [@Alex\_Hoffner](https://forum.ansible.com/u/Alex_Hoffner)\
**Post date:** [March 30, 2020, 9:02pm UTC](https://forum.ansible.com/t/developing-new-module-that-includes-filetransfer/32561/3 "2020-03-30T21:02:32Z")

</div>

Thanks a bunch Felix, I’ll have a look at it !!  
/Alex
