From ff090a1224905e206583a9ca8aa35f54f4d048c2 Mon Sep 17 00:00:00 2001 From: Lars Kellogg-Stedman Date: Thu, 22 Oct 2015 13:59:45 -0400 Subject: [PATCH] make os_keypair return a top level 'id' key make os_keypair return a top-level 'id' key, much like other os_* resources. --- lib/ansible/modules/cloud/openstack/os_keypair.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/lib/ansible/modules/cloud/openstack/os_keypair.py b/lib/ansible/modules/cloud/openstack/os_keypair.py index f62cc51bf64..64ebd8c67be 100644 --- a/lib/ansible/modules/cloud/openstack/os_keypair.py +++ b/lib/ansible/modules/cloud/openstack/os_keypair.py @@ -146,10 +146,14 @@ def main(): " as offered. Delete key first." % name ) else: - module.exit_json(changed=False, key=keypair) - - new_key = cloud.create_keypair(name, public_key) - module.exit_json(changed=True, key=new_key) + changed = False + else: + keypair = cloud.create_keypair(name, public_key) + changed = True + + module.exit_json(changed=changed, + key=keypair, + id=keypair['id']) elif state == 'absent': if keypair: