How to do lookup a dynamic filename?

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

You do not (and cannot) nest jinja print brackets

What you are looking for is:

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