Hi Eugene, Here is a fairly old snipped I used for such purpose. I hope you will find it useful
it uses template to produce authorized_keys https://gist.github.com/hostmaster/fc4bb8a2a9301bc2285f I think it is possible to do the same with assemble module but I have not tried. -- Best On Tue, Jul 28, 2015 at 10:08 AM, Eugene Knoxville <[email protected]> wrote: > Unfortunately, It's not useful for multiple keys :( > >> -----BEGIN PGP SIGNED MESSAGE----- >> Hash: SHA512 >> >> >> > But, when I decide to remove user2_key, It still persists in >> > authorized_key file! It's unacceptable! >> >> maybe you find the >> 'exclusive' parameter useful? >> http://docs.ansible.com/ansible/authorized_key_module.html >> >> > Whether to remove all other non-specified keys from the >> > authorized_keys file. Multiple keys can be specified in a single >> > key string value by separating them by newlines. This option is not >> > loop aware, so if you use with_ , it will be exclusive per >> > iteration of the loop, if you want multiple keys in the file you >> > need to pass them all to key in a single batch as mentioned above. >> >> -----BEGIN PGP SIGNATURE----- >> >> iQIcBAEBCgAGBQJVtMACAAoJEFv7XvVCELh011UP/RookFyHqk1N4qGGiQTSNmaK >> 7ul5NsyovbOBOk74pQgjn+CzjgHUHPQYDptznatSTTJTXaULUm7BRz74yfQplJtW >> OhVVP32lbtul9FxWLPcNBscfQ3wmh0DzbI0BODMRpHdqqmw2/Kjw2eoZU2Y5Mopv >> fC4gH8c76xx6IZVzcQdBvtvkOhPTHWviXHMPVp9DRSa4QByhStE01TTqxK2Iz/nX >> dUMA7WNXwYCi/tLIBihdxo9sYznmSD8sdhwdyPCXDtaab6d6WEk+jj/mzZgqL3OE >> QJ36+ltG8geml9+d13P3bdGH4RWbzzexftKm+iQbE6CEh2E4+4olFcbmNvislL// >> CgnonTHFtxDpv8wCVRH8vKehFk+gqNWlvk7PSwfNm2wp3+joUb2FtC6sPv6YV7Zi >> BRjCSnbj54prdESNo7I9TrlljVtSCNtkq3boM4h0uD4X+7g7s6Ltwuf/5pP/h0zo >> WbnPjMXkDvbXT12w4DIh6jBLwd+FFEHaJk9W1d/HYuX0s/ZLTVQl7fgLY6CASOeM >> OhJlBP2Nse9vGWSbuhSlpop5916Bre5UaEW/bBSrUexr0Y3dBF9Uoe90RYT2dJVv >> fp2IMJla6QEgy6hmTXzpvSfs/4Omi7gfh/p92yIQF0pkg/A6BddoHGY9XtR8LJbi >> GhWxfYqOVIGR5nRJV3tA >> =ypo0 >> -----END PGP SIGNATURE----- > > -- > 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/299c08e3-8c25-4403-a0bd-0638d36bfb58%40googlegroups.com. > For more options, visit https://groups.google.com/d/optout. -- 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/CAGuansrBpJxzT6ZbzpZzEKHnZJT9Vq_QRJ4-Rq0H-Q4io3ek3Q%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
