---
- name: Set up authorized_keys for the root user
authorized_key: user=root key="{{ lookup('file', {{ role_path }} + '/files/public_keys/' + {{ item.1 }} ) }}"
with_subelements:
- ssh_users
- names
I haven't been able to get those variables to evaluate within the file lookup (I have tried many other syntaxes to try to achieve this). I know I am importing them properly as I can get them to evaluate outside of the file lookup with something like the following, but then they whole string is not evaluated as a file.
---
- name: Set up authorized_keys for the root user
authorized_key: user=root key={{ role_path }} + '/files/public_keys/' + {{ item.1 }}
with_subelements:
- ssh_users
- names
Here is my dictionary with the embedded lists:
---
ssh_users:
- group: admin
names:
- bob
- dave
- group: developers
names:
- tim
- susan
- group: analysts
names:
- mike
- steve
I am open to changing the task in an way shape or form to achieve this.
Thanks for any help!