|
|
@ -162,18 +162,7 @@ class ElbManager:
|
|
|
|
"""Register the instance for all ELBs and wait for the ELB
|
|
|
|
"""Register the instance for all ELBs and wait for the ELB
|
|
|
|
to report the instance in-service"""
|
|
|
|
to report the instance in-service"""
|
|
|
|
for lb in self.lbs:
|
|
|
|
for lb in self.lbs:
|
|
|
|
if wait:
|
|
|
|
|
|
|
|
tries = 1
|
|
|
|
|
|
|
|
while True:
|
|
|
|
|
|
|
|
initial_state = self._get_instance_health(lb)
|
|
|
|
initial_state = self._get_instance_health(lb)
|
|
|
|
if initial_state:
|
|
|
|
|
|
|
|
break
|
|
|
|
|
|
|
|
time.sleep(1)
|
|
|
|
|
|
|
|
tries += 1
|
|
|
|
|
|
|
|
# FIXME: this should be configurable, but since it didn't
|
|
|
|
|
|
|
|
# wait at all before this is at least better
|
|
|
|
|
|
|
|
if tries > 10:
|
|
|
|
|
|
|
|
self.module.fail_json(msg='failed to find the initial state of the load balancer')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if enable_availability_zone:
|
|
|
|
if enable_availability_zone:
|
|
|
|
self._enable_availailability_zone(lb)
|
|
|
|
self._enable_availailability_zone(lb)
|
|
|
@ -313,7 +302,7 @@ class ElbManager:
|
|
|
|
def main():
|
|
|
|
def main():
|
|
|
|
argument_spec = ec2_argument_spec()
|
|
|
|
argument_spec = ec2_argument_spec()
|
|
|
|
argument_spec.update(dict(
|
|
|
|
argument_spec.update(dict(
|
|
|
|
state={'required': True, 'type' : 'bool'},
|
|
|
|
state={'required': True},
|
|
|
|
instance_id={'required': True},
|
|
|
|
instance_id={'required': True},
|
|
|
|
ec2_elbs={'default': None, 'required': False, 'type':'list'},
|
|
|
|
ec2_elbs={'default': None, 'required': False, 'type':'list'},
|
|
|
|
enable_availability_zone={'default': True, 'required': False, 'type': 'bool'},
|
|
|
|
enable_availability_zone={'default': True, 'required': False, 'type': 'bool'},
|
|
|
|