From 7feef1b64b5568259242fd0ec93778067dd1c769 Mon Sep 17 00:00:00 2001 From: rmudingay Date: Mon, 6 Aug 2018 06:50:27 +0200 Subject: [PATCH] junos_user: additonal sshkey types added (#43685) --- lib/ansible/modules/network/junos/junos_user.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/ansible/modules/network/junos/junos_user.py b/lib/ansible/modules/network/junos/junos_user.py index 81015deced..cdca5dc5dc 100644 --- a/lib/ansible/modules/network/junos/junos_user.py +++ b/lib/ansible/modules/network/junos/junos_user.py @@ -208,7 +208,14 @@ def map_obj_to_ele(module, want): if item.get('sshkey'): auth = SubElement(user, 'authentication') - ssh_rsa = SubElement(auth, 'ssh-rsa') + if 'ssh-rsa' in item['sshkey']: + ssh_rsa = SubElement(auth, 'ssh-rsa') + elif 'ssh-dss' in item['sshkey']: + ssh_rsa = SubElement(auth, 'ssh-dsa') + elif 'ecdsa-sha2' in item['sshkey']: + ssh_rsa = SubElement(auth, 'ssh-ecdsa') + elif 'ssh-ed25519' in item['sshkey']: + ssh_rsa = SubElement(auth, 'ssh-ed25519') key = SubElement(ssh_rsa, 'name').text = item['sshkey'] return element