Sharing files in tasks between playbooks

Hi,

We are adding more and more systems and services under Ansible’s control and it’s fun and allows us to manage our environment in a much more efficient way.

Currently we have all playbooks in Ansible’s top dir but imho this is will make the overview of the top dir’s content less clear ( i like clean things). I would also like to have our playbooks to be “portable” so we can tar them so other people can reuse them. Of course if we link to things outside of the playbook folder it would become a dependency to run that playbook.

So I tried to put playbooks in a “playbooks” dir under the top dir but I ran in the following problem:

I’ve included a task in a playbook which copies a file to the target machine but it doesn’t work because the file is located outside of the playbook’s dir and therefore not relative to the playbook’s dir

structure :

Have you looked into using roles?

They are designed to be redistributable and have some improvements to relative pathing inside them when you use them.

Hi Michael,

Haven’t looked at roles yet. But that might be the way to go.

Thanks for replying

Vincent