Access to local files from module

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

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.