# Lookup plugin with roles and passed-in file references

**URL:** <https://forum.ansible.com/t/lookup-plugin-with-roles-and-passed-in-file-references/13843>\
**Category:** Ansible Project\
**Created:** [November 5, 2013, 3:46am UTC](https://forum.ansible.com/t/lookup-plugin-with-roles-and-passed-in-file-references/13843 "2013-11-05T03:46:13Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jim\_Kleckner](https://avatars.discourse-cdn.com/v4/letter/j/848f3c/32.png) [@Jim\_Kleckner](https://forum.ansible.com/u/Jim_Kleckner)\
**Post date:** [November 5, 2013, 3:46am UTC](https://forum.ansible.com/t/lookup-plugin-with-roles-and-passed-in-file-references/13843/1 "2013-11-05T03:46:13Z")

</div>

In issue 2697, Michael added the ability to use the lookup plugin to find files directly in a role’s files/ directory:  
[https://github.com/ansible/ansible/issues/2697Thus](https://github.com/ansible/ansible/issues/2697Thus), the directory containing the play (generally roles//tasks) is examined and then roles//files/.

If we pass in files to a role via a group\_vars file, the file references are relative to the basedir of the inventory dir.

What do you recommend for how to tell the role where to find those files?

We currently prepend ‘…/…/…/’ to the file path but this would break if the role were found on a file path not in that relative position.

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan2](https://avatars.discourse-cdn.com/v4/letter/m/da6949/32.png) [@Michael\_DeHaan2](https://forum.ansible.com/u/Michael_DeHaan2)\
**Post date:** [November 6, 2013, 1:52pm UTC](https://forum.ansible.com/t/lookup-plugin-with-roles-and-passed-in-file-references/13843/2 "2013-11-06T13:52:40Z")

</div>

“If we pass in files to a role via a group\_vars file, the file references are relative to the basedir of the inventory dir.”

I generally benefit greatly from examples and seeing things graphically or laid out.

Can you show me what that looks like?

Thanks!
