From b2ab04861e524136c2ab446b7012ad423a6eb861 Mon Sep 17 00:00:00 2001 From: Aditya Putta Date: Fri, 11 Jul 2025 00:22:47 -0500 Subject: [PATCH] Ensure consistent SSH key format with idempotent Ed25519 key regeneration (#932) * Ensure consistent SSH key format with idempotent Ed25519 key regeneration * Update plugins/modules/openssh_keypair.py Co-authored-by: Felix Fontein * removed extra whitespace --------- Co-authored-by: Felix Fontein --- plugins/modules/openssh_keypair.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/plugins/modules/openssh_keypair.py b/plugins/modules/openssh_keypair.py index a0f79905..e14a3c23 100644 --- a/plugins/modules/openssh_keypair.py +++ b/plugins/modules/openssh_keypair.py @@ -159,6 +159,13 @@ EXAMPLES = r""" path: /tmp/id_ssh_rsa force: true +- name: Regenerate SSH keypair only if format or options mismatch + community.crypto.openssh_keypair: + path: /home/devops/.ssh/id_ed25519 + type: ed25519 + regenerate: full_idempotence + private_key_format: ssh + - name: Generate an OpenSSH keypair with a different algorithm (dsa) community.crypto.openssh_keypair: path: /tmp/id_ssh_dsa