Just skip the item when ssh_key is not available (`false` in your example):
- name: "add public keys to users"
authorized_key:
user: '{{ item.name }}'
key:'{{ item.ssh_key }}'
with_items: '{{ user }}'
when: item.ssh_key
On Thu, Jan 23, 2020 at 9:25 AM Hieronymus
Hi
I'm using the authorized_key module in my ansible user role.
As some user aren't ssh key yet, I would like that by default this key is
not created and the task escaped.
I've seen that the key string is required by this module.
Is means that I cannot put a false default value?
Here's my main