# How to use a variable into a lookup

**URL:** <https://forum.ansible.com/t/how-to-use-a-variable-into-a-lookup/14022>\
**Category:** Ansible Project\
**Created:** [November 28, 2013, 7:11am UTC](https://forum.ansible.com/t/how-to-use-a-variable-into-a-lookup/14022 "2013-11-28T07:11:39Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Herve\_Leclerc](https://avatars.discourse-cdn.com/v4/letter/h/a8b319/32.png) [@Herve\_Leclerc](https://forum.ansible.com/u/Herve_Leclerc)\
**Post date:** [November 28, 2013, 7:11am UTC](https://forum.ansible.com/t/how-to-use-a-variable-into-a-lookup/14022/1 "2013-11-28T07:11:39Z")

</div>

Hello,  
How can i use a variable into a lookup ?  
eg. {{ lookup(‘etcd’, ‘deploy/myapp/ **{{version}}** /release’) }}

---

<div class="post-metadata">

**Author:** ![kahlil.hodgson](https://avatars.discourse-cdn.com/v4/letter/k/b9bd4f/32.png) [@kahlil.hodgson](https://forum.ansible.com/u/kahlil.hodgson)\
**Post date:** [November 28, 2013, 7:28am UTC](https://forum.ansible.com/t/how-to-use-a-variable-into-a-lookup/14022/2 "2013-11-28T07:28:32Z")

</div>

Try

{{ lookup('etcd', 'deploy/myapp/' + version + '/release') }}

K

Kahlil (Kal) Hodgson GPG: C9A02289  
Head of Technology (m) +61 (0) 4 2573 0382  
DealMax Pty Ltd (w) +61 (0) 3 9008 5281

Suite 1415  
401 Docklands Drive  
Docklands VIC 3008 Australia

"All parts should go together without forcing. You must remember that  
the parts you are reassembling were disassembled by you. Therefore,  
if you can't get them together again, there must be a reason. By all  
means, do not use a hammer." -- IBM maintenance manual, 1925

---

<div class="post-metadata">

**Author:** ![Herve\_Leclerc](https://avatars.discourse-cdn.com/v4/letter/h/a8b319/32.png) [@Herve\_Leclerc](https://forum.ansible.com/u/Herve_Leclerc)\
**Post date:** [November 28, 2013, 8:13am UTC](https://forum.ansible.com/t/how-to-use-a-variable-into-a-lookup/14022/3 "2013-11-28T08:13:18Z")

</div>

So simple !  
it works fine

Thank you
