# How to do lookup a dynamic filename?

**URL:** <https://forum.ansible.com/t/how-to-do-lookup-a-dynamic-filename/17400>\
**Category:** Ansible Project\
**Created:** [January 29, 2015, 9:56pm UTC](https://forum.ansible.com/t/how-to-do-lookup-a-dynamic-filename/17400 "2015-01-29T21:56:23Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Eddie\_Welker](https://avatars.discourse-cdn.com/v4/letter/e/dfb087/32.png) [@Eddie\_Welker](https://forum.ansible.com/u/Eddie_Welker)\
**Post date:** [January 29, 2015, 9:56pm UTC](https://forum.ansible.com/t/how-to-do-lookup-a-dynamic-filename/17400/1 "2015-01-29T21:56:23Z")

</div>

Hi,

I’m trying to do something like the following in 'group\_vars/all":

name: “{{ lookup(‘env’, ‘PROJECT\_NAME’) }}”  
file: “{{ lookup(‘file’, ‘{{name}}’ ) }}”

but of course, the syntax above won’t work.

Is there an alternate way to do this? I can’t think of a way to accomplish this.

-e

---

<div class="post-metadata">

**Author:** ![sivel](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/sivel/32/1198_2.png) [@sivel](https://forum.ansible.com/u/sivel)\
**Post date:** [January 31, 2015, 12:27am UTC](https://forum.ansible.com/t/how-to-do-lookup-a-dynamic-filename/17400/2 "2015-01-31T00:27:04Z")

</div>

You do not (and cannot) nest jinja print brackets

What you are looking for is:

file: “{{ lookup(‘file’, name ) }}”
