From 3ae6583510e9e33029cadc24d6fb01efbd54ef20 Mon Sep 17 00:00:00 2001 From: Ghe Rivero Date: Wed, 25 May 2016 00:36:28 +0200 Subject: [PATCH] Make add ip_floating_ip idempotent Closes issue #1858 --- lib/ansible/modules/cloud/openstack/os_floating_ip.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/ansible/modules/cloud/openstack/os_floating_ip.py b/lib/ansible/modules/cloud/openstack/os_floating_ip.py index df2faa967e8..d7936b8c90a 100644 --- a/lib/ansible/modules/cloud/openstack/os_floating_ip.py +++ b/lib/ansible/modules/cloud/openstack/os_floating_ip.py @@ -162,6 +162,10 @@ def main(): msg="server {0} not found".format(server_name_or_id)) if state == 'present': + fip_address = cloud.get_server_public_ip(server) + f_ip = _get_floating_ip(cloud, fip_address) + if f_ip: + module.exit_json(changed=False, floating_ip=f_ip) server = cloud.add_ips_to_server( server=server, ips=floating_ip_address, ip_pool=network, reuse=reuse, fixed_address=fixed_address, wait=wait,