# authorized\_key and $FILE macro

**URL:** <https://forum.ansible.com/t/authorized-key-and-file-macro/12012>\
**Category:** Ansible Project\
**Created:** [October 22, 2012, 10:17am UTC](https://forum.ansible.com/t/authorized-key-and-file-macro/12012 "2012-10-22T10:17:02Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Julien\_Tognazzi](https://avatars.discourse-cdn.com/v4/letter/j/b38774/32.png) [@Julien\_Tognazzi](https://forum.ansible.com/u/Julien_Tognazzi)\
**Post date:** [October 22, 2012, 10:17am UTC](https://forum.ansible.com/t/authorized-key-and-file-macro/12012/1 "2012-10-22T10:17:02Z")

</div>

Hi,

I performed some simple tests with the authorized\_key and $FILE macro and it seems to me that the $FILE macro needs to be quoted:

```auto
tasks:
    - authorized_key user=$item key= **"** $FILE(/keys/$user1) **"**
      with_items:
         - pinky
         - brain
         - snowball

```

without the quote I have the following error:  
{“failed”: true, “msg”: “this module requires key=value arguments”}

In the docs it is mentionned twice without the quotes…  
[Getting values from files](http://ansible.cc/docs/playbooks2.html?highlight=pipe#contents) (here also the parameter name should be user)

[authorized\_key module documentation](http://ansible.cc/docs/modules.html#authorized-key)

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan](https://avatars.discourse-cdn.com/v4/letter/m/c4cdca/32.png) [@Michael\_DeHaan](https://forum.ansible.com/u/Michael_DeHaan)\
**Post date:** [October 22, 2012, 11:57am UTC](https://forum.ansible.com/t/authorized-key-and-file-macro/12012/2 "2012-10-22T11:57:01Z")

</div>

It might be because the SSH key has a space in it, but I'll check to make sure.

Can you file a github ticket so we can look at this for the docs?

github.com/ansible/ansible

Thanks!

---

<div class="post-metadata">

**Author:** ![Serge\_van\_Ginderacht](https://avatars.discourse-cdn.com/v4/letter/s/b782af/32.png) [@Serge\_van\_Ginderacht](https://forum.ansible.com/u/Serge_van_Ginderacht)\
**Post date:** [October 22, 2012, 3:24pm UTC](https://forum.ansible.com/t/authorized-key-and-file-macro/12012/3 "2012-10-22T15:24:52Z")

</div>

I had this very problem, using a variable containing the key. You indeed need to quote it as it has a space in it.

Serge
