# Access to local files from module

**URL:** <https://forum.ansible.com/t/access-to-local-files-from-module/15659>\
**Category:** Ansible Project\
**Created:** [July 13, 2014, 6:00pm UTC](https://forum.ansible.com/t/access-to-local-files-from-module/15659 "2014-07-13T18:00:19Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Gregor\_Giesen](https://avatars.discourse-cdn.com/v4/letter/g/47e85d/32.png) [@Gregor\_Giesen](https://forum.ansible.com/u/Gregor_Giesen)\
**Post date:** [July 13, 2014, 6:00pm UTC](https://forum.ansible.com/t/access-to-local-files-from-module/15659/1 "2014-07-13T18:00:19Z")

</div>

Hello everyone,

I try to write a module which reads a local file (e.g. from a playbook). How can I achieve it?

I’ve tried to start with the “copy” module which reads a local file given by the src argument. As far as I understand, ansible copies temporarily the “src”-file to the node where the copy script can access it. But when I put the copy module under a different name in my playbook libraries directory, it tries to access the “src”-file on the node.

Thanks in advance,  
Gregor

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan1](https://avatars.discourse-cdn.com/v4/letter/m/5e9695/32.png) [@Michael\_DeHaan1](https://forum.ansible.com/u/Michael_DeHaan1)\
**Post date:** [July 13, 2014, 6:39pm UTC](https://forum.ansible.com/t/access-to-local-files-from-module/15659/2 "2014-07-13T18:39:38Z")

</div>

Easiest way is to run the module via local\_action.

Otherwise you’ll have to write an action\_plugin which is overkill and much more low level (less heavy-lifting already done for you), and you’ll have to understand how that works.

Note that the copy module works via a pair of modules, the action\_plugin and the remote component.
