well, dumbass me was absolutly shure that the file lookup only occurs if 
the named file exists...so the error came from the authorized_key module 
not from the lookup plugin.

the following fixed it...

- stat:
      path: "{{ role_path+'/files/keys/'+item.name+'.key.pub' }}"
  register: has_key
  delegate_to: 127.0.0.1

- authorized_key:
                user: "{{ item.name }}"
                state: present
                key: "{{ lookup('file', 'files/keys/'+item.name+'.key.pub') 
}}"
  when: (item.state == 'present') and
        (has_key.stat.exists == True)




On Tuesday, October 9, 2018 at 8:31:28 PM UTC+2, Brian Coca wrote:
>
> I'm not sure i understand exactly what you are expecting, but in newer 
> version of ansible you can control lookup errors 
>
>
> https://docs.ansible.com/ansible/latest/plugins/lookup.html#using-lookup-plugins
>  
>
> -- 
> ---------- 
> Brian Coca 
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/28ca4b7d-4130-41d3-a445-f59f9f0d1718%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to