Access to local files from module

30 views
Skip to first unread message

Gregor Giesen

unread,
Jul 13, 2014, 2:00:19 PM7/13/14
to ansible...@googlegroups.com
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

Michael DeHaan

unread,
Jul 13, 2014, 2:39:41 PM7/13/14
to ansible...@googlegroups.com
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.






--
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 ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/df80194d-4903-44f0-87e9-ad577330f1ca%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages