Is it possible to make file lookup based on request from vars_prompt?

Hello team,
I have some playbook and csv file. Inside of this playbook i have vars_prompt module and inside os csv file i have a lot of vars items. For example:
playbook (just vars_prompt section)

`
vars_prompt:

  • name: “name_1”
    prompt: “Enter name”
    private: no
    `

cvs file:

`

Bruce_Wayne,Batman,Human
Clark_Kent,Superman,Alien
Diana_Price,Woman,Deity
Wally_West,flash,Human

`

The questions is: how can i make search inside csv file based on vars_prompt request?
i tried this one:

`

tasks:

  • debug: msg=“The atomic number of Lithium is {{ lookup(‘csvfile’, '”{{name_1}}" file=myfile.csv delimiter=,') }}"

`

But it’s not working…
Thank you!

vars from vars_prompt are like any other vars, also, don't stack the moustaches!

  - debug: msg="The atomic number of Lithium is {{ lookup('csvfile',
name_1 + ' file=myfile.csv delimiter=,') }}"

Hi Brian,
Thank you for your updates!
One more thing.
For example i have task like this one:

`

  • name: CREATE VRF
    nxos_command:
    commands:
  • conf t
  • vrf context {{ vrf_id }}
  • rd auto
  • vni {{ vni }}
  • address-family ipv4 unicast
  • route-target import {{ rt_imp }}
  • route-target import {{ rt_imp }} evpn
  • route-target export {{ rt_exp }}
  • route-target export {{ rt_exp }} evpn

`

and i want to take all these vars (vni, rt_imp, rt_exp) from see file like this one:

`

vrf_id, rt_imp, rt_exp, vni, vrf_tag,
iMZ, 64998:2030000, 64998:2030000, 2030000, 3901,
iTZ, 64998:2050000, 64998:2050000, 2050000, 3902,

`

How can i do this? (in general i have no idea…)
Thank you!