From 90b6178e61ba149d317d9d14a1324fe1906f3ef7 Mon Sep 17 00:00:00 2001 From: Sloane Hertel Date: Fri, 13 Oct 2017 13:59:24 -0400 Subject: [PATCH] [cloud] Don't try to deregister an instance that isn't in the load balancer (#31660) --- lib/ansible/modules/cloud/amazon/ec2_elb.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/ansible/modules/cloud/amazon/ec2_elb.py b/lib/ansible/modules/cloud/amazon/ec2_elb.py index c1d26b29e2..56e8adcdd6 100644 --- a/lib/ansible/modules/cloud/amazon/ec2_elb.py +++ b/lib/ansible/modules/cloud/amazon/ec2_elb.py @@ -133,6 +133,10 @@ class ElbManager: # balancer. Ignore it and try the next one. continue + # The instance is not associated with any load balancer so nothing to do + if not self._get_instance_lbs(): + return + lb.deregister_instances([self.instance_id]) # The ELB is changing state in some way. Either an instance that's