authorized_key + lookup + with_items

Hi,

I have problem I cannot manage.
When I try to use authorized_key module in loop with lookup i have error:

ERROR: cannot find lookup plugin named item for usage in with_item

this is my code:

  • name: User key
    authorized_key: user=“{{ item }}”
    key=“{{ lookup(‘file’, ‘pub_keys/’ + item + ‘.txt’) }}”
    with_item: userlist
    tags:
  • user
  • admin

I’m testing lookup alone:

  • debug: msg=“{{ lookup(‘file’, ‘pub_keys/’ + item + ‘.txt’) }}”
    with_items: userlist

and its works fine. What I,am doing wrong?

Thanks in advance, M.

with_items (plural) not "with_item: userlist"

What the shame… :wink:
Thanks.