Using subelements in Ansible to loop through multiple lists.
While working on my Ansible Galaxy users role I came across a situation where I needed to loop through a list inside a dictionary inside a list. For this specific case I had a list of users, and each user could have multiple authorized sshkeys stored in a “pubkeys” value. To add each sshkey I used subelements in Ansible to loop through multiple lists. Here’s an example variable. Note that there are two users, one user has two public keys, and the other has one: ...