# Is it possible to make file lookup based on request from vars\_prompt?

**URL:** <https://forum.ansible.com/t/is-it-possible-to-make-file-lookup-based-on-request-from-vars-prompt/27020>\
**Category:** Ansible Project\
**Created:** [March 17, 2018, 12:38am UTC](https://forum.ansible.com/t/is-it-possible-to-make-file-lookup-based-on-request-from-vars-prompt/27020 "2018-03-17T00:38:47Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Cyberbob](https://avatars.discourse-cdn.com/v4/letter/c/45deac/32.png) [@Cyberbob](https://forum.ansible.com/u/Cyberbob)\
**Post date:** [March 17, 2018, 12:38am UTC](https://forum.ansible.com/t/is-it-possible-to-make-file-lookup-based-on-request-from-vars-prompt/27020/1 "2018-03-17T00:38:47Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/ansible/original/1X/1882d9a01da5d8996a862359b0913cc568a39b84.svg) [@system](https://forum.ansible.com/u/system)\
**Post date:** [March 17, 2018, 2:41am UTC](https://forum.ansible.com/t/is-it-possible-to-make-file-lookup-based-on-request-from-vars-prompt/27020/2 "2018-03-17T02:41:26Z")

</div>

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

&nbsp;&nbsp;- debug: msg="The atomic number of Lithium is {{ lookup('csvfile',  
name\_1 + ' file=myfile.csv delimiter=,') }}"

---

<div class="post-metadata">

**Author:** ![Cyberbob](https://avatars.discourse-cdn.com/v4/letter/c/45deac/32.png) [@Cyberbob](https://forum.ansible.com/u/Cyberbob)\
**Post date:** [March 17, 2018, 12:14pm UTC](https://forum.ansible.com/t/is-it-possible-to-make-file-lookup-based-on-request-from-vars-prompt/27020/3 "2018-03-17T12:14:56Z")

</div>

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!
