I have 2 separate dictionaries that I need to iterate over to 1) create a
user and 2) add their ssh keys (some users might have multiple keys)
The first task works, the second...not so much - I've tried so many things,
I can't even remember (with_subelements, with_items, lookups, etc). How
would I iterate over the 2 dictionaries to properly add the correct key(s)
to each user created in the first task? I know it would easier to combine
the 2 dictionaries, but (for reasons) I can't at this time.
---
- name: Create Users
become: yes
user:
name: "{{ item }}"
shell: /bin/bash
state: present
with_items:
- "{{ ssh_users }}"
- name: Accept public keys for Users
become: yes
authorized_key:
state: present
user: ????????
manage_dir: yes
exclusive: yes
key: ??????
ssh_users:
- user1
- user2
- user3
public_ssh_keys:
user1:
- "ssh-rsa
H*ogAtiwigE!YMESuneza7ahU3YXeWYGorEny2E6A2o8AzEmy@uraVaXEHUWy5AgiVe7oME7erE2eQE5owYQu&oju4a=usU+U8UBYHA1Uga*iPEpoqy5yzADijA=upy%iseREMaTa=i4UpUWi!A6EqaViJUQo2EsEwyqepejYjebytEbo5UruGYrEtEdY2o6ipe@U1EgoWiRyqa%ovUbYSugy7igabe*owiqezUDe1y=AMo!i6Ypa*iQe7oQAVYjE7opomEwUqY=izEDuxiwE=yZYQinoMY@eQY+ehaGo8ubEhuNabiPYvuXenEZara!iseMaTEnu4yQU@eMoJExULy*E=o%YzUSe3ydUDuveTEQomy5Y5YL
user1"
user2:
- "ssh-rsa
gHuLEniHa8UHU2ugu@UZovU+o6U*ANiwuNE8ERA!E6yPEDaTi!eNixY7obeMEQaGajE1e7a5ENAbUNy4o&yveQo=agExyLa6u6ERAzigyZyza2u3eGE@oNi+a*Y3yse!i+E8yREQoGU4UtUVEnE8A4Y6aWA8E8E4eBA&oZuRaqixEDi+uHeLyHETYVisatAtEzotE4a@A&UmehuLuDAQeMoxuxy5YDyVi5Ysy=uQYBYtaSaSoME+yZoBUWadAPeMoHa*iMo7Uru&U&Eja3ESAgUbUvequgEZiWa4oGuZusAzULaGuZyVabe6o&y7epUpojo2APu*eQeXaGomYnA&ehY2iSeRA+Y+yRUZa%i&udu@azEzE7A2
user2"
user3:
- "ssh-rsa
pynU!iRUVesU+eQubARyRY7uSojyJA&A1ASa%YgUhiSidU6eXUgA*Ube+YTERy%o*U%i=yMiGyQYji4u8otohy8a!eMEbY+uzYty6adoLa!yby&YTE5YZo5uqESU8e8ajY=ySAni@Y4YrohAZUPupo!unaZoWuweZY@EbYriqUBaSY7ewedi6Y4Ave7o%UrURYHi7opY%oTeMu!uQi=ono+A6yhy2eWa2UXoxaSaLUwEpE*U5o*iqi5a@iPAwiQabi!ubeDe3upYMy5enUMAWygo@EboZe7aXySo8obEzeqY*ytYDuQY*e7UWo%YLiro=U+YpaQy4imube4ApY+uMe&o3AVeZUgYnosohy!Etode6aho8U4o
user3"
- "ssh-rsa
rExaWAZu8U4u*uBy4yLYbEDi=aZeqeHotiPAMYRaQe4EdU8e%ABENo5Y2i=yrA8o&E@iqy+EgyRU!e5Y%o@aNE&y1UhELyda=U2oTU5e&a2ixeSYmYXAtinyMEzaHU6Y=Yju5uBoty2o2UJoTo6eRAWE2YNyjuRePE7ELoQy*yxY@E2UZU6EjU2uHYbEDiruvA!UhUqygeXu=AGUTuJi2agAme6EWosazuxa4UpowUdAdU%a8AgEZEJywytUwYMERa4y4Ano4utYSudaMyvU!iXAQE%oSuvipATyZu5oxEXu5AsurASU8Utu!ovUqabyDYviDY4oTU&uWU%ETE8AbY!E+yBYqUxArUTuSeju%AHE7uva7AHu
user3"
--
You received this message because you are subscribed to the Google Groups
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/2742b85e-a061-477b-9ef2-7d51c892e62d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.