I have the following list of keys and users:
---
case1:
keys:
- sshrsa1
- sshrsa2
users:
- user1
- user2
- user4
case2:
keys:
- sshrsa3
- sshrsa4
- sshrsa5
users:
- user1
- user2
- user5
How can I combine these list to use with authorized_key in order to place all keys under case1 in all the users' authorized_file like the below example?
user1's auth file contains:
sshrsa1
sshrsa2
user2's auth file contains:
sshrsa1
sshrsa2
user4's auth file contains:
sshrsa1
sshrsa2
And the same with case2:
user1's auth file contains:
sshrsa3
sshrsa4
sshrsa5
user2's auth file contains:
sshrsa3
sshrsa4
sshrsa5
user5's auth file contains:
sshrsa3
sshrsa4
sshrsa5
Given the data
Q: "Place all keys under case* into the users' authorized_key files."
A: Convert the dictionary to a list and iterate with_subelements. For example,
gives (abridged)
Notes
The parameter key requires a string. Convert the keys from the list to lines in a string. For example,