Hard to tell what is going on without more information. * What do the keys that are being removed look like? * What does /path/to/totpubkey.pub look like? * What do the authorized_keys file(s) look like?
Could it be that the same pubkey is listed in your authorized_keys several times but with different comments? Dick On Thu, 28 May 2020 at 16:07, 'Mario Garcia' via Ansible Project <[email protected]> wrote: > > Hello > > I need to clean up a bit the authorized keys files on our infra > i created a simple palybook that goes and removed one key from the remote > authorized_keys files but when I run it in check/diff mode i see it tried to > remove far too many lines > > > this is the playbook > > --- > - hosts: all > > > tasks; > > - name: remove public keys > > authorized_key: > user: toto > state: absent > key: "{{ lookup('file', '/path/to/totpubkey.pub') }}" > > > I see absolutely no reason why in some hosts there are several public keys > that are being removed for the authorized_keys files and since the module > does not have a backup option is a bit of a problem. > > how could I use perhaps lineinfile to do the same? or how detect what is > causing the module to delete several lines instead on just the one provided? > > thank you. > > > > -- > 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 view this discussion on the web visit > https://groups.google.com/d/msgid/ansible-project/35db046d-01df-4876-bc69-62e42a83d91d%40googlegroups.com. -- Dick Visser Trust & Identity Service Operations Manager GÉANT -- 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 view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CAL8fbwNCSRLJ-pjFBuLsUMS%2Bec%3DjO%3Djr0kLShWHVBpnHVT1-bA%40mail.gmail.com.
