From 45ee165fcd0f4bf53cee130aa133e4046aeb8df8 Mon Sep 17 00:00:00 2001 From: Maxim Babushkin Date: Thu, 9 May 2019 19:38:29 +0300 Subject: [PATCH] os_nova_host_aggregate - Fix aggregate delete with hosts (#53166) Aggregate delete task will fail in case it has hosts within the aggregate. As by the OpenStack, the hosts should be removed from the aggregate prior aggregate delete. Add remove host in case provided. --- lib/ansible/modules/cloud/openstack/os_nova_host_aggregate.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/ansible/modules/cloud/openstack/os_nova_host_aggregate.py b/lib/ansible/modules/cloud/openstack/os_nova_host_aggregate.py index 931bc8cdb3..94bd628988 100644 --- a/lib/ansible/modules/cloud/openstack/os_nova_host_aggregate.py +++ b/lib/ansible/modules/cloud/openstack/os_nova_host_aggregate.py @@ -167,6 +167,9 @@ def main(): if aggregate is None: changed = False else: + if hosts: + for h in hosts: + cloud.remove_host_from_aggregate(aggregate.id, h) cloud.delete_aggregate(aggregate.id) changed = True module.exit_json(changed=changed)