# How do I eliminate this deprecation warning?

**URL:** <https://forum.ansible.com/t/how-do-i-eliminate-this-deprecation-warning/13975>\
**Category:** Ansible Project\
**Created:** [November 22, 2013, 3:50pm UTC](https://forum.ansible.com/t/how-do-i-eliminate-this-deprecation-warning/13975 "2013-11-22T15:50:12Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nolan\_Darilek](https://avatars.discourse-cdn.com/v4/letter/n/919ad9/32.png) [@Nolan\_Darilek](https://forum.ansible.com/u/Nolan_Darilek)\
**Post date:** [November 22, 2013, 3:50pm UTC](https://forum.ansible.com/t/how-do-i-eliminate-this-deprecation-warning/13975/1 "2013-11-22T15:50:12Z")

</div>

I have the following in one of my playbooks:

- authorized\_key: user=root key="$FILE(ssh/{{ item }}.pub)"  
&nbsp;&nbsp;with\_items:  
&nbsp;&nbsp;&nbsp;&nbsp;- nolan

I'm now attempting to remove the deprecation warning on this. I tried:

- authorized\_key: user=root key="{{lookup('file', 'ssh/{{item}}.pub')}}"  
&nbsp;&nbsp;with\_items:  
&nbsp;&nbsp;&nbsp;&nbsp;- nolan

I also tried:

- authorized\_key: user=root key="{{lookup('file', 'ssh/'+item+'.pub')}}"  
&nbsp;&nbsp;with\_items:  
&nbsp;&nbsp;&nbsp;&nbsp;- nolan

Either I'm told that {{item}}.pub can't be found, or that ssh/.pub is  
missing. Is it possible to refactor the play with the deprecated syntax?

Thanks.

---

<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:** [November 22, 2013, 5:01pm UTC](https://forum.ansible.com/t/how-do-i-eliminate-this-deprecation-warning/13975/2 "2013-11-22T17:01:30Z")

</div>

{{ lookup('file', 'ssh/' + item + '.pub') }}

-- Michael

---

<div class="post-metadata">

**Author:** ![Nolan\_Darilek](https://avatars.discourse-cdn.com/v4/letter/n/919ad9/32.png) [@Nolan\_Darilek](https://forum.ansible.com/u/Nolan_Darilek)\
**Post date:** [November 22, 2013, 5:12pm UTC](https://forum.ansible.com/t/how-do-i-eliminate-this-deprecation-warning/13975/3 "2013-11-22T17:12:34Z")

</div>

- authorized\_key: user=root key="{{ lookup('file', 'ssh/'+item+'.pub') }}"  
&nbsp;&nbsp;with\_items:  
&nbsp;&nbsp;&nbsp;&nbsp;- nolan

ERROR: /home/nolan/Projects/Infrastructure/roles/common/files/ssh/.pub  
does not exist

What am I missing?

Additionally, I have the ssh directory in the root of my Ansible tree  
alongside my roles directory. Will the lookup find them there? Not sure  
if that's why they aren't being found now, but I'd expect the item to be  
substituted in correctly either way.

Thanks.

---

<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:** [November 22, 2013, 5:20pm UTC](https://forum.ansible.com/t/how-do-i-eliminate-this-deprecation-warning/13975/4 "2013-11-22T17:20:38Z")

</div>

You might have an empty string in your list

-- Michael

---

<div class="post-metadata">

**Author:** ![Nolan\_Darilek](https://avatars.discourse-cdn.com/v4/letter/n/919ad9/32.png) [@Nolan\_Darilek](https://forum.ansible.com/u/Nolan_Darilek)\
**Post date:** [November 22, 2013, 5:24pm UTC](https://forum.ansible.com/t/how-do-i-eliminate-this-deprecation-warning/13975/5 "2013-11-22T17:24:23Z")

</div>

How would I find out? This worked just fine with the old syntax, so I'm  
not sure why I'd have an empty string in one run and not in another,  
when the with\_items list remains unchanged.

---

<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:** [November 22, 2013, 8:59pm UTC](https://forum.ansible.com/t/how-do-i-eliminate-this-deprecation-warning/13975/6 "2013-11-22T20:59:42Z")

</div>

Please show me where/how you are defining Nolan and we can get someone to see if they can reproduce this.
