# complex variable lists with file contents

**URL:** <https://forum.ansible.com/t/complex-variable-lists-with-file-contents/12830>\
**Category:** Ansible Project\
**Tags:** ansible-project\
**Created:** [May 20, 2013, 1:37am UTC](https://forum.ansible.com/t/complex-variable-lists-with-file-contents/12830 "2013-05-20T01:37:02Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Michael\_DeHaan2](https://avatars.discourse-cdn.com/v4/letter/m/da6949/32.png) [@Michael\_DeHaan2](https://forum.ansible.com/u/Michael_DeHaan2)\
**Post date:** [May 20, 2013, 1:37am UTC](https://forum.ansible.com/t/complex-variable-lists-with-file-contents/12830/1 "2013-05-20T01:37:02Z")

</div>

Ok, so since you are doing “{{” this means you are already using Ansible 1.2.

It is therefore much easier to just use all of the 1.2 syntax and stop using the old “$foo”.

This would make your example like this:

- name: add authorized key for user  
action: authorized\_key user={{ item.user\_name }} key=“{{ lookup(‘file’, item.pub\_key) }}”

with\_items: users

I’m hoping that works for you. Let me know if not and I can help test further.
