From ffd1200948359d33169af6fe8d8590c764c26b83 Mon Sep 17 00:00:00 2001 From: Alessandro Arnone Date: Mon, 19 Mar 2018 18:59:07 +0000 Subject: [PATCH] [cloud] ec2_asg: wait for the lifecycle hooks - Fixes #37281 (#37282) Wait for the lifecycle hooks by matching states `Terminating:Wait` and `Terminating:Proceed` in addition to `Terminating`. --- lib/ansible/modules/cloud/amazon/ec2_asg.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ansible/modules/cloud/amazon/ec2_asg.py b/lib/ansible/modules/cloud/amazon/ec2_asg.py index 8bc69f864b..35f4d5630f 100644 --- a/lib/ansible/modules/cloud/amazon/ec2_asg.py +++ b/lib/ansible/modules/cloud/amazon/ec2_asg.py @@ -1368,7 +1368,7 @@ def wait_for_term_inst(connection, term_instances): lifecycle = instance_facts[i]['lifecycle_state'] health = instance_facts[i]['health_status'] module.debug("Instance %s has state of %s,%s" % (i, lifecycle, health)) - if lifecycle == 'Terminating' or health == 'Unhealthy': + if lifecycle.startswith('Terminating') or health == 'Unhealthy': count += 1 time.sleep(10)