From c77d5cb7ef2bd7511b15d2bd9d560198b10ba972 Mon Sep 17 00:00:00 2001 From: The Magician Date: Fri, 30 Nov 2018 15:47:47 -0800 Subject: [PATCH] Add support for content-based load balancing to HealthCheck (#138) /cc @rileykarson --- .../cloud/google/gcp_compute_health_check.py | 32 +++++++++++++++++++ .../google/gcp_compute_health_check_facts.py | 14 ++++++++ 2 files changed, 46 insertions(+) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_health_check.py b/lib/ansible/modules/cloud/google/gcp_compute_health_check.py index 232dc92f78510d..1ef36f1092af84 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_health_check.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_health_check.py @@ -124,6 +124,12 @@ - The default value is /. required: false default: "/" + response: + description: + - The bytes to match against the beginning of the response data. If left empty + (the default value), any response will indicate health. The response data + can only be ASCII. + required: false port: description: - The TCP port number for the HTTP health check request. @@ -160,6 +166,12 @@ - The default value is /. required: false default: "/" + response: + description: + - The bytes to match against the beginning of the response data. If left empty + (the default value), any response will indicate health. The response data + can only be ASCII. + required: false port: description: - The TCP port number for the HTTPS health check request. @@ -352,6 +364,13 @@ - The default value is /. returned: success type: str + response: + description: + - The bytes to match against the beginning of the response data. If left empty + (the default value), any response will indicate health. The response data + can only be ASCII. + returned: success + type: str port: description: - The TCP port number for the HTTP health check request. @@ -389,6 +408,13 @@ - The default value is /. returned: success type: str + response: + description: + - The bytes to match against the beginning of the response data. If left empty + (the default value), any response will indicate health. The response data + can only be ASCII. + returned: success + type: str port: description: - The TCP port number for the HTTPS health check request. @@ -514,6 +540,7 @@ def main(): http_health_check=dict(type='dict', options=dict( host=dict(type='str'), request_path=dict(default='/', type='str'), + response=dict(type='str'), port=dict(type='int'), port_name=dict(type='str'), proxy_header=dict(default='NONE', type='str', choices=['NONE', 'PROXY_V1']) @@ -521,6 +548,7 @@ def main(): https_health_check=dict(type='dict', options=dict( host=dict(type='str'), request_path=dict(default='/', type='str'), + response=dict(type='str'), port=dict(type='int'), port_name=dict(type='str'), proxy_header=dict(default='NONE', type='str', choices=['NONE', 'PROXY_V1']) @@ -730,6 +758,7 @@ def to_request(self): return remove_nones_from_dict({ u'host': self.request.get('host'), u'requestPath': self.request.get('request_path'), + u'response': self.request.get('response'), u'port': self.request.get('port'), u'portName': self.request.get('port_name'), u'proxyHeader': self.request.get('proxy_header') @@ -739,6 +768,7 @@ def from_response(self): return remove_nones_from_dict({ u'host': self.request.get(u'host'), u'requestPath': self.request.get(u'requestPath'), + u'response': self.request.get(u'response'), u'port': self.request.get(u'port'), u'portName': self.request.get(u'portName'), u'proxyHeader': self.request.get(u'proxyHeader') @@ -757,6 +787,7 @@ def to_request(self): return remove_nones_from_dict({ u'host': self.request.get('host'), u'requestPath': self.request.get('request_path'), + u'response': self.request.get('response'), u'port': self.request.get('port'), u'portName': self.request.get('port_name'), u'proxyHeader': self.request.get('proxy_header') @@ -766,6 +797,7 @@ def from_response(self): return remove_nones_from_dict({ u'host': self.request.get(u'host'), u'requestPath': self.request.get(u'requestPath'), + u'response': self.request.get(u'response'), u'port': self.request.get(u'port'), u'portName': self.request.get(u'portName'), u'proxyHeader': self.request.get(u'proxyHeader') diff --git a/lib/ansible/modules/cloud/google/gcp_compute_health_check_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_health_check_facts.py index a35592f7a814bc..41dbf5735d111e 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_health_check_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_health_check_facts.py @@ -142,6 +142,13 @@ - The default value is /. returned: success type: str + response: + description: + - The bytes to match against the beginning of the response data. If left + empty (the default value), any response will indicate health. The response + data can only be ASCII. + returned: success + type: str port: description: - The TCP port number for the HTTP health check request. @@ -179,6 +186,13 @@ - The default value is /. returned: success type: str + response: + description: + - The bytes to match against the beginning of the response data. If left + empty (the default value), any response will indicate health. The response + data can only be ASCII. + returned: success + type: str port: description: - The TCP port number for the HTTPS health check request.