From 044dd699c22ae23cad80d62d3a4b4e23aeb8a00d Mon Sep 17 00:00:00 2001 From: Kaz Cheng Date: Fri, 6 Oct 2017 14:27:30 +1000 Subject: [PATCH] Addition of TCP protocol to ELB target group (#31228) * Addition of TCP protocol to ELB target group as target groups support HTTP/S and TCP now * Fixup stickiness type so that it checks if the current_tg has the stickiness_type key in the dict, as TCP ones do not --- lib/ansible/modules/cloud/amazon/elb_target_group.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/ansible/modules/cloud/amazon/elb_target_group.py b/lib/ansible/modules/cloud/amazon/elb_target_group.py index 7b7bc900f73..ed057fcf4b2 100644 --- a/lib/ansible/modules/cloud/amazon/elb_target_group.py +++ b/lib/ansible/modules/cloud/amazon/elb_target_group.py @@ -28,7 +28,7 @@ options: description: - The protocol the load balancer uses when performing health checks on targets. required: false - choices: [ 'http', 'https' ] + choices: [ 'http', 'https', 'tcp' ] health_check_port: description: - The port the load balancer uses when performing health checks on targets. @@ -68,7 +68,7 @@ options: description: - The protocol to use for routing traffic to the targets. Required when I(state) is C(present). required: false - choices: [ 'http', 'https' ] + choices: [ 'http', 'https', 'tcp' ] purge_tags: description: - If yes, existing tags will be purged from the resource to match exactly what is defined by I(tags) parameter. If the tag parameter is not set then @@ -549,7 +549,7 @@ def create_or_update_target_group(connection, module): if stickiness_lb_cookie_duration is not None: if str(stickiness_lb_cookie_duration) != current_tg_attributes['stickiness_lb_cookie_duration_seconds']: update_attributes.append({'Key': 'stickiness.lb_cookie.duration_seconds', 'Value': str(stickiness_lb_cookie_duration)}) - if stickiness_type is not None: + if stickiness_type is not None and "stickiness_type" in current_tg_attributes: if stickiness_type != current_tg_attributes['stickiness_type']: update_attributes.append({'Key': 'stickiness.type', 'Value': stickiness_type}) @@ -620,7 +620,7 @@ def main(): argument_spec.update( dict( deregistration_delay_timeout=dict(type='int'), - health_check_protocol=dict(choices=['http', 'https', 'HTTP', 'HTTPS'], type='str'), + health_check_protocol=dict(choices=['http', 'https', 'tcp', 'HTTP', 'HTTPS', 'TCP'], type='str'), health_check_port=dict(type='int'), health_check_path=dict(default=None, type='str'), health_check_interval=dict(type='int'), @@ -629,7 +629,7 @@ def main(): modify_targets=dict(default=True, type='bool'), name=dict(required=True, type='str'), port=dict(type='int'), - protocol=dict(choices=['http', 'https', 'HTTP', 'HTTPS'], type='str'), + protocol=dict(choices=['http', 'https', 'tcp', 'HTTP', 'HTTPS', 'TCP'], type='str'), purge_tags=dict(default=True, type='bool'), stickiness_enabled=dict(type='bool'), stickiness_type=dict(default='lb_cookie', type='str'),