mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Bug fixes for gcp_compute_backend_service (#42805)
This commit is contained in:
parent
476e98e0cf
commit
d1399ec5a2
2 changed files with 97 additions and 96 deletions
|
@ -83,7 +83,12 @@ options:
|
||||||
required: false
|
required: false
|
||||||
group:
|
group:
|
||||||
description:
|
description:
|
||||||
- A reference to InstanceGroup resource.
|
- This instance group defines the list of instances that serve traffic. Member virtual
|
||||||
|
machine instances from each instance group must live in the same zone as the instance
|
||||||
|
group itself.
|
||||||
|
- No two backends in a backend service are allowed to use same Instance Group resource.
|
||||||
|
- When the BackendService has load balancing scheme INTERNAL, the instance group must
|
||||||
|
be in a zone within the same region as the BackendService.
|
||||||
required: false
|
required: false
|
||||||
max_connections:
|
max_connections:
|
||||||
description:
|
description:
|
||||||
|
@ -215,7 +220,8 @@ options:
|
||||||
choices: ['HTTP', 'HTTPS', 'TCP', 'SSL']
|
choices: ['HTTP', 'HTTPS', 'TCP', 'SSL']
|
||||||
region:
|
region:
|
||||||
description:
|
description:
|
||||||
- A reference to Region resource.
|
- The region where the regional backend service resides.
|
||||||
|
- This field is not applicable to global backend services.
|
||||||
required: false
|
required: false
|
||||||
session_affinity:
|
session_affinity:
|
||||||
description:
|
description:
|
||||||
|
@ -238,19 +244,17 @@ extends_documentation_fragment: gcp
|
||||||
EXAMPLES = '''
|
EXAMPLES = '''
|
||||||
- name: create a instance group
|
- name: create a instance group
|
||||||
gcp_compute_instance_group:
|
gcp_compute_instance_group:
|
||||||
name: 'instancegroup-backendservice'
|
name: "instancegroup-backendservice"
|
||||||
zone: 'us-central1-a'
|
zone: us-central1-a
|
||||||
project: "{{ gcp_project }}"
|
project: "{{ gcp_project }}"
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
scopes:
|
|
||||||
- https://www.googleapis.com/auth/compute
|
|
||||||
state: present
|
state: present
|
||||||
register: instancegroup
|
register: instancegroup
|
||||||
|
|
||||||
- name: create a http health check
|
- name: create a http health check
|
||||||
gcp_compute_http_health_check:
|
gcp_compute_http_health_check:
|
||||||
name: 'httphealthcheck-backendservice'
|
name: "httphealthcheck-backendservice"
|
||||||
healthy_threshold: 10
|
healthy_threshold: 10
|
||||||
port: 8080
|
port: 8080
|
||||||
timeout_sec: 2
|
timeout_sec: 2
|
||||||
|
@ -258,24 +262,20 @@ EXAMPLES = '''
|
||||||
project: "{{ gcp_project }}"
|
project: "{{ gcp_project }}"
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
scopes:
|
|
||||||
- https://www.googleapis.com/auth/compute
|
|
||||||
state: present
|
state: present
|
||||||
register: healthcheck
|
register: healthcheck
|
||||||
|
|
||||||
- name: create a backend service
|
- name: create a backend service
|
||||||
gcp_compute_backend_service:
|
gcp_compute_backend_service:
|
||||||
name: testObject
|
name: "test_object"
|
||||||
backends:
|
backends:
|
||||||
- group: "{{ instancegroup }}"
|
- group: "{{ instancegroup }}"
|
||||||
health_checks:
|
health_checks:
|
||||||
- "{{ healthcheck.selfLink }}"
|
- "{{ healthcheck.selfLink }}"
|
||||||
enable_cdn: true
|
enable_cdn: true
|
||||||
project: testProject
|
project: "test_project"
|
||||||
auth_kind: service_account
|
auth_kind: "service_account"
|
||||||
service_account_file: /tmp/auth.pem
|
service_account_file: "/tmp/auth.pem"
|
||||||
scopes:
|
|
||||||
- https://www.googleapis.com/auth/compute
|
|
||||||
state: present
|
state: present
|
||||||
'''
|
'''
|
||||||
|
|
||||||
|
@ -320,7 +320,12 @@ RETURN = '''
|
||||||
type: str
|
type: str
|
||||||
group:
|
group:
|
||||||
description:
|
description:
|
||||||
- A reference to InstanceGroup resource.
|
- This instance group defines the list of instances that serve traffic. Member virtual
|
||||||
|
machine instances from each instance group must live in the same zone as the instance
|
||||||
|
group itself.
|
||||||
|
- No two backends in a backend service are allowed to use same Instance Group resource.
|
||||||
|
- When the BackendService has load balancing scheme INTERNAL, the instance group must
|
||||||
|
be in a zone within the same region as the BackendService.
|
||||||
returned: success
|
returned: success
|
||||||
type: dict
|
type: dict
|
||||||
max_connections:
|
max_connections:
|
||||||
|
@ -478,7 +483,8 @@ RETURN = '''
|
||||||
type: str
|
type: str
|
||||||
region:
|
region:
|
||||||
description:
|
description:
|
||||||
- A reference to Region resource.
|
- The region where the regional backend service resides.
|
||||||
|
- This field is not applicable to global backend services.
|
||||||
returned: success
|
returned: success
|
||||||
type: str
|
type: str
|
||||||
session_affinity:
|
session_affinity:
|
||||||
|
@ -554,6 +560,9 @@ def main():
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if not module.params['scopes']:
|
||||||
|
module.params['scopes'] = ['https://www.googleapis.com/auth/compute']
|
||||||
|
|
||||||
state = module.params['state']
|
state = module.params['state']
|
||||||
kind = 'compute#backendService'
|
kind = 'compute#backendService'
|
||||||
|
|
||||||
|
@ -563,10 +572,10 @@ def main():
|
||||||
if fetch:
|
if fetch:
|
||||||
if state == 'present':
|
if state == 'present':
|
||||||
if is_different(module, fetch):
|
if is_different(module, fetch):
|
||||||
fetch = update(module, self_link(module), kind, fetch)
|
fetch = update(module, self_link(module), kind)
|
||||||
changed = True
|
changed = True
|
||||||
else:
|
else:
|
||||||
delete(module, self_link(module), kind, fetch)
|
delete(module, self_link(module), kind)
|
||||||
fetch = {}
|
fetch = {}
|
||||||
changed = True
|
changed = True
|
||||||
else:
|
else:
|
||||||
|
@ -586,12 +595,12 @@ def create(module, link, kind):
|
||||||
return wait_for_operation(module, auth.post(link, resource_to_request(module)))
|
return wait_for_operation(module, auth.post(link, resource_to_request(module)))
|
||||||
|
|
||||||
|
|
||||||
def update(module, link, kind, fetch):
|
def update(module, link, kind):
|
||||||
auth = GcpSession(module, 'compute')
|
auth = GcpSession(module, 'compute')
|
||||||
return wait_for_operation(module, auth.put(link, resource_to_request(module)))
|
return wait_for_operation(module, auth.put(link, resource_to_request(module)))
|
||||||
|
|
||||||
|
|
||||||
def delete(module, link, kind, fetch):
|
def delete(module, link, kind):
|
||||||
auth = GcpSession(module, 'compute')
|
auth = GcpSession(module, 'compute')
|
||||||
return wait_for_operation(module, auth.delete(link))
|
return wait_for_operation(module, auth.delete(link))
|
||||||
|
|
||||||
|
@ -600,9 +609,9 @@ def resource_to_request(module):
|
||||||
request = {
|
request = {
|
||||||
u'kind': 'compute#backendService',
|
u'kind': 'compute#backendService',
|
||||||
u'affinityCookieTtlSec': module.params.get('affinity_cookie_ttl_sec'),
|
u'affinityCookieTtlSec': module.params.get('affinity_cookie_ttl_sec'),
|
||||||
u'backends': BackendServiceBackendArray(module.params.get('backends', []), module).to_request(),
|
u'backends': BackendServiceBackendsArray(module.params.get('backends', []), module).to_request(),
|
||||||
u'cdnPolicy': BackeServiCdnPolic(module.params.get('cdn_policy', {}), module).to_request(),
|
u'cdnPolicy': BackendServiceCdnPolicy(module.params.get('cdn_policy', {}), module).to_request(),
|
||||||
u'connectionDraining': BackeServiConneDrain(module.params.get('connection_draining', {}), module).to_request(),
|
u'connectionDraining': BackendServiceConnectionDraining(module.params.get('connection_draining', {}), module).to_request(),
|
||||||
u'description': module.params.get('description'),
|
u'description': module.params.get('description'),
|
||||||
u'enableCDN': module.params.get('enable_cdn'),
|
u'enableCDN': module.params.get('enable_cdn'),
|
||||||
u'healthChecks': module.params.get('health_checks'),
|
u'healthChecks': module.params.get('health_checks'),
|
||||||
|
@ -680,9 +689,9 @@ def is_different(module, response):
|
||||||
def response_to_hash(module, response):
|
def response_to_hash(module, response):
|
||||||
return {
|
return {
|
||||||
u'affinityCookieTtlSec': response.get(u'affinityCookieTtlSec'),
|
u'affinityCookieTtlSec': response.get(u'affinityCookieTtlSec'),
|
||||||
u'backends': BackendServiceBackendArray(response.get(u'backends', []), module).from_response(),
|
u'backends': BackendServiceBackendsArray(response.get(u'backends', []), module).from_response(),
|
||||||
u'cdnPolicy': BackeServiCdnPolic(response.get(u'cdnPolicy', {}), module).from_response(),
|
u'cdnPolicy': BackendServiceCdnPolicy(response.get(u'cdnPolicy', {}), module).from_response(),
|
||||||
u'connectionDraining': BackeServiConneDrain(response.get(u'connectionDraining', {}), module).from_response(),
|
u'connectionDraining': BackendServiceConnectionDraining(response.get(u'connectionDraining', {}), module).from_response(),
|
||||||
u'creationTimestamp': response.get(u'creationTimestamp'),
|
u'creationTimestamp': response.get(u'creationTimestamp'),
|
||||||
u'description': response.get(u'description'),
|
u'description': response.get(u'description'),
|
||||||
u'enableCDN': response.get(u'enableCDN'),
|
u'enableCDN': response.get(u'enableCDN'),
|
||||||
|
@ -718,7 +727,7 @@ def async_op_url(module, extra_data=None):
|
||||||
def wait_for_operation(module, response):
|
def wait_for_operation(module, response):
|
||||||
op_result = return_if_object(module, response, 'compute#operation')
|
op_result = return_if_object(module, response, 'compute#operation')
|
||||||
if op_result is None:
|
if op_result is None:
|
||||||
return None
|
return {}
|
||||||
status = navigate_hash(op_result, ['status'])
|
status = navigate_hash(op_result, ['status'])
|
||||||
wait_done = wait_for_completion(status, op_result, module)
|
wait_done = wait_for_completion(status, op_result, module)
|
||||||
return fetch_resource(module, navigate_hash(wait_done, ['targetLink']), 'compute#backendService')
|
return fetch_resource(module, navigate_hash(wait_done, ['targetLink']), 'compute#backendService')
|
||||||
|
@ -743,7 +752,7 @@ def raise_if_errors(response, err_path, module):
|
||||||
module.fail_json(msg=errors)
|
module.fail_json(msg=errors)
|
||||||
|
|
||||||
|
|
||||||
class BackendServiceBackendArray(object):
|
class BackendServiceBackendsArray(object):
|
||||||
def __init__(self, request, module):
|
def __init__(self, request, module):
|
||||||
self.module = module
|
self.module = module
|
||||||
if request:
|
if request:
|
||||||
|
@ -790,7 +799,7 @@ class BackendServiceBackendArray(object):
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
class BackeServiCdnPolic(object):
|
class BackendServiceCdnPolicy(object):
|
||||||
def __init__(self, request, module):
|
def __init__(self, request, module):
|
||||||
self.module = module
|
self.module = module
|
||||||
if request:
|
if request:
|
||||||
|
@ -800,16 +809,16 @@ class BackeServiCdnPolic(object):
|
||||||
|
|
||||||
def to_request(self):
|
def to_request(self):
|
||||||
return remove_nones_from_dict({
|
return remove_nones_from_dict({
|
||||||
u'cacheKeyPolicy': BackServCachKeyPoli(self.request.get('cache_key_policy', {}), self.module).to_request()
|
u'cacheKeyPolicy': BackendServiceCacheKeyPolicy(self.request.get('cache_key_policy', {}), self.module).to_request()
|
||||||
})
|
})
|
||||||
|
|
||||||
def from_response(self):
|
def from_response(self):
|
||||||
return remove_nones_from_dict({
|
return remove_nones_from_dict({
|
||||||
u'cacheKeyPolicy': BackServCachKeyPoli(self.request.get(u'cacheKeyPolicy', {}), self.module).from_response()
|
u'cacheKeyPolicy': BackendServiceCacheKeyPolicy(self.request.get(u'cacheKeyPolicy', {}), self.module).from_response()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
class BackServCachKeyPoli(object):
|
class BackendServiceCacheKeyPolicy(object):
|
||||||
def __init__(self, request, module):
|
def __init__(self, request, module):
|
||||||
self.module = module
|
self.module = module
|
||||||
if request:
|
if request:
|
||||||
|
@ -836,7 +845,7 @@ class BackServCachKeyPoli(object):
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
class BackeServiConneDrain(object):
|
class BackendServiceConnectionDraining(object):
|
||||||
def __init__(self, request, module):
|
def __init__(self, request, module):
|
||||||
self.module = module
|
self.module = module
|
||||||
if request:
|
if request:
|
||||||
|
|
|
@ -15,18 +15,16 @@
|
||||||
# Pre-test setup
|
# Pre-test setup
|
||||||
- name: create a instance group
|
- name: create a instance group
|
||||||
gcp_compute_instance_group:
|
gcp_compute_instance_group:
|
||||||
name: 'instancegroup-backendservice'
|
name: "instancegroup-backendservice"
|
||||||
zone: 'us-central1-a'
|
zone: us-central1-a
|
||||||
project: "{{ gcp_project }}"
|
project: "{{ gcp_project }}"
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
scopes:
|
|
||||||
- https://www.googleapis.com/auth/compute
|
|
||||||
state: present
|
state: present
|
||||||
register: instancegroup
|
register: instancegroup
|
||||||
- name: create a http health check
|
- name: create a http health check
|
||||||
gcp_compute_http_health_check:
|
gcp_compute_http_health_check:
|
||||||
name: 'httphealthcheck-backendservice'
|
name: "httphealthcheck-backendservice"
|
||||||
healthy_threshold: 10
|
healthy_threshold: 10
|
||||||
port: 8080
|
port: 8080
|
||||||
timeout_sec: 2
|
timeout_sec: 2
|
||||||
|
@ -34,38 +32,32 @@
|
||||||
project: "{{ gcp_project }}"
|
project: "{{ gcp_project }}"
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
scopes:
|
|
||||||
- https://www.googleapis.com/auth/compute
|
|
||||||
state: present
|
state: present
|
||||||
register: healthcheck
|
register: healthcheck
|
||||||
- name: delete a backend service
|
- name: delete a backend service
|
||||||
gcp_compute_backend_service:
|
gcp_compute_backend_service:
|
||||||
name: "{{ resource_name }}"
|
name: "{{ resource_name }}"
|
||||||
backends:
|
backends:
|
||||||
- group: "{{ instancegroup }}"
|
- group: "{{ instancegroup }}"
|
||||||
health_checks:
|
health_checks:
|
||||||
- "{{ healthcheck.selfLink }}"
|
- "{{ healthcheck.selfLink }}"
|
||||||
enable_cdn: true
|
enable_cdn: true
|
||||||
project: "{{ gcp_project }}"
|
project: "{{ gcp_project }}"
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
scopes:
|
|
||||||
- https://www.googleapis.com/auth/compute
|
|
||||||
state: absent
|
state: absent
|
||||||
#----------------------------------------------------------
|
#----------------------------------------------------------
|
||||||
- name: create a backend service
|
- name: create a backend service
|
||||||
gcp_compute_backend_service:
|
gcp_compute_backend_service:
|
||||||
name: "{{ resource_name }}"
|
name: "{{ resource_name }}"
|
||||||
backends:
|
backends:
|
||||||
- group: "{{ instancegroup }}"
|
- group: "{{ instancegroup }}"
|
||||||
health_checks:
|
health_checks:
|
||||||
- "{{ healthcheck.selfLink }}"
|
- "{{ healthcheck.selfLink }}"
|
||||||
enable_cdn: true
|
enable_cdn: true
|
||||||
project: "{{ gcp_project }}"
|
project: "{{ gcp_project }}"
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
scopes:
|
|
||||||
- https://www.googleapis.com/auth/compute
|
|
||||||
state: present
|
state: present
|
||||||
register: result
|
register: result
|
||||||
- name: assert changed is true
|
- name: assert changed is true
|
||||||
|
@ -74,27 +66,31 @@
|
||||||
- result.changed == true
|
- result.changed == true
|
||||||
- "result.kind == 'compute#backendService'"
|
- "result.kind == 'compute#backendService'"
|
||||||
- name: verify that backend_service was created
|
- name: verify that backend_service was created
|
||||||
shell: |
|
gcp_compute_backend_service_facts:
|
||||||
gcloud compute backend-services describe --project="{{ gcp_project}}" --global "{{ resource_name }}"
|
filters:
|
||||||
register: results
|
- name = {{ resource_name }}
|
||||||
- name: verify that command succeeded
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- results.rc == 0
|
|
||||||
# ----------------------------------------------------------------------------
|
|
||||||
- name: create a backend service that already exists
|
|
||||||
gcp_compute_backend_service:
|
|
||||||
name: "{{ resource_name }}"
|
|
||||||
backends:
|
|
||||||
- group: "{{ instancegroup }}"
|
|
||||||
health_checks:
|
|
||||||
- "{{ healthcheck.selfLink }}"
|
|
||||||
enable_cdn: true
|
|
||||||
project: "{{ gcp_project }}"
|
project: "{{ gcp_project }}"
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
scopes:
|
scopes:
|
||||||
- https://www.googleapis.com/auth/compute
|
- https://www.googleapis.com/auth/compute
|
||||||
|
register: results
|
||||||
|
- name: verify that command succeeded
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- results['items'] | length == 1
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
- name: create a backend service that already exists
|
||||||
|
gcp_compute_backend_service:
|
||||||
|
name: "{{ resource_name }}"
|
||||||
|
backends:
|
||||||
|
- group: "{{ instancegroup }}"
|
||||||
|
health_checks:
|
||||||
|
- "{{ healthcheck.selfLink }}"
|
||||||
|
enable_cdn: true
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
state: present
|
state: present
|
||||||
register: result
|
register: result
|
||||||
- name: assert changed is false
|
- name: assert changed is false
|
||||||
|
@ -107,15 +103,13 @@
|
||||||
gcp_compute_backend_service:
|
gcp_compute_backend_service:
|
||||||
name: "{{ resource_name }}"
|
name: "{{ resource_name }}"
|
||||||
backends:
|
backends:
|
||||||
- group: "{{ instancegroup }}"
|
- group: "{{ instancegroup }}"
|
||||||
health_checks:
|
health_checks:
|
||||||
- "{{ healthcheck.selfLink }}"
|
- "{{ healthcheck.selfLink }}"
|
||||||
enable_cdn: true
|
enable_cdn: true
|
||||||
project: "{{ gcp_project }}"
|
project: "{{ gcp_project }}"
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
scopes:
|
|
||||||
- https://www.googleapis.com/auth/compute
|
|
||||||
state: absent
|
state: absent
|
||||||
register: result
|
register: result
|
||||||
- name: assert changed is true
|
- name: assert changed is true
|
||||||
|
@ -124,29 +118,31 @@
|
||||||
- result.changed == true
|
- result.changed == true
|
||||||
- result.has_key('kind') == False
|
- result.has_key('kind') == False
|
||||||
- name: verify that backend_service was deleted
|
- name: verify that backend_service was deleted
|
||||||
shell: |
|
gcp_compute_backend_service_facts:
|
||||||
gcloud compute backend-services describe --project="{{ gcp_project}}" --global "{{ resource_name }}"
|
filters:
|
||||||
register: results
|
- name = {{ resource_name }}
|
||||||
failed_when: results.rc == 0
|
|
||||||
- name: verify that command succeeded
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- results.rc == 1
|
|
||||||
- "\"'projects/{{ gcp_project }}/global/backendServices/{{ resource_name }}' was not found\" in results.stderr"
|
|
||||||
# ----------------------------------------------------------------------------
|
|
||||||
- name: delete a backend service that does not exist
|
|
||||||
gcp_compute_backend_service:
|
|
||||||
name: "{{ resource_name }}"
|
|
||||||
backends:
|
|
||||||
- group: "{{ instancegroup }}"
|
|
||||||
health_checks:
|
|
||||||
- "{{ healthcheck.selfLink }}"
|
|
||||||
enable_cdn: true
|
|
||||||
project: "{{ gcp_project }}"
|
project: "{{ gcp_project }}"
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
scopes:
|
scopes:
|
||||||
- https://www.googleapis.com/auth/compute
|
- https://www.googleapis.com/auth/compute
|
||||||
|
register: results
|
||||||
|
- name: verify that command succeeded
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- results['items'] | length == 0
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
- name: delete a backend service that does not exist
|
||||||
|
gcp_compute_backend_service:
|
||||||
|
name: "{{ resource_name }}"
|
||||||
|
backends:
|
||||||
|
- group: "{{ instancegroup }}"
|
||||||
|
health_checks:
|
||||||
|
- "{{ healthcheck.selfLink }}"
|
||||||
|
enable_cdn: true
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
state: absent
|
state: absent
|
||||||
register: result
|
register: result
|
||||||
- name: assert changed is false
|
- name: assert changed is false
|
||||||
|
@ -158,7 +154,7 @@
|
||||||
# Post-test teardown
|
# Post-test teardown
|
||||||
- name: delete a http health check
|
- name: delete a http health check
|
||||||
gcp_compute_http_health_check:
|
gcp_compute_http_health_check:
|
||||||
name: 'httphealthcheck-backendservice'
|
name: "httphealthcheck-backendservice"
|
||||||
healthy_threshold: 10
|
healthy_threshold: 10
|
||||||
port: 8080
|
port: 8080
|
||||||
timeout_sec: 2
|
timeout_sec: 2
|
||||||
|
@ -166,18 +162,14 @@
|
||||||
project: "{{ gcp_project }}"
|
project: "{{ gcp_project }}"
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
scopes:
|
|
||||||
- https://www.googleapis.com/auth/compute
|
|
||||||
state: absent
|
state: absent
|
||||||
register: healthcheck
|
register: healthcheck
|
||||||
- name: delete a instance group
|
- name: delete a instance group
|
||||||
gcp_compute_instance_group:
|
gcp_compute_instance_group:
|
||||||
name: 'instancegroup-backendservice'
|
name: "instancegroup-backendservice"
|
||||||
zone: 'us-central1-a'
|
zone: us-central1-a
|
||||||
project: "{{ gcp_project }}"
|
project: "{{ gcp_project }}"
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
scopes:
|
|
||||||
- https://www.googleapis.com/auth/compute
|
|
||||||
state: absent
|
state: absent
|
||||||
register: instancegroup
|
register: instancegroup
|
||||||
|
|
Loading…
Reference in a new issue