How to prevent empty subelement list error in Ansible loop?
Solution 1:
Q: "Error: the key 'ssh_pub_keys' should point to a list, got None."
A: You might want to use lookup and set 'skip_missing': True.
loop: "{{ lookup('subelements',
users,
'ssh_pub_keys',
{'skip_missing': True}) }}"
Q: "Error: 'list object' has no attribute 'username'"
A: The index is missing. Fix it.
label: "{{ item.0.username }}"