From b87e1a023d1bebb50a0735498801697bd1b7b821 Mon Sep 17 00:00:00 2001 From: Rob <wimnat@users.noreply.github.com> Date: Tue, 3 Jul 2018 04:31:56 +1000 Subject: [PATCH] [aws] add support for http2 to AWS ALB (#40372) --- lib/ansible/module_utils/aws/elbv2.py | 15 +++++++-------- .../modules/cloud/amazon/elb_application_lb.py | 13 +++++++++++++ 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/lib/ansible/module_utils/aws/elbv2.py b/lib/ansible/module_utils/aws/elbv2.py index 74632ed4557..7928f66fa41 100644 --- a/lib/ansible/module_utils/aws/elbv2.py +++ b/lib/ansible/module_utils/aws/elbv2.py @@ -228,6 +228,7 @@ class ApplicationLoadBalancer(ElasticLoadBalancerV2): self.access_logs_s3_bucket = module.params.get("access_logs_s3_bucket") self.access_logs_s3_prefix = module.params.get("access_logs_s3_prefix") self.idle_timeout = module.params.get("idle_timeout") + self.http2 = module.params.get("http2") if self.elb is not None and self.elb['Type'] != 'application': self.module.fail_json(msg="The load balancer type you are trying to manage is not application. Try elb_network_lb module instead.") @@ -271,20 +272,18 @@ class ApplicationLoadBalancer(ElasticLoadBalancerV2): update_attributes = [] - if self.access_logs_enabled and self.elb_attributes['access_logs_s3_enabled'] != "true": - update_attributes.append({'Key': 'access_logs.s3.enabled', 'Value': "true"}) - if not self.access_logs_enabled and self.elb_attributes['access_logs_s3_enabled'] != "false": - update_attributes.append({'Key': 'access_logs.s3.enabled', 'Value': 'false'}) + if self.access_logs_enabled is not None and str(self.access_logs_enabled).lower() != self.elb_attributes['access_logs_s3_enabled']: + update_attributes.append({'Key': 'access_logs.s3.enabled', 'Value': str(self.access_logs_enabled).lower()}) if self.access_logs_s3_bucket is not None and self.access_logs_s3_bucket != self.elb_attributes['access_logs_s3_bucket']: update_attributes.append({'Key': 'access_logs.s3.bucket', 'Value': self.access_logs_s3_bucket}) if self.access_logs_s3_prefix is not None and self.access_logs_s3_prefix != self.elb_attributes['access_logs_s3_prefix']: update_attributes.append({'Key': 'access_logs.s3.prefix', 'Value': self.access_logs_s3_prefix}) - if self.deletion_protection and self.elb_attributes['deletion_protection_enabled'] != "true": - update_attributes.append({'Key': 'deletion_protection.enabled', 'Value': "true"}) - if self.deletion_protection is not None and not self.deletion_protection and self.elb_attributes['deletion_protection_enabled'] != "false": - update_attributes.append({'Key': 'deletion_protection.enabled', 'Value': "false"}) + if self.deletion_protection is not None and str(self.deletion_protection).lower() != self.elb_attributes['deletion_protection_enabled']: + update_attributes.append({'Key': 'deletion_protection.enabled', 'Value': str(self.deletion_protection).lower()}) if self.idle_timeout is not None and str(self.idle_timeout) != self.elb_attributes['idle_timeout_timeout_seconds']: update_attributes.append({'Key': 'idle_timeout.timeout_seconds', 'Value': str(self.idle_timeout)}) + if self.http2 is not None and str(self.http2).lower() != self.elb_attributes['routing_http2_enabled']: + update_attributes.append({'Key': 'routing.http2.enabled', 'Value': str(self.http2).lower()}) if update_attributes: try: diff --git a/lib/ansible/modules/cloud/amazon/elb_application_lb.py b/lib/ansible/modules/cloud/amazon/elb_application_lb.py index 42f31d7051b..3985e9c70b5 100644 --- a/lib/ansible/modules/cloud/amazon/elb_application_lb.py +++ b/lib/ansible/modules/cloud/amazon/elb_application_lb.py @@ -48,6 +48,13 @@ options: required: false default: no type: bool + http2: + description: + - Indicates whether to enable HTTP2 routing. + required: false + default: no + type: bool + version_added: 2.6 idle_timeout: description: - The number of seconds to wait before an idle connection is closed. @@ -320,6 +327,11 @@ load_balancer_name: returned: when state is present type: string sample: my-elb +routing_http2_enabled: + description: Indicates whether HTTP/2 is enabled. + returned: when state is present + type: string + sample: true scheme: description: Internet-facing or internal load balancer. returned: when state is present @@ -490,6 +502,7 @@ def main(): access_logs_s3_bucket=dict(type='str'), access_logs_s3_prefix=dict(type='str'), deletion_protection=dict(type='bool'), + http2=dict(type='bool'), idle_timeout=dict(type='int'), listeners=dict(type='list', elements='dict',