# lookup a file from a role outside the role directory

**URL:** <https://forum.ansible.com/t/lookup-a-file-from-a-role-outside-the-role-directory/12912>\
**Category:** Ansible Project\
**Created:** [June 6, 2013, 12:51am UTC](https://forum.ansible.com/t/lookup-a-file-from-a-role-outside-the-role-directory/12912 "2013-06-06T00:51:13Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![David\_Golden](https://avatars.discourse-cdn.com/v4/letter/d/d2c977/32.png) [@David\_Golden](https://forum.ansible.com/u/David_Golden)\
**Post date:** [June 6, 2013, 12:51am UTC](https://forum.ansible.com/t/lookup-a-file-from-a-role-outside-the-role-directory/12912/1 "2013-06-06T00:51:13Z")

</div>

I want to pass a file path into a role and use it with a lookup plugin:

&nbsp;&nbsp;&nbsp;&nbsp;lookup('file', some\_variable)

That only seems to be working if the some\_variable is a relative path  
in the roles/files directory.

How can I lookup a path relative to the current directory when I run  
ansible-playbook or to an absolute path?

---

<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:** [June 6, 2013, 12:44pm UTC](https://forum.ansible.com/t/lookup-a-file-from-a-role-outside-the-role-directory/12912/2 "2013-06-06T12:44:25Z")

</div>

Pretty much everyone wanted lookup paths to be relative to the role, so we fixed the glitch.

You can “climb out” of the role using “…/” etc.
