# Syntax help for "lookup"

**URL:** <https://forum.ansible.com/t/syntax-help-for-lookup/13454>\
**Category:** Ansible Project\
**Created:** [September 11, 2013, 8:00am UTC](https://forum.ansible.com/t/syntax-help-for-lookup/13454 "2013-09-11T08:00:04Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dean\_Song](https://avatars.discourse-cdn.com/v4/letter/d/e495f1/32.png) [@Dean\_Song](https://forum.ansible.com/u/Dean_Song)\
**Post date:** [September 11, 2013, 8:00am UTC](https://forum.ansible.com/t/syntax-help-for-lookup/13454/1 "2013-09-11T08:00:04Z")

</div>

Hi guys,

Newbie in ansible. Anybody can help me to understand the the lookup syntax below.

- hosts: test  
roles:
- { role: test  
data\_file: {{ lookup(‘file’, ‘xyz/abc’) }}  
}

Note sure I’ll get all the content of the ‘xyz/abc’ file or just get the file path, then I can use it in the playbook:

- name: copy template  
file: src=${data\_file} dest=/tmp/abc …

Btw, I can’t find the full syntac page about the kind of “lookup” usage, anyone can help to turn on the light for me? thanks very much!

Thanks,  
Dean

---

<div class="post-metadata">

**Author:** ![James\_Cammarata1](https://avatars.discourse-cdn.com/v4/letter/j/d26b3c/32.png) [@James\_Cammarata1](https://forum.ansible.com/u/James_Cammarata1)\
**Post date:** [September 11, 2013, 3:58pm UTC](https://forum.ansible.com/t/syntax-help-for-lookup/13454/2 "2013-09-11T15:58:42Z")

</div>

Using lookup(‘file’,‘xyz/abc’) would be the same as using:

with\_file:

- xyz/abc

So the above would return the content of that file. Remember, lookups are done on the _controlling_ machine, not the target. For most cases, you can probably just use the copy/file modules if all you’re trying to do is copy a file out to remote systems.
