|
|
|
@ -127,7 +127,7 @@ options:
|
|
|
|
|
- An associative array of stickness policy settings. Policy will be applied to all listeners ( see example )
|
|
|
|
|
required: false
|
|
|
|
|
version_added: "2.0"
|
|
|
|
|
wait_for:
|
|
|
|
|
wait:
|
|
|
|
|
description:
|
|
|
|
|
- When specified, Ansible will check the status of the load balancer to ensure it has been successfully
|
|
|
|
|
removed from AWS.
|
|
|
|
@ -135,6 +135,13 @@ options:
|
|
|
|
|
default: no
|
|
|
|
|
choices: ["yes", "no"]
|
|
|
|
|
version_added: 2.0
|
|
|
|
|
wait_timeout:
|
|
|
|
|
description:
|
|
|
|
|
- Used in conjunction with wait. Number of seconds to wait for the elb to be terminated.
|
|
|
|
|
A maximum of 600 seconds (10 minutes) is allowed.
|
|
|
|
|
required: false
|
|
|
|
|
default: 60
|
|
|
|
|
version_added: 2.0
|
|
|
|
|
|
|
|
|
|
extends_documentation_fragment: aws
|
|
|
|
|
"""
|
|
|
|
@ -208,12 +215,20 @@ EXAMPLES = """
|
|
|
|
|
name: "test-please-delete"
|
|
|
|
|
state: absent
|
|
|
|
|
|
|
|
|
|
# Ensure ELB is gone and wait for check
|
|
|
|
|
# Ensure ELB is gone and wait for check (for default timeout)
|
|
|
|
|
- local_action:
|
|
|
|
|
module: ec2_elb_lb
|
|
|
|
|
name: "test-please-delete"
|
|
|
|
|
state: absent
|
|
|
|
|
wait_for: yes
|
|
|
|
|
wait: yes
|
|
|
|
|
|
|
|
|
|
# Ensure ELB is gone and wait for check with timeout value
|
|
|
|
|
- local_action:
|
|
|
|
|
module: ec2_elb_lb
|
|
|
|
|
name: "test-please-delete"
|
|
|
|
|
state: absent
|
|
|
|
|
wait: yes
|
|
|
|
|
wait_timeout: 600
|
|
|
|
|
|
|
|
|
|
# Normally, this module will purge any listeners that exist on the ELB
|
|
|
|
|
# but aren't specified in the listeners parameter. If purge_listeners is
|
|
|
|
@ -337,7 +352,7 @@ class ElbManager(object):
|
|
|
|
|
scheme="internet-facing", connection_draining_timeout=None,
|
|
|
|
|
idle_timeout=None,
|
|
|
|
|
cross_az_load_balancing=None, access_logs=None,
|
|
|
|
|
stickiness=None, wait_for=None, region=None, **aws_connect_params):
|
|
|
|
|
stickiness=None, wait=None, wait_timeout=None, region=None, **aws_connect_params):
|
|
|
|
|
|
|
|
|
|
self.module = module
|
|
|
|
|
self.name = name
|
|
|
|
@ -355,7 +370,8 @@ class ElbManager(object):
|
|
|
|
|
self.cross_az_load_balancing = cross_az_load_balancing
|
|
|
|
|
self.access_logs = access_logs
|
|
|
|
|
self.stickiness = stickiness
|
|
|
|
|
self.wait_for = wait_for
|
|
|
|
|
self.wait = wait
|
|
|
|
|
self.wait_timeout = wait_timeout
|
|
|
|
|
|
|
|
|
|
self.aws_connect_params = aws_connect_params
|
|
|
|
|
self.region = region
|
|
|
|
@ -395,7 +411,7 @@ class ElbManager(object):
|
|
|
|
|
"""Destroy the ELB"""
|
|
|
|
|
if self.elb:
|
|
|
|
|
self._delete_elb()
|
|
|
|
|
if self.wait_for:
|
|
|
|
|
if self.wait:
|
|
|
|
|
elb_removed = self._wait_for_elb_removed()
|
|
|
|
|
# Unfortunately even though the ELB itself is removed quickly
|
|
|
|
|
# the interfaces take longer so reliant security groups cannot
|
|
|
|
@ -504,8 +520,8 @@ class ElbManager(object):
|
|
|
|
|
return info
|
|
|
|
|
|
|
|
|
|
def _wait_for_elb_removed(self):
|
|
|
|
|
polling_increment_secs = 30
|
|
|
|
|
max_retries = 10
|
|
|
|
|
polling_increment_secs = 15
|
|
|
|
|
max_retries = (self.wait_timeout / polling_increment_secs)
|
|
|
|
|
status_achieved = False
|
|
|
|
|
|
|
|
|
|
for x in range(0, max_retries):
|
|
|
|
@ -521,8 +537,8 @@ class ElbManager(object):
|
|
|
|
|
return status_achieved
|
|
|
|
|
|
|
|
|
|
def _wait_for_elb_interface_removed(self):
|
|
|
|
|
polling_increment_secs = 30
|
|
|
|
|
max_retries = 10
|
|
|
|
|
polling_increment_secs = 15
|
|
|
|
|
max_retries = (self.wait_timeout / polling_increment_secs)
|
|
|
|
|
status_achieved = False
|
|
|
|
|
|
|
|
|
|
elb_interfaces = self.ec2_conn.get_all_network_interfaces(
|
|
|
|
@ -970,7 +986,8 @@ def main():
|
|
|
|
|
cross_az_load_balancing={'default': None, 'required': False},
|
|
|
|
|
stickiness={'default': None, 'required': False, 'type': 'dict'},
|
|
|
|
|
access_logs={'default': None, 'required': False, 'type': 'dict'},
|
|
|
|
|
wait_for={'default': False, 'type': 'bool', 'required': False}
|
|
|
|
|
wait={'default': False, 'type': 'bool', 'required': False},
|
|
|
|
|
wait_timeout={'default': 60, 'type': 'int', 'required': False}
|
|
|
|
|
)
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
@ -1003,7 +1020,8 @@ def main():
|
|
|
|
|
idle_timeout = module.params['idle_timeout']
|
|
|
|
|
cross_az_load_balancing = module.params['cross_az_load_balancing']
|
|
|
|
|
stickiness = module.params['stickiness']
|
|
|
|
|
wait_for = module.params['wait_for']
|
|
|
|
|
wait = module.params['wait']
|
|
|
|
|
wait_timeout = module.params['wait_timeout']
|
|
|
|
|
|
|
|
|
|
if state == 'present' and not listeners:
|
|
|
|
|
module.fail_json(msg="At least one port is required for ELB creation")
|
|
|
|
@ -1011,6 +1029,9 @@ def main():
|
|
|
|
|
if state == 'present' and not (zones or subnets):
|
|
|
|
|
module.fail_json(msg="At least one availability zone or subnet is required for ELB creation")
|
|
|
|
|
|
|
|
|
|
if wait_timeout > 600:
|
|
|
|
|
module.fail_json(msg='wait_timeout maximum is 600 seconds')
|
|
|
|
|
|
|
|
|
|
if security_group_names:
|
|
|
|
|
security_group_ids = []
|
|
|
|
|
try:
|
|
|
|
@ -1031,7 +1052,7 @@ def main():
|
|
|
|
|
subnets, purge_subnets, scheme,
|
|
|
|
|
connection_draining_timeout, idle_timeout,
|
|
|
|
|
cross_az_load_balancing,
|
|
|
|
|
access_logs, stickiness, wait_for,
|
|
|
|
|
access_logs, stickiness, wait, wait_timeout,
|
|
|
|
|
region=region, **aws_connect_params)
|
|
|
|
|
|
|
|
|
|
# check for unsupported attributes for this version of boto
|
|
|
|
|