diff --git a/changelogs/fragments/ec2_asg_retry_deletion_when_busy.yaml b/changelogs/fragments/ec2_asg_retry_deletion_when_busy.yaml new file mode 100644 index 00000000000..c1ce7420783 --- /dev/null +++ b/changelogs/fragments/ec2_asg_retry_deletion_when_busy.yaml @@ -0,0 +1,2 @@ +bugfixes: + - Retry deleting the autoscaling group if there are scaling activities in progress. diff --git a/lib/ansible/modules/cloud/amazon/ec2_asg.py b/lib/ansible/modules/cloud/amazon/ec2_asg.py index 7b88a717d39..45433ba6a64 100644 --- a/lib/ansible/modules/cloud/amazon/ec2_asg.py +++ b/lib/ansible/modules/cloud/amazon/ec2_asg.py @@ -585,7 +585,7 @@ def update_asg(connection, **params): connection.update_auto_scaling_group(**params) -@AWSRetry.backoff(**backoff_params) +@AWSRetry.backoff(catch_extra_error_codes=['ScalingActivityInProgress'], **backoff_params) def delete_asg(connection, asg_name, force_delete): connection.delete_auto_scaling_group(AutoScalingGroupName=asg_name, ForceDelete=force_delete)