1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Ensure an existing ssh-key returns useful information (id + name) instead of a string; this way it can be used to register a variable to use in a later task.

This commit is contained in:
Vincent Viallet 2013-06-14 14:59:52 +08:00 committed by Michael DeHaan
parent 60d1ff125e
commit 66b5689afb

View file

@ -262,7 +262,7 @@ def core(module):
if state in ('active', 'present'): if state in ('active', 'present'):
key = SSH.find(name) key = SSH.find(name)
if key: if key:
module.exit_json(changed=False, msg='SSH key with the name of %s already exists.' % name) module.exit_json(changed=False, ssh_key=key.to_json())
key = SSH.add(name, getkeyordie('ssh_pub_key')) key = SSH.add(name, getkeyordie('ssh_pub_key'))
module.exit_json(changed=True, ssh_key=key.to_json()) module.exit_json(changed=True, ssh_key=key.to_json())