From 8d286d7b2b78cdb9634404c66a85fd7e74708485 Mon Sep 17 00:00:00 2001 From: Alex Stephen Date: Wed, 2 May 2018 00:06:15 +0000 Subject: [PATCH 001/144] Initial MM commit --- lib/ansible/modules/cloud/google/gcp_dns_resource_record_set.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ansible/modules/cloud/google/gcp_dns_resource_record_set.py b/lib/ansible/modules/cloud/google/gcp_dns_resource_record_set.py index 1e4050108c39f1..3f5331256568fd 100644 --- a/lib/ansible/modules/cloud/google/gcp_dns_resource_record_set.py +++ b/lib/ansible/modules/cloud/google/gcp_dns_resource_record_set.py @@ -38,7 +38,7 @@ - The record will include the domain/subdomain name, a type (i.e. A, AAA, CAA, MX, CNAME, NS, etc) . short_description: Creates a GCP ResourceRecordSet -version_added: 2.6 +version_added: 2.5 author: Google Inc. (@googlecloudplatform) requirements: - python >= 2.6 From 4d233d5f86953465fe926c006b27d4bf127f2fbe Mon Sep 17 00:00:00 2001 From: The Magician Date: Tue, 29 May 2018 14:01:30 -0700 Subject: [PATCH 002/144] Ansible support on the Magician. (#7) /cc @rambleraptor --- .../modules/cloud/google/gcp_compute_target_tcp_proxy.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_tcp_proxy.py b/lib/ansible/modules/cloud/google/gcp_compute_target_tcp_proxy.py index f8fea560407aae..1e3de10bc21f55 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_tcp_proxy.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_tcp_proxy.py @@ -206,10 +206,10 @@ def main(): if fetch: if state == 'present': if is_different(module, fetch): - fetch = update(module, self_link(module), kind) + fetch = update(module, self_link(module), kind, fetch) changed = True else: - delete(module, self_link(module), kind) + delete(module, self_link(module), kind, fetch) fetch = {} changed = True else: @@ -229,12 +229,12 @@ def create(module, link, kind): return wait_for_operation(module, auth.post(link, resource_to_request(module))) -def update(module, link, kind): +def update(module, link, kind, fetch): auth = GcpSession(module, 'compute') return wait_for_operation(module, auth.put(link, resource_to_request(module))) -def delete(module, link, kind): +def delete(module, link, kind, fetch): auth = GcpSession(module, 'compute') return wait_for_operation(module, auth.delete(link)) From c389004b6df38ab69cfd6c0c11713c0eba2780d2 Mon Sep 17 00:00:00 2001 From: The Magician Date: Tue, 29 May 2018 16:14:53 -0700 Subject: [PATCH 003/144] Bringing Ansible to HEAD (#9) /cc @rambleraptor --- lib/ansible/plugins/lookup/gcp_lookup.py | 327 +++++++++++++++++++++++ 1 file changed, 327 insertions(+) create mode 100644 lib/ansible/plugins/lookup/gcp_lookup.py diff --git a/lib/ansible/plugins/lookup/gcp_lookup.py b/lib/ansible/plugins/lookup/gcp_lookup.py new file mode 100644 index 00000000000000..2efc014d55b1db --- /dev/null +++ b/lib/ansible/plugins/lookup/gcp_lookup.py @@ -0,0 +1,327 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2017 Google +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) +# ---------------------------------------------------------------------------- +# +# *** AUTO GENERATED CODE *** AUTO GENERATED CODE *** +# +# ---------------------------------------------------------------------------- +# +# This file is automatically generated by Magic Modules and manual +# changes will be clobbered when the file is regenerated. +# +# Please read more about how to change this file at +# https://www.github.com/GoogleCloudPlatform/magic-modules +# +# ---------------------------------------------------------------------------- + +from __future__ import (absolute_import, division, print_function) +__metaclass__ = type + +DOCUMENTATION = """ +lookup: gcp_lookup +author: + - Google (@googlecloudplatform) +version_added: "2.6" +requirements: + - python >= 2.6 + - requests >= 2.18.4 + - google-auth >= 1.3.0 +extends_documentation_fragment: + - gcp +short_description: Look up and verify GCP Attributes +description: + - Describes attributes on GCP. You can specify one of the listed + attribute choices or omit it to see all attributes. +options: + attribute: + description: The attribute for which to get the value(s). + default: null + choices: + - disk_type + - license + - machine_type + - region + - zone + return: + description: An optional value to describe what part of the attribute should + be returned + default: null +""" + +EXAMPLES = """ +vars: + account_details: "{{ lookup('gcp_lookup', + attribute='region', + label='us-west1', + auth_kind='serviceaccount', + service_account_file='/tmp/my_account.json', + project='test-project', + scopes=['https://www.googleapis.com/auth/compute']) }}" + # us-west1 + account_details: "{{ lookup('gcp_lookup', + attribute='region', + return='self_link', + label='us-west1', + auth_kind='serviceaccount', + service_account_file='/tmp/my_account.json', + project='test-project', + scopes=['https://www.googleapis.com/auth/compute']) }}" + # us-west1 + +""" + +RETURN = """ +""" + + +################################################################################ +# Imports +################################################################################ + +from ansible.errors import AnsibleError +from ansible.plugins import AnsiblePlugin +from ansible.plugins.lookup import LookupBase +from ansible.module_utils.gcp_utils import navigate_hash, GcpSession, GcpRequestException +import json + +################################################################################ +# Main +################################################################################ + + +class GcpModule(object): + def __init__(self, options): + self.params = options + if 'label' in self.params: + self.params['name'] = self.params['label'] + del self.params['label'] + + def fail_json(self, **kwargs): + raise AnsibleError(kwargs['msg']) + + +class GcpDiskType(object): + def __init__(self, options): + self.module = GcpModule(options) + + self.kind = 'compute#diskType' + self.link = "https://www.googleapis.com/compute/v1/projects/{project}/zones/{zone}/diskTypes/{name}".format(**self.module.params) + + def _fetch_resource(self): + auth = GcpSession(self.module, 'compute') + return self._return_if_object(auth.get(self.link)) + + def _return_if_object(self, response): + # If not found, return nothing. + if response.status_code == 404: + return None + + # If no content, return nothing. + if response.status_code == 204: + return None + + try: + response.raise_for_status + result = response.json() + except getattr(json.decoder, 'JSONDecodeError', ValueError) as inst: + self.module.fail_json(msg="Invalid JSON response with error: %s" % inst) + except GcpRequestException as inst: + self.module.fail_json(msg="Network error: %s" % inst) + + if navigate_hash(result, ['error', 'errors']): + self.module.fail_json(msg=navigate_hash(result, ['error', 'errors'])) + if result['kind'] != self.kind: + self.module.fail_json(msg="Incorrect result: {kind}".format(**result)) + + return result + + def run(self): + response = self._fetch_resource() + if 'return' in self.module.params: + return response[self.module.params['return']] + return response['self_link'] + + +class GcpLicense(object): + def __init__(self, options): + self.module = GcpModule(options) + + self.kind = 'compute#license' + self.link = "https://www.googleapis.com/compute/v1//projects/{project}/global/licenses/{name}".format(**self.module.params) + + def _fetch_resource(self): + auth = GcpSession(self.module, 'compute') + return self._return_if_object(auth.get(self.link)) + + def _return_if_object(self, response): + # If not found, return nothing. + if response.status_code == 404: + return None + + # If no content, return nothing. + if response.status_code == 204: + return None + + try: + response.raise_for_status + result = response.json() + except getattr(json.decoder, 'JSONDecodeError', ValueError) as inst: + self.module.fail_json(msg="Invalid JSON response with error: %s" % inst) + except GcpRequestException as inst: + self.module.fail_json(msg="Network error: %s" % inst) + + if navigate_hash(result, ['error', 'errors']): + self.module.fail_json(msg=navigate_hash(result, ['error', 'errors'])) + if result['kind'] != self.kind: + self.module.fail_json(msg="Incorrect result: {kind}".format(**result)) + + return result + + def run(self): + response = self._fetch_resource() + if 'return' in self.module.params: + return response[self.module.params['return']] + return response['self_link'] + + +class GcpMachineType(object): + def __init__(self, options): + self.module = GcpModule(options) + + self.kind = 'compute#machineType' + self.link = "https://www.googleapis.com/compute/v1/projects/{project}/zones/{zone}/machineTypes/{name}".format(**self.module.params) + + def _fetch_resource(self): + auth = GcpSession(self.module, 'compute') + return self._return_if_object(auth.get(self.link)) + + def _return_if_object(self, response): + # If not found, return nothing. + if response.status_code == 404: + return None + + # If no content, return nothing. + if response.status_code == 204: + return None + + try: + response.raise_for_status + result = response.json() + except getattr(json.decoder, 'JSONDecodeError', ValueError) as inst: + self.module.fail_json(msg="Invalid JSON response with error: %s" % inst) + except GcpRequestException as inst: + self.module.fail_json(msg="Network error: %s" % inst) + + if navigate_hash(result, ['error', 'errors']): + self.module.fail_json(msg=navigate_hash(result, ['error', 'errors'])) + if result['kind'] != self.kind: + self.module.fail_json(msg="Incorrect result: {kind}".format(**result)) + + return result + + def run(self): + response = self._fetch_resource() + if 'return' in self.module.params: + return response[self.module.params['return']] + return response['name'] + + +class GcpRegion(object): + def __init__(self, options): + self.module = GcpModule(options) + + self.kind = 'compute#region' + self.link = "https://www.googleapis.com/compute/v1/projects/{project}/regions/{name}".format(**self.module.params) + + def _fetch_resource(self): + auth = GcpSession(self.module, 'compute') + return self._return_if_object(auth.get(self.link)) + + def _return_if_object(self, response): + # If not found, return nothing. + if response.status_code == 404: + return None + + # If no content, return nothing. + if response.status_code == 204: + return None + + try: + response.raise_for_status + result = response.json() + except getattr(json.decoder, 'JSONDecodeError', ValueError) as inst: + self.module.fail_json(msg="Invalid JSON response with error: %s" % inst) + except GcpRequestException as inst: + self.module.fail_json(msg="Network error: %s" % inst) + + if navigate_hash(result, ['error', 'errors']): + self.module.fail_json(msg=navigate_hash(result, ['error', 'errors'])) + if result['kind'] != self.kind: + self.module.fail_json(msg="Incorrect result: {kind}".format(**result)) + + return result + + def run(self): + response = self._fetch_resource() + if 'return' in self.module.params: + return response[self.module.params['return']] + return response['name'] + + +class GcpZone(object): + def __init__(self, options): + self.module = GcpModule(options) + + self.kind = 'compute#zone' + self.link = "https://www.googleapis.com/compute/v1/projects/{project}/zones/{name}".format(**self.module.params) + + def _fetch_resource(self): + auth = GcpSession(self.module, 'compute') + return self._return_if_object(auth.get(self.link)) + + def _return_if_object(self, response): + # If not found, return nothing. + if response.status_code == 404: + return None + + # If no content, return nothing. + if response.status_code == 204: + return None + + try: + response.raise_for_status + result = response.json() + except getattr(json.decoder, 'JSONDecodeError', ValueError) as inst: + self.module.fail_json(msg="Invalid JSON response with error: %s" % inst) + except GcpRequestException as inst: + self.module.fail_json(msg="Network error: %s" % inst) + + if navigate_hash(result, ['error', 'errors']): + self.module.fail_json(msg=navigate_hash(result, ['error', 'errors'])) + if result['kind'] != self.kind: + self.module.fail_json(msg="Incorrect result: {kind}".format(**result)) + + return result + + def run(self): + response = self._fetch_resource() + if 'return' in self.module.params: + return response[self.module.params['return']] + return response['name'] + + +class LookupModule(LookupBase): + def run(self, terms, variables, **kwargs): + + self.set_options(var_options=variables, direct=kwargs) + options = { + 'disk_type': GcpDiskType, + 'license': GcpLicense, + 'machine_type': GcpMachineType, + 'region': GcpRegion, + 'zone': GcpZone + } + + return str(options[kwargs['attribute']](kwargs).run()) From 59d2b2f01587c2d1e25f3fe8771eda07ebb338e0 Mon Sep 17 00:00:00 2001 From: Nathan McKinley Date: Fri, 1 Jun 2018 19:59:47 +0000 Subject: [PATCH 004/144] Generates DefaultObjectACL and ObjectAccessControl resources. Also adds support for default object ACLs to storage buckets.. --- .../google/gcp_storage_default_object_acl.py | 357 ++++++++++++++++++ .../gcp_storage_object_access_control.py | 357 ++++++++++++++++++ .../gcp_storage_default_object_acl/aliases | 2 + .../defaults/main.yml | 3 + .../meta/main.yml | 0 .../gcp_storage_object_access_control/aliases | 2 + .../defaults/main.yml | 3 + .../meta/main.yml | 0 8 files changed, 724 insertions(+) create mode 100644 lib/ansible/modules/cloud/google/gcp_storage_default_object_acl.py create mode 100644 lib/ansible/modules/cloud/google/gcp_storage_object_access_control.py create mode 100644 test/integration/targets/gcp_storage_default_object_acl/aliases create mode 100644 test/integration/targets/gcp_storage_default_object_acl/defaults/main.yml create mode 100644 test/integration/targets/gcp_storage_default_object_acl/meta/main.yml create mode 100644 test/integration/targets/gcp_storage_object_access_control/aliases create mode 100644 test/integration/targets/gcp_storage_object_access_control/defaults/main.yml create mode 100644 test/integration/targets/gcp_storage_object_access_control/meta/main.yml diff --git a/lib/ansible/modules/cloud/google/gcp_storage_default_object_acl.py b/lib/ansible/modules/cloud/google/gcp_storage_default_object_acl.py new file mode 100644 index 00000000000000..f73715ad29a63d --- /dev/null +++ b/lib/ansible/modules/cloud/google/gcp_storage_default_object_acl.py @@ -0,0 +1,357 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# +# Copyright (C) 2017 Google +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) +# ---------------------------------------------------------------------------- +# +# *** AUTO GENERATED CODE *** AUTO GENERATED CODE *** +# +# ---------------------------------------------------------------------------- +# +# This file is automatically generated by Magic Modules and manual +# changes will be clobbered when the file is regenerated. +# +# Please read more about how to change this file at +# https://www.github.com/GoogleCloudPlatform/magic-modules +# +# ---------------------------------------------------------------------------- + +from __future__ import absolute_import, division, print_function +__metaclass__ = type + +################################################################################ +# Documentation +################################################################################ + +ANSIBLE_METADATA = {'metadata_version': '1.1', + 'status': ["preview"], + 'supported_by': 'community'} + +DOCUMENTATION = ''' +--- +module: gcp_storage_default_object_acl +description: + - The ObjectAccessControls resources represent the Access Control Lists (ACLs) for + objects within Google Cloud Storage. ACLs let you specify who has access to your + data and to what extent. + - 'There are two roles that can be assigned to an entity: READERs can get an object, + though the acl property will not be revealed.' + - OWNERs are READERs, and they can get the acl property, update an object, and call + all objectAccessControls methods on the object. The owner of an object is always + an OWNER. + - For more information, see Access Control, with the caveat that this API uses READER + and OWNER instead of READ and FULL_CONTROL. +short_description: Creates a GCP DefaultObjectACL +version_added: 2.6 +author: Google Inc. (@googlecloudplatform) +requirements: + - python >= 2.6 + - requests >= 2.18.4 + - google-auth >= 1.3.0 +options: + state: + description: + - Whether the given object should exist in GCP + choices: ['present', 'absent'] + default: 'present' + bucket: + description: + - The name of the bucket. + required: true + entity: + description: + - 'The entity holding the permission, in one of the following + forms: user-userId user-email group-groupId group-email + domain-domain project-team-projectId allUsers + allAuthenticatedUsers Examples: The user liz@example.com would be + user-liz@example.com.' + - The group example@googlegroups.com would be group-example@googlegroups.com. + - To refer to all members of the Google Apps for Business domain example.com, the + entity would be domain-example.com. + required: true + entity_id: + description: + - The ID for the entity. + required: false + object: + description: + - The name of the object, if applied to an object. + required: false + project_team: + description: + - The project team associated with the entity. + required: false + suboptions: + project_number: + description: + - The project team associated with the entity. + required: false + team: + description: + - The team. + required: false + choices: ['editors', 'owners', 'viewers'] + role: + description: + - The access permission for the entity. + required: false + choices: ['OWNER', 'READER'] +extends_documentation_fragment: gcp +''' + + +RETURN = ''' + bucket: + description: + - The name of the bucket. + returned: success + type: dict + domain: + description: + - The domain associated with the entity. + returned: success + type: str + email: + description: + - The email address associated with the entity. + returned: success + type: str + entity: + description: + - 'The entity holding the permission, in one of the following + forms: user-userId user-email group-groupId group-email + domain-domain project-team-projectId allUsers + allAuthenticatedUsers Examples: The user liz@example.com would be + user-liz@example.com.' + - The group example@googlegroups.com would be group-example@googlegroups.com. + - To refer to all members of the Google Apps for Business domain example.com, the + entity would be domain-example.com. + returned: success + type: str + entity_id: + description: + - The ID for the entity. + returned: success + type: str + generation: + description: + - The content generation of the object, if applied to an object. + returned: success + type: int + id: + description: + - The ID of the access-control entry. + returned: success + type: str + object: + description: + - The name of the object, if applied to an object. + returned: success + type: str + project_team: + description: + - The project team associated with the entity. + returned: success + type: complex + contains: + project_number: + description: + - The project team associated with the entity. + returned: success + type: str + team: + description: + - The team. + returned: success + type: str + role: + description: + - The access permission for the entity. + returned: success + type: str +''' + +################################################################################ +# Imports +################################################################################ + +from ansible.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest, remove_nones_from_dict, replace_resource_dict +import json + +################################################################################ +# Main +################################################################################ + + +def main(): + """Main function""" + + module = GcpModule( + argument_spec=dict( + state=dict(default='present', choices=['present', 'absent'], type='str'), + bucket=dict(required=True, type='dict'), + entity=dict(required=True, type='str'), + entity_id=dict(type='str'), + object=dict(type='str'), + project_team=dict(type='dict', options=dict( + project_number=dict(type='str'), + team=dict(type='str', choices=['editors', 'owners', 'viewers']) + )), + role=dict(type='str', choices=['OWNER', 'READER']) + ) + ) + + state = module.params['state'] + kind = 'storage#objectAccessControl' + + fetch = fetch_resource(module, self_link(module), kind) + changed = False + + if fetch: + if state == 'present': + if is_different(module, fetch): + fetch = update(module, self_link(module), kind) + changed = True + else: + delete(module, self_link(module), kind) + fetch = {} + changed = True + else: + if state == 'present': + fetch = create(module, collection(module), kind) + changed = True + else: + fetch = {} + + fetch.update({'changed': changed}) + + module.exit_json(**fetch) + + +def create(module, link, kind): + auth = GcpSession(module, 'storage') + return return_if_object(module, auth.post(link, resource_to_request(module)), kind) + + +def update(module, link, kind): + auth = GcpSession(module, 'storage') + return return_if_object(module, auth.put(link, resource_to_request(module)), kind) + + +def delete(module, link, kind): + auth = GcpSession(module, 'storage') + return return_if_object(module, auth.delete(link), kind) + + +def resource_to_request(module): + request = { + u'kind': 'storage#objectAccessControl', + u'bucket': replace_resource_dict(module.params.get(u'bucket', {}), 'name'), + u'entity': module.params.get('entity'), + u'entityId': module.params.get('entity_id'), + u'object': module.params.get('object'), + u'projectTeam': DefaObjeAclProjTeam(module.params.get('project_team', {}), module).to_request(), + u'role': module.params.get('role') + } + return_vals = {} + for k, v in request.items(): + if v: + return_vals[k] = v + + return return_vals + + +def fetch_resource(module, link, kind): + auth = GcpSession(module, 'storage') + return return_if_object(module, auth.get(link), kind) + + +def self_link(module): + return "https://www.googleapis.com/storage/v1/b/{bucket}/defaultObjectAcl/{entity}".format(**module.params) + + +def collection(module): + return "https://www.googleapis.com/storage/v1/b/{bucket}/defaultObjectAcl".format(**module.params) + + +def return_if_object(module, response, kind): + # If not found, return nothing. + if response.status_code == 404: + return None + + # If no content, return nothing. + if response.status_code == 204: + return None + + try: + module.raise_for_status(response) + result = response.json() + except getattr(json.decoder, 'JSONDecodeError', ValueError) as inst: + module.fail_json(msg="Invalid JSON response with error: %s" % inst) + + if navigate_hash(result, ['error', 'errors']): + module.fail_json(msg=navigate_hash(result, ['error', 'errors'])) + if result['kind'] != kind: + module.fail_json(msg="Incorrect result: {kind}".format(**result)) + + return result + + +def is_different(module, response): + request = resource_to_request(module) + response = response_to_hash(module, response) + + # Remove all output-only from response. + response_vals = {} + for k, v in response.items(): + if k in request: + response_vals[k] = v + + request_vals = {} + for k, v in request.items(): + if k in response: + request_vals[k] = v + + return GcpRequest(request_vals) != GcpRequest(response_vals) + + +# Remove unnecessary properties from the response. +# This is for doing comparisons with Ansible's current parameters. +def response_to_hash(module, response): + return { + u'bucket': response.get(u'bucket'), + u'domain': response.get(u'domain'), + u'email': response.get(u'email'), + u'entity': response.get(u'entity'), + u'entityId': response.get(u'entityId'), + u'generation': response.get(u'generation'), + u'id': response.get(u'id'), + u'object': response.get(u'object'), + u'projectTeam': DefaObjeAclProjTeam(response.get(u'projectTeam', {}), module).from_response(), + u'role': response.get(u'role') + } + + +class DefaObjeAclProjTeam(object): + def __init__(self, request, module): + self.module = module + if request: + self.request = request + else: + self.request = {} + + def to_request(self): + return remove_nones_from_dict({ + u'projectNumber': self.request.get('project_number'), + u'team': self.request.get('team') + }) + + def from_response(self): + return remove_nones_from_dict({ + u'projectNumber': self.request.get(u'projectNumber'), + u'team': self.request.get(u'team') + }) + +if __name__ == '__main__': + main() diff --git a/lib/ansible/modules/cloud/google/gcp_storage_object_access_control.py b/lib/ansible/modules/cloud/google/gcp_storage_object_access_control.py new file mode 100644 index 00000000000000..3b27d6e0ecfbd5 --- /dev/null +++ b/lib/ansible/modules/cloud/google/gcp_storage_object_access_control.py @@ -0,0 +1,357 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# +# Copyright (C) 2017 Google +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) +# ---------------------------------------------------------------------------- +# +# *** AUTO GENERATED CODE *** AUTO GENERATED CODE *** +# +# ---------------------------------------------------------------------------- +# +# This file is automatically generated by Magic Modules and manual +# changes will be clobbered when the file is regenerated. +# +# Please read more about how to change this file at +# https://www.github.com/GoogleCloudPlatform/magic-modules +# +# ---------------------------------------------------------------------------- + +from __future__ import absolute_import, division, print_function +__metaclass__ = type + +################################################################################ +# Documentation +################################################################################ + +ANSIBLE_METADATA = {'metadata_version': '1.1', + 'status': ["preview"], + 'supported_by': 'community'} + +DOCUMENTATION = ''' +--- +module: gcp_storage_object_access_control +description: + - The ObjectAccessControls resources represent the Access Control Lists (ACLs) for + objects within Google Cloud Storage. ACLs let you specify who has access to your + data and to what extent. + - 'There are two roles that can be assigned to an entity: READERs can get an object, + though the acl property will not be revealed.' + - OWNERs are READERs, and they can get the acl property, update an object, and call + all objectAccessControls methods on the object. The owner of an object is always + an OWNER. + - For more information, see Access Control, with the caveat that this API uses READER + and OWNER instead of READ and FULL_CONTROL. +short_description: Creates a GCP ObjectAccessControl +version_added: 2.6 +author: Google Inc. (@googlecloudplatform) +requirements: + - python >= 2.6 + - requests >= 2.18.4 + - google-auth >= 1.3.0 +options: + state: + description: + - Whether the given object should exist in GCP + choices: ['present', 'absent'] + default: 'present' + bucket: + description: + - The name of the bucket. + required: true + entity: + description: + - 'The entity holding the permission, in one of the following + forms: user-userId user-email group-groupId group-email + domain-domain project-team-projectId allUsers + allAuthenticatedUsers Examples: The user liz@example.com would be + user-liz@example.com.' + - The group example@googlegroups.com would be group-example@googlegroups.com. + - To refer to all members of the Google Apps for Business domain example.com, the + entity would be domain-example.com. + required: true + entity_id: + description: + - The ID for the entity. + required: false + object: + description: + - The name of the object, if applied to an object. + required: true + project_team: + description: + - The project team associated with the entity. + required: false + suboptions: + project_number: + description: + - The project team associated with the entity. + required: false + team: + description: + - The team. + required: false + choices: ['editors', 'owners', 'viewers'] + role: + description: + - The access permission for the entity. + required: false + choices: ['OWNER', 'READER'] +extends_documentation_fragment: gcp +''' + + +RETURN = ''' + bucket: + description: + - The name of the bucket. + returned: success + type: dict + domain: + description: + - The domain associated with the entity. + returned: success + type: str + email: + description: + - The email address associated with the entity. + returned: success + type: str + entity: + description: + - 'The entity holding the permission, in one of the following + forms: user-userId user-email group-groupId group-email + domain-domain project-team-projectId allUsers + allAuthenticatedUsers Examples: The user liz@example.com would be + user-liz@example.com.' + - The group example@googlegroups.com would be group-example@googlegroups.com. + - To refer to all members of the Google Apps for Business domain example.com, the + entity would be domain-example.com. + returned: success + type: str + entity_id: + description: + - The ID for the entity. + returned: success + type: str + generation: + description: + - The content generation of the object, if applied to an object. + returned: success + type: int + id: + description: + - The ID of the access-control entry. + returned: success + type: str + object: + description: + - The name of the object, if applied to an object. + returned: success + type: str + project_team: + description: + - The project team associated with the entity. + returned: success + type: complex + contains: + project_number: + description: + - The project team associated with the entity. + returned: success + type: str + team: + description: + - The team. + returned: success + type: str + role: + description: + - The access permission for the entity. + returned: success + type: str +''' + +################################################################################ +# Imports +################################################################################ + +from ansible.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest, remove_nones_from_dict, replace_resource_dict +import json + +################################################################################ +# Main +################################################################################ + + +def main(): + """Main function""" + + module = GcpModule( + argument_spec=dict( + state=dict(default='present', choices=['present', 'absent'], type='str'), + bucket=dict(required=True, type='dict'), + entity=dict(required=True, type='str'), + entity_id=dict(type='str'), + object=dict(required=True, type='str'), + project_team=dict(type='dict', options=dict( + project_number=dict(type='str'), + team=dict(type='str', choices=['editors', 'owners', 'viewers']) + )), + role=dict(type='str', choices=['OWNER', 'READER']) + ) + ) + + state = module.params['state'] + kind = 'storage#objectAccessControl' + + fetch = fetch_resource(module, self_link(module), kind) + changed = False + + if fetch: + if state == 'present': + if is_different(module, fetch): + fetch = update(module, self_link(module), kind) + changed = True + else: + delete(module, self_link(module), kind) + fetch = {} + changed = True + else: + if state == 'present': + fetch = create(module, collection(module), kind) + changed = True + else: + fetch = {} + + fetch.update({'changed': changed}) + + module.exit_json(**fetch) + + +def create(module, link, kind): + auth = GcpSession(module, 'storage') + return return_if_object(module, auth.post(link, resource_to_request(module)), kind) + + +def update(module, link, kind): + auth = GcpSession(module, 'storage') + return return_if_object(module, auth.put(link, resource_to_request(module)), kind) + + +def delete(module, link, kind): + auth = GcpSession(module, 'storage') + return return_if_object(module, auth.delete(link), kind) + + +def resource_to_request(module): + request = { + u'kind': 'storage#objectAccessControl', + u'bucket': replace_resource_dict(module.params.get(u'bucket', {}), 'name'), + u'entity': module.params.get('entity'), + u'entityId': module.params.get('entity_id'), + u'object': module.params.get('object'), + u'projectTeam': ObjeAcceContProjTeam(module.params.get('project_team', {}), module).to_request(), + u'role': module.params.get('role') + } + return_vals = {} + for k, v in request.items(): + if v: + return_vals[k] = v + + return return_vals + + +def fetch_resource(module, link, kind): + auth = GcpSession(module, 'storage') + return return_if_object(module, auth.get(link), kind) + + +def self_link(module): + return "https://www.googleapis.com/storage/v1/b/{bucket}/o/{object}/acl/{entity}".format(**module.params) + + +def collection(module): + return "https://www.googleapis.com/storage/v1/b/{bucket}/o/{object}/acl".format(**module.params) + + +def return_if_object(module, response, kind): + # If not found, return nothing. + if response.status_code == 404: + return None + + # If no content, return nothing. + if response.status_code == 204: + return None + + try: + module.raise_for_status(response) + result = response.json() + except getattr(json.decoder, 'JSONDecodeError', ValueError) as inst: + module.fail_json(msg="Invalid JSON response with error: %s" % inst) + + if navigate_hash(result, ['error', 'errors']): + module.fail_json(msg=navigate_hash(result, ['error', 'errors'])) + if result['kind'] != kind: + module.fail_json(msg="Incorrect result: {kind}".format(**result)) + + return result + + +def is_different(module, response): + request = resource_to_request(module) + response = response_to_hash(module, response) + + # Remove all output-only from response. + response_vals = {} + for k, v in response.items(): + if k in request: + response_vals[k] = v + + request_vals = {} + for k, v in request.items(): + if k in response: + request_vals[k] = v + + return GcpRequest(request_vals) != GcpRequest(response_vals) + + +# Remove unnecessary properties from the response. +# This is for doing comparisons with Ansible's current parameters. +def response_to_hash(module, response): + return { + u'bucket': response.get(u'bucket'), + u'domain': response.get(u'domain'), + u'email': response.get(u'email'), + u'entity': response.get(u'entity'), + u'entityId': response.get(u'entityId'), + u'generation': response.get(u'generation'), + u'id': response.get(u'id'), + u'object': response.get(u'object'), + u'projectTeam': ObjeAcceContProjTeam(response.get(u'projectTeam', {}), module).from_response(), + u'role': response.get(u'role') + } + + +class ObjeAcceContProjTeam(object): + def __init__(self, request, module): + self.module = module + if request: + self.request = request + else: + self.request = {} + + def to_request(self): + return remove_nones_from_dict({ + u'projectNumber': self.request.get('project_number'), + u'team': self.request.get('team') + }) + + def from_response(self): + return remove_nones_from_dict({ + u'projectNumber': self.request.get(u'projectNumber'), + u'team': self.request.get(u'team') + }) + +if __name__ == '__main__': + main() diff --git a/test/integration/targets/gcp_storage_default_object_acl/aliases b/test/integration/targets/gcp_storage_default_object_acl/aliases new file mode 100644 index 00000000000000..9812f019ca4bae --- /dev/null +++ b/test/integration/targets/gcp_storage_default_object_acl/aliases @@ -0,0 +1,2 @@ +cloud/gcp +unsupported diff --git a/test/integration/targets/gcp_storage_default_object_acl/defaults/main.yml b/test/integration/targets/gcp_storage_default_object_acl/defaults/main.yml new file mode 100644 index 00000000000000..aa87a2a8e0e0e0 --- /dev/null +++ b/test/integration/targets/gcp_storage_default_object_acl/defaults/main.yml @@ -0,0 +1,3 @@ +--- +# defaults file +resource_name: '{{resource_prefix}}' diff --git a/test/integration/targets/gcp_storage_default_object_acl/meta/main.yml b/test/integration/targets/gcp_storage_default_object_acl/meta/main.yml new file mode 100644 index 00000000000000..e69de29bb2d1d6 diff --git a/test/integration/targets/gcp_storage_object_access_control/aliases b/test/integration/targets/gcp_storage_object_access_control/aliases new file mode 100644 index 00000000000000..9812f019ca4bae --- /dev/null +++ b/test/integration/targets/gcp_storage_object_access_control/aliases @@ -0,0 +1,2 @@ +cloud/gcp +unsupported diff --git a/test/integration/targets/gcp_storage_object_access_control/defaults/main.yml b/test/integration/targets/gcp_storage_object_access_control/defaults/main.yml new file mode 100644 index 00000000000000..aa87a2a8e0e0e0 --- /dev/null +++ b/test/integration/targets/gcp_storage_object_access_control/defaults/main.yml @@ -0,0 +1,3 @@ +--- +# defaults file +resource_name: '{{resource_prefix}}' diff --git a/test/integration/targets/gcp_storage_object_access_control/meta/main.yml b/test/integration/targets/gcp_storage_object_access_control/meta/main.yml new file mode 100644 index 00000000000000..e69de29bb2d1d6 From c4031818f7904c600f6e56425805bcdf972067ea Mon Sep 17 00:00:00 2001 From: The Magician Date: Fri, 1 Jun 2018 15:56:15 -0700 Subject: [PATCH 005/144] SQL Databases (#12) --- lib/ansible/modules/cloud/google/gcp_sql_instance.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/ansible/modules/cloud/google/gcp_sql_instance.py b/lib/ansible/modules/cloud/google/gcp_sql_instance.py index 373e1bf0edf994..1589854b5cab31 100644 --- a/lib/ansible/modules/cloud/google/gcp_sql_instance.py +++ b/lib/ansible/modules/cloud/google/gcp_sql_instance.py @@ -690,6 +690,13 @@ def return_if_object(module, response, kind): return result + if navigate_hash(result, ['error', 'errors']): + module.fail_json(msg=navigate_hash(result, ['error', 'errors'])) + if result['kind'] != kind: + module.fail_json(msg="Incorrect result: {kind}".format(**result)) + + return result + def is_different(module, response): request = resource_to_request(module) From d07f2acf5c9376c21d667582892733b40f1d0ce3 Mon Sep 17 00:00:00 2001 From: The Magician Date: Tue, 5 Jun 2018 14:19:24 -0700 Subject: [PATCH 006/144] Ansible: SQL Users (#16) /cc @rambleraptor --- lib/ansible/modules/cloud/google/gcp_sql_instance.py | 7 ------- 1 file changed, 7 deletions(-) diff --git a/lib/ansible/modules/cloud/google/gcp_sql_instance.py b/lib/ansible/modules/cloud/google/gcp_sql_instance.py index 1589854b5cab31..373e1bf0edf994 100644 --- a/lib/ansible/modules/cloud/google/gcp_sql_instance.py +++ b/lib/ansible/modules/cloud/google/gcp_sql_instance.py @@ -690,13 +690,6 @@ def return_if_object(module, response, kind): return result - if navigate_hash(result, ['error', 'errors']): - module.fail_json(msg=navigate_hash(result, ['error', 'errors'])) - if result['kind'] != kind: - module.fail_json(msg="Incorrect result: {kind}".format(**result)) - - return result - def is_different(module, response): request = resource_to_request(module) From d09a4be986d8a3bee97abc2a459dece547c1098a Mon Sep 17 00:00:00 2001 From: The Magician Date: Tue, 5 Jun 2018 16:28:48 -0700 Subject: [PATCH 007/144] Added autogenerated header check (#18) /cc @rambleraptor --- test/integration/cloud-config-gcp.yml.template | 14 ++++++++++++++ test/units/module_utils/gcp/test_gcp_utils.py | 2 ++ 2 files changed, 16 insertions(+) diff --git a/test/integration/cloud-config-gcp.yml.template b/test/integration/cloud-config-gcp.yml.template index 3ac2dccf7b8478..2073c645c9073e 100644 --- a/test/integration/cloud-config-gcp.yml.template +++ b/test/integration/cloud-config-gcp.yml.template @@ -1,3 +1,17 @@ +<% if false # the license inside this if block assertains to this file -%> +# Copyright 2017 Google Inc. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +<% end -%> # This is the configuration template for ansible-test GCP integration tests. # # You do not need this template if you are: diff --git a/test/units/module_utils/gcp/test_gcp_utils.py b/test/units/module_utils/gcp/test_gcp_utils.py index c6c6958f857e35..5aca41d19bb60c 100644 --- a/test/units/module_utils/gcp/test_gcp_utils.py +++ b/test/units/module_utils/gcp/test_gcp_utils.py @@ -174,3 +174,5 @@ def test_arrays_dicts_with_difference(self): request2 = GcpRequest(value2) self.assertEquals(request1 == request2, False) self.assertEquals(request1.difference(request2), difference) + + From 43627db9a7cdb8464b6716424b251230104efaa2 Mon Sep 17 00:00:00 2001 From: Vincent Roseberry Date: Tue, 5 Jun 2018 23:57:47 +0000 Subject: [PATCH 008/144] Magic Modules changes. --- .../modules/cloud/google/gcp_compute_forwarding_rule.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_forwarding_rule.py b/lib/ansible/modules/cloud/google/gcp_compute_forwarding_rule.py index 500482d5f3fab2..da7c7503a29a9e 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_forwarding_rule.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_forwarding_rule.py @@ -386,10 +386,10 @@ def main(): if fetch: if state == 'present': if is_different(module, fetch): - fetch = update(module, self_link(module), kind) + fetch = update(module, self_link(module), kind, fetch) changed = True else: - delete(module, self_link(module), kind) + delete(module, self_link(module), kind, fetch) fetch = {} changed = True else: @@ -409,12 +409,12 @@ def create(module, link, kind): return wait_for_operation(module, auth.post(link, resource_to_request(module))) -def update(module, link, kind): +def update(module, link, kind, fetch): auth = GcpSession(module, 'compute') return wait_for_operation(module, auth.put(link, resource_to_request(module))) -def delete(module, link, kind): +def delete(module, link, kind, fetch): auth = GcpSession(module, 'compute') return wait_for_operation(module, auth.delete(link)) From 1884c7e574e58f2fed98070ed8a2f77d8d1ed338 Mon Sep 17 00:00:00 2001 From: Nathan McKinley Date: Thu, 14 Jun 2018 18:29:50 +0000 Subject: [PATCH 009/144] Add description field to Route resource, make non-updateable. --- lib/ansible/modules/cloud/google/gcp_compute_route.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_route.py b/lib/ansible/modules/cloud/google/gcp_compute_route.py index 1a61e098b6bad9..b3d9d378ff95b2 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_route.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_route.py @@ -271,10 +271,10 @@ def main(): if fetch: if state == 'present': if is_different(module, fetch): - fetch = update(module, self_link(module), kind) + fetch = update(module, self_link(module), kind, fetch) changed = True else: - delete(module, self_link(module), kind) + delete(module, self_link(module), kind, fetch) fetch = {} changed = True else: @@ -294,12 +294,12 @@ def create(module, link, kind): return wait_for_operation(module, auth.post(link, resource_to_request(module))) -def update(module, link, kind): +def update(module, link, kind, fetch): auth = GcpSession(module, 'compute') return wait_for_operation(module, auth.put(link, resource_to_request(module))) -def delete(module, link, kind): +def delete(module, link, kind, fetch): auth = GcpSession(module, 'compute') return wait_for_operation(module, auth.delete(link)) From a8232a0aa8df02b91447edfc4b41106fbaa96efc Mon Sep 17 00:00:00 2001 From: Alex Stephen Date: Wed, 13 Jun 2018 19:43:43 +0000 Subject: [PATCH 010/144] Ansible doesn't need save_api_results --- .../modules/cloud/google/gcp_compute_forwarding_rule.py | 8 ++++---- .../modules/cloud/google/gcp_compute_target_tcp_proxy.py | 8 ++++---- .../modules/cloud/google/gcp_dns_resource_record_set.py | 8 ++++---- lib/ansible/modules/cloud/google/gcp_sql_instance.py | 8 ++++---- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_forwarding_rule.py b/lib/ansible/modules/cloud/google/gcp_compute_forwarding_rule.py index da7c7503a29a9e..500482d5f3fab2 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_forwarding_rule.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_forwarding_rule.py @@ -386,10 +386,10 @@ def main(): if fetch: if state == 'present': if is_different(module, fetch): - fetch = update(module, self_link(module), kind, fetch) + fetch = update(module, self_link(module), kind) changed = True else: - delete(module, self_link(module), kind, fetch) + delete(module, self_link(module), kind) fetch = {} changed = True else: @@ -409,12 +409,12 @@ def create(module, link, kind): 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') 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') return wait_for_operation(module, auth.delete(link)) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_tcp_proxy.py b/lib/ansible/modules/cloud/google/gcp_compute_target_tcp_proxy.py index 1e3de10bc21f55..f8fea560407aae 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_tcp_proxy.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_tcp_proxy.py @@ -206,10 +206,10 @@ def main(): if fetch: if state == 'present': if is_different(module, fetch): - fetch = update(module, self_link(module), kind, fetch) + fetch = update(module, self_link(module), kind) changed = True else: - delete(module, self_link(module), kind, fetch) + delete(module, self_link(module), kind) fetch = {} changed = True else: @@ -229,12 +229,12 @@ def create(module, link, kind): 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') 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') return wait_for_operation(module, auth.delete(link)) diff --git a/lib/ansible/modules/cloud/google/gcp_dns_resource_record_set.py b/lib/ansible/modules/cloud/google/gcp_dns_resource_record_set.py index 3f5331256568fd..24967297d697ab 100644 --- a/lib/ansible/modules/cloud/google/gcp_dns_resource_record_set.py +++ b/lib/ansible/modules/cloud/google/gcp_dns_resource_record_set.py @@ -174,10 +174,10 @@ def main(): if fetch: if state == 'present': if is_different(module, fetch): - fetch = update(module, self_link(module), kind, fetch) + fetch = update(module, self_link(module), kind) changed = True else: - delete(module, self_link(module), kind, fetch) + delete(module, self_link(module), kind) fetch = {} changed = True else: @@ -202,7 +202,7 @@ def create(module, link, kind): 'rrsets') -def update(module, link, kind, fetch): +def update(module, link, kind): change = create_change(fetch, updated_record(module), module) change_id = int(change['id']) if change['status'] == 'pending': @@ -212,7 +212,7 @@ def update(module, link, kind, fetch): 'rrsets') -def delete(module, link, kind, fetch): +def delete(module, link, kind): change = create_change(fetch, None, module) change_id = int(change['id']) if change['status'] == 'pending': diff --git a/lib/ansible/modules/cloud/google/gcp_sql_instance.py b/lib/ansible/modules/cloud/google/gcp_sql_instance.py index 373e1bf0edf994..b8e2be89cfc985 100644 --- a/lib/ansible/modules/cloud/google/gcp_sql_instance.py +++ b/lib/ansible/modules/cloud/google/gcp_sql_instance.py @@ -595,10 +595,10 @@ def main(): if fetch: if state == 'present': if is_different(module, fetch): - fetch = update(module, self_link(module), kind, fetch) + fetch = update(module, self_link(module), kind) changed = True else: - delete(module, self_link(module), kind, fetch) + delete(module, self_link(module), kind) fetch = {} changed = True else: @@ -618,12 +618,12 @@ def create(module, link, kind): 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, 'sql') 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, 'sql') return wait_for_operation(module, auth.delete(link)) From 09a67bc5c2dba0f80e6759a4217dcd618c66e5ff Mon Sep 17 00:00:00 2001 From: Alex Stephen Date: Mon, 18 Jun 2018 17:31:53 +0000 Subject: [PATCH 011/144] Magic Modules changes. --- .../modules/cloud/google/gcp_compute_route.py | 8 +- .../google/gcp_storage_default_object_acl.py | 357 ------------------ .../gcp_storage_object_access_control.py | 357 ------------------ 3 files changed, 4 insertions(+), 718 deletions(-) delete mode 100644 lib/ansible/modules/cloud/google/gcp_storage_default_object_acl.py delete mode 100644 lib/ansible/modules/cloud/google/gcp_storage_object_access_control.py diff --git a/lib/ansible/modules/cloud/google/gcp_compute_route.py b/lib/ansible/modules/cloud/google/gcp_compute_route.py index b3d9d378ff95b2..1a61e098b6bad9 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_route.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_route.py @@ -271,10 +271,10 @@ def main(): if fetch: if state == 'present': if is_different(module, fetch): - fetch = update(module, self_link(module), kind, fetch) + fetch = update(module, self_link(module), kind) changed = True else: - delete(module, self_link(module), kind, fetch) + delete(module, self_link(module), kind) fetch = {} changed = True else: @@ -294,12 +294,12 @@ def create(module, link, kind): 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') 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') return wait_for_operation(module, auth.delete(link)) diff --git a/lib/ansible/modules/cloud/google/gcp_storage_default_object_acl.py b/lib/ansible/modules/cloud/google/gcp_storage_default_object_acl.py deleted file mode 100644 index f73715ad29a63d..00000000000000 --- a/lib/ansible/modules/cloud/google/gcp_storage_default_object_acl.py +++ /dev/null @@ -1,357 +0,0 @@ -#!/usr/bin/python -# -*- coding: utf-8 -*- -# -# Copyright (C) 2017 Google -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) -# ---------------------------------------------------------------------------- -# -# *** AUTO GENERATED CODE *** AUTO GENERATED CODE *** -# -# ---------------------------------------------------------------------------- -# -# This file is automatically generated by Magic Modules and manual -# changes will be clobbered when the file is regenerated. -# -# Please read more about how to change this file at -# https://www.github.com/GoogleCloudPlatform/magic-modules -# -# ---------------------------------------------------------------------------- - -from __future__ import absolute_import, division, print_function -__metaclass__ = type - -################################################################################ -# Documentation -################################################################################ - -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ["preview"], - 'supported_by': 'community'} - -DOCUMENTATION = ''' ---- -module: gcp_storage_default_object_acl -description: - - The ObjectAccessControls resources represent the Access Control Lists (ACLs) for - objects within Google Cloud Storage. ACLs let you specify who has access to your - data and to what extent. - - 'There are two roles that can be assigned to an entity: READERs can get an object, - though the acl property will not be revealed.' - - OWNERs are READERs, and they can get the acl property, update an object, and call - all objectAccessControls methods on the object. The owner of an object is always - an OWNER. - - For more information, see Access Control, with the caveat that this API uses READER - and OWNER instead of READ and FULL_CONTROL. -short_description: Creates a GCP DefaultObjectACL -version_added: 2.6 -author: Google Inc. (@googlecloudplatform) -requirements: - - python >= 2.6 - - requests >= 2.18.4 - - google-auth >= 1.3.0 -options: - state: - description: - - Whether the given object should exist in GCP - choices: ['present', 'absent'] - default: 'present' - bucket: - description: - - The name of the bucket. - required: true - entity: - description: - - 'The entity holding the permission, in one of the following - forms: user-userId user-email group-groupId group-email - domain-domain project-team-projectId allUsers - allAuthenticatedUsers Examples: The user liz@example.com would be - user-liz@example.com.' - - The group example@googlegroups.com would be group-example@googlegroups.com. - - To refer to all members of the Google Apps for Business domain example.com, the - entity would be domain-example.com. - required: true - entity_id: - description: - - The ID for the entity. - required: false - object: - description: - - The name of the object, if applied to an object. - required: false - project_team: - description: - - The project team associated with the entity. - required: false - suboptions: - project_number: - description: - - The project team associated with the entity. - required: false - team: - description: - - The team. - required: false - choices: ['editors', 'owners', 'viewers'] - role: - description: - - The access permission for the entity. - required: false - choices: ['OWNER', 'READER'] -extends_documentation_fragment: gcp -''' - - -RETURN = ''' - bucket: - description: - - The name of the bucket. - returned: success - type: dict - domain: - description: - - The domain associated with the entity. - returned: success - type: str - email: - description: - - The email address associated with the entity. - returned: success - type: str - entity: - description: - - 'The entity holding the permission, in one of the following - forms: user-userId user-email group-groupId group-email - domain-domain project-team-projectId allUsers - allAuthenticatedUsers Examples: The user liz@example.com would be - user-liz@example.com.' - - The group example@googlegroups.com would be group-example@googlegroups.com. - - To refer to all members of the Google Apps for Business domain example.com, the - entity would be domain-example.com. - returned: success - type: str - entity_id: - description: - - The ID for the entity. - returned: success - type: str - generation: - description: - - The content generation of the object, if applied to an object. - returned: success - type: int - id: - description: - - The ID of the access-control entry. - returned: success - type: str - object: - description: - - The name of the object, if applied to an object. - returned: success - type: str - project_team: - description: - - The project team associated with the entity. - returned: success - type: complex - contains: - project_number: - description: - - The project team associated with the entity. - returned: success - type: str - team: - description: - - The team. - returned: success - type: str - role: - description: - - The access permission for the entity. - returned: success - type: str -''' - -################################################################################ -# Imports -################################################################################ - -from ansible.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest, remove_nones_from_dict, replace_resource_dict -import json - -################################################################################ -# Main -################################################################################ - - -def main(): - """Main function""" - - module = GcpModule( - argument_spec=dict( - state=dict(default='present', choices=['present', 'absent'], type='str'), - bucket=dict(required=True, type='dict'), - entity=dict(required=True, type='str'), - entity_id=dict(type='str'), - object=dict(type='str'), - project_team=dict(type='dict', options=dict( - project_number=dict(type='str'), - team=dict(type='str', choices=['editors', 'owners', 'viewers']) - )), - role=dict(type='str', choices=['OWNER', 'READER']) - ) - ) - - state = module.params['state'] - kind = 'storage#objectAccessControl' - - fetch = fetch_resource(module, self_link(module), kind) - changed = False - - if fetch: - if state == 'present': - if is_different(module, fetch): - fetch = update(module, self_link(module), kind) - changed = True - else: - delete(module, self_link(module), kind) - fetch = {} - changed = True - else: - if state == 'present': - fetch = create(module, collection(module), kind) - changed = True - else: - fetch = {} - - fetch.update({'changed': changed}) - - module.exit_json(**fetch) - - -def create(module, link, kind): - auth = GcpSession(module, 'storage') - return return_if_object(module, auth.post(link, resource_to_request(module)), kind) - - -def update(module, link, kind): - auth = GcpSession(module, 'storage') - return return_if_object(module, auth.put(link, resource_to_request(module)), kind) - - -def delete(module, link, kind): - auth = GcpSession(module, 'storage') - return return_if_object(module, auth.delete(link), kind) - - -def resource_to_request(module): - request = { - u'kind': 'storage#objectAccessControl', - u'bucket': replace_resource_dict(module.params.get(u'bucket', {}), 'name'), - u'entity': module.params.get('entity'), - u'entityId': module.params.get('entity_id'), - u'object': module.params.get('object'), - u'projectTeam': DefaObjeAclProjTeam(module.params.get('project_team', {}), module).to_request(), - u'role': module.params.get('role') - } - return_vals = {} - for k, v in request.items(): - if v: - return_vals[k] = v - - return return_vals - - -def fetch_resource(module, link, kind): - auth = GcpSession(module, 'storage') - return return_if_object(module, auth.get(link), kind) - - -def self_link(module): - return "https://www.googleapis.com/storage/v1/b/{bucket}/defaultObjectAcl/{entity}".format(**module.params) - - -def collection(module): - return "https://www.googleapis.com/storage/v1/b/{bucket}/defaultObjectAcl".format(**module.params) - - -def return_if_object(module, response, kind): - # If not found, return nothing. - if response.status_code == 404: - return None - - # If no content, return nothing. - if response.status_code == 204: - return None - - try: - module.raise_for_status(response) - result = response.json() - except getattr(json.decoder, 'JSONDecodeError', ValueError) as inst: - module.fail_json(msg="Invalid JSON response with error: %s" % inst) - - if navigate_hash(result, ['error', 'errors']): - module.fail_json(msg=navigate_hash(result, ['error', 'errors'])) - if result['kind'] != kind: - module.fail_json(msg="Incorrect result: {kind}".format(**result)) - - return result - - -def is_different(module, response): - request = resource_to_request(module) - response = response_to_hash(module, response) - - # Remove all output-only from response. - response_vals = {} - for k, v in response.items(): - if k in request: - response_vals[k] = v - - request_vals = {} - for k, v in request.items(): - if k in response: - request_vals[k] = v - - return GcpRequest(request_vals) != GcpRequest(response_vals) - - -# Remove unnecessary properties from the response. -# This is for doing comparisons with Ansible's current parameters. -def response_to_hash(module, response): - return { - u'bucket': response.get(u'bucket'), - u'domain': response.get(u'domain'), - u'email': response.get(u'email'), - u'entity': response.get(u'entity'), - u'entityId': response.get(u'entityId'), - u'generation': response.get(u'generation'), - u'id': response.get(u'id'), - u'object': response.get(u'object'), - u'projectTeam': DefaObjeAclProjTeam(response.get(u'projectTeam', {}), module).from_response(), - u'role': response.get(u'role') - } - - -class DefaObjeAclProjTeam(object): - def __init__(self, request, module): - self.module = module - if request: - self.request = request - else: - self.request = {} - - def to_request(self): - return remove_nones_from_dict({ - u'projectNumber': self.request.get('project_number'), - u'team': self.request.get('team') - }) - - def from_response(self): - return remove_nones_from_dict({ - u'projectNumber': self.request.get(u'projectNumber'), - u'team': self.request.get(u'team') - }) - -if __name__ == '__main__': - main() diff --git a/lib/ansible/modules/cloud/google/gcp_storage_object_access_control.py b/lib/ansible/modules/cloud/google/gcp_storage_object_access_control.py deleted file mode 100644 index 3b27d6e0ecfbd5..00000000000000 --- a/lib/ansible/modules/cloud/google/gcp_storage_object_access_control.py +++ /dev/null @@ -1,357 +0,0 @@ -#!/usr/bin/python -# -*- coding: utf-8 -*- -# -# Copyright (C) 2017 Google -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) -# ---------------------------------------------------------------------------- -# -# *** AUTO GENERATED CODE *** AUTO GENERATED CODE *** -# -# ---------------------------------------------------------------------------- -# -# This file is automatically generated by Magic Modules and manual -# changes will be clobbered when the file is regenerated. -# -# Please read more about how to change this file at -# https://www.github.com/GoogleCloudPlatform/magic-modules -# -# ---------------------------------------------------------------------------- - -from __future__ import absolute_import, division, print_function -__metaclass__ = type - -################################################################################ -# Documentation -################################################################################ - -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ["preview"], - 'supported_by': 'community'} - -DOCUMENTATION = ''' ---- -module: gcp_storage_object_access_control -description: - - The ObjectAccessControls resources represent the Access Control Lists (ACLs) for - objects within Google Cloud Storage. ACLs let you specify who has access to your - data and to what extent. - - 'There are two roles that can be assigned to an entity: READERs can get an object, - though the acl property will not be revealed.' - - OWNERs are READERs, and they can get the acl property, update an object, and call - all objectAccessControls methods on the object. The owner of an object is always - an OWNER. - - For more information, see Access Control, with the caveat that this API uses READER - and OWNER instead of READ and FULL_CONTROL. -short_description: Creates a GCP ObjectAccessControl -version_added: 2.6 -author: Google Inc. (@googlecloudplatform) -requirements: - - python >= 2.6 - - requests >= 2.18.4 - - google-auth >= 1.3.0 -options: - state: - description: - - Whether the given object should exist in GCP - choices: ['present', 'absent'] - default: 'present' - bucket: - description: - - The name of the bucket. - required: true - entity: - description: - - 'The entity holding the permission, in one of the following - forms: user-userId user-email group-groupId group-email - domain-domain project-team-projectId allUsers - allAuthenticatedUsers Examples: The user liz@example.com would be - user-liz@example.com.' - - The group example@googlegroups.com would be group-example@googlegroups.com. - - To refer to all members of the Google Apps for Business domain example.com, the - entity would be domain-example.com. - required: true - entity_id: - description: - - The ID for the entity. - required: false - object: - description: - - The name of the object, if applied to an object. - required: true - project_team: - description: - - The project team associated with the entity. - required: false - suboptions: - project_number: - description: - - The project team associated with the entity. - required: false - team: - description: - - The team. - required: false - choices: ['editors', 'owners', 'viewers'] - role: - description: - - The access permission for the entity. - required: false - choices: ['OWNER', 'READER'] -extends_documentation_fragment: gcp -''' - - -RETURN = ''' - bucket: - description: - - The name of the bucket. - returned: success - type: dict - domain: - description: - - The domain associated with the entity. - returned: success - type: str - email: - description: - - The email address associated with the entity. - returned: success - type: str - entity: - description: - - 'The entity holding the permission, in one of the following - forms: user-userId user-email group-groupId group-email - domain-domain project-team-projectId allUsers - allAuthenticatedUsers Examples: The user liz@example.com would be - user-liz@example.com.' - - The group example@googlegroups.com would be group-example@googlegroups.com. - - To refer to all members of the Google Apps for Business domain example.com, the - entity would be domain-example.com. - returned: success - type: str - entity_id: - description: - - The ID for the entity. - returned: success - type: str - generation: - description: - - The content generation of the object, if applied to an object. - returned: success - type: int - id: - description: - - The ID of the access-control entry. - returned: success - type: str - object: - description: - - The name of the object, if applied to an object. - returned: success - type: str - project_team: - description: - - The project team associated with the entity. - returned: success - type: complex - contains: - project_number: - description: - - The project team associated with the entity. - returned: success - type: str - team: - description: - - The team. - returned: success - type: str - role: - description: - - The access permission for the entity. - returned: success - type: str -''' - -################################################################################ -# Imports -################################################################################ - -from ansible.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest, remove_nones_from_dict, replace_resource_dict -import json - -################################################################################ -# Main -################################################################################ - - -def main(): - """Main function""" - - module = GcpModule( - argument_spec=dict( - state=dict(default='present', choices=['present', 'absent'], type='str'), - bucket=dict(required=True, type='dict'), - entity=dict(required=True, type='str'), - entity_id=dict(type='str'), - object=dict(required=True, type='str'), - project_team=dict(type='dict', options=dict( - project_number=dict(type='str'), - team=dict(type='str', choices=['editors', 'owners', 'viewers']) - )), - role=dict(type='str', choices=['OWNER', 'READER']) - ) - ) - - state = module.params['state'] - kind = 'storage#objectAccessControl' - - fetch = fetch_resource(module, self_link(module), kind) - changed = False - - if fetch: - if state == 'present': - if is_different(module, fetch): - fetch = update(module, self_link(module), kind) - changed = True - else: - delete(module, self_link(module), kind) - fetch = {} - changed = True - else: - if state == 'present': - fetch = create(module, collection(module), kind) - changed = True - else: - fetch = {} - - fetch.update({'changed': changed}) - - module.exit_json(**fetch) - - -def create(module, link, kind): - auth = GcpSession(module, 'storage') - return return_if_object(module, auth.post(link, resource_to_request(module)), kind) - - -def update(module, link, kind): - auth = GcpSession(module, 'storage') - return return_if_object(module, auth.put(link, resource_to_request(module)), kind) - - -def delete(module, link, kind): - auth = GcpSession(module, 'storage') - return return_if_object(module, auth.delete(link), kind) - - -def resource_to_request(module): - request = { - u'kind': 'storage#objectAccessControl', - u'bucket': replace_resource_dict(module.params.get(u'bucket', {}), 'name'), - u'entity': module.params.get('entity'), - u'entityId': module.params.get('entity_id'), - u'object': module.params.get('object'), - u'projectTeam': ObjeAcceContProjTeam(module.params.get('project_team', {}), module).to_request(), - u'role': module.params.get('role') - } - return_vals = {} - for k, v in request.items(): - if v: - return_vals[k] = v - - return return_vals - - -def fetch_resource(module, link, kind): - auth = GcpSession(module, 'storage') - return return_if_object(module, auth.get(link), kind) - - -def self_link(module): - return "https://www.googleapis.com/storage/v1/b/{bucket}/o/{object}/acl/{entity}".format(**module.params) - - -def collection(module): - return "https://www.googleapis.com/storage/v1/b/{bucket}/o/{object}/acl".format(**module.params) - - -def return_if_object(module, response, kind): - # If not found, return nothing. - if response.status_code == 404: - return None - - # If no content, return nothing. - if response.status_code == 204: - return None - - try: - module.raise_for_status(response) - result = response.json() - except getattr(json.decoder, 'JSONDecodeError', ValueError) as inst: - module.fail_json(msg="Invalid JSON response with error: %s" % inst) - - if navigate_hash(result, ['error', 'errors']): - module.fail_json(msg=navigate_hash(result, ['error', 'errors'])) - if result['kind'] != kind: - module.fail_json(msg="Incorrect result: {kind}".format(**result)) - - return result - - -def is_different(module, response): - request = resource_to_request(module) - response = response_to_hash(module, response) - - # Remove all output-only from response. - response_vals = {} - for k, v in response.items(): - if k in request: - response_vals[k] = v - - request_vals = {} - for k, v in request.items(): - if k in response: - request_vals[k] = v - - return GcpRequest(request_vals) != GcpRequest(response_vals) - - -# Remove unnecessary properties from the response. -# This is for doing comparisons with Ansible's current parameters. -def response_to_hash(module, response): - return { - u'bucket': response.get(u'bucket'), - u'domain': response.get(u'domain'), - u'email': response.get(u'email'), - u'entity': response.get(u'entity'), - u'entityId': response.get(u'entityId'), - u'generation': response.get(u'generation'), - u'id': response.get(u'id'), - u'object': response.get(u'object'), - u'projectTeam': ObjeAcceContProjTeam(response.get(u'projectTeam', {}), module).from_response(), - u'role': response.get(u'role') - } - - -class ObjeAcceContProjTeam(object): - def __init__(self, request, module): - self.module = module - if request: - self.request = request - else: - self.request = {} - - def to_request(self): - return remove_nones_from_dict({ - u'projectNumber': self.request.get('project_number'), - u'team': self.request.get('team') - }) - - def from_response(self): - return remove_nones_from_dict({ - u'projectNumber': self.request.get(u'projectNumber'), - u'team': self.request.get(u'team') - }) - -if __name__ == '__main__': - main() From 7c52a15dcae9d99bbf4ac9c8d2199c82a46d605c Mon Sep 17 00:00:00 2001 From: Alex Stephen Date: Mon, 18 Jun 2018 21:22:10 +0000 Subject: [PATCH 012/144] removing integration folders for deleted storage --- metadata-rWG2H2.json | 14 ++++++++++++++ .../targets/gcp_storage_default_object_acl/aliases | 2 -- .../defaults/main.yml | 3 --- .../gcp_storage_default_object_acl/meta/main.yml | 0 .../gcp_storage_object_access_control/aliases | 2 -- .../defaults/main.yml | 3 --- .../meta/main.yml | 0 7 files changed, 14 insertions(+), 10 deletions(-) create mode 100644 metadata-rWG2H2.json delete mode 100644 test/integration/targets/gcp_storage_default_object_acl/aliases delete mode 100644 test/integration/targets/gcp_storage_default_object_acl/defaults/main.yml delete mode 100644 test/integration/targets/gcp_storage_default_object_acl/meta/main.yml delete mode 100644 test/integration/targets/gcp_storage_object_access_control/aliases delete mode 100644 test/integration/targets/gcp_storage_object_access_control/defaults/main.yml delete mode 100644 test/integration/targets/gcp_storage_object_access_control/meta/main.yml diff --git a/metadata-rWG2H2.json b/metadata-rWG2H2.json new file mode 100644 index 00000000000000..f5827365a541a3 --- /dev/null +++ b/metadata-rWG2H2.json @@ -0,0 +1,14 @@ +{ + "change_description": { + "changed_paths": [], + "command": "", + "deleted_paths": [], + "focused_command_targets": {}, + "no_integration_paths": [], + "regular_command_targets": {} + }, + "changes": {}, + "ci_provider": "", + "cloud_config": null, + "instance_config": null +} \ No newline at end of file diff --git a/test/integration/targets/gcp_storage_default_object_acl/aliases b/test/integration/targets/gcp_storage_default_object_acl/aliases deleted file mode 100644 index 9812f019ca4bae..00000000000000 --- a/test/integration/targets/gcp_storage_default_object_acl/aliases +++ /dev/null @@ -1,2 +0,0 @@ -cloud/gcp -unsupported diff --git a/test/integration/targets/gcp_storage_default_object_acl/defaults/main.yml b/test/integration/targets/gcp_storage_default_object_acl/defaults/main.yml deleted file mode 100644 index aa87a2a8e0e0e0..00000000000000 --- a/test/integration/targets/gcp_storage_default_object_acl/defaults/main.yml +++ /dev/null @@ -1,3 +0,0 @@ ---- -# defaults file -resource_name: '{{resource_prefix}}' diff --git a/test/integration/targets/gcp_storage_default_object_acl/meta/main.yml b/test/integration/targets/gcp_storage_default_object_acl/meta/main.yml deleted file mode 100644 index e69de29bb2d1d6..00000000000000 diff --git a/test/integration/targets/gcp_storage_object_access_control/aliases b/test/integration/targets/gcp_storage_object_access_control/aliases deleted file mode 100644 index 9812f019ca4bae..00000000000000 --- a/test/integration/targets/gcp_storage_object_access_control/aliases +++ /dev/null @@ -1,2 +0,0 @@ -cloud/gcp -unsupported diff --git a/test/integration/targets/gcp_storage_object_access_control/defaults/main.yml b/test/integration/targets/gcp_storage_object_access_control/defaults/main.yml deleted file mode 100644 index aa87a2a8e0e0e0..00000000000000 --- a/test/integration/targets/gcp_storage_object_access_control/defaults/main.yml +++ /dev/null @@ -1,3 +0,0 @@ ---- -# defaults file -resource_name: '{{resource_prefix}}' diff --git a/test/integration/targets/gcp_storage_object_access_control/meta/main.yml b/test/integration/targets/gcp_storage_object_access_control/meta/main.yml deleted file mode 100644 index e69de29bb2d1d6..00000000000000 From 1d509b22d835d3b1db7338332705c4a11e10eda8 Mon Sep 17 00:00:00 2001 From: Alex Stephen Date: Mon, 18 Jun 2018 22:59:13 +0000 Subject: [PATCH 013/144] Adding fetch back on certain places. --- .../modules/cloud/google/gcp_dns_resource_record_set.py | 8 ++++---- lib/ansible/modules/cloud/google/gcp_sql_instance.py | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/ansible/modules/cloud/google/gcp_dns_resource_record_set.py b/lib/ansible/modules/cloud/google/gcp_dns_resource_record_set.py index 24967297d697ab..3f5331256568fd 100644 --- a/lib/ansible/modules/cloud/google/gcp_dns_resource_record_set.py +++ b/lib/ansible/modules/cloud/google/gcp_dns_resource_record_set.py @@ -174,10 +174,10 @@ def main(): if fetch: if state == 'present': if is_different(module, fetch): - fetch = update(module, self_link(module), kind) + fetch = update(module, self_link(module), kind, fetch) changed = True else: - delete(module, self_link(module), kind) + delete(module, self_link(module), kind, fetch) fetch = {} changed = True else: @@ -202,7 +202,7 @@ def create(module, link, kind): 'rrsets') -def update(module, link, kind): +def update(module, link, kind, fetch): change = create_change(fetch, updated_record(module), module) change_id = int(change['id']) if change['status'] == 'pending': @@ -212,7 +212,7 @@ def update(module, link, kind): 'rrsets') -def delete(module, link, kind): +def delete(module, link, kind, fetch): change = create_change(fetch, None, module) change_id = int(change['id']) if change['status'] == 'pending': diff --git a/lib/ansible/modules/cloud/google/gcp_sql_instance.py b/lib/ansible/modules/cloud/google/gcp_sql_instance.py index b8e2be89cfc985..373e1bf0edf994 100644 --- a/lib/ansible/modules/cloud/google/gcp_sql_instance.py +++ b/lib/ansible/modules/cloud/google/gcp_sql_instance.py @@ -595,10 +595,10 @@ def main(): if fetch: if state == 'present': if is_different(module, fetch): - fetch = update(module, self_link(module), kind) + fetch = update(module, self_link(module), kind, fetch) changed = True else: - delete(module, self_link(module), kind) + delete(module, self_link(module), kind, fetch) fetch = {} changed = True else: @@ -618,12 +618,12 @@ def create(module, link, kind): return wait_for_operation(module, auth.post(link, resource_to_request(module))) -def update(module, link, kind): +def update(module, link, kind, fetch): auth = GcpSession(module, 'sql') return wait_for_operation(module, auth.put(link, resource_to_request(module))) -def delete(module, link, kind): +def delete(module, link, kind, fetch): auth = GcpSession(module, 'sql') return wait_for_operation(module, auth.delete(link)) From 7976cf08d6a870abaebea2ec3fd1a4f13ae54c9c Mon Sep 17 00:00:00 2001 From: Alex Stephen Date: Tue, 26 Jun 2018 23:09:35 +0000 Subject: [PATCH 014/144] Spanner Instances + Databases --- lib/ansible/plugins/lookup/gcp_lookup.py | 45 +++++++++++++++++++++++- 1 file changed, 44 insertions(+), 1 deletion(-) diff --git a/lib/ansible/plugins/lookup/gcp_lookup.py b/lib/ansible/plugins/lookup/gcp_lookup.py index 2efc014d55b1db..dd93544511d4eb 100644 --- a/lib/ansible/plugins/lookup/gcp_lookup.py +++ b/lib/ansible/plugins/lookup/gcp_lookup.py @@ -44,6 +44,7 @@ - machine_type - region - zone + - instance_config return: description: An optional value to describe what part of the attribute should be returned @@ -312,6 +313,47 @@ def run(self): return response['name'] +class GcpInstanceConfig(object): + def __init__(self, options): + self.module = GcpModule(options) + + self.link = "https://spanner.googleapis.com/v1/projects/{project}/instanceConfigs/{name}".format(**self.module.params) + + def _fetch_resource(self): + auth = GcpSession(self.module, 'spanner') + return self._return_if_object(auth.get(self.link)) + + def _return_if_object(self, response): + # If not found, return nothing. + if response.status_code == 404: + return None + + # If no content, return nothing. + if response.status_code == 204: + return None + + try: + response.raise_for_status + result = response.json() + except getattr(json.decoder, 'JSONDecodeError', ValueError) as inst: + self.module.fail_json(msg="Invalid JSON response with error: %s" % inst) + except GcpRequestException as inst: + self.module.fail_json(msg="Network error: %s" % inst) + + if navigate_hash(result, ['error', 'errors']): + self.module.fail_json(msg=navigate_hash(result, ['error', 'errors'])) + if result['kind'] != self.kind: + self.module.fail_json(msg="Incorrect result: {kind}".format(**result)) + + return result + + def run(self): + response = self._fetch_resource() + if 'return' in self.module.params: + return response[self.module.params['return']] + return response['name'] + + class LookupModule(LookupBase): def run(self, terms, variables, **kwargs): @@ -321,7 +363,8 @@ def run(self, terms, variables, **kwargs): 'license': GcpLicense, 'machine_type': GcpMachineType, 'region': GcpRegion, - 'zone': GcpZone + 'zone': GcpZone, + 'instance_config': GcpInstanceConfig } return str(options[kwargs['attribute']](kwargs).run()) From 651edb5391f027554143e61c71090cf3c55fe7c3 Mon Sep 17 00:00:00 2001 From: The Magician Date: Fri, 20 Jul 2018 11:54:00 -0700 Subject: [PATCH 015/144] Example refactor /cc @rambleraptor --- .../tasks/main.yml | 40 +++++++++---------- .../tasks/main.yml | 16 ++++---- .../tasks/main.yml | 16 ++++---- 3 files changed, 36 insertions(+), 36 deletions(-) diff --git a/test/integration/targets/gcp_compute_ssl_certificate/tasks/main.yml b/test/integration/targets/gcp_compute_ssl_certificate/tasks/main.yml index 5350f6a72c3ce1..dfa028377cddcf 100644 --- a/test/integration/targets/gcp_compute_ssl_certificate/tasks/main.yml +++ b/test/integration/targets/gcp_compute_ssl_certificate/tasks/main.yml @@ -18,7 +18,7 @@ name: "{{ resource_name }}" description: A certificate for testing. Do not use this certificate in production certificate: | - -----BEGIN CERTIFICATE----- + --BEGIN CERTIFICATE-- MIICqjCCAk+gAwIBAgIJAIuJ+0352Kq4MAoGCCqGSM49BAMCMIGwMQswCQYDVQQG EwJVUzETMBEGA1UECAwKV2FzaGluZ3RvbjERMA8GA1UEBwwIS2lya2xhbmQxFTAT BgNVBAoMDEdvb2dsZSwgSW5jLjEeMBwGA1UECwwVR29vZ2xlIENsb3VkIFBsYXRm @@ -34,13 +34,13 @@ 0YLKineDNq/BMAwGA1UdEwQFMAMBAf8wCgYIKoZIzj0EAwIDSQAwRgIhALs4vy+O M3jcqgA4fSW/oKw6UJxp+M6a+nGMX+UJR3YgAiEAvvl39QRVAiv84hdoCuyON0lJ zqGNhIPGq2ULqXKK8BY= - -----END CERTIFICATE----- + --END CERTIFICATE-- private_key: | - -----BEGIN EC PRIVATE KEY----- + --BEGIN EC PRIVATE KEY-- MHcCAQEEIObtRo8tkUqoMjeHhsOh2ouPpXCgBcP+EDxZCB/tws15oAoGCCqGSM49 AwEHoUQDQgAEHGzpcRJ4XzfBJCCPMQeXQpTXwlblimODQCuQ4mzkzTv0dXyB750f OGN02HtkpBOZzzvUARTR10JQoSe2/5PIwQ== - -----END EC PRIVATE KEY----- + --END EC PRIVATE KEY-- project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" @@ -51,7 +51,7 @@ name: "{{ resource_name }}" description: A certificate for testing. Do not use this certificate in production certificate: | - -----BEGIN CERTIFICATE----- + --BEGIN CERTIFICATE-- MIICqjCCAk+gAwIBAgIJAIuJ+0352Kq4MAoGCCqGSM49BAMCMIGwMQswCQYDVQQG EwJVUzETMBEGA1UECAwKV2FzaGluZ3RvbjERMA8GA1UEBwwIS2lya2xhbmQxFTAT BgNVBAoMDEdvb2dsZSwgSW5jLjEeMBwGA1UECwwVR29vZ2xlIENsb3VkIFBsYXRm @@ -67,13 +67,13 @@ 0YLKineDNq/BMAwGA1UdEwQFMAMBAf8wCgYIKoZIzj0EAwIDSQAwRgIhALs4vy+O M3jcqgA4fSW/oKw6UJxp+M6a+nGMX+UJR3YgAiEAvvl39QRVAiv84hdoCuyON0lJ zqGNhIPGq2ULqXKK8BY= - -----END CERTIFICATE----- + --END CERTIFICATE-- private_key: | - -----BEGIN EC PRIVATE KEY----- + --BEGIN EC PRIVATE KEY-- MHcCAQEEIObtRo8tkUqoMjeHhsOh2ouPpXCgBcP+EDxZCB/tws15oAoGCCqGSM49 AwEHoUQDQgAEHGzpcRJ4XzfBJCCPMQeXQpTXwlblimODQCuQ4mzkzTv0dXyB750f OGN02HtkpBOZzzvUARTR10JQoSe2/5PIwQ== - -----END EC PRIVATE KEY----- + --END EC PRIVATE KEY-- project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" @@ -104,7 +104,7 @@ name: "{{ resource_name }}" description: A certificate for testing. Do not use this certificate in production certificate: | - -----BEGIN CERTIFICATE----- + --BEGIN CERTIFICATE-- MIICqjCCAk+gAwIBAgIJAIuJ+0352Kq4MAoGCCqGSM49BAMCMIGwMQswCQYDVQQG EwJVUzETMBEGA1UECAwKV2FzaGluZ3RvbjERMA8GA1UEBwwIS2lya2xhbmQxFTAT BgNVBAoMDEdvb2dsZSwgSW5jLjEeMBwGA1UECwwVR29vZ2xlIENsb3VkIFBsYXRm @@ -120,13 +120,13 @@ 0YLKineDNq/BMAwGA1UdEwQFMAMBAf8wCgYIKoZIzj0EAwIDSQAwRgIhALs4vy+O M3jcqgA4fSW/oKw6UJxp+M6a+nGMX+UJR3YgAiEAvvl39QRVAiv84hdoCuyON0lJ zqGNhIPGq2ULqXKK8BY= - -----END CERTIFICATE----- + --END CERTIFICATE-- private_key: | - -----BEGIN EC PRIVATE KEY----- + --BEGIN EC PRIVATE KEY-- MHcCAQEEIObtRo8tkUqoMjeHhsOh2ouPpXCgBcP+EDxZCB/tws15oAoGCCqGSM49 AwEHoUQDQgAEHGzpcRJ4XzfBJCCPMQeXQpTXwlblimODQCuQ4mzkzTv0dXyB750f OGN02HtkpBOZzzvUARTR10JQoSe2/5PIwQ== - -----END EC PRIVATE KEY----- + --END EC PRIVATE KEY-- project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" @@ -143,7 +143,7 @@ name: "{{ resource_name }}" description: A certificate for testing. Do not use this certificate in production certificate: | - -----BEGIN CERTIFICATE----- + --BEGIN CERTIFICATE-- MIICqjCCAk+gAwIBAgIJAIuJ+0352Kq4MAoGCCqGSM49BAMCMIGwMQswCQYDVQQG EwJVUzETMBEGA1UECAwKV2FzaGluZ3RvbjERMA8GA1UEBwwIS2lya2xhbmQxFTAT BgNVBAoMDEdvb2dsZSwgSW5jLjEeMBwGA1UECwwVR29vZ2xlIENsb3VkIFBsYXRm @@ -159,13 +159,13 @@ 0YLKineDNq/BMAwGA1UdEwQFMAMBAf8wCgYIKoZIzj0EAwIDSQAwRgIhALs4vy+O M3jcqgA4fSW/oKw6UJxp+M6a+nGMX+UJR3YgAiEAvvl39QRVAiv84hdoCuyON0lJ zqGNhIPGq2ULqXKK8BY= - -----END CERTIFICATE----- + --END CERTIFICATE-- private_key: | - -----BEGIN EC PRIVATE KEY----- + --BEGIN EC PRIVATE KEY-- MHcCAQEEIObtRo8tkUqoMjeHhsOh2ouPpXCgBcP+EDxZCB/tws15oAoGCCqGSM49 AwEHoUQDQgAEHGzpcRJ4XzfBJCCPMQeXQpTXwlblimODQCuQ4mzkzTv0dXyB750f OGN02HtkpBOZzzvUARTR10JQoSe2/5PIwQ== - -----END EC PRIVATE KEY----- + --END EC PRIVATE KEY-- project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" @@ -196,7 +196,7 @@ name: "{{ resource_name }}" description: A certificate for testing. Do not use this certificate in production certificate: | - -----BEGIN CERTIFICATE----- + --BEGIN CERTIFICATE-- MIICqjCCAk+gAwIBAgIJAIuJ+0352Kq4MAoGCCqGSM49BAMCMIGwMQswCQYDVQQG EwJVUzETMBEGA1UECAwKV2FzaGluZ3RvbjERMA8GA1UEBwwIS2lya2xhbmQxFTAT BgNVBAoMDEdvb2dsZSwgSW5jLjEeMBwGA1UECwwVR29vZ2xlIENsb3VkIFBsYXRm @@ -212,13 +212,13 @@ 0YLKineDNq/BMAwGA1UdEwQFMAMBAf8wCgYIKoZIzj0EAwIDSQAwRgIhALs4vy+O M3jcqgA4fSW/oKw6UJxp+M6a+nGMX+UJR3YgAiEAvvl39QRVAiv84hdoCuyON0lJ zqGNhIPGq2ULqXKK8BY= - -----END CERTIFICATE----- + --END CERTIFICATE-- private_key: | - -----BEGIN EC PRIVATE KEY----- + --BEGIN EC PRIVATE KEY-- MHcCAQEEIObtRo8tkUqoMjeHhsOh2ouPpXCgBcP+EDxZCB/tws15oAoGCCqGSM49 AwEHoUQDQgAEHGzpcRJ4XzfBJCCPMQeXQpTXwlblimODQCuQ4mzkzTv0dXyB750f OGN02HtkpBOZzzvUARTR10JQoSe2/5PIwQ== - -----END EC PRIVATE KEY----- + --END EC PRIVATE KEY-- project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" diff --git a/test/integration/targets/gcp_compute_target_https_proxy/tasks/main.yml b/test/integration/targets/gcp_compute_target_https_proxy/tasks/main.yml index f8d18634fbde9c..82627ed3b481f3 100644 --- a/test/integration/targets/gcp_compute_target_https_proxy/tasks/main.yml +++ b/test/integration/targets/gcp_compute_target_https_proxy/tasks/main.yml @@ -61,7 +61,7 @@ name: "sslcert-targethttpsproxy" description: A certificate for testing. Do not use this certificate in production certificate: | - -----BEGIN CERTIFICATE----- + --BEGIN CERTIFICATE-- MIICqjCCAk+gAwIBAgIJAIuJ+0352Kq4MAoGCCqGSM49BAMCMIGwMQswCQYDVQQG EwJVUzETMBEGA1UECAwKV2FzaGluZ3RvbjERMA8GA1UEBwwIS2lya2xhbmQxFTAT BgNVBAoMDEdvb2dsZSwgSW5jLjEeMBwGA1UECwwVR29vZ2xlIENsb3VkIFBsYXRm @@ -77,13 +77,13 @@ 0YLKineDNq/BMAwGA1UdEwQFMAMBAf8wCgYIKoZIzj0EAwIDSQAwRgIhALs4vy+O M3jcqgA4fSW/oKw6UJxp+M6a+nGMX+UJR3YgAiEAvvl39QRVAiv84hdoCuyON0lJ zqGNhIPGq2ULqXKK8BY= - -----END CERTIFICATE----- + --END CERTIFICATE-- private_key: | - -----BEGIN EC PRIVATE KEY----- + --BEGIN EC PRIVATE KEY-- MHcCAQEEIObtRo8tkUqoMjeHhsOh2ouPpXCgBcP+EDxZCB/tws15oAoGCCqGSM49 AwEHoUQDQgAEHGzpcRJ4XzfBJCCPMQeXQpTXwlblimODQCuQ4mzkzTv0dXyB750f OGN02HtkpBOZzzvUARTR10JQoSe2/5PIwQ== - -----END EC PRIVATE KEY----- + --END EC PRIVATE KEY-- project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" @@ -202,7 +202,7 @@ name: "sslcert-targethttpsproxy" description: A certificate for testing. Do not use this certificate in production certificate: | - -----BEGIN CERTIFICATE----- + --BEGIN CERTIFICATE-- MIICqjCCAk+gAwIBAgIJAIuJ+0352Kq4MAoGCCqGSM49BAMCMIGwMQswCQYDVQQG EwJVUzETMBEGA1UECAwKV2FzaGluZ3RvbjERMA8GA1UEBwwIS2lya2xhbmQxFTAT BgNVBAoMDEdvb2dsZSwgSW5jLjEeMBwGA1UECwwVR29vZ2xlIENsb3VkIFBsYXRm @@ -218,13 +218,13 @@ 0YLKineDNq/BMAwGA1UdEwQFMAMBAf8wCgYIKoZIzj0EAwIDSQAwRgIhALs4vy+O M3jcqgA4fSW/oKw6UJxp+M6a+nGMX+UJR3YgAiEAvvl39QRVAiv84hdoCuyON0lJ zqGNhIPGq2ULqXKK8BY= - -----END CERTIFICATE----- + --END CERTIFICATE-- private_key: | - -----BEGIN EC PRIVATE KEY----- + --BEGIN EC PRIVATE KEY-- MHcCAQEEIObtRo8tkUqoMjeHhsOh2ouPpXCgBcP+EDxZCB/tws15oAoGCCqGSM49 AwEHoUQDQgAEHGzpcRJ4XzfBJCCPMQeXQpTXwlblimODQCuQ4mzkzTv0dXyB750f OGN02HtkpBOZzzvUARTR10JQoSe2/5PIwQ== - -----END EC PRIVATE KEY----- + --END EC PRIVATE KEY-- project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" diff --git a/test/integration/targets/gcp_compute_target_ssl_proxy/tasks/main.yml b/test/integration/targets/gcp_compute_target_ssl_proxy/tasks/main.yml index 2b9f24154f5b9c..122576d34ebaa3 100644 --- a/test/integration/targets/gcp_compute_target_ssl_proxy/tasks/main.yml +++ b/test/integration/targets/gcp_compute_target_ssl_proxy/tasks/main.yml @@ -56,7 +56,7 @@ name: "sslcert-targetsslproxy" description: A certificate for testing. Do not use this certificate in production certificate: | - -----BEGIN CERTIFICATE----- + --BEGIN CERTIFICATE-- MIICqjCCAk+gAwIBAgIJAIuJ+0352Kq4MAoGCCqGSM49BAMCMIGwMQswCQYDVQQG EwJVUzETMBEGA1UECAwKV2FzaGluZ3RvbjERMA8GA1UEBwwIS2lya2xhbmQxFTAT BgNVBAoMDEdvb2dsZSwgSW5jLjEeMBwGA1UECwwVR29vZ2xlIENsb3VkIFBsYXRm @@ -72,13 +72,13 @@ 0YLKineDNq/BMAwGA1UdEwQFMAMBAf8wCgYIKoZIzj0EAwIDSQAwRgIhALs4vy+O M3jcqgA4fSW/oKw6UJxp+M6a+nGMX+UJR3YgAiEAvvl39QRVAiv84hdoCuyON0lJ zqGNhIPGq2ULqXKK8BY= - -----END CERTIFICATE----- + --END CERTIFICATE-- private_key: | - -----BEGIN EC PRIVATE KEY----- + --BEGIN EC PRIVATE KEY-- MHcCAQEEIObtRo8tkUqoMjeHhsOh2ouPpXCgBcP+EDxZCB/tws15oAoGCCqGSM49 AwEHoUQDQgAEHGzpcRJ4XzfBJCCPMQeXQpTXwlblimODQCuQ4mzkzTv0dXyB750f OGN02HtkpBOZzzvUARTR10JQoSe2/5PIwQ== - -----END EC PRIVATE KEY----- + --END EC PRIVATE KEY-- project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" @@ -197,7 +197,7 @@ name: "sslcert-targetsslproxy" description: A certificate for testing. Do not use this certificate in production certificate: | - -----BEGIN CERTIFICATE----- + --BEGIN CERTIFICATE-- MIICqjCCAk+gAwIBAgIJAIuJ+0352Kq4MAoGCCqGSM49BAMCMIGwMQswCQYDVQQG EwJVUzETMBEGA1UECAwKV2FzaGluZ3RvbjERMA8GA1UEBwwIS2lya2xhbmQxFTAT BgNVBAoMDEdvb2dsZSwgSW5jLjEeMBwGA1UECwwVR29vZ2xlIENsb3VkIFBsYXRm @@ -213,13 +213,13 @@ 0YLKineDNq/BMAwGA1UdEwQFMAMBAf8wCgYIKoZIzj0EAwIDSQAwRgIhALs4vy+O M3jcqgA4fSW/oKw6UJxp+M6a+nGMX+UJR3YgAiEAvvl39QRVAiv84hdoCuyON0lJ zqGNhIPGq2ULqXKK8BY= - -----END CERTIFICATE----- + --END CERTIFICATE-- private_key: | - -----BEGIN EC PRIVATE KEY----- + --BEGIN EC PRIVATE KEY-- MHcCAQEEIObtRo8tkUqoMjeHhsOh2ouPpXCgBcP+EDxZCB/tws15oAoGCCqGSM49 AwEHoUQDQgAEHGzpcRJ4XzfBJCCPMQeXQpTXwlblimODQCuQ4mzkzTv0dXyB750f OGN02HtkpBOZzzvUARTR10JQoSe2/5PIwQ== - -----END EC PRIVATE KEY----- + --END EC PRIVATE KEY-- project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" From 802d3ad366af62b037f6c78cc26c581b96537df8 Mon Sep 17 00:00:00 2001 From: The Magician Date: Mon, 6 Aug 2018 16:03:03 -0700 Subject: [PATCH 016/144] Adding Compute Facts (#60) --- .../tasks/main.yml | 40 ++++++------ .../tasks/main.yml | 16 ++--- .../tasks/main.yml | 16 ++--- .../tasks/main.yml | 65 ------------------- 4 files changed, 36 insertions(+), 101 deletions(-) diff --git a/test/integration/targets/gcp_compute_ssl_certificate/tasks/main.yml b/test/integration/targets/gcp_compute_ssl_certificate/tasks/main.yml index dfa028377cddcf..5350f6a72c3ce1 100644 --- a/test/integration/targets/gcp_compute_ssl_certificate/tasks/main.yml +++ b/test/integration/targets/gcp_compute_ssl_certificate/tasks/main.yml @@ -18,7 +18,7 @@ name: "{{ resource_name }}" description: A certificate for testing. Do not use this certificate in production certificate: | - --BEGIN CERTIFICATE-- + -----BEGIN CERTIFICATE----- MIICqjCCAk+gAwIBAgIJAIuJ+0352Kq4MAoGCCqGSM49BAMCMIGwMQswCQYDVQQG EwJVUzETMBEGA1UECAwKV2FzaGluZ3RvbjERMA8GA1UEBwwIS2lya2xhbmQxFTAT BgNVBAoMDEdvb2dsZSwgSW5jLjEeMBwGA1UECwwVR29vZ2xlIENsb3VkIFBsYXRm @@ -34,13 +34,13 @@ 0YLKineDNq/BMAwGA1UdEwQFMAMBAf8wCgYIKoZIzj0EAwIDSQAwRgIhALs4vy+O M3jcqgA4fSW/oKw6UJxp+M6a+nGMX+UJR3YgAiEAvvl39QRVAiv84hdoCuyON0lJ zqGNhIPGq2ULqXKK8BY= - --END CERTIFICATE-- + -----END CERTIFICATE----- private_key: | - --BEGIN EC PRIVATE KEY-- + -----BEGIN EC PRIVATE KEY----- MHcCAQEEIObtRo8tkUqoMjeHhsOh2ouPpXCgBcP+EDxZCB/tws15oAoGCCqGSM49 AwEHoUQDQgAEHGzpcRJ4XzfBJCCPMQeXQpTXwlblimODQCuQ4mzkzTv0dXyB750f OGN02HtkpBOZzzvUARTR10JQoSe2/5PIwQ== - --END EC PRIVATE KEY-- + -----END EC PRIVATE KEY----- project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" @@ -51,7 +51,7 @@ name: "{{ resource_name }}" description: A certificate for testing. Do not use this certificate in production certificate: | - --BEGIN CERTIFICATE-- + -----BEGIN CERTIFICATE----- MIICqjCCAk+gAwIBAgIJAIuJ+0352Kq4MAoGCCqGSM49BAMCMIGwMQswCQYDVQQG EwJVUzETMBEGA1UECAwKV2FzaGluZ3RvbjERMA8GA1UEBwwIS2lya2xhbmQxFTAT BgNVBAoMDEdvb2dsZSwgSW5jLjEeMBwGA1UECwwVR29vZ2xlIENsb3VkIFBsYXRm @@ -67,13 +67,13 @@ 0YLKineDNq/BMAwGA1UdEwQFMAMBAf8wCgYIKoZIzj0EAwIDSQAwRgIhALs4vy+O M3jcqgA4fSW/oKw6UJxp+M6a+nGMX+UJR3YgAiEAvvl39QRVAiv84hdoCuyON0lJ zqGNhIPGq2ULqXKK8BY= - --END CERTIFICATE-- + -----END CERTIFICATE----- private_key: | - --BEGIN EC PRIVATE KEY-- + -----BEGIN EC PRIVATE KEY----- MHcCAQEEIObtRo8tkUqoMjeHhsOh2ouPpXCgBcP+EDxZCB/tws15oAoGCCqGSM49 AwEHoUQDQgAEHGzpcRJ4XzfBJCCPMQeXQpTXwlblimODQCuQ4mzkzTv0dXyB750f OGN02HtkpBOZzzvUARTR10JQoSe2/5PIwQ== - --END EC PRIVATE KEY-- + -----END EC PRIVATE KEY----- project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" @@ -104,7 +104,7 @@ name: "{{ resource_name }}" description: A certificate for testing. Do not use this certificate in production certificate: | - --BEGIN CERTIFICATE-- + -----BEGIN CERTIFICATE----- MIICqjCCAk+gAwIBAgIJAIuJ+0352Kq4MAoGCCqGSM49BAMCMIGwMQswCQYDVQQG EwJVUzETMBEGA1UECAwKV2FzaGluZ3RvbjERMA8GA1UEBwwIS2lya2xhbmQxFTAT BgNVBAoMDEdvb2dsZSwgSW5jLjEeMBwGA1UECwwVR29vZ2xlIENsb3VkIFBsYXRm @@ -120,13 +120,13 @@ 0YLKineDNq/BMAwGA1UdEwQFMAMBAf8wCgYIKoZIzj0EAwIDSQAwRgIhALs4vy+O M3jcqgA4fSW/oKw6UJxp+M6a+nGMX+UJR3YgAiEAvvl39QRVAiv84hdoCuyON0lJ zqGNhIPGq2ULqXKK8BY= - --END CERTIFICATE-- + -----END CERTIFICATE----- private_key: | - --BEGIN EC PRIVATE KEY-- + -----BEGIN EC PRIVATE KEY----- MHcCAQEEIObtRo8tkUqoMjeHhsOh2ouPpXCgBcP+EDxZCB/tws15oAoGCCqGSM49 AwEHoUQDQgAEHGzpcRJ4XzfBJCCPMQeXQpTXwlblimODQCuQ4mzkzTv0dXyB750f OGN02HtkpBOZzzvUARTR10JQoSe2/5PIwQ== - --END EC PRIVATE KEY-- + -----END EC PRIVATE KEY----- project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" @@ -143,7 +143,7 @@ name: "{{ resource_name }}" description: A certificate for testing. Do not use this certificate in production certificate: | - --BEGIN CERTIFICATE-- + -----BEGIN CERTIFICATE----- MIICqjCCAk+gAwIBAgIJAIuJ+0352Kq4MAoGCCqGSM49BAMCMIGwMQswCQYDVQQG EwJVUzETMBEGA1UECAwKV2FzaGluZ3RvbjERMA8GA1UEBwwIS2lya2xhbmQxFTAT BgNVBAoMDEdvb2dsZSwgSW5jLjEeMBwGA1UECwwVR29vZ2xlIENsb3VkIFBsYXRm @@ -159,13 +159,13 @@ 0YLKineDNq/BMAwGA1UdEwQFMAMBAf8wCgYIKoZIzj0EAwIDSQAwRgIhALs4vy+O M3jcqgA4fSW/oKw6UJxp+M6a+nGMX+UJR3YgAiEAvvl39QRVAiv84hdoCuyON0lJ zqGNhIPGq2ULqXKK8BY= - --END CERTIFICATE-- + -----END CERTIFICATE----- private_key: | - --BEGIN EC PRIVATE KEY-- + -----BEGIN EC PRIVATE KEY----- MHcCAQEEIObtRo8tkUqoMjeHhsOh2ouPpXCgBcP+EDxZCB/tws15oAoGCCqGSM49 AwEHoUQDQgAEHGzpcRJ4XzfBJCCPMQeXQpTXwlblimODQCuQ4mzkzTv0dXyB750f OGN02HtkpBOZzzvUARTR10JQoSe2/5PIwQ== - --END EC PRIVATE KEY-- + -----END EC PRIVATE KEY----- project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" @@ -196,7 +196,7 @@ name: "{{ resource_name }}" description: A certificate for testing. Do not use this certificate in production certificate: | - --BEGIN CERTIFICATE-- + -----BEGIN CERTIFICATE----- MIICqjCCAk+gAwIBAgIJAIuJ+0352Kq4MAoGCCqGSM49BAMCMIGwMQswCQYDVQQG EwJVUzETMBEGA1UECAwKV2FzaGluZ3RvbjERMA8GA1UEBwwIS2lya2xhbmQxFTAT BgNVBAoMDEdvb2dsZSwgSW5jLjEeMBwGA1UECwwVR29vZ2xlIENsb3VkIFBsYXRm @@ -212,13 +212,13 @@ 0YLKineDNq/BMAwGA1UdEwQFMAMBAf8wCgYIKoZIzj0EAwIDSQAwRgIhALs4vy+O M3jcqgA4fSW/oKw6UJxp+M6a+nGMX+UJR3YgAiEAvvl39QRVAiv84hdoCuyON0lJ zqGNhIPGq2ULqXKK8BY= - --END CERTIFICATE-- + -----END CERTIFICATE----- private_key: | - --BEGIN EC PRIVATE KEY-- + -----BEGIN EC PRIVATE KEY----- MHcCAQEEIObtRo8tkUqoMjeHhsOh2ouPpXCgBcP+EDxZCB/tws15oAoGCCqGSM49 AwEHoUQDQgAEHGzpcRJ4XzfBJCCPMQeXQpTXwlblimODQCuQ4mzkzTv0dXyB750f OGN02HtkpBOZzzvUARTR10JQoSe2/5PIwQ== - --END EC PRIVATE KEY-- + -----END EC PRIVATE KEY----- project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" diff --git a/test/integration/targets/gcp_compute_target_https_proxy/tasks/main.yml b/test/integration/targets/gcp_compute_target_https_proxy/tasks/main.yml index 82627ed3b481f3..f8d18634fbde9c 100644 --- a/test/integration/targets/gcp_compute_target_https_proxy/tasks/main.yml +++ b/test/integration/targets/gcp_compute_target_https_proxy/tasks/main.yml @@ -61,7 +61,7 @@ name: "sslcert-targethttpsproxy" description: A certificate for testing. Do not use this certificate in production certificate: | - --BEGIN CERTIFICATE-- + -----BEGIN CERTIFICATE----- MIICqjCCAk+gAwIBAgIJAIuJ+0352Kq4MAoGCCqGSM49BAMCMIGwMQswCQYDVQQG EwJVUzETMBEGA1UECAwKV2FzaGluZ3RvbjERMA8GA1UEBwwIS2lya2xhbmQxFTAT BgNVBAoMDEdvb2dsZSwgSW5jLjEeMBwGA1UECwwVR29vZ2xlIENsb3VkIFBsYXRm @@ -77,13 +77,13 @@ 0YLKineDNq/BMAwGA1UdEwQFMAMBAf8wCgYIKoZIzj0EAwIDSQAwRgIhALs4vy+O M3jcqgA4fSW/oKw6UJxp+M6a+nGMX+UJR3YgAiEAvvl39QRVAiv84hdoCuyON0lJ zqGNhIPGq2ULqXKK8BY= - --END CERTIFICATE-- + -----END CERTIFICATE----- private_key: | - --BEGIN EC PRIVATE KEY-- + -----BEGIN EC PRIVATE KEY----- MHcCAQEEIObtRo8tkUqoMjeHhsOh2ouPpXCgBcP+EDxZCB/tws15oAoGCCqGSM49 AwEHoUQDQgAEHGzpcRJ4XzfBJCCPMQeXQpTXwlblimODQCuQ4mzkzTv0dXyB750f OGN02HtkpBOZzzvUARTR10JQoSe2/5PIwQ== - --END EC PRIVATE KEY-- + -----END EC PRIVATE KEY----- project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" @@ -202,7 +202,7 @@ name: "sslcert-targethttpsproxy" description: A certificate for testing. Do not use this certificate in production certificate: | - --BEGIN CERTIFICATE-- + -----BEGIN CERTIFICATE----- MIICqjCCAk+gAwIBAgIJAIuJ+0352Kq4MAoGCCqGSM49BAMCMIGwMQswCQYDVQQG EwJVUzETMBEGA1UECAwKV2FzaGluZ3RvbjERMA8GA1UEBwwIS2lya2xhbmQxFTAT BgNVBAoMDEdvb2dsZSwgSW5jLjEeMBwGA1UECwwVR29vZ2xlIENsb3VkIFBsYXRm @@ -218,13 +218,13 @@ 0YLKineDNq/BMAwGA1UdEwQFMAMBAf8wCgYIKoZIzj0EAwIDSQAwRgIhALs4vy+O M3jcqgA4fSW/oKw6UJxp+M6a+nGMX+UJR3YgAiEAvvl39QRVAiv84hdoCuyON0lJ zqGNhIPGq2ULqXKK8BY= - --END CERTIFICATE-- + -----END CERTIFICATE----- private_key: | - --BEGIN EC PRIVATE KEY-- + -----BEGIN EC PRIVATE KEY----- MHcCAQEEIObtRo8tkUqoMjeHhsOh2ouPpXCgBcP+EDxZCB/tws15oAoGCCqGSM49 AwEHoUQDQgAEHGzpcRJ4XzfBJCCPMQeXQpTXwlblimODQCuQ4mzkzTv0dXyB750f OGN02HtkpBOZzzvUARTR10JQoSe2/5PIwQ== - --END EC PRIVATE KEY-- + -----END EC PRIVATE KEY----- project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" diff --git a/test/integration/targets/gcp_compute_target_ssl_proxy/tasks/main.yml b/test/integration/targets/gcp_compute_target_ssl_proxy/tasks/main.yml index 122576d34ebaa3..2b9f24154f5b9c 100644 --- a/test/integration/targets/gcp_compute_target_ssl_proxy/tasks/main.yml +++ b/test/integration/targets/gcp_compute_target_ssl_proxy/tasks/main.yml @@ -56,7 +56,7 @@ name: "sslcert-targetsslproxy" description: A certificate for testing. Do not use this certificate in production certificate: | - --BEGIN CERTIFICATE-- + -----BEGIN CERTIFICATE----- MIICqjCCAk+gAwIBAgIJAIuJ+0352Kq4MAoGCCqGSM49BAMCMIGwMQswCQYDVQQG EwJVUzETMBEGA1UECAwKV2FzaGluZ3RvbjERMA8GA1UEBwwIS2lya2xhbmQxFTAT BgNVBAoMDEdvb2dsZSwgSW5jLjEeMBwGA1UECwwVR29vZ2xlIENsb3VkIFBsYXRm @@ -72,13 +72,13 @@ 0YLKineDNq/BMAwGA1UdEwQFMAMBAf8wCgYIKoZIzj0EAwIDSQAwRgIhALs4vy+O M3jcqgA4fSW/oKw6UJxp+M6a+nGMX+UJR3YgAiEAvvl39QRVAiv84hdoCuyON0lJ zqGNhIPGq2ULqXKK8BY= - --END CERTIFICATE-- + -----END CERTIFICATE----- private_key: | - --BEGIN EC PRIVATE KEY-- + -----BEGIN EC PRIVATE KEY----- MHcCAQEEIObtRo8tkUqoMjeHhsOh2ouPpXCgBcP+EDxZCB/tws15oAoGCCqGSM49 AwEHoUQDQgAEHGzpcRJ4XzfBJCCPMQeXQpTXwlblimODQCuQ4mzkzTv0dXyB750f OGN02HtkpBOZzzvUARTR10JQoSe2/5PIwQ== - --END EC PRIVATE KEY-- + -----END EC PRIVATE KEY----- project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" @@ -197,7 +197,7 @@ name: "sslcert-targetsslproxy" description: A certificate for testing. Do not use this certificate in production certificate: | - --BEGIN CERTIFICATE-- + -----BEGIN CERTIFICATE----- MIICqjCCAk+gAwIBAgIJAIuJ+0352Kq4MAoGCCqGSM49BAMCMIGwMQswCQYDVQQG EwJVUzETMBEGA1UECAwKV2FzaGluZ3RvbjERMA8GA1UEBwwIS2lya2xhbmQxFTAT BgNVBAoMDEdvb2dsZSwgSW5jLjEeMBwGA1UECwwVR29vZ2xlIENsb3VkIFBsYXRm @@ -213,13 +213,13 @@ 0YLKineDNq/BMAwGA1UdEwQFMAMBAf8wCgYIKoZIzj0EAwIDSQAwRgIhALs4vy+O M3jcqgA4fSW/oKw6UJxp+M6a+nGMX+UJR3YgAiEAvvl39QRVAiv84hdoCuyON0lJ zqGNhIPGq2ULqXKK8BY= - --END CERTIFICATE-- + -----END CERTIFICATE----- private_key: | - --BEGIN EC PRIVATE KEY-- + -----BEGIN EC PRIVATE KEY----- MHcCAQEEIObtRo8tkUqoMjeHhsOh2ouPpXCgBcP+EDxZCB/tws15oAoGCCqGSM49 AwEHoUQDQgAEHGzpcRJ4XzfBJCCPMQeXQpTXwlblimODQCuQ4mzkzTv0dXyB750f OGN02HtkpBOZzzvUARTR10JQoSe2/5PIwQ== - --END EC PRIVATE KEY-- + -----END EC PRIVATE KEY----- project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" diff --git a/test/integration/targets/gcp_dns_resource_record_set/tasks/main.yml b/test/integration/targets/gcp_dns_resource_record_set/tasks/main.yml index b60b513c63d329..f1ee3a47a2643c 100644 --- a/test/integration/targets/gcp_dns_resource_record_set/tasks/main.yml +++ b/test/integration/targets/gcp_dns_resource_record_set/tasks/main.yml @@ -23,33 +23,7 @@ service_account_file: "{{ gcp_cred_file }}" state: present register: managed_zone -- name: delete a resource record set - gcp_dns_resource_record_set: - name: www.testzone-4.com. - managed_zone: "{{ managed_zone }}" - type: A - ttl: 600 - target: - - 10.1.2.3 - - 40.5.6.7 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent #---------------------------------------------------------- -- name: create a resource record set - gcp_dns_resource_record_set: - name: www.testzone-4.com. - managed_zone: "{{ managed_zone }}" - type: A - ttl: 600 - target: - - 10.1.2.3 - - 40.5.6.7 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present register: result - name: assert changed is true assert: @@ -57,19 +31,6 @@ - result.changed == true - "result.kind == 'dns#resourceRecordSet'" # ---------------------------------------------------------------------------- -- name: create a resource record set that already exists - gcp_dns_resource_record_set: - name: www.testzone-4.com. - managed_zone: "{{ managed_zone }}" - type: A - ttl: 600 - target: - - 10.1.2.3 - - 40.5.6.7 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present register: result - name: assert changed is false assert: @@ -77,19 +38,6 @@ - result.changed == false - "result.kind == 'dns#resourceRecordSet'" #---------------------------------------------------------- -- name: delete a resource record set - gcp_dns_resource_record_set: - name: www.testzone-4.com. - managed_zone: "{{ managed_zone }}" - type: A - ttl: 600 - target: - - 10.1.2.3 - - 40.5.6.7 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent register: result - name: assert changed is true assert: @@ -97,19 +45,6 @@ - result.changed == true - result.has_key('kind') == False # ---------------------------------------------------------------------------- -- name: delete a resource record set that does not exist - gcp_dns_resource_record_set: - name: www.testzone-4.com. - managed_zone: "{{ managed_zone }}" - type: A - ttl: 600 - target: - - 10.1.2.3 - - 40.5.6.7 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent register: result - name: assert changed is false assert: From 9256c2f1efc750fd3364f1bea8c57e51d6decda1 Mon Sep 17 00:00:00 2001 From: The Magician Date: Wed, 15 Aug 2018 13:39:22 -0700 Subject: [PATCH 017/144] Object.input should == noneditable (#62) /cc @rambleraptor --- lib/ansible/modules/cloud/google/gcp_compute_address.py | 3 +-- .../modules/cloud/google/gcp_compute_forwarding_rule.py | 3 +-- lib/ansible/modules/cloud/google/gcp_compute_global_address.py | 3 +-- .../modules/cloud/google/gcp_compute_instance_template.py | 3 +-- lib/ansible/modules/cloud/google/gcp_compute_route.py | 3 +-- lib/ansible/modules/cloud/google/gcp_compute_subnetwork.py | 3 +-- .../modules/cloud/google/gcp_compute_target_http_proxy.py | 3 +-- .../modules/cloud/google/gcp_compute_target_https_proxy.py | 3 +-- .../modules/cloud/google/gcp_compute_target_ssl_proxy.py | 3 +-- .../modules/cloud/google/gcp_compute_target_tcp_proxy.py | 3 +-- .../modules/cloud/google/gcp_compute_target_vpn_gateway.py | 3 +-- lib/ansible/modules/cloud/google/gcp_compute_vpn_tunnel.py | 3 +-- 12 files changed, 12 insertions(+), 24 deletions(-) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_address.py b/lib/ansible/modules/cloud/google/gcp_compute_address.py index c7d40c9838dc51..b641e9e9def51d 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_address.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_address.py @@ -233,8 +233,7 @@ def create(module, link, kind): def update(module, link, kind): - auth = GcpSession(module, 'compute') - return wait_for_operation(module, auth.put(link, resource_to_request(module))) + module.fail_json(msg="Address cannot be edited") def delete(module, link, kind): diff --git a/lib/ansible/modules/cloud/google/gcp_compute_forwarding_rule.py b/lib/ansible/modules/cloud/google/gcp_compute_forwarding_rule.py index 500482d5f3fab2..7b33e640c6fd02 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_forwarding_rule.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_forwarding_rule.py @@ -410,8 +410,7 @@ def create(module, link, kind): def update(module, link, kind): - auth = GcpSession(module, 'compute') - return wait_for_operation(module, auth.put(link, resource_to_request(module))) + module.fail_json(msg="ForwardingRule cannot be edited") def delete(module, link, kind): diff --git a/lib/ansible/modules/cloud/google/gcp_compute_global_address.py b/lib/ansible/modules/cloud/google/gcp_compute_global_address.py index 3402fd96e18b45..d313db81b4f5c1 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_global_address.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_global_address.py @@ -190,8 +190,7 @@ def create(module, link, kind): def update(module, link, kind): - auth = GcpSession(module, 'compute') - return wait_for_operation(module, auth.put(link, resource_to_request(module))) + module.fail_json(msg="GlobalAddress cannot be edited") def delete(module, link, kind): diff --git a/lib/ansible/modules/cloud/google/gcp_compute_instance_template.py b/lib/ansible/modules/cloud/google/gcp_compute_instance_template.py index a3b4919e7f093a..77ddb23ccdd0d5 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_instance_template.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_instance_template.py @@ -908,8 +908,7 @@ def create(module, link, kind): def update(module, link, kind): - auth = GcpSession(module, 'compute') - return wait_for_operation(module, auth.put(link, resource_to_request(module))) + module.fail_json(msg="InstanceTemplate cannot be edited") def delete(module, link, kind): diff --git a/lib/ansible/modules/cloud/google/gcp_compute_route.py b/lib/ansible/modules/cloud/google/gcp_compute_route.py index 1a61e098b6bad9..d1efd1f7accf79 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_route.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_route.py @@ -295,8 +295,7 @@ def create(module, link, kind): def update(module, link, kind): - auth = GcpSession(module, 'compute') - return wait_for_operation(module, auth.put(link, resource_to_request(module))) + module.fail_json(msg="Route cannot be edited") def delete(module, link, kind): diff --git a/lib/ansible/modules/cloud/google/gcp_compute_subnetwork.py b/lib/ansible/modules/cloud/google/gcp_compute_subnetwork.py index e2cca992391c12..183ea3761fab53 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_subnetwork.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_subnetwork.py @@ -252,8 +252,7 @@ def create(module, link, kind): def update(module, link, kind): - auth = GcpSession(module, 'compute') - return wait_for_operation(module, auth.put(link, resource_to_request(module))) + module.fail_json(msg="Subnetwork cannot be edited") def delete(module, link, kind): diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_http_proxy.py b/lib/ansible/modules/cloud/google/gcp_compute_target_http_proxy.py index ae62cd29d3855b..99d963e25c4c10 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_http_proxy.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_http_proxy.py @@ -222,8 +222,7 @@ def create(module, link, kind): def update(module, link, kind): - auth = GcpSession(module, 'compute') - return wait_for_operation(module, auth.put(link, resource_to_request(module))) + module.fail_json(msg="TargetHttpProxy cannot be edited") def delete(module, link, kind): diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_https_proxy.py b/lib/ansible/modules/cloud/google/gcp_compute_target_https_proxy.py index c3e4cb23434906..cef23873e65e7e 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_https_proxy.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_https_proxy.py @@ -290,8 +290,7 @@ def create(module, link, kind): def update(module, link, kind): - auth = GcpSession(module, 'compute') - return wait_for_operation(module, auth.put(link, resource_to_request(module))) + module.fail_json(msg="TargetHttpsProxy cannot be edited") def delete(module, link, kind): diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_ssl_proxy.py b/lib/ansible/modules/cloud/google/gcp_compute_target_ssl_proxy.py index 6c3b0725f34eaf..ac115a4e525227 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_ssl_proxy.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_ssl_proxy.py @@ -277,8 +277,7 @@ def create(module, link, kind): def update(module, link, kind): - auth = GcpSession(module, 'compute') - return wait_for_operation(module, auth.put(link, resource_to_request(module))) + module.fail_json(msg="TargetSslProxy cannot be edited") def delete(module, link, kind): diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_tcp_proxy.py b/lib/ansible/modules/cloud/google/gcp_compute_target_tcp_proxy.py index f8fea560407aae..1c5459e2c57ce1 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_tcp_proxy.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_tcp_proxy.py @@ -230,8 +230,7 @@ def create(module, link, kind): def update(module, link, kind): - auth = GcpSession(module, 'compute') - return wait_for_operation(module, auth.put(link, resource_to_request(module))) + module.fail_json(msg="TargetTcpProxy cannot be edited") def delete(module, link, kind): diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_vpn_gateway.py b/lib/ansible/modules/cloud/google/gcp_compute_target_vpn_gateway.py index a68d32f44623d1..26c700b8282292 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_vpn_gateway.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_vpn_gateway.py @@ -214,8 +214,7 @@ def create(module, link, kind): def update(module, link, kind): - auth = GcpSession(module, 'compute') - return wait_for_operation(module, auth.put(link, resource_to_request(module))) + module.fail_json(msg="TargetVpnGateway cannot be edited") def delete(module, link, kind): diff --git a/lib/ansible/modules/cloud/google/gcp_compute_vpn_tunnel.py b/lib/ansible/modules/cloud/google/gcp_compute_vpn_tunnel.py index 0697ab9002304e..06502428239bad 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_vpn_tunnel.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_vpn_tunnel.py @@ -312,8 +312,7 @@ def create(module, link, kind): def update(module, link, kind): - auth = GcpSession(module, 'compute') - return wait_for_operation(module, auth.put(link, resource_to_request(module))) + module.fail_json(msg="VpnTunnel cannot be edited") def delete(module, link, kind): From 3d115c20d4d61603bb4db7c92788b19fbe49b269 Mon Sep 17 00:00:00 2001 From: Dana Hoffman Date: Thu, 16 Aug 2018 18:18:40 +0000 Subject: [PATCH 018/144] add RegionDiskType --- .../modules/cloud/google/gcp_compute_disk.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_disk.py b/lib/ansible/modules/cloud/google/gcp_compute_disk.py index 8dfc0d1ed1be9e..31fac0a5d9e481 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_disk.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_disk.py @@ -248,18 +248,18 @@ sizeGb must not be less than the size of the sourceImage or the size of the snapshot. returned: success type: int - type: - description: - - URL of the disk type resource describing which disk type to use to create the disk. - Provide this when creating the disk. - returned: success - type: str users: description: - 'Links to the users of the disk (attached instances) in form: project/zones/zone/instances/instance .' returned: success type: list + type: + description: + - URL of the disk type resource describing which disk type to use to create the disk. + Provide this when creating the disk. + returned: success + type: str source_image: description: - The source image used to create this disk. If the source image is deleted, this @@ -548,8 +548,8 @@ def response_to_hash(module, response): u'licenses': response.get(u'licenses'), u'name': module.params.get('name'), u'sizeGb': response.get(u'sizeGb'), - u'type': response.get(u'type'), u'users': response.get(u'users'), + u'type': response.get(u'type'), u'sourceImage': module.params.get('source_image') } From 3a2805f94f693efb6a01c65c2703a2683e65e4a8 Mon Sep 17 00:00:00 2001 From: The Magician Date: Mon, 20 Aug 2018 11:25:12 -0700 Subject: [PATCH 019/144] Partial updates (#63) --- .../modules/cloud/google/gcp_compute_disk.py | 49 +++++++++++++++- .../cloud/google/gcp_compute_disk_facts.py | 6 ++ .../google/gcp_compute_forwarding_rule.py | 48 ++++++++++++++-- .../gcp_compute_forwarding_rule_facts.py | 6 ++ .../google/gcp_compute_global_address.py | 32 ++++++++++- .../gcp_compute_global_address_facts.py | 6 ++ .../cloud/google/gcp_compute_subnetwork.py | 41 +++++++++++++- .../google/gcp_compute_target_http_proxy.py | 26 ++++++++- .../google/gcp_compute_target_https_proxy.py | 56 ++++++++++++++++++- .../google/gcp_compute_target_ssl_proxy.py | 56 ++++++++++++++++++- .../google/gcp_compute_target_tcp_proxy.py | 41 +++++++++++++- .../cloud/google/gcp_compute_vpn_tunnel.py | 37 ++++++++++-- .../google/gcp_compute_vpn_tunnel_facts.py | 6 ++ 13 files changed, 381 insertions(+), 29 deletions(-) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_disk.py b/lib/ansible/modules/cloud/google/gcp_compute_disk.py index 31fac0a5d9e481..be4f5bf18177e4 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_disk.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_disk.py @@ -193,6 +193,12 @@ ''' RETURN = ''' + label_fingerprint: + description: + - The fingerprint used for optimistic locking of this resource. Used internally during + updates. + returned: success + type: str creation_timestamp: description: - Creation timestamp in RFC3339 text format. @@ -427,7 +433,7 @@ def main(): if fetch: if state == 'present': if is_different(module, fetch): - fetch = update(module, self_link(module), kind) + fetch = update(module, self_link(module), kind, fetch) changed = True else: delete(module, self_link(module), kind) @@ -450,8 +456,44 @@ def create(module, link, kind): return wait_for_operation(module, auth.post(link, resource_to_request(module))) -def update(module, link, kind): - module.fail_json(msg="Disk cannot be edited") +def update(module, link, kind, fetch): + update_fields(module, resource_to_request(module), + response_to_hash(module, fetch)) + return fetch_resource(module, self_link(module), kind) + + +def update_fields(module, request, response): + if response.get('labels') != request.get('labels'): + label_fingerprint_update(module, request, response) + if response.get('sizeGb') != request.get('sizeGb'): + size_gb_update(module, request, response) + + +def label_fingerprint_update(module, request, response): + auth = GcpSession(module, 'compute') + auth.post( + ''.join([ + "https://www.googleapis.com/compute/v1/", + "projects/{project}/zones/{zone}/disks/{name}/setLabels" + ]).format(**module.params), + { + u'labelFingerprint': response.get('labelFingerprint'), + u'labels': module.params.get('labels') + } + ) + + +def size_gb_update(module, request, response): + auth = GcpSession(module, 'compute') + auth.post( + ''.join([ + "https://www.googleapis.com/compute/v1/", + "projects/{project}/zones/{zone}/disks/{name}/resize" + ]).format(**module.params), + { + u'sizeGb': module.params.get('size_gb') + } + ) def delete(module, link, kind): @@ -539,6 +581,7 @@ def is_different(module, response): # This is for doing comparisons with Ansible's current parameters. def response_to_hash(module, response): return { + u'labelFingerprint': response.get(u'labelFingerprint'), u'creationTimestamp': response.get(u'creationTimestamp'), u'description': response.get(u'description'), u'id': response.get(u'id'), diff --git a/lib/ansible/modules/cloud/google/gcp_compute_disk_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_disk_facts.py index 13f01c8d88f375..4366852ae112c7 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_disk_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_disk_facts.py @@ -71,6 +71,12 @@ returned: always type: complex contains: + label_fingerprint: + description: + - The fingerprint used for optimistic locking of this resource. Used internally during + updates. + returned: success + type: str creation_timestamp: description: - Creation timestamp in RFC3339 text format. diff --git a/lib/ansible/modules/cloud/google/gcp_compute_forwarding_rule.py b/lib/ansible/modules/cloud/google/gcp_compute_forwarding_rule.py index 7b33e640c6fd02..a499ec5ff5c87c 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_forwarding_rule.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_forwarding_rule.py @@ -331,6 +331,12 @@ - This field is not used for internal load balancing. returned: success type: dict + label_fingerprint: + description: + - The fingerprint used for optimistic locking of this resource. Used internally during + updates. + returned: success + type: str region: description: - A reference to the region where the regional forwarding rule resides. @@ -386,7 +392,7 @@ def main(): if fetch: if state == 'present': if is_different(module, fetch): - fetch = update(module, self_link(module), kind) + fetch = update(module, self_link(module), kind, fetch) changed = True else: delete(module, self_link(module), kind) @@ -409,8 +415,41 @@ def create(module, link, kind): return wait_for_operation(module, auth.post(link, resource_to_request(module))) -def update(module, link, kind): - module.fail_json(msg="ForwardingRule cannot be edited") +def update(module, link, kind, fetch): + update_fields(module, resource_to_request(module), + response_to_hash(module, fetch)) + return fetch_resource(module, self_link(module), kind) + + +def update_fields(module, request, response): + if response.get('target') != request.get('target'): + target_update(module, request, response) + + +def target_update(module, request, response): + auth = GcpSession(module, 'compute') + auth.post( + ''.join([ + "https://www.googleapis.com/compute/v1/", + "projects/{project}/regions/{region}/forwardingRules/{name}/setTarget" + ]).format(**module.params), + { + u'target': replace_resource_dict(module.params.get(u'target', {}), 'selfLink') + } + ) + + +def label_fingerprint_update(module, request, response): + auth = GcpSession(module, 'compute') + auth.post( + ''.join([ + "https://www.googleapis.com/compute/v1/", + "projects/{project}/regions/{region}/forwardingRules/{name}/setLabels" + ]).format(**module.params), + { + u'labelFingerprint': response.get('labelFingerprint') + } + ) def delete(module, link, kind): @@ -513,7 +552,8 @@ def response_to_hash(module, response): u'portRange': response.get(u'portRange'), u'ports': response.get(u'ports'), u'subnetwork': response.get(u'subnetwork'), - u'target': response.get(u'target') + u'target': response.get(u'target'), + u'labelFingerprint': response.get(u'labelFingerprint') } diff --git a/lib/ansible/modules/cloud/google/gcp_compute_forwarding_rule_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_forwarding_rule_facts.py index 2be21b9ec54fc4..38936246c196f0 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_forwarding_rule_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_forwarding_rule_facts.py @@ -199,6 +199,12 @@ - This field is not used for internal load balancing. returned: success type: dict + label_fingerprint: + description: + - The fingerprint used for optimistic locking of this resource. Used internally during + updates. + returned: success + type: str region: description: - A reference to the region where the regional forwarding rule resides. diff --git a/lib/ansible/modules/cloud/google/gcp_compute_global_address.py b/lib/ansible/modules/cloud/google/gcp_compute_global_address.py index d313db81b4f5c1..3981dd058c8d1e 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_global_address.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_global_address.py @@ -115,6 +115,12 @@ be a dash. returned: success type: str + label_fingerprint: + description: + - The fingerprint used for optimistic locking of this resource. Used internally during + updates. + returned: success + type: str ip_version: description: - The IP Version that will be used by this address. Valid options are IPV4 or IPV6. @@ -166,7 +172,7 @@ def main(): if fetch: if state == 'present': if is_different(module, fetch): - fetch = update(module, self_link(module), kind) + fetch = update(module, self_link(module), kind, fetch) changed = True else: delete(module, self_link(module), kind) @@ -189,8 +195,27 @@ def create(module, link, kind): return wait_for_operation(module, auth.post(link, resource_to_request(module))) -def update(module, link, kind): - module.fail_json(msg="GlobalAddress cannot be edited") +def update(module, link, kind, fetch): + update_fields(module, resource_to_request(module), + response_to_hash(module, fetch)) + return fetch_resource(module, self_link(module), kind) + + +def update_fields(module, request, response): + pass + + +def label_fingerprint_update(module, request, response): + auth = GcpSession(module, 'compute') + auth.post( + ''.join([ + "https://www.googleapis.com/compute/v1/", + "projects/{project}/global/addresses/{name}/setLabels" + ]).format(**module.params), + { + u'labelFingerprint': response.get('labelFingerprint') + } + ) def delete(module, link, kind): @@ -276,6 +301,7 @@ def response_to_hash(module, response): u'description': response.get(u'description'), u'id': response.get(u'id'), u'name': response.get(u'name'), + u'labelFingerprint': response.get(u'labelFingerprint'), u'ipVersion': response.get(u'ipVersion'), u'region': response.get(u'region') } diff --git a/lib/ansible/modules/cloud/google/gcp_compute_global_address_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_global_address_facts.py index 69cdab4f81387c..d141ffc3f78745 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_global_address_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_global_address_facts.py @@ -97,6 +97,12 @@ be a dash. returned: success type: str + label_fingerprint: + description: + - The fingerprint used for optimistic locking of this resource. Used internally during + updates. + returned: success + type: str ip_version: description: - The IP Version that will be used by this address. Valid options are IPV4 or IPV6. diff --git a/lib/ansible/modules/cloud/google/gcp_compute_subnetwork.py b/lib/ansible/modules/cloud/google/gcp_compute_subnetwork.py index 183ea3761fab53..326f9a769151e0 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_subnetwork.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_subnetwork.py @@ -228,7 +228,7 @@ def main(): if fetch: if state == 'present': if is_different(module, fetch): - fetch = update(module, self_link(module), kind) + fetch = update(module, self_link(module), kind, fetch) changed = True else: delete(module, self_link(module), kind) @@ -251,8 +251,43 @@ def create(module, link, kind): return wait_for_operation(module, auth.post(link, resource_to_request(module))) -def update(module, link, kind): - module.fail_json(msg="Subnetwork cannot be edited") +def update(module, link, kind, fetch): + update_fields(module, resource_to_request(module), + response_to_hash(module, fetch)) + return fetch_resource(module, self_link(module), kind) + + +def update_fields(module, request, response): + if response.get('ipCidrRange') != request.get('ipCidrRange'): + ip_cidr_range_update(module, request, response) + if response.get('privateIpGoogleAccess') != request.get('privateIpGoogleAccess'): + private_ip_google_access_update(module, request, response) + + +def ip_cidr_range_update(module, request, response): + auth = GcpSession(module, 'compute') + auth.post( + ''.join([ + "https://www.googleapis.com/compute/v1/", + "projects/{project}/regions/{region}/subnetworks/{name}/expandIpCidrRange" + ]).format(**module.params), + { + u'ipCidrRange': module.params.get('ip_cidr_range') + } + ) + + +def private_ip_google_access_update(module, request, response): + auth = GcpSession(module, 'compute') + auth.post( + ''.join([ + "https://www.googleapis.com/compute/v1/", + "projects/{project}/regions/{region}/subnetworks/{name}/setPrivateIpGoogleAccess" + ]).format(**module.params), + { + u'privateIpGoogleAccess': module.params.get('private_ip_google_access') + } + ) def delete(module, link, kind): diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_http_proxy.py b/lib/ansible/modules/cloud/google/gcp_compute_target_http_proxy.py index 99d963e25c4c10..0097aad02bf710 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_http_proxy.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_http_proxy.py @@ -198,7 +198,7 @@ def main(): if fetch: if state == 'present': if is_different(module, fetch): - fetch = update(module, self_link(module), kind) + fetch = update(module, self_link(module), kind, fetch) changed = True else: delete(module, self_link(module), kind) @@ -221,8 +221,28 @@ def create(module, link, kind): return wait_for_operation(module, auth.post(link, resource_to_request(module))) -def update(module, link, kind): - module.fail_json(msg="TargetHttpProxy cannot be edited") +def update(module, link, kind, fetch): + update_fields(module, resource_to_request(module), + response_to_hash(module, fetch)) + return fetch_resource(module, self_link(module), kind) + + +def update_fields(module, request, response): + if response.get('urlMap') != request.get('urlMap'): + url_map_update(module, request, response) + + +def url_map_update(module, request, response): + auth = GcpSession(module, 'compute') + auth.post( + ''.join([ + "https://www.googleapis.com/compute/v1/", + "projects/{project}/targetHttpProxies/{name}/setUrlMap" + ]).format(**module.params), + { + u'urlMap': replace_resource_dict(module.params.get(u'url_map', {}), 'selfLink') + } + ) def delete(module, link, kind): diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_https_proxy.py b/lib/ansible/modules/cloud/google/gcp_compute_target_https_proxy.py index cef23873e65e7e..08a175c8215d48 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_https_proxy.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_https_proxy.py @@ -266,7 +266,7 @@ def main(): if fetch: if state == 'present': if is_different(module, fetch): - fetch = update(module, self_link(module), kind) + fetch = update(module, self_link(module), kind, fetch) changed = True else: delete(module, self_link(module), kind) @@ -289,8 +289,58 @@ def create(module, link, kind): return wait_for_operation(module, auth.post(link, resource_to_request(module))) -def update(module, link, kind): - module.fail_json(msg="TargetHttpsProxy cannot be edited") +def update(module, link, kind, fetch): + update_fields(module, resource_to_request(module), + response_to_hash(module, fetch)) + return fetch_resource(module, self_link(module), kind) + + +def update_fields(module, request, response): + if response.get('quicOverride') != request.get('quicOverride'): + quic_override_update(module, request, response) + if response.get('sslCertificates') != request.get('sslCertificates'): + ssl_certificates_update(module, request, response) + if response.get('urlMap') != request.get('urlMap'): + url_map_update(module, request, response) + + +def quic_override_update(module, request, response): + auth = GcpSession(module, 'compute') + auth.post( + ''.join([ + "https://www.googleapis.com/compute/v1/", + "projects/{project}/global/targetHttpsProxies/{name}/setQuicOverride" + ]).format(**module.params), + { + u'quicOverride': module.params.get('quic_override') + } + ) + + +def ssl_certificates_update(module, request, response): + auth = GcpSession(module, 'compute') + auth.post( + ''.join([ + "https://www.googleapis.com/compute/v1/", + "projects/{project}/targetHttpsProxies/{name}/setSslCertificates" + ]).format(**module.params), + { + u'sslCertificates': replace_resource_dict(module.params.get('ssl_certificates', []), 'selfLink') + } + ) + + +def url_map_update(module, request, response): + auth = GcpSession(module, 'compute') + auth.post( + ''.join([ + "https://www.googleapis.com/compute/v1/", + "projects/{project}/targetHttpsProxies/{name}/setUrlMap" + ]).format(**module.params), + { + u'urlMap': replace_resource_dict(module.params.get(u'url_map', {}), 'selfLink') + } + ) def delete(module, link, kind): diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_ssl_proxy.py b/lib/ansible/modules/cloud/google/gcp_compute_target_ssl_proxy.py index ac115a4e525227..af131c27e1b49a 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_ssl_proxy.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_ssl_proxy.py @@ -253,7 +253,7 @@ def main(): if fetch: if state == 'present': if is_different(module, fetch): - fetch = update(module, self_link(module), kind) + fetch = update(module, self_link(module), kind, fetch) changed = True else: delete(module, self_link(module), kind) @@ -276,8 +276,58 @@ def create(module, link, kind): return wait_for_operation(module, auth.post(link, resource_to_request(module))) -def update(module, link, kind): - module.fail_json(msg="TargetSslProxy cannot be edited") +def update(module, link, kind, fetch): + update_fields(module, resource_to_request(module), + response_to_hash(module, fetch)) + return fetch_resource(module, self_link(module), kind) + + +def update_fields(module, request, response): + if response.get('proxyHeader') != request.get('proxyHeader'): + proxy_header_update(module, request, response) + if response.get('service') != request.get('service'): + service_update(module, request, response) + if response.get('sslCertificates') != request.get('sslCertificates'): + ssl_certificates_update(module, request, response) + + +def proxy_header_update(module, request, response): + auth = GcpSession(module, 'compute') + auth.post( + ''.join([ + "https://www.googleapis.com/compute/v1/", + "projects/{project}/global/targetSslProxies/{name}/setProxyHeader" + ]).format(**module.params), + { + u'proxyHeader': module.params.get('proxy_header') + } + ) + + +def service_update(module, request, response): + auth = GcpSession(module, 'compute') + auth.post( + ''.join([ + "https://www.googleapis.com/compute/v1/", + "projects/{project}/global/targetSslProxies/{name}/setBackendService" + ]).format(**module.params), + { + u'service': replace_resource_dict(module.params.get(u'service', {}), 'selfLink') + } + ) + + +def ssl_certificates_update(module, request, response): + auth = GcpSession(module, 'compute') + auth.post( + ''.join([ + "https://www.googleapis.com/compute/v1/", + "projects/{project}/global/targetSslProxies/{name}/setSslCertificates" + ]).format(**module.params), + { + u'sslCertificates': replace_resource_dict(module.params.get('ssl_certificates', []), 'selfLink') + } + ) def delete(module, link, kind): diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_tcp_proxy.py b/lib/ansible/modules/cloud/google/gcp_compute_target_tcp_proxy.py index 1c5459e2c57ce1..56887a40e2cdca 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_tcp_proxy.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_tcp_proxy.py @@ -206,7 +206,7 @@ def main(): if fetch: if state == 'present': if is_different(module, fetch): - fetch = update(module, self_link(module), kind) + fetch = update(module, self_link(module), kind, fetch) changed = True else: delete(module, self_link(module), kind) @@ -229,8 +229,43 @@ def create(module, link, kind): return wait_for_operation(module, auth.post(link, resource_to_request(module))) -def update(module, link, kind): - module.fail_json(msg="TargetTcpProxy cannot be edited") +def update(module, link, kind, fetch): + update_fields(module, resource_to_request(module), + response_to_hash(module, fetch)) + return fetch_resource(module, self_link(module), kind) + + +def update_fields(module, request, response): + if response.get('proxyHeader') != request.get('proxyHeader'): + proxy_header_update(module, request, response) + if response.get('service') != request.get('service'): + service_update(module, request, response) + + +def proxy_header_update(module, request, response): + auth = GcpSession(module, 'compute') + auth.post( + ''.join([ + "https://www.googleapis.com/compute/v1/", + "projects/{project}/global/targetTcpProxies/{name}/setProxyHeader" + ]).format(**module.params), + { + u'proxyHeader': module.params.get('proxy_header') + } + ) + + +def service_update(module, request, response): + auth = GcpSession(module, 'compute') + auth.post( + ''.join([ + "https://www.googleapis.com/compute/v1/", + "projects/{project}/global/targetTcpProxies/{name}/setBackendService" + ]).format(**module.params), + { + u'service': replace_resource_dict(module.params.get(u'service', {}), 'selfLink') + } + ) def delete(module, link, kind): diff --git a/lib/ansible/modules/cloud/google/gcp_compute_vpn_tunnel.py b/lib/ansible/modules/cloud/google/gcp_compute_vpn_tunnel.py index 06502428239bad..91fddc74e5ba00 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_vpn_tunnel.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_vpn_tunnel.py @@ -236,6 +236,12 @@ - Labels to apply to this VpnTunnel. returned: success type: dict + label_fingerprint: + description: + - The fingerprint used for optimistic locking of this resource. Used internally during + updates. + returned: success + type: str region: description: - The region where the tunnel is located. @@ -288,7 +294,7 @@ def main(): if fetch: if state == 'present': if is_different(module, fetch): - fetch = update(module, self_link(module), kind) + fetch = update(module, self_link(module), kind, fetch) changed = True else: delete(module, self_link(module), kind) @@ -297,6 +303,7 @@ def main(): else: if state == 'present': fetch = create(module, collection(module), kind) + labels_update(module, module.params, fetch) changed = True else: fetch = {} @@ -311,8 +318,29 @@ def create(module, link, kind): return wait_for_operation(module, auth.post(link, resource_to_request(module))) -def update(module, link, kind): - module.fail_json(msg="VpnTunnel cannot be edited") +def update(module, link, kind, fetch): + update_fields(module, resource_to_request(module), + response_to_hash(module, fetch)) + return fetch_resource(module, self_link(module), kind) + + +def update_fields(module, request, response): + if response.get('labels') != request.get('labels'): + labels_update(module, request, response) + + +def labels_update(module, request, response): + auth = GcpSession(module, 'compute') + auth.post( + ''.join([ + "https://www.googleapis.com/compute/v1/", + "projects/{project}/regions/{region}/vpnTunnels/{name}/setLabels" + ]).format(**module.params), + { + u'labels': module.params.get('labels'), + u'labelFingerprint': response.get('labelFingerprint') + } + ) def delete(module, link, kind): @@ -411,7 +439,8 @@ def response_to_hash(module, response): u'ikeVersion': response.get(u'ikeVersion'), u'localTrafficSelector': response.get(u'localTrafficSelector'), u'remoteTrafficSelector': response.get(u'remoteTrafficSelector'), - u'labels': response.get(u'labels') + u'labels': response.get(u'labels'), + u'labelFingerprint': response.get(u'labelFingerprint') } diff --git a/lib/ansible/modules/cloud/google/gcp_compute_vpn_tunnel_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_vpn_tunnel_facts.py index 24a0142a24efe7..275b6665c3777c 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_vpn_tunnel_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_vpn_tunnel_facts.py @@ -143,6 +143,12 @@ - Labels to apply to this VpnTunnel. returned: success type: dict + label_fingerprint: + description: + - The fingerprint used for optimistic locking of this resource. Used internally during + updates. + returned: success + type: str region: description: - The region where the tunnel is located. From 3a5767759a4a840fcf217e9f0ebe8bbbb0caeef4 Mon Sep 17 00:00:00 2001 From: Dana Hoffman Date: Mon, 20 Aug 2018 21:21:35 +0000 Subject: [PATCH 020/144] Add a few new fields to firewalls, and use PATCH instead of PUT for updates, because it supports updating more fields. --- .../cloud/google/gcp_compute_firewall.py | 205 +++++++++++++++++- .../google/gcp_compute_firewall_facts.py | 69 +++++- 2 files changed, 266 insertions(+), 8 deletions(-) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_firewall.py b/lib/ansible/modules/cloud/google/gcp_compute_firewall.py index 747ea290ae7252..c84db8b73c0d94 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_firewall.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_firewall.py @@ -72,11 +72,46 @@ specified, this rule applies to connections through any port. - 'Example inputs include: ["22"], ["80","443"], and ["12345-12349"].' required: false + denied: + description: + - The list of DENY rules specified by this firewall. Each rule specifies a protocol + and port-range tuple that describes a denied connection. + required: false + version_added: 2.7 + suboptions: + ip_protocol: + description: + - The IP protocol to which this rule applies. The protocol type is required when creating + a firewall rule. This value can either be one of the following well known protocol + strings (tcp, udp, icmp, esp, ah, sctp), or the IP protocol number. + required: true + ports: + description: + - An optional list of ports to which this rule applies. This field is only applicable + for UDP or TCP protocol. Each entry must be either an integer or a range. If not + specified, this rule applies to connections through any port. + - 'Example inputs include: ["22"], ["80","443"], and ["12345-12349"].' + required: false description: description: - An optional description of this resource. Provide this property when you create the resource. required: false + destination_ranges: + description: + - If destination ranges are specified, the firewall will apply only to traffic that + has destination IP address in these ranges. These ranges must be expressed in CIDR + format. Only IPv4 is supported. + required: false + version_added: 2.7 + direction: + description: + - 'Direction of traffic to which this firewall applies; default is INGRESS. Note: + For INGRESS traffic, it is NOT supported to specify destinationRanges; For EGRESS + traffic, it is NOT supported to specify sourceRanges OR sourceTags.' + required: false + version_added: 2.7 + choices: ['INGRESS', 'EGRESS'] name: description: - Name of the resource. Provided by the client when the resource is created. The name @@ -85,7 +120,7 @@ which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash. - required: false + required: true network: description: - 'URL of the network resource for this firewall rule. If not specified when creating @@ -95,7 +130,17 @@ U(https://www.googleapis.com/compute/v1/projects/myproject/global/) networks/my-network projects/myproject/global/networks/my-network global/networks/default .' + required: true + priority: + description: + - Priority for this rule. This is an integer between 0 and 65535, both inclusive. + When not specified, the value assumed is 1000. Relative priorities determine precedence + of conflicting rules. Lower value of priority implies higher precedence (eg, a rule + with priority 0 has higher precedence than a rule with priority 1). DENY rules take + precedence over ALLOW rules having equal priority. required: false + default: 1000 + version_added: 2.7 source_ranges: description: - If source ranges are specified, the firewall will apply only to traffic that has @@ -105,6 +150,19 @@ OR the source IP that belongs to a tag listed in the sourceTags property. The connection does not need to match both properties for the firewall to apply. Only IPv4 is supported. required: false + source_service_accounts: + description: + - If source service accounts are specified, the firewall will apply only to traffic + originating from an instance with a service account in this list. Source service + accounts cannot be used to control traffic to an instance's external IP address + because service accounts are associated with an instance, not an IP address. sourceRanges + can be set at the same time as sourceServiceAccounts. If both are set, the firewall + will apply to traffic that has source IP address within sourceRanges OR the source + IP belongs to an instance with service account listed in sourceServiceAccount. The + connection does not need to match both properties for the firewall to apply. sourceServiceAccounts + cannot be used at the same time as sourceTags or targetTags. + required: false + version_added: 2.7 source_tags: description: - If source tags are specified, the firewall will apply only to traffic with source @@ -116,6 +174,15 @@ sourceTags property. The connection does not need to match both properties for the firewall to apply. required: false + target_service_accounts: + description: + - A list of service accounts indicating sets of instances located in the network that + may make network connections as specified in allowed[]. + - targetServiceAccounts cannot be used at the same time as targetTags or sourceTags. + If neither targetServiceAccounts nor targetTags are specified, the firewall rule + applies to all instances on the specified network. + required: false + version_added: 2.7 target_tags: description: - A list of instance tags indicating sets of instances located in the network that @@ -124,6 +191,9 @@ specified network. required: false extends_documentation_fragment: gcp +notes: + - "API Reference: U(https://cloud.google.com/compute/docs/reference/latest/firewalls)" + - "Official Documentation: U(https://cloud.google.com/vpc/docs/firewalls)" ''' EXAMPLES = ''' @@ -173,12 +243,48 @@ - Creation timestamp in RFC3339 text format. returned: success type: str + denied: + description: + - The list of DENY rules specified by this firewall. Each rule specifies a protocol + and port-range tuple that describes a denied connection. + returned: success + type: complex + contains: + ip_protocol: + description: + - The IP protocol to which this rule applies. The protocol type is required when creating + a firewall rule. This value can either be one of the following well known protocol + strings (tcp, udp, icmp, esp, ah, sctp), or the IP protocol number. + returned: success + type: str + ports: + description: + - An optional list of ports to which this rule applies. This field is only applicable + for UDP or TCP protocol. Each entry must be either an integer or a range. If not + specified, this rule applies to connections through any port. + - 'Example inputs include: ["22"], ["80","443"], and ["12345-12349"].' + returned: success + type: list description: description: - An optional description of this resource. Provide this property when you create the resource. returned: success type: str + destination_ranges: + description: + - If destination ranges are specified, the firewall will apply only to traffic that + has destination IP address in these ranges. These ranges must be expressed in CIDR + format. Only IPv4 is supported. + returned: success + type: list + direction: + description: + - 'Direction of traffic to which this firewall applies; default is INGRESS. Note: + For INGRESS traffic, it is NOT supported to specify destinationRanges; For EGRESS + traffic, it is NOT supported to specify sourceRanges OR sourceTags.' + returned: success + type: str id: description: - The unique identifier for the resource. @@ -204,7 +310,16 @@ networks/my-network projects/myproject/global/networks/my-network global/networks/default .' returned: success - type: str + type: dict + priority: + description: + - Priority for this rule. This is an integer between 0 and 65535, both inclusive. + When not specified, the value assumed is 1000. Relative priorities determine precedence + of conflicting rules. Lower value of priority implies higher precedence (eg, a rule + with priority 0 has higher precedence than a rule with priority 1). DENY rules take + precedence over ALLOW rules having equal priority. + returned: success + type: int source_ranges: description: - If source ranges are specified, the firewall will apply only to traffic that has @@ -215,6 +330,19 @@ does not need to match both properties for the firewall to apply. Only IPv4 is supported. returned: success type: list + source_service_accounts: + description: + - If source service accounts are specified, the firewall will apply only to traffic + originating from an instance with a service account in this list. Source service + accounts cannot be used to control traffic to an instance's external IP address + because service accounts are associated with an instance, not an IP address. sourceRanges + can be set at the same time as sourceServiceAccounts. If both are set, the firewall + will apply to traffic that has source IP address within sourceRanges OR the source + IP belongs to an instance with service account listed in sourceServiceAccount. The + connection does not need to match both properties for the firewall to apply. sourceServiceAccounts + cannot be used at the same time as sourceTags or targetTags. + returned: success + type: list source_tags: description: - If source tags are specified, the firewall will apply only to traffic with source @@ -227,6 +355,15 @@ firewall to apply. returned: success type: list + target_service_accounts: + description: + - A list of service accounts indicating sets of instances located in the network that + may make network connections as specified in allowed[]. + - targetServiceAccounts cannot be used at the same time as targetTags or sourceTags. + If neither targetServiceAccounts nor targetTags are specified, the firewall rule + applies to all instances on the specified network. + returned: success + type: list target_tags: description: - A list of instance tags indicating sets of instances located in the network that @@ -260,11 +397,20 @@ def main(): ip_protocol=dict(required=True, type='str'), ports=dict(type='list', elements='str') )), + denied=dict(type='list', elements='dict', options=dict( + ip_protocol=dict(required=True, type='str'), + ports=dict(type='list', elements='str') + )), description=dict(type='str'), - name=dict(type='str'), - network=dict(type='str'), + destination_ranges=dict(type='list', elements='str'), + direction=dict(type='str', choices=['INGRESS', 'EGRESS']), + name=dict(required=True, type='str'), + network=dict(required=True, type='dict'), + priority=dict(default=1000, type='int'), source_ranges=dict(type='list', elements='str'), + source_service_accounts=dict(type='list', elements='str'), source_tags=dict(type='list', elements='str'), + target_service_accounts=dict(type='list', elements='str'), target_tags=dict(type='list', elements='str') ) ) @@ -306,7 +452,7 @@ def create(module, link, kind): def update(module, link, kind): auth = GcpSession(module, 'compute') - return wait_for_operation(module, auth.put(link, resource_to_request(module))) + return wait_for_operation(module, auth.patch(link, resource_to_request(module))) def delete(module, link, kind): @@ -318,11 +464,17 @@ def resource_to_request(module): request = { u'kind': 'compute#firewall', u'allowed': FirewallAllowedArray(module.params.get('allowed', []), module).to_request(), + u'denied': FirewallDeniedArray(module.params.get('denied', []), module).to_request(), u'description': module.params.get('description'), + u'destinationRanges': module.params.get('destination_ranges'), + u'direction': module.params.get('direction'), u'name': module.params.get('name'), - u'network': module.params.get('network'), + u'network': replace_resource_dict(module.params.get(u'network', {}), 'selfLink'), + u'priority': module.params.get('priority'), u'sourceRanges': module.params.get('source_ranges'), + u'sourceServiceAccounts': module.params.get('source_service_accounts'), u'sourceTags': module.params.get('source_tags'), + u'targetServiceAccounts': module.params.get('target_service_accounts'), u'targetTags': module.params.get('target_tags') } return_vals = {} @@ -393,12 +545,18 @@ def response_to_hash(module, response): return { u'allowed': FirewallAllowedArray(response.get(u'allowed', []), module).from_response(), u'creationTimestamp': response.get(u'creationTimestamp'), + u'denied': FirewallDeniedArray(response.get(u'denied', []), module).from_response(), u'description': response.get(u'description'), + u'destinationRanges': response.get(u'destinationRanges'), + u'direction': response.get(u'direction'), u'id': response.get(u'id'), - u'name': response.get(u'name'), + u'name': module.params.get('name'), u'network': response.get(u'network'), + u'priority': response.get(u'priority'), u'sourceRanges': response.get(u'sourceRanges'), + u'sourceServiceAccounts': response.get(u'sourceServiceAccounts'), u'sourceTags': response.get(u'sourceTags'), + u'targetServiceAccounts': response.get(u'targetServiceAccounts'), u'targetTags': response.get(u'targetTags') } @@ -473,5 +631,38 @@ def _response_from_item(self, item): }) +class FirewallDeniedArray(object): + def __init__(self, request, module): + self.module = module + if request: + self.request = request + else: + self.request = [] + + def to_request(self): + items = [] + for item in self.request: + items.append(self._request_for_item(item)) + return items + + def from_response(self): + items = [] + for item in self.request: + items.append(self._response_from_item(item)) + return items + + def _request_for_item(self, item): + return remove_nones_from_dict({ + u'IPProtocol': item.get('ip_protocol'), + u'ports': item.get('ports') + }) + + def _response_from_item(self, item): + return remove_nones_from_dict({ + u'IPProtocol': item.get(u'ip_protocol'), + u'ports': item.get(u'ports') + }) + + if __name__ == '__main__': main() diff --git a/lib/ansible/modules/cloud/google/gcp_compute_firewall_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_firewall_facts.py index 1ad88378ff0078..a6d38e72ce9f49 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_firewall_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_firewall_facts.py @@ -93,12 +93,48 @@ - Creation timestamp in RFC3339 text format. returned: success type: str + denied: + description: + - The list of DENY rules specified by this firewall. Each rule specifies a protocol + and port-range tuple that describes a denied connection. + returned: success + type: complex + contains: + ip_protocol: + description: + - The IP protocol to which this rule applies. The protocol type is required when creating + a firewall rule. This value can either be one of the following well known protocol + strings (tcp, udp, icmp, esp, ah, sctp), or the IP protocol number. + returned: success + type: str + ports: + description: + - An optional list of ports to which this rule applies. This field is only applicable + for UDP or TCP protocol. Each entry must be either an integer or a range. If not + specified, this rule applies to connections through any port. + - 'Example inputs include: ["22"], ["80","443"], and ["12345-12349"].' + returned: success + type: list description: description: - An optional description of this resource. Provide this property when you create the resource. returned: success type: str + destination_ranges: + description: + - If destination ranges are specified, the firewall will apply only to traffic that + has destination IP address in these ranges. These ranges must be expressed in CIDR + format. Only IPv4 is supported. + returned: success + type: list + direction: + description: + - 'Direction of traffic to which this firewall applies; default is INGRESS. Note: + For INGRESS traffic, it is NOT supported to specify destinationRanges; For EGRESS + traffic, it is NOT supported to specify sourceRanges OR sourceTags.' + returned: success + type: str id: description: - The unique identifier for the resource. @@ -124,7 +160,16 @@ networks/my-network projects/myproject/global/networks/my-network global/networks/default .' returned: success - type: str + type: dict + priority: + description: + - Priority for this rule. This is an integer between 0 and 65535, both inclusive. + When not specified, the value assumed is 1000. Relative priorities determine precedence + of conflicting rules. Lower value of priority implies higher precedence (eg, a rule + with priority 0 has higher precedence than a rule with priority 1). DENY rules take + precedence over ALLOW rules having equal priority. + returned: success + type: int source_ranges: description: - If source ranges are specified, the firewall will apply only to traffic that has @@ -135,6 +180,19 @@ does not need to match both properties for the firewall to apply. Only IPv4 is supported. returned: success type: list + source_service_accounts: + description: + - If source service accounts are specified, the firewall will apply only to traffic + originating from an instance with a service account in this list. Source service + accounts cannot be used to control traffic to an instance's external IP address + because service accounts are associated with an instance, not an IP address. sourceRanges + can be set at the same time as sourceServiceAccounts. If both are set, the firewall + will apply to traffic that has source IP address within sourceRanges OR the source + IP belongs to an instance with service account listed in sourceServiceAccount. The + connection does not need to match both properties for the firewall to apply. sourceServiceAccounts + cannot be used at the same time as sourceTags or targetTags. + returned: success + type: list source_tags: description: - If source tags are specified, the firewall will apply only to traffic with source @@ -147,6 +205,15 @@ firewall to apply. returned: success type: list + target_service_accounts: + description: + - A list of service accounts indicating sets of instances located in the network that + may make network connections as specified in allowed[]. + - targetServiceAccounts cannot be used at the same time as targetTags or sourceTags. + If neither targetServiceAccounts nor targetTags are specified, the firewall rule + applies to all instances on the specified network. + returned: success + type: list target_tags: description: - A list of instance tags indicating sets of instances located in the network that From 57bd543dc3c5ddc4256f627ef302ff728e33718d Mon Sep 17 00:00:00 2001 From: The Magician Date: Mon, 27 Aug 2018 13:50:01 -0700 Subject: [PATCH 021/144] Magic Modules changes. (#79) --- .../tasks/main.yml | 65 +++++++++++++++++++ 1 file changed, 65 insertions(+) diff --git a/test/integration/targets/gcp_dns_resource_record_set/tasks/main.yml b/test/integration/targets/gcp_dns_resource_record_set/tasks/main.yml index f1ee3a47a2643c..b60b513c63d329 100644 --- a/test/integration/targets/gcp_dns_resource_record_set/tasks/main.yml +++ b/test/integration/targets/gcp_dns_resource_record_set/tasks/main.yml @@ -23,7 +23,33 @@ service_account_file: "{{ gcp_cred_file }}" state: present register: managed_zone +- name: delete a resource record set + gcp_dns_resource_record_set: + name: www.testzone-4.com. + managed_zone: "{{ managed_zone }}" + type: A + ttl: 600 + target: + - 10.1.2.3 + - 40.5.6.7 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent #---------------------------------------------------------- +- name: create a resource record set + gcp_dns_resource_record_set: + name: www.testzone-4.com. + managed_zone: "{{ managed_zone }}" + type: A + ttl: 600 + target: + - 10.1.2.3 + - 40.5.6.7 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: result - name: assert changed is true assert: @@ -31,6 +57,19 @@ - result.changed == true - "result.kind == 'dns#resourceRecordSet'" # ---------------------------------------------------------------------------- +- name: create a resource record set that already exists + gcp_dns_resource_record_set: + name: www.testzone-4.com. + managed_zone: "{{ managed_zone }}" + type: A + ttl: 600 + target: + - 10.1.2.3 + - 40.5.6.7 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: result - name: assert changed is false assert: @@ -38,6 +77,19 @@ - result.changed == false - "result.kind == 'dns#resourceRecordSet'" #---------------------------------------------------------- +- name: delete a resource record set + gcp_dns_resource_record_set: + name: www.testzone-4.com. + managed_zone: "{{ managed_zone }}" + type: A + ttl: 600 + target: + - 10.1.2.3 + - 40.5.6.7 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent register: result - name: assert changed is true assert: @@ -45,6 +97,19 @@ - result.changed == true - result.has_key('kind') == False # ---------------------------------------------------------------------------- +- name: delete a resource record set that does not exist + gcp_dns_resource_record_set: + name: www.testzone-4.com. + managed_zone: "{{ managed_zone }}" + type: A + ttl: 600 + target: + - 10.1.2.3 + - 40.5.6.7 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent register: result - name: assert changed is false assert: From 2e06037118490f18b6c301fc18803700b9c5be01 Mon Sep 17 00:00:00 2001 From: The Magician Date: Mon, 27 Aug 2018 17:04:13 -0700 Subject: [PATCH 022/144] Minor updates to HealthCheck description, default values. (#78) --- .../cloud/google/gcp_compute_health_check.py | 45 +++++++++++++------ 1 file changed, 31 insertions(+), 14 deletions(-) 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 a07c5d1030bf0f..60a98ef01e81ea 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_health_check.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_health_check.py @@ -32,8 +32,15 @@ --- module: gcp_compute_health_check description: - - An HealthCheck resource. This resource defines a template for how individual virtual - machines should be checked for health, via one of the supported protocols. + - Health Checks determine whether instances are responsive and able to do work. + - They are an important part of a comprehensive load balancing configuration, as they + enable monitoring instances behind load balancers. + - Health Checks poll instances at a specified interval. Instances that do not respond + successfully to some number of probes in a row are marked as unhealthy. No new connections + are sent to unhealthy instances, though existing connections will continue. The + health check will continue to poll unhealthy instances. If an instance later responds + successfully to some number of consecutive probes, it is marked healthy again and + can receive new connections. short_description: Creates a GCP HealthCheck version_added: 2.6 author: Google Inc. (@googlecloudplatform) @@ -62,6 +69,7 @@ - A so-far unhealthy instance will be marked healthy after this many consecutive successes. The default value is 2. required: false + default: 2 name: description: - Name of the resource. Provided by the client when the resource is created. The name @@ -70,7 +78,7 @@ which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash. - required: false + required: true timeout_sec: description: - How long (in seconds) to wait before claiming failure. @@ -91,7 +99,7 @@ the default is TCP. Exactly one of the protocol-specific health check field must be specified, which must match type field. required: false - choices: ['TCP', 'SSL', 'HTTP'] + choices: ['TCP', 'SSL', 'HTTP', 'HTTPS'] http_health_check: description: - A nested object resource. @@ -108,6 +116,7 @@ - The request path of the HTTP health check request. - The default value is /. required: false + default: / port: description: - The TCP port number for the HTTP health check request. @@ -123,6 +132,7 @@ - Specifies the type of proxy header to append before sending data to the backend, either NONE or PROXY_V1. The default is NONE. required: false + default: NONE choices: ['NONE', 'PROXY_V1'] https_health_check: description: @@ -140,6 +150,7 @@ - The request path of the HTTPS health check request. - The default value is /. required: false + default: / port: description: - The TCP port number for the HTTPS health check request. @@ -155,6 +166,7 @@ - Specifies the type of proxy header to append before sending data to the backend, either NONE or PROXY_V1. The default is NONE. required: false + default: NONE choices: ['NONE', 'PROXY_V1'] tcp_health_check: description: @@ -188,6 +200,7 @@ - Specifies the type of proxy header to append before sending data to the backend, either NONE or PROXY_V1. The default is NONE. required: false + default: NONE choices: ['NONE', 'PROXY_V1'] ssl_health_check: description: @@ -221,8 +234,12 @@ - Specifies the type of proxy header to append before sending data to the backend, either NONE or PROXY_V1. The default is NONE. required: false + default: NONE choices: ['NONE', 'PROXY_V1'] extends_documentation_fragment: gcp +notes: + - "API Reference: U(https://cloud.google.com/compute/docs/reference/rest/latest/healthChecks)" + - "Official Documentation: U(https://cloud.google.com/load-balancing/docs/health-checks)" ''' EXAMPLES = ''' @@ -474,38 +491,38 @@ def main(): state=dict(default='present', choices=['present', 'absent'], type='str'), check_interval_sec=dict(default=5, type='int'), description=dict(type='str'), - healthy_threshold=dict(type='int'), - name=dict(type='str'), + healthy_threshold=dict(default=2, type='int'), + name=dict(required=True, type='str'), timeout_sec=dict(default=5, type='int', aliases=['timeout_seconds']), unhealthy_threshold=dict(default=2, type='int'), - type=dict(type='str', choices=['TCP', 'SSL', 'HTTP']), + type=dict(type='str', choices=['TCP', 'SSL', 'HTTP', 'HTTPS']), http_health_check=dict(type='dict', options=dict( host=dict(type='str'), - request_path=dict(type='str'), + request_path=dict(default='/', type='str'), port=dict(type='int'), port_name=dict(type='str'), - proxy_header=dict(type='str', choices=['NONE', 'PROXY_V1']) + proxy_header=dict(default='NONE', type='str', choices=['NONE', 'PROXY_V1']) )), https_health_check=dict(type='dict', options=dict( host=dict(type='str'), - request_path=dict(type='str'), + request_path=dict(default='/', type='str'), port=dict(type='int'), port_name=dict(type='str'), - proxy_header=dict(type='str', choices=['NONE', 'PROXY_V1']) + proxy_header=dict(default='NONE', type='str', choices=['NONE', 'PROXY_V1']) )), tcp_health_check=dict(type='dict', options=dict( request=dict(type='str'), response=dict(type='str'), port=dict(type='int'), port_name=dict(type='str'), - proxy_header=dict(type='str', choices=['NONE', 'PROXY_V1']) + proxy_header=dict(default='NONE', type='str', choices=['NONE', 'PROXY_V1']) )), ssl_health_check=dict(type='dict', options=dict( request=dict(type='str'), response=dict(type='str'), port=dict(type='int'), port_name=dict(type='str'), - proxy_header=dict(type='str', choices=['NONE', 'PROXY_V1']) + proxy_header=dict(default='NONE', type='str', choices=['NONE', 'PROXY_V1']) )) ) ) @@ -641,7 +658,7 @@ def response_to_hash(module, response): u'description': response.get(u'description'), u'healthyThreshold': response.get(u'healthyThreshold'), u'id': response.get(u'id'), - u'name': response.get(u'name'), + u'name': module.params.get('name'), u'timeoutSec': response.get(u'timeoutSec'), u'unhealthyThreshold': response.get(u'unhealthyThreshold'), u'type': response.get(u'type'), From c92e418cf614972639f201a00a6576aa670f029f Mon Sep 17 00:00:00 2001 From: The Magician Date: Mon, 27 Aug 2018 21:24:44 -0700 Subject: [PATCH 023/144] removed kind checks (#76) /cc @rambleraptor --- lib/ansible/modules/cloud/google/gcp_compute_address.py | 2 -- lib/ansible/modules/cloud/google/gcp_compute_backend_bucket.py | 2 -- lib/ansible/modules/cloud/google/gcp_compute_disk.py | 2 -- lib/ansible/modules/cloud/google/gcp_compute_firewall.py | 2 -- lib/ansible/modules/cloud/google/gcp_compute_forwarding_rule.py | 2 -- lib/ansible/modules/cloud/google/gcp_compute_global_address.py | 2 -- .../modules/cloud/google/gcp_compute_global_forwarding_rule.py | 2 -- lib/ansible/modules/cloud/google/gcp_compute_health_check.py | 2 -- .../modules/cloud/google/gcp_compute_http_health_check.py | 2 -- .../modules/cloud/google/gcp_compute_https_health_check.py | 2 -- lib/ansible/modules/cloud/google/gcp_compute_image.py | 2 -- lib/ansible/modules/cloud/google/gcp_compute_instance.py | 2 -- lib/ansible/modules/cloud/google/gcp_compute_instance_group.py | 2 -- .../modules/cloud/google/gcp_compute_instance_group_manager.py | 2 -- .../modules/cloud/google/gcp_compute_instance_template.py | 2 -- lib/ansible/modules/cloud/google/gcp_compute_network.py | 2 -- lib/ansible/modules/cloud/google/gcp_compute_route.py | 2 -- lib/ansible/modules/cloud/google/gcp_compute_router.py | 2 -- lib/ansible/modules/cloud/google/gcp_compute_ssl_certificate.py | 2 -- lib/ansible/modules/cloud/google/gcp_compute_ssl_policy.py | 2 -- lib/ansible/modules/cloud/google/gcp_compute_subnetwork.py | 2 -- .../modules/cloud/google/gcp_compute_target_http_proxy.py | 2 -- .../modules/cloud/google/gcp_compute_target_https_proxy.py | 2 -- lib/ansible/modules/cloud/google/gcp_compute_target_pool.py | 2 -- .../modules/cloud/google/gcp_compute_target_ssl_proxy.py | 2 -- .../modules/cloud/google/gcp_compute_target_tcp_proxy.py | 2 -- .../modules/cloud/google/gcp_compute_target_vpn_gateway.py | 2 -- lib/ansible/modules/cloud/google/gcp_compute_url_map.py | 2 -- lib/ansible/modules/cloud/google/gcp_compute_vpn_tunnel.py | 2 -- lib/ansible/modules/cloud/google/gcp_dns_managed_zone.py | 2 -- lib/ansible/modules/cloud/google/gcp_dns_resource_record_set.py | 2 -- lib/ansible/modules/cloud/google/gcp_storage_bucket.py | 2 -- .../modules/cloud/google/gcp_storage_bucket_access_control.py | 2 -- 33 files changed, 66 deletions(-) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_address.py b/lib/ansible/modules/cloud/google/gcp_compute_address.py index b641e9e9def51d..5ed559ccca2575 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_address.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_address.py @@ -288,8 +288,6 @@ def return_if_object(module, response, kind): if navigate_hash(result, ['error', 'errors']): module.fail_json(msg=navigate_hash(result, ['error', 'errors'])) - if result['kind'] != kind: - module.fail_json(msg="Incorrect result: {kind}".format(**result)) return result diff --git a/lib/ansible/modules/cloud/google/gcp_compute_backend_bucket.py b/lib/ansible/modules/cloud/google/gcp_compute_backend_bucket.py index 8cd3e419557512..8fbc4dfe300b89 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_backend_bucket.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_backend_bucket.py @@ -257,8 +257,6 @@ def return_if_object(module, response, kind): if navigate_hash(result, ['error', 'errors']): module.fail_json(msg=navigate_hash(result, ['error', 'errors'])) - if result['kind'] != kind: - module.fail_json(msg="Incorrect result: {kind}".format(**result)) return result diff --git a/lib/ansible/modules/cloud/google/gcp_compute_disk.py b/lib/ansible/modules/cloud/google/gcp_compute_disk.py index be4f5bf18177e4..07a1be580cf98c 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_disk.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_disk.py @@ -553,8 +553,6 @@ def return_if_object(module, response, kind): if navigate_hash(result, ['error', 'errors']): module.fail_json(msg=navigate_hash(result, ['error', 'errors'])) - if result['kind'] != kind: - module.fail_json(msg="Incorrect result: {kind}".format(**result)) return result diff --git a/lib/ansible/modules/cloud/google/gcp_compute_firewall.py b/lib/ansible/modules/cloud/google/gcp_compute_firewall.py index c84db8b73c0d94..1c4a0f9f48ac58 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_firewall.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_firewall.py @@ -515,8 +515,6 @@ def return_if_object(module, response, kind): if navigate_hash(result, ['error', 'errors']): module.fail_json(msg=navigate_hash(result, ['error', 'errors'])) - if result['kind'] != kind: - module.fail_json(msg="Incorrect result: {kind}".format(**result)) return result diff --git a/lib/ansible/modules/cloud/google/gcp_compute_forwarding_rule.py b/lib/ansible/modules/cloud/google/gcp_compute_forwarding_rule.py index a499ec5ff5c87c..f9ed419d43c44b 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_forwarding_rule.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_forwarding_rule.py @@ -511,8 +511,6 @@ def return_if_object(module, response, kind): if navigate_hash(result, ['error', 'errors']): module.fail_json(msg=navigate_hash(result, ['error', 'errors'])) - if result['kind'] != kind: - module.fail_json(msg="Incorrect result: {kind}".format(**result)) return result diff --git a/lib/ansible/modules/cloud/google/gcp_compute_global_address.py b/lib/ansible/modules/cloud/google/gcp_compute_global_address.py index 3981dd058c8d1e..ba68c18f93bd2f 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_global_address.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_global_address.py @@ -268,8 +268,6 @@ def return_if_object(module, response, kind): if navigate_hash(result, ['error', 'errors']): module.fail_json(msg=navigate_hash(result, ['error', 'errors'])) - if result['kind'] != kind: - module.fail_json(msg="Incorrect result: {kind}".format(**result)) return result diff --git a/lib/ansible/modules/cloud/google/gcp_compute_global_forwarding_rule.py b/lib/ansible/modules/cloud/google/gcp_compute_global_forwarding_rule.py index 27b65d5c62f45c..c7c6b9c49d1a06 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_global_forwarding_rule.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_global_forwarding_rule.py @@ -506,8 +506,6 @@ def return_if_object(module, response, kind): if navigate_hash(result, ['error', 'errors']): module.fail_json(msg=navigate_hash(result, ['error', 'errors'])) - if result['kind'] != kind: - module.fail_json(msg="Incorrect result: {kind}".format(**result)) return result 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 60a98ef01e81ea..b1222760fedc24 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_health_check.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_health_check.py @@ -625,8 +625,6 @@ def return_if_object(module, response, kind): if navigate_hash(result, ['error', 'errors']): module.fail_json(msg=navigate_hash(result, ['error', 'errors'])) - if result['kind'] != kind: - module.fail_json(msg="Incorrect result: {kind}".format(**result)) return result diff --git a/lib/ansible/modules/cloud/google/gcp_compute_http_health_check.py b/lib/ansible/modules/cloud/google/gcp_compute_http_health_check.py index d22962a468de69..43b7c87453f9d0 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_http_health_check.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_http_health_check.py @@ -319,8 +319,6 @@ def return_if_object(module, response, kind): if navigate_hash(result, ['error', 'errors']): module.fail_json(msg=navigate_hash(result, ['error', 'errors'])) - if result['kind'] != kind: - module.fail_json(msg="Incorrect result: {kind}".format(**result)) return result diff --git a/lib/ansible/modules/cloud/google/gcp_compute_https_health_check.py b/lib/ansible/modules/cloud/google/gcp_compute_https_health_check.py index 2cf4962cce0c95..838151aa30a37f 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_https_health_check.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_https_health_check.py @@ -317,8 +317,6 @@ def return_if_object(module, response, kind): if navigate_hash(result, ['error', 'errors']): module.fail_json(msg=navigate_hash(result, ['error', 'errors'])) - if result['kind'] != kind: - module.fail_json(msg="Incorrect result: {kind}".format(**result)) return result diff --git a/lib/ansible/modules/cloud/google/gcp_compute_image.py b/lib/ansible/modules/cloud/google/gcp_compute_image.py index be56da41a462db..fad394aa18c114 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_image.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_image.py @@ -545,8 +545,6 @@ def return_if_object(module, response, kind): if navigate_hash(result, ['error', 'errors']): module.fail_json(msg=navigate_hash(result, ['error', 'errors'])) - if result['kind'] != kind: - module.fail_json(msg="Incorrect result: {kind}".format(**result)) return result diff --git a/lib/ansible/modules/cloud/google/gcp_compute_instance.py b/lib/ansible/modules/cloud/google/gcp_compute_instance.py index e4140516cb587d..25923f6c8ed8c9 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_instance.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_instance.py @@ -1001,8 +1001,6 @@ def return_if_object(module, response, kind): if navigate_hash(result, ['error', 'errors']): module.fail_json(msg=navigate_hash(result, ['error', 'errors'])) - if result['kind'] != kind: - module.fail_json(msg="Incorrect result: {kind}".format(**result)) return result diff --git a/lib/ansible/modules/cloud/google/gcp_compute_instance_group.py b/lib/ansible/modules/cloud/google/gcp_compute_instance_group.py index 276798dcc82b35..015bb53977a7a5 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_instance_group.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_instance_group.py @@ -313,8 +313,6 @@ def return_if_object(module, response, kind): if navigate_hash(result, ['error', 'errors']): module.fail_json(msg=navigate_hash(result, ['error', 'errors'])) - if result['kind'] != kind: - module.fail_json(msg="Incorrect result: {kind}".format(**result)) return result diff --git a/lib/ansible/modules/cloud/google/gcp_compute_instance_group_manager.py b/lib/ansible/modules/cloud/google/gcp_compute_instance_group_manager.py index c3e39d3d53ca82..b35e76e0dfc0ad 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_instance_group_manager.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_instance_group_manager.py @@ -437,8 +437,6 @@ def return_if_object(module, response, kind): if navigate_hash(result, ['error', 'errors']): module.fail_json(msg=navigate_hash(result, ['error', 'errors'])) - if result['kind'] != kind: - module.fail_json(msg="Incorrect result: {kind}".format(**result)) return result diff --git a/lib/ansible/modules/cloud/google/gcp_compute_instance_template.py b/lib/ansible/modules/cloud/google/gcp_compute_instance_template.py index 77ddb23ccdd0d5..21faf7799c2413 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_instance_template.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_instance_template.py @@ -964,8 +964,6 @@ def return_if_object(module, response, kind): if navigate_hash(result, ['error', 'errors']): module.fail_json(msg=navigate_hash(result, ['error', 'errors'])) - if result['kind'] != kind: - module.fail_json(msg="Incorrect result: {kind}".format(**result)) return result diff --git a/lib/ansible/modules/cloud/google/gcp_compute_network.py b/lib/ansible/modules/cloud/google/gcp_compute_network.py index f5cda926068902..2c4de01f77e187 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_network.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_network.py @@ -280,8 +280,6 @@ def return_if_object(module, response, kind): if navigate_hash(result, ['error', 'errors']): module.fail_json(msg=navigate_hash(result, ['error', 'errors'])) - if result['kind'] != kind: - module.fail_json(msg="Incorrect result: {kind}".format(**result)) return result diff --git a/lib/ansible/modules/cloud/google/gcp_compute_route.py b/lib/ansible/modules/cloud/google/gcp_compute_route.py index d1efd1f7accf79..0628fd3b8381f2 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_route.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_route.py @@ -355,8 +355,6 @@ def return_if_object(module, response, kind): if navigate_hash(result, ['error', 'errors']): module.fail_json(msg=navigate_hash(result, ['error', 'errors'])) - if result['kind'] != kind: - module.fail_json(msg="Incorrect result: {kind}".format(**result)) return result diff --git a/lib/ansible/modules/cloud/google/gcp_compute_router.py b/lib/ansible/modules/cloud/google/gcp_compute_router.py index e35f67f5cfb0e5..eaba5f2f498b98 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_router.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_router.py @@ -354,8 +354,6 @@ def return_if_object(module, response, kind): if navigate_hash(result, ['error', 'errors']): module.fail_json(msg=navigate_hash(result, ['error', 'errors'])) - if result['kind'] != kind: - module.fail_json(msg="Incorrect result: {kind}".format(**result)) return result diff --git a/lib/ansible/modules/cloud/google/gcp_compute_ssl_certificate.py b/lib/ansible/modules/cloud/google/gcp_compute_ssl_certificate.py index 2f64ca61670d51..6e7db3c706cfdb 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_ssl_certificate.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_ssl_certificate.py @@ -265,8 +265,6 @@ def return_if_object(module, response, kind): if navigate_hash(result, ['error', 'errors']): module.fail_json(msg=navigate_hash(result, ['error', 'errors'])) - if result['kind'] != kind: - module.fail_json(msg="Incorrect result: {kind}".format(**result)) return result diff --git a/lib/ansible/modules/cloud/google/gcp_compute_ssl_policy.py b/lib/ansible/modules/cloud/google/gcp_compute_ssl_policy.py index bb7ab24d734f36..121ed4dedf328e 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_ssl_policy.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_ssl_policy.py @@ -297,8 +297,6 @@ def return_if_object(module, response, kind): if navigate_hash(result, ['error', 'errors']): module.fail_json(msg=navigate_hash(result, ['error', 'errors'])) - if result['kind'] != kind: - module.fail_json(msg="Incorrect result: {kind}".format(**result)) return result diff --git a/lib/ansible/modules/cloud/google/gcp_compute_subnetwork.py b/lib/ansible/modules/cloud/google/gcp_compute_subnetwork.py index 326f9a769151e0..4e0a4556d9b14d 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_subnetwork.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_subnetwork.py @@ -343,8 +343,6 @@ def return_if_object(module, response, kind): if navigate_hash(result, ['error', 'errors']): module.fail_json(msg=navigate_hash(result, ['error', 'errors'])) - if result['kind'] != kind: - module.fail_json(msg="Incorrect result: {kind}".format(**result)) return result diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_http_proxy.py b/lib/ansible/modules/cloud/google/gcp_compute_target_http_proxy.py index 0097aad02bf710..07eb314ec659c7 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_http_proxy.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_http_proxy.py @@ -295,8 +295,6 @@ def return_if_object(module, response, kind): if navigate_hash(result, ['error', 'errors']): module.fail_json(msg=navigate_hash(result, ['error', 'errors'])) - if result['kind'] != kind: - module.fail_json(msg="Incorrect result: {kind}".format(**result)) return result diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_https_proxy.py b/lib/ansible/modules/cloud/google/gcp_compute_target_https_proxy.py index 08a175c8215d48..52edd596820d66 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_https_proxy.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_https_proxy.py @@ -395,8 +395,6 @@ def return_if_object(module, response, kind): if navigate_hash(result, ['error', 'errors']): module.fail_json(msg=navigate_hash(result, ['error', 'errors'])) - if result['kind'] != kind: - module.fail_json(msg="Incorrect result: {kind}".format(**result)) return result diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_pool.py b/lib/ansible/modules/cloud/google/gcp_compute_target_pool.py index dac771de36d4db..e2ec714462d3b9 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_pool.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_pool.py @@ -344,8 +344,6 @@ def return_if_object(module, response, kind): if navigate_hash(result, ['error', 'errors']): module.fail_json(msg=navigate_hash(result, ['error', 'errors'])) - if result['kind'] != kind: - module.fail_json(msg="Incorrect result: {kind}".format(**result)) return result diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_ssl_proxy.py b/lib/ansible/modules/cloud/google/gcp_compute_target_ssl_proxy.py index af131c27e1b49a..a14d429caecb0d 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_ssl_proxy.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_ssl_proxy.py @@ -382,8 +382,6 @@ def return_if_object(module, response, kind): if navigate_hash(result, ['error', 'errors']): module.fail_json(msg=navigate_hash(result, ['error', 'errors'])) - if result['kind'] != kind: - module.fail_json(msg="Incorrect result: {kind}".format(**result)) return result diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_tcp_proxy.py b/lib/ansible/modules/cloud/google/gcp_compute_target_tcp_proxy.py index 56887a40e2cdca..a15a6b36b29cd6 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_tcp_proxy.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_tcp_proxy.py @@ -319,8 +319,6 @@ def return_if_object(module, response, kind): if navigate_hash(result, ['error', 'errors']): module.fail_json(msg=navigate_hash(result, ['error', 'errors'])) - if result['kind'] != kind: - module.fail_json(msg="Incorrect result: {kind}".format(**result)) return result diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_vpn_gateway.py b/lib/ansible/modules/cloud/google/gcp_compute_target_vpn_gateway.py index 26c700b8282292..ce52de624ff7ed 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_vpn_gateway.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_vpn_gateway.py @@ -267,8 +267,6 @@ def return_if_object(module, response, kind): if navigate_hash(result, ['error', 'errors']): module.fail_json(msg=navigate_hash(result, ['error', 'errors'])) - if result['kind'] != kind: - module.fail_json(msg="Incorrect result: {kind}".format(**result)) return result diff --git a/lib/ansible/modules/cloud/google/gcp_compute_url_map.py b/lib/ansible/modules/cloud/google/gcp_compute_url_map.py index f39d002aee1c2c..6e45c2eeba5b19 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_url_map.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_url_map.py @@ -456,8 +456,6 @@ def return_if_object(module, response, kind): if navigate_hash(result, ['error', 'errors']): module.fail_json(msg=navigate_hash(result, ['error', 'errors'])) - if result['kind'] != kind: - module.fail_json(msg="Incorrect result: {kind}".format(**result)) return result diff --git a/lib/ansible/modules/cloud/google/gcp_compute_vpn_tunnel.py b/lib/ansible/modules/cloud/google/gcp_compute_vpn_tunnel.py index 91fddc74e5ba00..4044c2bc5d5953 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_vpn_tunnel.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_vpn_tunnel.py @@ -400,8 +400,6 @@ def return_if_object(module, response, kind): if navigate_hash(result, ['error', 'errors']): module.fail_json(msg=navigate_hash(result, ['error', 'errors'])) - if result['kind'] != kind: - module.fail_json(msg="Incorrect result: {kind}".format(**result)) return result diff --git a/lib/ansible/modules/cloud/google/gcp_dns_managed_zone.py b/lib/ansible/modules/cloud/google/gcp_dns_managed_zone.py index 9965a315068d57..7899a9de44189b 100644 --- a/lib/ansible/modules/cloud/google/gcp_dns_managed_zone.py +++ b/lib/ansible/modules/cloud/google/gcp_dns_managed_zone.py @@ -241,8 +241,6 @@ def return_if_object(module, response, kind): if navigate_hash(result, ['error', 'errors']): module.fail_json(msg=navigate_hash(result, ['error', 'errors'])) - if result['kind'] != kind: - module.fail_json(msg="Incorrect result: {kind}".format(**result)) return result diff --git a/lib/ansible/modules/cloud/google/gcp_dns_resource_record_set.py b/lib/ansible/modules/cloud/google/gcp_dns_resource_record_set.py index 3f5331256568fd..aaaf406703f330 100644 --- a/lib/ansible/modules/cloud/google/gcp_dns_resource_record_set.py +++ b/lib/ansible/modules/cloud/google/gcp_dns_resource_record_set.py @@ -294,8 +294,6 @@ def return_if_object(module, response, kind): if navigate_hash(result, ['error', 'errors']): module.fail_json(msg=navigate_hash(result, ['error', 'errors'])) - if result['kind'] != kind: - module.fail_json(msg="Incorrect result: {kind}".format(**result)) return result diff --git a/lib/ansible/modules/cloud/google/gcp_storage_bucket.py b/lib/ansible/modules/cloud/google/gcp_storage_bucket.py index 0f47994284ca1b..989b9b84cd5cec 100644 --- a/lib/ansible/modules/cloud/google/gcp_storage_bucket.py +++ b/lib/ansible/modules/cloud/google/gcp_storage_bucket.py @@ -929,8 +929,6 @@ def return_if_object(module, response, kind): if navigate_hash(result, ['error', 'errors']): module.fail_json(msg=navigate_hash(result, ['error', 'errors'])) - if result['kind'] != kind: - module.fail_json(msg="Incorrect result: {kind}".format(**result)) return result diff --git a/lib/ansible/modules/cloud/google/gcp_storage_bucket_access_control.py b/lib/ansible/modules/cloud/google/gcp_storage_bucket_access_control.py index 586ba93202ff16..71f972adb11742 100644 --- a/lib/ansible/modules/cloud/google/gcp_storage_bucket_access_control.py +++ b/lib/ansible/modules/cloud/google/gcp_storage_bucket_access_control.py @@ -297,8 +297,6 @@ def return_if_object(module, response, kind): if navigate_hash(result, ['error', 'errors']): module.fail_json(msg=navigate_hash(result, ['error', 'errors'])) - if result['kind'] != kind: - module.fail_json(msg="Incorrect result: {kind}".format(**result)) return result From 9fcb94bd00658cebe3ec814fb8e05d280bf3a7bf Mon Sep 17 00:00:00 2001 From: The Magician Date: Tue, 28 Aug 2018 15:25:00 -0700 Subject: [PATCH 024/144] BackendService LoadBalancingScheme + IAP support --- .../gcp_compute_backend_service_facts.py | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_backend_service_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_backend_service_facts.py index 614f4f2d7aeb5a..b6ab45ac619ad4 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_backend_service_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_backend_service_facts.py @@ -242,6 +242,39 @@ - The unique identifier for the resource. returned: success type: int + iap: + description: + - Settings for enabling Cloud Identity Aware Proxy. + returned: success + type: complex + contains: + enabled: + description: + - Enables IAP. + returned: success + type: bool + oauth2_client_id: + description: + - OAuth2 Client ID for IAP. + returned: success + type: str + oauth2_client_secret: + description: + - OAuth2 Client Secret for IAP. + returned: success + type: str + oauth2_client_secret_sha256: + description: + - OAuth2 Client Secret SHA-256 for IAP. + returned: success + type: str + load_balancing_scheme: + description: + - Indicates whether the backend service will be used with internal or external load + balancing. A backend service created for one type of load balancing cannot be used + with the other. + returned: success + type: str name: description: - Name of the resource. Provided by the client when the resource is created. The name From 0c5df16693bc9ea03113fdebf502d82ecfeceb51 Mon Sep 17 00:00:00 2001 From: The Magician Date: Thu, 30 Aug 2018 13:31:49 -0700 Subject: [PATCH 025/144] InstanceGroup should add/remove instances (#82) --- .../google/gcp_compute_instance_group.py | 88 ++++++++++++++++++- .../gcp_compute_instance_group_facts.py | 9 ++ 2 files changed, 95 insertions(+), 2 deletions(-) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_instance_group.py b/lib/ansible/modules/cloud/google/gcp_compute_instance_group.py index 015bb53977a7a5..2d4c31363f3a74 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_instance_group.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_instance_group.py @@ -94,6 +94,15 @@ description: - A reference to the zone where the instance group resides. required: true + instances: + description: + - The list of instances associated with this InstanceGroup. + - All instances must be created before being added to an InstanceGroup. + - All instances not in this list will be removed from the InstanceGroup and will not + be deleted. + - Only the full identifier of the instance will be returned. + required: false + version_added: 2.7 extends_documentation_fragment: gcp ''' @@ -186,6 +195,15 @@ - A reference to the zone where the instance group resides. returned: success type: str + instances: + description: + - The list of instances associated with this InstanceGroup. + - All instances must be created before being added to an InstanceGroup. + - All instances not in this list will be removed from the InstanceGroup and will not + be deleted. + - Only the full identifier of the instance will be returned. + returned: success + type: list ''' ################################################################################ @@ -217,7 +235,8 @@ def main(): network=dict(type='dict'), region=dict(type='str'), subnetwork=dict(type='dict'), - zone=dict(required=True, type='str') + zone=dict(required=True, type='str'), + instances=dict(type='list', elements='dict') ) ) @@ -246,6 +265,10 @@ def main(): else: fetch = {} + if fetch: + instance = InstanceLogic(module) + instance.run() + fetch.update({'instances': instance.list_instances()}) fetch.update({'changed': changed}) module.exit_json(**fetch) @@ -257,7 +280,8 @@ def create(module, link, kind): def update(module, link, kind): - module.fail_json(msg="InstanceGroup cannot be edited") + instance = InstanceLogic(module) + instance.run() def delete(module, link, kind): @@ -396,6 +420,66 @@ def raise_if_errors(response, err_path, module): module.fail_json(msg=errors) +class InstanceLogic(object): + def __init__(self, module): + self.module = module + self.current_instances = self.list_instances() + self.module_instances = [] + + # Transform module list of instances (dicts of instance responses) into a list of selfLinks. + instances = self.module.params.get('instances') + if instances: + for instance in instances: + self.module_instances.append(replace_resource_dict(instance, 'selfLink')) + + def run(self): + # Find all instances to add and add them + instances_to_add = list(set(self.module_instances) - set(self.current_instances)) + if instances_to_add: + self.add_instances(instances_to_add) + + # Find all instances to remove and remove them + instances_to_remove = list(set(self.current_instances) - set(self.module_instances)) + if instances_to_remove: + self.remove_instances(instances_to_remove) + + def list_instances(self): + auth = GcpSession(self.module, 'compute') + response = return_if_object(self.module, auth.post(self._list_instances_url(), {'instanceState': 'ALL'}), + 'compute#instanceGroupsListInstances') + + # Transform instance list into a list of selfLinks for diffing with module parameters + instances = [] + for instance in response.get('items', []): + instances.append(instance['instance']) + return instances + + def add_instances(self, instances): + auth = GcpSession(self.module, 'compute') + wait_for_operation(self.module, auth.post(self._add_instances_url(), self._build_request(instances))) + + def remove_instances(self, instances): + auth = GcpSession(self.module, 'compute') + wait_for_operation(self.module, auth.post(self._remove_instances_url(), self._build_request(instances))) + + def _list_instances_url(self): + return "https://www.googleapis.com/compute/v1/projects/{project}/zones/{zone}/instanceGroups/{name}/listInstances".format(**self.module.params) + + def _remove_instances_url(self): + return "https://www.googleapis.com/compute/v1/projects/{project}/zones/{zone}/instanceGroups/{name}/removeInstances".format(**self.module.params) + + def _add_instances_url(self): + return "https://www.googleapis.com/compute/v1/projects/{project}/zones/{zone}/instanceGroups/{name}/addInstances".format(**self.module.params) + + def _build_request(self, instances): + request = { + 'instances': [] + } + for instance in instances: + request['instances'].append({'instance': instance}) + return request + + class InstanceGroupNamedPortsArray(object): def __init__(self, request, module): self.module = module diff --git a/lib/ansible/modules/cloud/google/gcp_compute_instance_group_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_instance_group_facts.py index 9ffccbf34c6e64..5cb989cea6daa7 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_instance_group_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_instance_group_facts.py @@ -135,6 +135,15 @@ - A reference to the zone where the instance group resides. returned: success type: str + instances: + description: + - The list of instances associated with this InstanceGroup. + - All instances must be created before being added to an InstanceGroup. + - All instances not in this list will be removed from the InstanceGroup and will not + be deleted. + - Only the full identifier of the instance will be returned. + returned: success + type: list ''' ################################################################################ From 6f80bb4b4339af6859ddd2f14720d683c03ce4f8 Mon Sep 17 00:00:00 2001 From: The Magician Date: Wed, 5 Sep 2018 10:56:56 -0700 Subject: [PATCH 026/144] Add settingsVersion property to Cloud SQL instance settings (#84) /cc @slevenick --- .../modules/cloud/google/gcp_sql_instance.py | 22 ++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/lib/ansible/modules/cloud/google/gcp_sql_instance.py b/lib/ansible/modules/cloud/google/gcp_sql_instance.py index 373e1bf0edf994..e68109f2e9bf63 100644 --- a/lib/ansible/modules/cloud/google/gcp_sql_instance.py +++ b/lib/ansible/modules/cloud/google/gcp_sql_instance.py @@ -246,6 +246,12 @@ instances, this field determines whether the instance is Second Generation (recommended) or First Generation. required: false + settings_version: + description: + - The version of instance settings. This is a required field for update method to + make sure concurrent updates are handled properly. During update, use the most + recent settingsVersion value for this instance and do not try to update this value. + required: false extends_documentation_fragment: gcp ''' @@ -517,6 +523,13 @@ or First Generation. returned: success type: str + settings_version: + description: + - The version of instance settings. This is a required field for update method to + make sure concurrent updates are handled properly. During update, use the most + recent settingsVersion value for this instance and do not try to update this value. + returned: success + type: int ''' ################################################################################ @@ -578,7 +591,8 @@ def main(): )), require_ssl=dict(type='bool') )), - tier=dict(type='str') + tier=dict(type='str'), + settings_version=dict(type='int') )) ) ) @@ -895,13 +909,15 @@ def __init__(self, request, module): def to_request(self): return remove_nones_from_dict({ u'ipConfiguration': InstanceIpConfiguration(self.request.get('ip_configuration', {}), self.module).to_request(), - u'tier': self.request.get('tier') + u'tier': self.request.get('tier'), + u'settingsVersion': self.request.get('settings_version') }) def from_response(self): return remove_nones_from_dict({ u'ipConfiguration': InstanceIpConfiguration(self.request.get(u'ipConfiguration', {}), self.module).from_response(), - u'tier': self.request.get(u'tier') + u'tier': self.request.get(u'tier'), + u'settingsVersion': self.request.get(u'settingsVersion') }) From e724a089a18f4c839c06c026257ce39cbefacbc2 Mon Sep 17 00:00:00 2001 From: Dana Hoffman Date: Fri, 7 Sep 2018 00:30:58 +0000 Subject: [PATCH 027/144] make vpnTunnel.router into a ResourceRef --- .../modules/cloud/google/gcp_compute_vpn_tunnel.py | 8 ++++---- .../modules/cloud/google/gcp_compute_vpn_tunnel_facts.py | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_vpn_tunnel.py b/lib/ansible/modules/cloud/google/gcp_compute_vpn_tunnel.py index 4044c2bc5d5953..94d00cc7a8dd55 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_vpn_tunnel.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_vpn_tunnel.py @@ -192,7 +192,7 @@ description: - URL of router resource to be used for dynamic routing. returned: success - type: str + type: dict peer_ip: description: - IP address of the peer VPN gateway. Only IPv4 is supported. @@ -271,7 +271,7 @@ def main(): name=dict(required=True, type='str'), description=dict(type='str'), target_vpn_gateway=dict(required=True, type='dict'), - router=dict(type='str'), + router=dict(type='dict'), peer_ip=dict(required=True, type='str'), shared_secret=dict(required=True, type='str'), ike_version=dict(default=2, type='int'), @@ -354,7 +354,7 @@ def resource_to_request(module): u'name': module.params.get('name'), u'description': module.params.get('description'), u'targetVpnGateway': replace_resource_dict(module.params.get(u'target_vpn_gateway', {}), 'selfLink'), - u'router': module.params.get('router'), + u'router': replace_resource_dict(module.params.get(u'router', {}), 'selfLink'), u'peerIp': module.params.get('peer_ip'), u'sharedSecret': module.params.get('shared_secret'), u'ikeVersion': module.params.get('ike_version'), @@ -430,7 +430,7 @@ def response_to_hash(module, response): u'name': response.get(u'name'), u'description': module.params.get('description'), u'targetVpnGateway': replace_resource_dict(module.params.get(u'target_vpn_gateway', {}), 'selfLink'), - u'router': module.params.get('router'), + u'router': replace_resource_dict(module.params.get(u'router', {}), 'selfLink'), u'peerIp': response.get(u'peerIp'), u'sharedSecret': response.get(u'sharedSecret'), u'sharedSecretHash': response.get(u'sharedSecretHash'), diff --git a/lib/ansible/modules/cloud/google/gcp_compute_vpn_tunnel_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_vpn_tunnel_facts.py index 275b6665c3777c..86c9f38eeb4739 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_vpn_tunnel_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_vpn_tunnel_facts.py @@ -99,7 +99,7 @@ description: - URL of router resource to be used for dynamic routing. returned: success - type: str + type: dict peer_ip: description: - IP address of the peer VPN gateway. Only IPv4 is supported. From 0df5fc4dff9ad9b70cd9921251a49e6b4ef6afe0 Mon Sep 17 00:00:00 2001 From: The Magician Date: Fri, 7 Sep 2018 14:15:36 -0700 Subject: [PATCH 028/144] examples showing an improper auth value (#87) /cc @rambleraptor --- lib/ansible/modules/cloud/google/gcp_compute_address.py | 2 +- lib/ansible/modules/cloud/google/gcp_compute_address_facts.py | 2 +- lib/ansible/modules/cloud/google/gcp_compute_backend_bucket.py | 2 +- .../modules/cloud/google/gcp_compute_backend_bucket_facts.py | 2 +- lib/ansible/modules/cloud/google/gcp_compute_backend_service.py | 2 +- .../modules/cloud/google/gcp_compute_backend_service_facts.py | 2 +- lib/ansible/modules/cloud/google/gcp_compute_disk.py | 2 +- lib/ansible/modules/cloud/google/gcp_compute_disk_facts.py | 2 +- lib/ansible/modules/cloud/google/gcp_compute_firewall.py | 2 +- lib/ansible/modules/cloud/google/gcp_compute_firewall_facts.py | 2 +- lib/ansible/modules/cloud/google/gcp_compute_forwarding_rule.py | 2 +- .../modules/cloud/google/gcp_compute_forwarding_rule_facts.py | 2 +- lib/ansible/modules/cloud/google/gcp_compute_global_address.py | 2 +- .../modules/cloud/google/gcp_compute_global_address_facts.py | 2 +- .../modules/cloud/google/gcp_compute_global_forwarding_rule.py | 2 +- .../cloud/google/gcp_compute_global_forwarding_rule_facts.py | 2 +- lib/ansible/modules/cloud/google/gcp_compute_health_check.py | 2 +- .../modules/cloud/google/gcp_compute_health_check_facts.py | 2 +- .../modules/cloud/google/gcp_compute_http_health_check.py | 2 +- .../modules/cloud/google/gcp_compute_http_health_check_facts.py | 2 +- .../modules/cloud/google/gcp_compute_https_health_check.py | 2 +- .../cloud/google/gcp_compute_https_health_check_facts.py | 2 +- lib/ansible/modules/cloud/google/gcp_compute_image.py | 2 +- lib/ansible/modules/cloud/google/gcp_compute_image_facts.py | 2 +- lib/ansible/modules/cloud/google/gcp_compute_instance.py | 2 +- lib/ansible/modules/cloud/google/gcp_compute_instance_facts.py | 2 +- lib/ansible/modules/cloud/google/gcp_compute_instance_group.py | 2 +- .../modules/cloud/google/gcp_compute_instance_group_facts.py | 2 +- .../modules/cloud/google/gcp_compute_instance_group_manager.py | 2 +- .../cloud/google/gcp_compute_instance_group_manager_facts.py | 2 +- .../modules/cloud/google/gcp_compute_instance_template.py | 2 +- .../modules/cloud/google/gcp_compute_instance_template_facts.py | 2 +- lib/ansible/modules/cloud/google/gcp_compute_network.py | 2 +- lib/ansible/modules/cloud/google/gcp_compute_network_facts.py | 2 +- lib/ansible/modules/cloud/google/gcp_compute_route.py | 2 +- lib/ansible/modules/cloud/google/gcp_compute_route_facts.py | 2 +- lib/ansible/modules/cloud/google/gcp_compute_router.py | 2 +- lib/ansible/modules/cloud/google/gcp_compute_router_facts.py | 2 +- lib/ansible/modules/cloud/google/gcp_compute_ssl_certificate.py | 2 +- .../modules/cloud/google/gcp_compute_ssl_certificate_facts.py | 2 +- lib/ansible/modules/cloud/google/gcp_compute_ssl_policy.py | 2 +- .../modules/cloud/google/gcp_compute_ssl_policy_facts.py | 2 +- lib/ansible/modules/cloud/google/gcp_compute_subnetwork.py | 2 +- .../modules/cloud/google/gcp_compute_subnetwork_facts.py | 2 +- .../modules/cloud/google/gcp_compute_target_http_proxy.py | 2 +- .../modules/cloud/google/gcp_compute_target_http_proxy_facts.py | 2 +- .../modules/cloud/google/gcp_compute_target_https_proxy.py | 2 +- .../cloud/google/gcp_compute_target_https_proxy_facts.py | 2 +- lib/ansible/modules/cloud/google/gcp_compute_target_pool.py | 2 +- .../modules/cloud/google/gcp_compute_target_pool_facts.py | 2 +- .../modules/cloud/google/gcp_compute_target_ssl_proxy.py | 2 +- .../modules/cloud/google/gcp_compute_target_ssl_proxy_facts.py | 2 +- .../modules/cloud/google/gcp_compute_target_tcp_proxy.py | 2 +- .../modules/cloud/google/gcp_compute_target_tcp_proxy_facts.py | 2 +- .../modules/cloud/google/gcp_compute_target_vpn_gateway.py | 2 +- .../cloud/google/gcp_compute_target_vpn_gateway_facts.py | 2 +- lib/ansible/modules/cloud/google/gcp_compute_url_map.py | 2 +- lib/ansible/modules/cloud/google/gcp_compute_url_map_facts.py | 2 +- lib/ansible/modules/cloud/google/gcp_compute_vpn_tunnel.py | 2 +- .../modules/cloud/google/gcp_compute_vpn_tunnel_facts.py | 2 +- lib/ansible/modules/cloud/google/gcp_container_cluster.py | 2 +- lib/ansible/modules/cloud/google/gcp_container_node_pool.py | 2 +- lib/ansible/modules/cloud/google/gcp_dns_managed_zone.py | 2 +- lib/ansible/modules/cloud/google/gcp_dns_resource_record_set.py | 2 +- lib/ansible/modules/cloud/google/gcp_pubsub_subscription.py | 2 +- lib/ansible/modules/cloud/google/gcp_pubsub_topic.py | 2 +- lib/ansible/modules/cloud/google/gcp_spanner_database.py | 2 +- lib/ansible/modules/cloud/google/gcp_spanner_instance.py | 2 +- lib/ansible/modules/cloud/google/gcp_sql_database.py | 2 +- lib/ansible/modules/cloud/google/gcp_sql_instance.py | 2 +- lib/ansible/modules/cloud/google/gcp_sql_user.py | 2 +- lib/ansible/modules/cloud/google/gcp_storage_bucket.py | 2 +- .../modules/cloud/google/gcp_storage_bucket_access_control.py | 2 +- 73 files changed, 73 insertions(+), 73 deletions(-) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_address.py b/lib/ansible/modules/cloud/google/gcp_compute_address.py index 5ed559ccca2575..b442082a9c5d7f 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_address.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_address.py @@ -106,7 +106,7 @@ name: test-address1 region: us-west1 project: "test_project" - auth_kind: "service_account" + auth_kind: "serviceaccount" service_account_file: "/tmp/auth.pem" state: present ''' diff --git a/lib/ansible/modules/cloud/google/gcp_compute_address_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_address_facts.py index a011ffc904c4c2..5be5e6e4c41477 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_address_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_address_facts.py @@ -62,7 +62,7 @@ filters: - name = test_object project: test_project - auth_kind: service_account + auth_kind: serviceaccount service_account_file: "/tmp/auth.pem" ''' diff --git a/lib/ansible/modules/cloud/google/gcp_compute_backend_bucket.py b/lib/ansible/modules/cloud/google/gcp_compute_backend_bucket.py index 8fbc4dfe300b89..a4c822094d298b 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_backend_bucket.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_backend_bucket.py @@ -96,7 +96,7 @@ description: A BackendBucket to connect LNB w/ Storage Bucket enable_cdn: true project: "test_project" - auth_kind: "service_account" + auth_kind: "serviceaccount" service_account_file: "/tmp/auth.pem" state: present ''' diff --git a/lib/ansible/modules/cloud/google/gcp_compute_backend_bucket_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_backend_bucket_facts.py index 6686db14d993ce..f14c9f9ea2781c 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_backend_bucket_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_backend_bucket_facts.py @@ -56,7 +56,7 @@ filters: - name = test_object project: test_project - auth_kind: service_account + auth_kind: serviceaccount service_account_file: "/tmp/auth.pem" ''' diff --git a/lib/ansible/modules/cloud/google/gcp_compute_backend_service.py b/lib/ansible/modules/cloud/google/gcp_compute_backend_service.py index e5a796f3f380b2..7f46f4705317b5 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_backend_service.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_backend_service.py @@ -305,7 +305,7 @@ - "{{ healthcheck.selfLink }}" enable_cdn: true project: "test_project" - auth_kind: "service_account" + auth_kind: "serviceaccount" service_account_file: "/tmp/auth.pem" state: present ''' diff --git a/lib/ansible/modules/cloud/google/gcp_compute_backend_service_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_backend_service_facts.py index b6ab45ac619ad4..1ae55b6347f99b 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_backend_service_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_backend_service_facts.py @@ -56,7 +56,7 @@ filters: - name = test_object project: test_project - auth_kind: service_account + auth_kind: serviceaccount service_account_file: "/tmp/auth.pem" ''' diff --git a/lib/ansible/modules/cloud/google/gcp_compute_disk.py b/lib/ansible/modules/cloud/google/gcp_compute_disk.py index 07a1be580cf98c..5965e9931f7923 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_disk.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_disk.py @@ -187,7 +187,7 @@ raw_key: SGVsbG8gZnJvbSBHb29nbGUgQ2xvdWQgUGxhdGZvcm0= zone: us-central1-a project: "test_project" - auth_kind: "service_account" + auth_kind: "serviceaccount" service_account_file: "/tmp/auth.pem" state: present ''' diff --git a/lib/ansible/modules/cloud/google/gcp_compute_disk_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_disk_facts.py index 4366852ae112c7..b944ce0793c7b5 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_disk_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_disk_facts.py @@ -61,7 +61,7 @@ filters: - name = test_object project: test_project - auth_kind: service_account + auth_kind: serviceaccount service_account_file: "/tmp/auth.pem" ''' diff --git a/lib/ansible/modules/cloud/google/gcp_compute_firewall.py b/lib/ansible/modules/cloud/google/gcp_compute_firewall.py index 1c4a0f9f48ac58..76ff0a3ac3d374 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_firewall.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_firewall.py @@ -210,7 +210,7 @@ source_tags: - test-ssh-clients project: "test_project" - auth_kind: "service_account" + auth_kind: "serviceaccount" service_account_file: "/tmp/auth.pem" state: present ''' diff --git a/lib/ansible/modules/cloud/google/gcp_compute_firewall_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_firewall_facts.py index a6d38e72ce9f49..0cff51656c1ec5 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_firewall_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_firewall_facts.py @@ -56,7 +56,7 @@ filters: - name = test_object project: test_project - auth_kind: service_account + auth_kind: serviceaccount service_account_file: "/tmp/auth.pem" ''' diff --git a/lib/ansible/modules/cloud/google/gcp_compute_forwarding_rule.py b/lib/ansible/modules/cloud/google/gcp_compute_forwarding_rule.py index f9ed419d43c44b..bab25c7b12f4f0 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_forwarding_rule.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_forwarding_rule.py @@ -198,7 +198,7 @@ port_range: 80-80 ip_address: "{{ address.address }}" project: "test_project" - auth_kind: "service_account" + auth_kind: "serviceaccount" service_account_file: "/tmp/auth.pem" state: present ''' diff --git a/lib/ansible/modules/cloud/google/gcp_compute_forwarding_rule_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_forwarding_rule_facts.py index 38936246c196f0..67497f1a9ae22c 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_forwarding_rule_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_forwarding_rule_facts.py @@ -62,7 +62,7 @@ filters: - name = test_object project: test_project - auth_kind: service_account + auth_kind: serviceaccount service_account_file: "/tmp/auth.pem" ''' diff --git a/lib/ansible/modules/cloud/google/gcp_compute_global_address.py b/lib/ansible/modules/cloud/google/gcp_compute_global_address.py index ba68c18f93bd2f..88f7adcf4b537f 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_global_address.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_global_address.py @@ -78,7 +78,7 @@ gcp_compute_global_address: name: "test_object" project: "test_project" - auth_kind: "service_account" + auth_kind: "serviceaccount" service_account_file: "/tmp/auth.pem" state: present ''' diff --git a/lib/ansible/modules/cloud/google/gcp_compute_global_address_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_global_address_facts.py index d141ffc3f78745..99d0c9141c9996 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_global_address_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_global_address_facts.py @@ -56,7 +56,7 @@ filters: - name = test_object project: test_project - auth_kind: service_account + auth_kind: serviceaccount service_account_file: "/tmp/auth.pem" ''' diff --git a/lib/ansible/modules/cloud/google/gcp_compute_global_forwarding_rule.py b/lib/ansible/modules/cloud/google/gcp_compute_global_forwarding_rule.py index c7c6b9c49d1a06..8158c40a0cdd2c 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_global_forwarding_rule.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_global_forwarding_rule.py @@ -234,7 +234,7 @@ port_range: 80-80 target: "{{ httpproxy.selfLink }}" project: "test_project" - auth_kind: "service_account" + auth_kind: "serviceaccount" service_account_file: "/tmp/auth.pem" state: present ''' diff --git a/lib/ansible/modules/cloud/google/gcp_compute_global_forwarding_rule_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_global_forwarding_rule_facts.py index e8693d9375a091..71b9d22e7799b3 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_global_forwarding_rule_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_global_forwarding_rule_facts.py @@ -56,7 +56,7 @@ filters: - name = test_object project: test_project - auth_kind: service_account + auth_kind: serviceaccount service_account_file: "/tmp/auth.pem" ''' 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 b1222760fedc24..0ac627d31f6f0f 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_health_check.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_health_check.py @@ -255,7 +255,7 @@ timeout_sec: 2 unhealthy_threshold: 5 project: "test_project" - auth_kind: "service_account" + auth_kind: "serviceaccount" service_account_file: "/tmp/auth.pem" state: present ''' 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 e3d4480a064092..672ea2d114cbd8 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 @@ -56,7 +56,7 @@ filters: - name = test_object project: test_project - auth_kind: service_account + auth_kind: serviceaccount service_account_file: "/tmp/auth.pem" ''' diff --git a/lib/ansible/modules/cloud/google/gcp_compute_http_health_check.py b/lib/ansible/modules/cloud/google/gcp_compute_http_health_check.py index 43b7c87453f9d0..fc09c76974a377 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_http_health_check.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_http_health_check.py @@ -115,7 +115,7 @@ timeout_sec: 2 unhealthy_threshold: 5 project: "test_project" - auth_kind: "service_account" + auth_kind: "serviceaccount" service_account_file: "/tmp/auth.pem" state: present ''' diff --git a/lib/ansible/modules/cloud/google/gcp_compute_http_health_check_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_http_health_check_facts.py index e4f9096920cbc1..5a1a385833b0e0 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_http_health_check_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_http_health_check_facts.py @@ -56,7 +56,7 @@ filters: - name = test_object project: test_project - auth_kind: service_account + auth_kind: serviceaccount service_account_file: "/tmp/auth.pem" ''' diff --git a/lib/ansible/modules/cloud/google/gcp_compute_https_health_check.py b/lib/ansible/modules/cloud/google/gcp_compute_https_health_check.py index 838151aa30a37f..a2bdfbc6fcc53f 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_https_health_check.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_https_health_check.py @@ -113,7 +113,7 @@ timeout_sec: 2 unhealthy_threshold: 5 project: "test_project" - auth_kind: "service_account" + auth_kind: "serviceaccount" service_account_file: "/tmp/auth.pem" state: present ''' diff --git a/lib/ansible/modules/cloud/google/gcp_compute_https_health_check_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_https_health_check_facts.py index 9599e301908e00..8779713ddf2ff4 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_https_health_check_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_https_health_check_facts.py @@ -56,7 +56,7 @@ filters: - name = test_object project: test_project - auth_kind: service_account + auth_kind: serviceaccount service_account_file: "/tmp/auth.pem" ''' diff --git a/lib/ansible/modules/cloud/google/gcp_compute_image.py b/lib/ansible/modules/cloud/google/gcp_compute_image.py index fad394aa18c114..13e54c2f0ab1dc 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_image.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_image.py @@ -196,7 +196,7 @@ name: "test_object" source_disk: "{{ disk }}" project: "test_project" - auth_kind: "service_account" + auth_kind: "serviceaccount" service_account_file: "/tmp/auth.pem" state: present ''' diff --git a/lib/ansible/modules/cloud/google/gcp_compute_image_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_image_facts.py index 516315890ff67b..b94f80c53819b8 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_image_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_image_facts.py @@ -56,7 +56,7 @@ filters: - name = test_object project: test_project - auth_kind: service_account + auth_kind: serviceaccount service_account_file: "/tmp/auth.pem" ''' diff --git a/lib/ansible/modules/cloud/google/gcp_compute_instance.py b/lib/ansible/modules/cloud/google/gcp_compute_instance.py index 25923f6c8ed8c9..afa8b187e63a70 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_instance.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_instance.py @@ -417,7 +417,7 @@ type: ONE_TO_ONE_NAT zone: us-central1-a project: "test_project" - auth_kind: "service_account" + auth_kind: "serviceaccount" service_account_file: "/tmp/auth.pem" state: present ''' diff --git a/lib/ansible/modules/cloud/google/gcp_compute_instance_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_instance_facts.py index a8fc1d5050d4c7..a9dee77fc8f09d 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_instance_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_instance_facts.py @@ -61,7 +61,7 @@ filters: - name = test_object project: test_project - auth_kind: service_account + auth_kind: serviceaccount service_account_file: "/tmp/auth.pem" ''' diff --git a/lib/ansible/modules/cloud/google/gcp_compute_instance_group.py b/lib/ansible/modules/cloud/google/gcp_compute_instance_group.py index 2d4c31363f3a74..882c947c0b6e49 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_instance_group.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_instance_group.py @@ -125,7 +125,7 @@ network: "{{ network }}" zone: us-central1-a project: "test_project" - auth_kind: "service_account" + auth_kind: "serviceaccount" service_account_file: "/tmp/auth.pem" state: present ''' diff --git a/lib/ansible/modules/cloud/google/gcp_compute_instance_group_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_instance_group_facts.py index 5cb989cea6daa7..01dfc77a71475b 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_instance_group_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_instance_group_facts.py @@ -61,7 +61,7 @@ filters: - name = test_object project: test_project - auth_kind: service_account + auth_kind: serviceaccount service_account_file: "/tmp/auth.pem" ''' diff --git a/lib/ansible/modules/cloud/google/gcp_compute_instance_group_manager.py b/lib/ansible/modules/cloud/google/gcp_compute_instance_group_manager.py index b35e76e0dfc0ad..29555e842e1e75 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_instance_group_manager.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_instance_group_manager.py @@ -156,7 +156,7 @@ target_size: 3 zone: us-west1-a project: "test_project" - auth_kind: "service_account" + auth_kind: "serviceaccount" service_account_file: "/tmp/auth.pem" state: present ''' diff --git a/lib/ansible/modules/cloud/google/gcp_compute_instance_group_manager_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_instance_group_manager_facts.py index 2d8928b6e90f24..a0b331b170ef9a 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_instance_group_manager_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_instance_group_manager_facts.py @@ -61,7 +61,7 @@ filters: - name = test_object project: test_project - auth_kind: service_account + auth_kind: serviceaccount service_account_file: "/tmp/auth.pem" ''' diff --git a/lib/ansible/modules/cloud/google/gcp_compute_instance_template.py b/lib/ansible/modules/cloud/google/gcp_compute_instance_template.py index 21faf7799c2413..751d495de8a724 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_instance_template.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_instance_template.py @@ -407,7 +407,7 @@ type: ONE_TO_ONE_NAT nat_ip: "{{ address }}" project: "test_project" - auth_kind: "service_account" + auth_kind: "serviceaccount" service_account_file: "/tmp/auth.pem" state: present ''' diff --git a/lib/ansible/modules/cloud/google/gcp_compute_instance_template_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_instance_template_facts.py index aca57a632cac06..c769ce4143c814 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_instance_template_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_instance_template_facts.py @@ -56,7 +56,7 @@ filters: - name = test_object project: test_project - auth_kind: service_account + auth_kind: serviceaccount service_account_file: "/tmp/auth.pem" ''' diff --git a/lib/ansible/modules/cloud/google/gcp_compute_network.py b/lib/ansible/modules/cloud/google/gcp_compute_network.py index 2c4de01f77e187..e4092713f9fc0b 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_network.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_network.py @@ -100,7 +100,7 @@ name: "test_object" auto_create_subnetworks: true project: "test_project" - auth_kind: "service_account" + auth_kind: "serviceaccount" service_account_file: "/tmp/auth.pem" state: present ''' diff --git a/lib/ansible/modules/cloud/google/gcp_compute_network_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_network_facts.py index 22a32ffeb01999..e7e39527824964 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_network_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_network_facts.py @@ -56,7 +56,7 @@ filters: - name = test_object project: test_project - auth_kind: service_account + auth_kind: serviceaccount service_account_file: "/tmp/auth.pem" ''' diff --git a/lib/ansible/modules/cloud/google/gcp_compute_route.py b/lib/ansible/modules/cloud/google/gcp_compute_route.py index 0628fd3b8381f2..95db3f8c8bb6ad 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_route.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_route.py @@ -146,7 +146,7 @@ - backends - databases project: "test_project" - auth_kind: "service_account" + auth_kind: "serviceaccount" service_account_file: "/tmp/auth.pem" state: present ''' diff --git a/lib/ansible/modules/cloud/google/gcp_compute_route_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_route_facts.py index e9b1a43856b91c..632e02dee78324 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_route_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_route_facts.py @@ -56,7 +56,7 @@ filters: - name = test_object project: test_project - auth_kind: service_account + auth_kind: serviceaccount service_account_file: "/tmp/auth.pem" ''' diff --git a/lib/ansible/modules/cloud/google/gcp_compute_router.py b/lib/ansible/modules/cloud/google/gcp_compute_router.py index eaba5f2f498b98..4dde20a2991839 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_router.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_router.py @@ -138,7 +138,7 @@ - range: 6.7.0.0/16 region: us-central1 project: "test_project" - auth_kind: "service_account" + auth_kind: "serviceaccount" service_account_file: "/tmp/auth.pem" state: present ''' diff --git a/lib/ansible/modules/cloud/google/gcp_compute_router_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_router_facts.py index 81d7f1fb23078b..fcc962972d06f0 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_router_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_router_facts.py @@ -61,7 +61,7 @@ filters: - name = test_object project: test_project - auth_kind: service_account + auth_kind: serviceaccount service_account_file: "/tmp/auth.pem" ''' diff --git a/lib/ansible/modules/cloud/google/gcp_compute_ssl_certificate.py b/lib/ansible/modules/cloud/google/gcp_compute_ssl_certificate.py index 6e7db3c706cfdb..79af7777adf1ba 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_ssl_certificate.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_ssl_certificate.py @@ -103,7 +103,7 @@ OGN02HtkpBOZzzvUARTR10JQoSe2/5PIwQ== -----END EC PRIVATE KEY----- project: "test_project" - auth_kind: "service_account" + auth_kind: "serviceaccount" service_account_file: "/tmp/auth.pem" state: present ''' diff --git a/lib/ansible/modules/cloud/google/gcp_compute_ssl_certificate_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_ssl_certificate_facts.py index 10dcc20f0900da..64696d70d66964 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_ssl_certificate_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_ssl_certificate_facts.py @@ -56,7 +56,7 @@ filters: - name = test_object project: test_project - auth_kind: service_account + auth_kind: serviceaccount service_account_file: "/tmp/auth.pem" ''' diff --git a/lib/ansible/modules/cloud/google/gcp_compute_ssl_policy.py b/lib/ansible/modules/cloud/google/gcp_compute_ssl_policy.py index 121ed4dedf328e..ebe3a01b916166 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_ssl_policy.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_ssl_policy.py @@ -96,7 +96,7 @@ - TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 - TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 project: "test_project" - auth_kind: "service_account" + auth_kind: "serviceaccount" service_account_file: "/tmp/auth.pem" state: present ''' diff --git a/lib/ansible/modules/cloud/google/gcp_compute_ssl_policy_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_ssl_policy_facts.py index 3b638b9c66707d..c25c9106bdc5db 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_ssl_policy_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_ssl_policy_facts.py @@ -56,7 +56,7 @@ filters: - name = test_object project: test_project - auth_kind: service_account + auth_kind: serviceaccount service_account_file: "/tmp/auth.pem" ''' diff --git a/lib/ansible/modules/cloud/google/gcp_compute_subnetwork.py b/lib/ansible/modules/cloud/google/gcp_compute_subnetwork.py index 4e0a4556d9b14d..82f7c272336989 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_subnetwork.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_subnetwork.py @@ -123,7 +123,7 @@ network: "{{ network }}" ip_cidr_range: 172.16.0.0/16 project: "test_project" - auth_kind: "service_account" + auth_kind: "serviceaccount" service_account_file: "/tmp/auth.pem" state: present ''' diff --git a/lib/ansible/modules/cloud/google/gcp_compute_subnetwork_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_subnetwork_facts.py index aa05e1d4d12d7a..38918a6fca08bf 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_subnetwork_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_subnetwork_facts.py @@ -61,7 +61,7 @@ filters: - name = test_object project: test_project - auth_kind: service_account + auth_kind: serviceaccount service_account_file: "/tmp/auth.pem" ''' diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_http_proxy.py b/lib/ansible/modules/cloud/google/gcp_compute_target_http_proxy.py index 07eb314ec659c7..a2dd5b3d6199f9 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_http_proxy.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_http_proxy.py @@ -123,7 +123,7 @@ name: "test_object" url_map: "{{ urlmap }}" project: "test_project" - auth_kind: "service_account" + auth_kind: "serviceaccount" service_account_file: "/tmp/auth.pem" state: present ''' diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_http_proxy_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_target_http_proxy_facts.py index f5f276e083c767..910299ca867ab0 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_http_proxy_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_http_proxy_facts.py @@ -56,7 +56,7 @@ filters: - name = test_object project: test_project - auth_kind: service_account + auth_kind: serviceaccount service_account_file: "/tmp/auth.pem" ''' diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_https_proxy.py b/lib/ansible/modules/cloud/google/gcp_compute_target_https_proxy.py index 52edd596820d66..926e7de3568cef 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_https_proxy.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_https_proxy.py @@ -174,7 +174,7 @@ - "{{ sslcert }}" url_map: "{{ urlmap }}" project: "test_project" - auth_kind: "service_account" + auth_kind: "serviceaccount" service_account_file: "/tmp/auth.pem" state: present ''' diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_https_proxy_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_target_https_proxy_facts.py index 2b33efa3d87813..1f99648515fe53 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_https_proxy_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_https_proxy_facts.py @@ -56,7 +56,7 @@ filters: - name = test_object project: test_project - auth_kind: service_account + auth_kind: serviceaccount service_account_file: "/tmp/auth.pem" ''' diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_pool.py b/lib/ansible/modules/cloud/google/gcp_compute_target_pool.py index e2ec714462d3b9..171a39485db75d 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_pool.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_pool.py @@ -125,7 +125,7 @@ name: "test_object" region: us-west1 project: "test_project" - auth_kind: "service_account" + auth_kind: "serviceaccount" service_account_file: "/tmp/auth.pem" state: present ''' diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_pool_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_target_pool_facts.py index b8c65f740d0432..2699076fb6fd78 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_pool_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_pool_facts.py @@ -61,7 +61,7 @@ filters: - name = test_object project: test_project - auth_kind: service_account + auth_kind: serviceaccount service_account_file: "/tmp/auth.pem" ''' diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_ssl_proxy.py b/lib/ansible/modules/cloud/google/gcp_compute_target_ssl_proxy.py index a14d429caecb0d..5edd255e37078a 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_ssl_proxy.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_ssl_proxy.py @@ -164,7 +164,7 @@ - "{{ sslcert }}" service: "{{ backendservice }}" project: "test_project" - auth_kind: "service_account" + auth_kind: "serviceaccount" service_account_file: "/tmp/auth.pem" state: present ''' diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_ssl_proxy_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_target_ssl_proxy_facts.py index 8a41381db942a0..2795aaf6938bbd 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_ssl_proxy_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_ssl_proxy_facts.py @@ -56,7 +56,7 @@ filters: - name = test_object project: test_project - auth_kind: service_account + auth_kind: serviceaccount service_account_file: "/tmp/auth.pem" ''' diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_tcp_proxy.py b/lib/ansible/modules/cloud/google/gcp_compute_target_tcp_proxy.py index a15a6b36b29cd6..0161e24cf9311d 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_tcp_proxy.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_tcp_proxy.py @@ -124,7 +124,7 @@ proxy_header: PROXY_V1 service: "{{ backendservice }}" project: "test_project" - auth_kind: "service_account" + auth_kind: "serviceaccount" service_account_file: "/tmp/auth.pem" state: present ''' diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_tcp_proxy_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_target_tcp_proxy_facts.py index 34e885d4a7e48d..9cb2f6709f31f5 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_tcp_proxy_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_tcp_proxy_facts.py @@ -56,7 +56,7 @@ filters: - name = test_object project: test_project - auth_kind: service_account + auth_kind: serviceaccount service_account_file: "/tmp/auth.pem" ''' diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_vpn_gateway.py b/lib/ansible/modules/cloud/google/gcp_compute_target_vpn_gateway.py index ce52de624ff7ed..c065c2cce325db 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_vpn_gateway.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_vpn_gateway.py @@ -99,7 +99,7 @@ region: us-west1 network: "{{ network }}" project: "test_project" - auth_kind: "service_account" + auth_kind: "serviceaccount" service_account_file: "/tmp/auth.pem" state: present ''' diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_vpn_gateway_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_target_vpn_gateway_facts.py index 23d1a4b89285a9..b68ed93e832289 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_vpn_gateway_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_vpn_gateway_facts.py @@ -61,7 +61,7 @@ filters: - name = test_object project: test_project - auth_kind: service_account + auth_kind: serviceaccount service_account_file: "/tmp/auth.pem" ''' diff --git a/lib/ansible/modules/cloud/google/gcp_compute_url_map.py b/lib/ansible/modules/cloud/google/gcp_compute_url_map.py index 6e45c2eeba5b19..a109044d323409 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_url_map.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_url_map.py @@ -187,7 +187,7 @@ name: "test_object" default_service: "{{ backendservice }}" project: "test_project" - auth_kind: "service_account" + auth_kind: "serviceaccount" service_account_file: "/tmp/auth.pem" state: present ''' diff --git a/lib/ansible/modules/cloud/google/gcp_compute_url_map_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_url_map_facts.py index 515e4031c80843..ea7d6027627bed 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_url_map_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_url_map_facts.py @@ -56,7 +56,7 @@ filters: - name = test_object project: test_project - auth_kind: service_account + auth_kind: serviceaccount service_account_file: "/tmp/auth.pem" ''' diff --git a/lib/ansible/modules/cloud/google/gcp_compute_vpn_tunnel.py b/lib/ansible/modules/cloud/google/gcp_compute_vpn_tunnel.py index 94d00cc7a8dd55..f40b50480c3871 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_vpn_tunnel.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_vpn_tunnel.py @@ -158,7 +158,7 @@ router: "{{ router }}" shared_secret: super secret project: "test_project" - auth_kind: "service_account" + auth_kind: "serviceaccount" service_account_file: "/tmp/auth.pem" state: present ''' diff --git a/lib/ansible/modules/cloud/google/gcp_compute_vpn_tunnel_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_vpn_tunnel_facts.py index 86c9f38eeb4739..437ce212577f1f 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_vpn_tunnel_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_vpn_tunnel_facts.py @@ -61,7 +61,7 @@ filters: - name = test_object project: test_project - auth_kind: service_account + auth_kind: serviceaccount service_account_file: "/tmp/auth.pem" ''' diff --git a/lib/ansible/modules/cloud/google/gcp_container_cluster.py b/lib/ansible/modules/cloud/google/gcp_container_cluster.py index 1998155c60aade..3baf720f82eed2 100644 --- a/lib/ansible/modules/cloud/google/gcp_container_cluster.py +++ b/lib/ansible/modules/cloud/google/gcp_container_cluster.py @@ -268,7 +268,7 @@ disk_size_gb: 500 zone: us-central1-a project: "test_project" - auth_kind: "service_account" + auth_kind: "serviceaccount" service_account_file: "/tmp/auth.pem" state: present ''' diff --git a/lib/ansible/modules/cloud/google/gcp_container_node_pool.py b/lib/ansible/modules/cloud/google/gcp_container_node_pool.py index dffe9b322913a5..17ebbedc1b1919 100644 --- a/lib/ansible/modules/cloud/google/gcp_container_node_pool.py +++ b/lib/ansible/modules/cloud/google/gcp_container_node_pool.py @@ -225,7 +225,7 @@ cluster: "{{ cluster }}" zone: us-central1-a project: "test_project" - auth_kind: "service_account" + auth_kind: "serviceaccount" service_account_file: "/tmp/auth.pem" state: present ''' diff --git a/lib/ansible/modules/cloud/google/gcp_dns_managed_zone.py b/lib/ansible/modules/cloud/google/gcp_dns_managed_zone.py index 7899a9de44189b..9d0a12981408be 100644 --- a/lib/ansible/modules/cloud/google/gcp_dns_managed_zone.py +++ b/lib/ansible/modules/cloud/google/gcp_dns_managed_zone.py @@ -77,7 +77,7 @@ dns_name: test.somewild2.example.com. description: test zone project: "test_project" - auth_kind: "service_account" + auth_kind: "serviceaccount" service_account_file: "/tmp/auth.pem" state: present ''' diff --git a/lib/ansible/modules/cloud/google/gcp_dns_resource_record_set.py b/lib/ansible/modules/cloud/google/gcp_dns_resource_record_set.py index aaaf406703f330..aae7f8a263ee1a 100644 --- a/lib/ansible/modules/cloud/google/gcp_dns_resource_record_set.py +++ b/lib/ansible/modules/cloud/google/gcp_dns_resource_record_set.py @@ -97,7 +97,7 @@ - 10.1.2.3 - 40.5.6.7 project: "test_project" - auth_kind: "service_account" + auth_kind: "serviceaccount" service_account_file: "/tmp/auth.pem" state: present ''' diff --git a/lib/ansible/modules/cloud/google/gcp_pubsub_subscription.py b/lib/ansible/modules/cloud/google/gcp_pubsub_subscription.py index 5f7c2807c565d2..463f913bdb9439 100644 --- a/lib/ansible/modules/cloud/google/gcp_pubsub_subscription.py +++ b/lib/ansible/modules/cloud/google/gcp_pubsub_subscription.py @@ -105,7 +105,7 @@ push_endpoint: https://myapp.graphite.cloudnativeapp.com/webhook/sub1 ack_deadline_seconds: 300 project: "test_project" - auth_kind: "service_account" + auth_kind: "serviceaccount" service_account_file: "/tmp/auth.pem" state: present ''' diff --git a/lib/ansible/modules/cloud/google/gcp_pubsub_topic.py b/lib/ansible/modules/cloud/google/gcp_pubsub_topic.py index 863c9f39f67696..0b1b468f64335f 100644 --- a/lib/ansible/modules/cloud/google/gcp_pubsub_topic.py +++ b/lib/ansible/modules/cloud/google/gcp_pubsub_topic.py @@ -58,7 +58,7 @@ gcp_pubsub_topic: name: test-topic1 project: "test_project" - auth_kind: "service_account" + auth_kind: "serviceaccount" service_account_file: "/tmp/auth.pem" state: present ''' diff --git a/lib/ansible/modules/cloud/google/gcp_spanner_database.py b/lib/ansible/modules/cloud/google/gcp_spanner_database.py index 702dddd3558575..bbb37d2020f0c1 100644 --- a/lib/ansible/modules/cloud/google/gcp_spanner_database.py +++ b/lib/ansible/modules/cloud/google/gcp_spanner_database.py @@ -85,7 +85,7 @@ name: webstore instance: "{{ instance }}" project: "test_project" - auth_kind: "service_account" + auth_kind: "serviceaccount" service_account_file: "/tmp/auth.pem" state: present ''' diff --git a/lib/ansible/modules/cloud/google/gcp_spanner_instance.py b/lib/ansible/modules/cloud/google/gcp_spanner_instance.py index bd5dbb3e6d1d01..d91a6e0103d18c 100644 --- a/lib/ansible/modules/cloud/google/gcp_spanner_instance.py +++ b/lib/ansible/modules/cloud/google/gcp_spanner_instance.py @@ -99,7 +99,7 @@ cost_center: ti-1700004 config: regional-us-central1 project: "test_project" - auth_kind: "service_account" + auth_kind: "serviceaccount" service_account_file: "/tmp/auth.pem" state: present ''' diff --git a/lib/ansible/modules/cloud/google/gcp_sql_database.py b/lib/ansible/modules/cloud/google/gcp_sql_database.py index 574c00112ba3b7..b8a9f3c9de9686 100644 --- a/lib/ansible/modules/cloud/google/gcp_sql_database.py +++ b/lib/ansible/modules/cloud/google/gcp_sql_database.py @@ -89,7 +89,7 @@ charset: utf8 instance: "{{ instance }}" project: "test_project" - auth_kind: "service_account" + auth_kind: "serviceaccount" service_account_file: "/tmp/auth.pem" state: present ''' diff --git a/lib/ansible/modules/cloud/google/gcp_sql_instance.py b/lib/ansible/modules/cloud/google/gcp_sql_instance.py index e68109f2e9bf63..765df28baedd7e 100644 --- a/lib/ansible/modules/cloud/google/gcp_sql_instance.py +++ b/lib/ansible/modules/cloud/google/gcp_sql_instance.py @@ -267,7 +267,7 @@ tier: db-n1-standard-1 region: us-central1 project: "test_project" - auth_kind: "service_account" + auth_kind: "serviceaccount" service_account_file: "/tmp/auth.pem" state: present ''' diff --git a/lib/ansible/modules/cloud/google/gcp_sql_user.py b/lib/ansible/modules/cloud/google/gcp_sql_user.py index b91372221053e2..e94b531e22fd1c 100644 --- a/lib/ansible/modules/cloud/google/gcp_sql_user.py +++ b/lib/ansible/modules/cloud/google/gcp_sql_user.py @@ -91,7 +91,7 @@ password: secret-password instance: "{{ instance }}" project: "test_project" - auth_kind: "service_account" + auth_kind: "serviceaccount" service_account_file: "/tmp/auth.pem" state: present ''' diff --git a/lib/ansible/modules/cloud/google/gcp_storage_bucket.py b/lib/ansible/modules/cloud/google/gcp_storage_bucket.py index 989b9b84cd5cec..459396afe2b5f7 100644 --- a/lib/ansible/modules/cloud/google/gcp_storage_bucket.py +++ b/lib/ansible/modules/cloud/google/gcp_storage_bucket.py @@ -358,7 +358,7 @@ gcp_storage_bucket: name: ansible-storage-module project: "test_project" - auth_kind: "service_account" + auth_kind: "serviceaccount" service_account_file: "/tmp/auth.pem" state: present ''' diff --git a/lib/ansible/modules/cloud/google/gcp_storage_bucket_access_control.py b/lib/ansible/modules/cloud/google/gcp_storage_bucket_access_control.py index 71f972adb11742..d6ce92cf70c3fe 100644 --- a/lib/ansible/modules/cloud/google/gcp_storage_bucket_access_control.py +++ b/lib/ansible/modules/cloud/google/gcp_storage_bucket_access_control.py @@ -111,7 +111,7 @@ entity: user-alexstephen@google.com role: WRITER project: "test_project" - auth_kind: "service_account" + auth_kind: "serviceaccount" service_account_file: "/tmp/auth.pem" state: present ''' From e3b351458ce9d1fdb80f3a720e43d11c657217fd Mon Sep 17 00:00:00 2001 From: The Magician Date: Wed, 12 Sep 2018 12:47:38 -0700 Subject: [PATCH 029/144] Adding ability to override classes (#92) --- lib/ansible/modules/cloud/google/gcp_compute_disk.py | 2 +- lib/ansible/modules/cloud/google/gcp_compute_instance.py | 4 ++-- .../modules/cloud/google/gcp_compute_instance_template.py | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_disk.py b/lib/ansible/modules/cloud/google/gcp_compute_disk.py index 5965e9931f7923..5ab9da55a13934 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_disk.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_disk.py @@ -598,7 +598,7 @@ def response_to_hash(module, response): def disk_type_selflink(name, params): if name is None: return - url = r"https://www.googleapis.com/compute/v1/projects/.*/zones/{zone}/diskTypes/[a-z1-9\-]*" + url = r"https://www.googleapis.com/compute/v1/projects/.*/zones/[a-z1-9\-]*/diskTypes/[a-z1-9\-]*" if not re.match(url, name): name = "https://www.googleapis.com/compute/v1/projects/{project}/zones/{zone}/diskTypes/%s".format(**params) % name return name diff --git a/lib/ansible/modules/cloud/google/gcp_compute_instance.py b/lib/ansible/modules/cloud/google/gcp_compute_instance.py index afa8b187e63a70..4588a55ed2a908 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_instance.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_instance.py @@ -1051,7 +1051,7 @@ def response_to_hash(module, response): def disk_type_selflink(name, params): if name is None: return - url = r"https://www.googleapis.com/compute/v1/projects/.*/zones/{zone}/diskTypes/[a-z1-9\-]*" + url = r"https://www.googleapis.com/compute/v1/projects/.*/zones/[a-z1-9\-]*/diskTypes/[a-z1-9\-]*" if not re.match(url, name): name = "https://www.googleapis.com/compute/v1/projects/{project}/zones/{zone}/diskTypes/%s".format(**params) % name return name @@ -1060,7 +1060,7 @@ def disk_type_selflink(name, params): def machine_type_selflink(name, params): if name is None: return - url = r"https://www.googleapis.com/compute/v1/projects/.*/zones/{zone}/machineTypes/[a-z1-9\-]*" + url = r"https://www.googleapis.com/compute/v1/projects/.*/zones/[a-z1-9\-]*/machineTypes/[a-z1-9\-]*" if not re.match(url, name): name = "https://www.googleapis.com/compute/v1/projects/{project}/zones/{zone}/machineTypes/%s".format(**params) % name return name diff --git a/lib/ansible/modules/cloud/google/gcp_compute_instance_template.py b/lib/ansible/modules/cloud/google/gcp_compute_instance_template.py index 751d495de8a724..11fc872452b8e9 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_instance_template.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_instance_template.py @@ -1002,7 +1002,7 @@ def response_to_hash(module, response): def disk_type_selflink(name, params): if name is None: return - url = r"https://www.googleapis.com/compute/v1/projects/.*/zones/{zone}/diskTypes/[a-z1-9\-]*" + url = r"https://www.googleapis.com/compute/v1/projects/.*/zones/[a-z1-9\-]*/diskTypes/[a-z1-9\-]*" if not re.match(url, name): name = "https://www.googleapis.com/compute/v1/projects/{project}/zones/{zone}/diskTypes/%s".format(**params) % name return name From e8340485946e8e886d99ac3c9e96fa341b31181e Mon Sep 17 00:00:00 2001 From: The Magician Date: Wed, 12 Sep 2018 14:50:22 -0700 Subject: [PATCH 030/144] Minor schema/docs update to SslCertificate. (#89) /cc @rileykarson --- .../google/gcp_compute_ssl_certificate.py | 23 +++++++++++-------- .../gcp_compute_ssl_certificate_facts.py | 2 +- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_ssl_certificate.py b/lib/ansible/modules/cloud/google/gcp_compute_ssl_certificate.py index 79af7777adf1ba..b4267dc6f3c2f4 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_ssl_certificate.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_ssl_certificate.py @@ -32,8 +32,9 @@ --- module: gcp_compute_ssl_certificate description: - - An SslCertificate resource. This resource provides a mechanism to upload an SSL - key and certificate to the load balancer to serve secure connections from the user. + - An SslCertificate resource, used for HTTPS load balancing. This resource provides + a mechanism to upload an SSL key and certificate to the load balancer to serve secure + connections from the user. short_description: Creates a GCP SslCertificate version_added: 2.6 author: Google Inc. (@googlecloudplatform) @@ -52,7 +53,7 @@ - The certificate in PEM format. - The certificate chain must be no greater than 5 certs long. - The chain must include at least one intermediate cert. - required: false + required: true description: description: - An optional description of this resource. @@ -68,9 +69,12 @@ required: false private_key: description: - - The private key in PEM format. - required: false + - The write-only private key in PEM format. + required: true extends_documentation_fragment: gcp +notes: + - "API Reference: U(https://cloud.google.com/compute/docs/reference/rest/v1/sslCertificates)" + - "Official Documentation: U(https://cloud.google.com/load-balancing/docs/ssl-certificates)" ''' EXAMPLES = ''' @@ -143,7 +147,7 @@ type: str private_key: description: - - The private key in PEM format. + - The write-only private key in PEM format. returned: success type: str ''' @@ -167,10 +171,10 @@ def main(): module = GcpModule( argument_spec=dict( state=dict(default='present', choices=['present', 'absent'], type='str'), - certificate=dict(type='str'), + certificate=dict(required=True, type='str'), description=dict(type='str'), name=dict(type='str'), - private_key=dict(type='str') + private_key=dict(required=True, type='str') ) ) @@ -210,8 +214,7 @@ def create(module, link, kind): def update(module, link, kind): - auth = GcpSession(module, 'compute') - return wait_for_operation(module, auth.put(link, resource_to_request(module))) + module.fail_json(msg="SslCertificate cannot be edited") def delete(module, link, kind): diff --git a/lib/ansible/modules/cloud/google/gcp_compute_ssl_certificate_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_ssl_certificate_facts.py index 64696d70d66964..78f50ce30e5227 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_ssl_certificate_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_ssl_certificate_facts.py @@ -100,7 +100,7 @@ type: str private_key: description: - - The private key in PEM format. + - The write-only private key in PEM format. returned: success type: str ''' From e826a4b1eaa6cdbe19efa96d9f0be7c311e16887 Mon Sep 17 00:00:00 2001 From: The Magician Date: Wed, 12 Sep 2018 15:50:25 -0700 Subject: [PATCH 031/144] Magic Modules changes. (#91) --- test/integration/cloud-config-gcp.yml.template | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/integration/cloud-config-gcp.yml.template b/test/integration/cloud-config-gcp.yml.template index 2073c645c9073e..83a9e531669fa3 100644 --- a/test/integration/cloud-config-gcp.yml.template +++ b/test/integration/cloud-config-gcp.yml.template @@ -1,4 +1,4 @@ -<% if false # the license inside this if block assertains to this file -%> +<%# The license inside this block applies to this file # Copyright 2017 Google Inc. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -11,7 +11,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -<% end -%> +-%> # This is the configuration template for ansible-test GCP integration tests. # # You do not need this template if you are: From 16124a5d732aeec4ac5c3d139887e407789e5f44 Mon Sep 17 00:00:00 2001 From: The Magician Date: Thu, 20 Sep 2018 13:05:05 -0700 Subject: [PATCH 032/144] Express project name in env variable (#94) /cc @rambleraptor --- lib/ansible/module_utils/gcp_utils.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/ansible/module_utils/gcp_utils.py b/lib/ansible/module_utils/gcp_utils.py index cea381d027652b..9171e3f358b057 100644 --- a/lib/ansible/module_utils/gcp_utils.py +++ b/lib/ansible/module_utils/gcp_utils.py @@ -152,7 +152,10 @@ def __init__(self, *args, **kwargs): kwargs['argument_spec'] = self._merge_dictionaries( arg_spec, dict( - project=dict(required=True, type='str'), + project=dict( + required=True, + type='str', + fallback=(env_fallback, ['GCP_PROJECT'])), auth_kind=dict( required=False, fallback=(env_fallback, ['GCP_AUTH_KIND']), From aed81a81f525b9bf49b29e3d7534742c0658afe4 Mon Sep 17 00:00:00 2001 From: The Magician Date: Fri, 21 Sep 2018 10:57:51 -0700 Subject: [PATCH 033/144] Pubsub + DNS Facts (#75) /cc @rambleraptor --- .../gcp_compute_backend_bucket_facts.py | 2 +- .../gcp_compute_backend_service_facts.py | 2 +- .../google/gcp_compute_firewall_facts.py | 2 +- .../gcp_compute_global_address_facts.py | 2 +- ...cp_compute_global_forwarding_rule_facts.py | 2 +- .../google/gcp_compute_health_check_facts.py | 2 +- .../gcp_compute_http_health_check_facts.py | 2 +- .../gcp_compute_https_health_check_facts.py | 2 +- .../cloud/google/gcp_compute_image_facts.py | 2 +- .../gcp_compute_instance_template_facts.py | 2 +- .../cloud/google/gcp_compute_network_facts.py | 2 +- .../cloud/google/gcp_compute_route_facts.py | 2 +- .../gcp_compute_ssl_certificate_facts.py | 2 +- .../google/gcp_compute_ssl_policy_facts.py | 2 +- .../gcp_compute_target_http_proxy_facts.py | 2 +- .../gcp_compute_target_https_proxy_facts.py | 2 +- .../gcp_compute_target_ssl_proxy_facts.py | 2 +- .../gcp_compute_target_tcp_proxy_facts.py | 2 +- .../cloud/google/gcp_compute_url_map_facts.py | 2 +- .../google/gcp_dns_managed_zone_facts.py | 172 ++++++++++++++++++ .../gcp_dns_resource_record_set_facts.py | 163 +++++++++++++++++ .../cloud/google/gcp_pubsub_subscription.py | 2 +- .../google/gcp_pubsub_subscription_facts.py | 167 +++++++++++++++++ .../cloud/google/gcp_pubsub_topic_facts.py | 130 +++++++++++++ .../gcp_container_node_pool/tasks/main.yml | 4 +- .../gcp_dns_managed_zone/tasks/main.yml | 24 ++- .../tasks/main.yml | 26 +++ .../gcp_pubsub_subscription/tasks/main.yml | 22 ++- .../targets/gcp_pubsub_topic/tasks/main.yml | 22 ++- .../targets/gcp_sql_user/tasks/main.yml | 4 +- 30 files changed, 726 insertions(+), 48 deletions(-) create mode 100644 lib/ansible/modules/cloud/google/gcp_dns_managed_zone_facts.py create mode 100644 lib/ansible/modules/cloud/google/gcp_dns_resource_record_set_facts.py create mode 100644 lib/ansible/modules/cloud/google/gcp_pubsub_subscription_facts.py create mode 100644 lib/ansible/modules/cloud/google/gcp_pubsub_topic_facts.py diff --git a/lib/ansible/modules/cloud/google/gcp_compute_backend_bucket_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_backend_bucket_facts.py index f14c9f9ea2781c..7674b8e9bd4b3c 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_backend_bucket_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_backend_bucket_facts.py @@ -118,7 +118,7 @@ def main(): module = GcpModule( argument_spec=dict( - filters=dict(type='list', elements='str'), + filters=dict(type='list', elements='str') ) ) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_backend_service_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_backend_service_facts.py index 1ae55b6347f99b..1c50fb3e963172 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_backend_service_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_backend_service_facts.py @@ -337,7 +337,7 @@ def main(): module = GcpModule( argument_spec=dict( - filters=dict(type='list', elements='str'), + filters=dict(type='list', elements='str') ) ) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_firewall_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_firewall_facts.py index 0cff51656c1ec5..0767c9849d48d5 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_firewall_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_firewall_facts.py @@ -238,7 +238,7 @@ def main(): module = GcpModule( argument_spec=dict( - filters=dict(type='list', elements='str'), + filters=dict(type='list', elements='str') ) ) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_global_address_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_global_address_facts.py index 99d0c9141c9996..2bdfb6cdaefa91 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_global_address_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_global_address_facts.py @@ -130,7 +130,7 @@ def main(): module = GcpModule( argument_spec=dict( - filters=dict(type='list', elements='str'), + filters=dict(type='list', elements='str') ) ) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_global_forwarding_rule_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_global_forwarding_rule_facts.py index 71b9d22e7799b3..9295d27f6e14c3 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_global_forwarding_rule_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_global_forwarding_rule_facts.py @@ -213,7 +213,7 @@ def main(): module = GcpModule( argument_spec=dict( - filters=dict(type='list', elements='str'), + filters=dict(type='list', elements='str') ) ) 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 672ea2d114cbd8..fce02448256ff4 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 @@ -289,7 +289,7 @@ def main(): module = GcpModule( argument_spec=dict( - filters=dict(type='list', elements='str'), + filters=dict(type='list', elements='str') ) ) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_http_health_check_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_http_health_check_facts.py index 5a1a385833b0e0..00ba7096a3e36a 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_http_health_check_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_http_health_check_facts.py @@ -151,7 +151,7 @@ def main(): module = GcpModule( argument_spec=dict( - filters=dict(type='list', elements='str'), + filters=dict(type='list', elements='str') ) ) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_https_health_check_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_https_health_check_facts.py index 8779713ddf2ff4..e22bf26ca1f237 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_https_health_check_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_https_health_check_facts.py @@ -151,7 +151,7 @@ def main(): module = GcpModule( argument_spec=dict( - filters=dict(type='list', elements='str'), + filters=dict(type='list', elements='str') ) ) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_image_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_image_facts.py index b94f80c53819b8..3187ca01e60228 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_image_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_image_facts.py @@ -278,7 +278,7 @@ def main(): module = GcpModule( argument_spec=dict( - filters=dict(type='list', elements='str'), + filters=dict(type='list', elements='str') ) ) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_instance_template_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_instance_template_facts.py index c769ce4143c814..1c2c994e7c679f 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_instance_template_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_instance_template_facts.py @@ -451,7 +451,7 @@ def main(): module = GcpModule( argument_spec=dict( - filters=dict(type='list', elements='str'), + filters=dict(type='list', elements='str') ) ) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_network_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_network_facts.py index e7e39527824964..5cebe4725b98d1 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_network_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_network_facts.py @@ -135,7 +135,7 @@ def main(): module = GcpModule( argument_spec=dict( - filters=dict(type='list', elements='str'), + filters=dict(type='list', elements='str') ) ) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_route_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_route_facts.py index 632e02dee78324..84dad393332e67 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_route_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_route_facts.py @@ -155,7 +155,7 @@ def main(): module = GcpModule( argument_spec=dict( - filters=dict(type='list', elements='str'), + filters=dict(type='list', elements='str') ) ) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_ssl_certificate_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_ssl_certificate_facts.py index 78f50ce30e5227..a922fbbb96f3c8 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_ssl_certificate_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_ssl_certificate_facts.py @@ -119,7 +119,7 @@ def main(): module = GcpModule( argument_spec=dict( - filters=dict(type='list', elements='str'), + filters=dict(type='list', elements='str') ) ) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_ssl_policy_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_ssl_policy_facts.py index c25c9106bdc5db..1c15a8b327696b 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_ssl_policy_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_ssl_policy_facts.py @@ -156,7 +156,7 @@ def main(): module = GcpModule( argument_spec=dict( - filters=dict(type='list', elements='str'), + filters=dict(type='list', elements='str') ) ) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_http_proxy_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_target_http_proxy_facts.py index 910299ca867ab0..c17e74dadaf2d8 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_http_proxy_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_http_proxy_facts.py @@ -112,7 +112,7 @@ def main(): module = GcpModule( argument_spec=dict( - filters=dict(type='list', elements='str'), + filters=dict(type='list', elements='str') ) ) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_https_proxy_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_target_https_proxy_facts.py index 1f99648515fe53..9b746963994cf7 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_https_proxy_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_https_proxy_facts.py @@ -127,7 +127,7 @@ def main(): module = GcpModule( argument_spec=dict( - filters=dict(type='list', elements='str'), + filters=dict(type='list', elements='str') ) ) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_ssl_proxy_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_target_ssl_proxy_facts.py index 2795aaf6938bbd..dcfc8baa4355ee 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_ssl_proxy_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_ssl_proxy_facts.py @@ -124,7 +124,7 @@ def main(): module = GcpModule( argument_spec=dict( - filters=dict(type='list', elements='str'), + filters=dict(type='list', elements='str') ) ) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_tcp_proxy_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_target_tcp_proxy_facts.py index 9cb2f6709f31f5..a52c9f27ae9b28 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_tcp_proxy_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_tcp_proxy_facts.py @@ -118,7 +118,7 @@ def main(): module = GcpModule( argument_spec=dict( - filters=dict(type='list', elements='str'), + filters=dict(type='list', elements='str') ) ) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_url_map_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_url_map_facts.py index ea7d6027627bed..ca5c6762faae7b 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_url_map_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_url_map_facts.py @@ -205,7 +205,7 @@ def main(): module = GcpModule( argument_spec=dict( - filters=dict(type='list', elements='str'), + filters=dict(type='list', elements='str') ) ) diff --git a/lib/ansible/modules/cloud/google/gcp_dns_managed_zone_facts.py b/lib/ansible/modules/cloud/google/gcp_dns_managed_zone_facts.py new file mode 100644 index 00000000000000..04618a2718e6d6 --- /dev/null +++ b/lib/ansible/modules/cloud/google/gcp_dns_managed_zone_facts.py @@ -0,0 +1,172 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# +# Copyright (C) 2017 Google +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) +# ---------------------------------------------------------------------------- +# +# *** AUTO GENERATED CODE *** AUTO GENERATED CODE *** +# +# ---------------------------------------------------------------------------- +# +# This file is automatically generated by Magic Modules and manual +# changes will be clobbered when the file is regenerated. +# +# Please read more about how to change this file at +# https://www.github.com/GoogleCloudPlatform/magic-modules +# +# ---------------------------------------------------------------------------- + +from __future__ import absolute_import, division, print_function +__metaclass__ = type + +################################################################################ +# Documentation +################################################################################ + +ANSIBLE_METADATA = {'metadata_version': '1.1', + 'status': ["preview"], + 'supported_by': 'community'} + +DOCUMENTATION = ''' +--- +module: gcp_dns_managed_zone_facts +description: + - Gather facts for GCP ManagedZone +short_description: Gather facts for GCP ManagedZone +version_added: 2.7 +author: Google Inc. (@googlecloudplatform) +requirements: + - python >= 2.6 + - requests >= 2.18.4 + - google-auth >= 1.3.0 +options: + dns_name: + description: + Restricts the list to return only zones with this domain name. +extends_documentation_fragment: gcp +''' + +EXAMPLES = ''' +- name: a managed zone facts + gcp_dns_managed_zone_facts: + dns_name: test.somewild2.example.com. + project: test_project + auth_kind: serviceaccount + service_account_file: "/tmp/auth.pem" +''' + +RETURN = ''' +items: + description: List of items + returned: always + type: complex + contains: + description: + description: + - A mutable string of at most 1024 characters associated with this resource for the + user's convenience. Has no effect on the managed zone's function. + returned: success + type: str + dns_name: + description: + - The DNS name of this managed zone, for instance "example.com.". + returned: success + type: str + id: + description: + - Unique identifier for the resource; defined by the server. + returned: success + type: int + name: + description: + - User assigned name for this resource. + - Must be unique within the project. + returned: success + type: str + name_servers: + description: + - Delegate your managed_zone to these virtual name servers; defined by the server + . + returned: success + type: list + name_server_set: + description: + - Optionally specifies the NameServerSet for this ManagedZone. A NameServerSet is + a set of DNS name servers that all host the same ManagedZones. Most users will leave + this field unset. + returned: success + type: list + creation_time: + description: + - The time that this resource was created on the server. + - This is in RFC3339 text format. + returned: success + type: str +''' + +################################################################################ +# Imports +################################################################################ +from ansible.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest +import json + +################################################################################ +# Main +################################################################################ + + +def main(): + module = GcpModule( + argument_spec=dict( + dns_name=dict(type='list', elements='str') + ) + ) + + if 'scopes' not in module.params: + module.params['scopes'] = ['https://www.googleapis.com/auth/ndev.clouddns.readwrite'] + + items = fetch_list(module, collection(module), module.params['dns_name']) + if items.get('managedZones'): + items = items.get('managedZones') + else: + items = [] + return_value = { + 'items': items + } + module.exit_json(**return_value) + + +def collection(module): + return "https://www.googleapis.com/dns/v1/projects/{project}/managedZones".format(**module.params) + + +def fetch_list(module, link, query): + auth = GcpSession(module, 'dns') + response = auth.get(link, params={'dnsName': query}) + return return_if_object(module, response) + + +def return_if_object(module, response): + # If not found, return nothing. + if response.status_code == 404: + return None + + # If no content, return nothing. + if response.status_code == 204: + return None + + try: + module.raise_for_status(response) + result = response.json() + except getattr(json.decoder, 'JSONDecodeError', ValueError) as inst: + module.fail_json(msg="Invalid JSON response with error: %s" % inst) + + if navigate_hash(result, ['error', 'errors']): + module.fail_json(msg=navigate_hash(result, ['error', 'errors'])) + + return result + + +if __name__ == "__main__": + main() diff --git a/lib/ansible/modules/cloud/google/gcp_dns_resource_record_set_facts.py b/lib/ansible/modules/cloud/google/gcp_dns_resource_record_set_facts.py new file mode 100644 index 00000000000000..fff16074a7ed1e --- /dev/null +++ b/lib/ansible/modules/cloud/google/gcp_dns_resource_record_set_facts.py @@ -0,0 +1,163 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# +# Copyright (C) 2017 Google +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) +# ---------------------------------------------------------------------------- +# +# *** AUTO GENERATED CODE *** AUTO GENERATED CODE *** +# +# ---------------------------------------------------------------------------- +# +# This file is automatically generated by Magic Modules and manual +# changes will be clobbered when the file is regenerated. +# +# Please read more about how to change this file at +# https://www.github.com/GoogleCloudPlatform/magic-modules +# +# ---------------------------------------------------------------------------- + +from __future__ import absolute_import, division, print_function +__metaclass__ = type + +################################################################################ +# Documentation +################################################################################ + +ANSIBLE_METADATA = {'metadata_version': '1.1', + 'status': ["preview"], + 'supported_by': 'community'} + +DOCUMENTATION = ''' +--- +module: gcp_dns_resource_record_set_facts +description: + - Gather facts for GCP ResourceRecordSet +short_description: Gather facts for GCP ResourceRecordSet +version_added: 2.7 +author: Google Inc. (@googlecloudplatform) +requirements: + - python >= 2.6 + - requests >= 2.18.4 + - google-auth >= 1.3.0 +options: + managed_zone: + description: + - Identifies the managed zone addressed by this request. + - Can be the managed zone name or id. + required: true +extends_documentation_fragment: gcp +''' + +EXAMPLES = ''' +- name: a resource record set facts + gcp_dns_resource_record_set_facts: + managed_zone: "{{ managed_zone }}" + project: test_project + auth_kind: serviceaccount + service_account_file: "/tmp/auth.pem" +''' + +RETURN = ''' +items: + description: List of items + returned: always + type: complex + contains: + name: + description: + - For example, U(www.example.com.) + returned: success + type: str + type: + description: + - One of valid DNS resource types. + returned: success + type: str + ttl: + description: + - Number of seconds that this ResourceRecordSet can be cached by resolvers. + returned: success + type: int + target: + description: + - As defined in RFC 1035 (section 5) and RFC 1034 (section 3.6.1) . + returned: success + type: list + managed_zone: + description: + - Identifies the managed zone addressed by this request. + - Can be the managed zone name or id. + returned: success + type: dict +''' + +################################################################################ +# Imports +################################################################################ +from ansible.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest, replace_resource_dict +import json + +################################################################################ +# Main +################################################################################ + + +def main(): + module = GcpModule( + argument_spec=dict( + managed_zone=dict(required=True, type='dict') + ) + ) + + if 'scopes' not in module.params: + module.params['scopes'] = ['https://www.googleapis.com/auth/ndev.clouddns.readwrite'] + + items = fetch_list(module, collection(module)) + if items.get('rrsets'): + items = items.get('rrsets') + else: + items = [] + return_value = { + 'items': items + } + module.exit_json(**return_value) + + +def collection(module): + res = { + 'project': module.params['project'], + 'managed_zone': replace_resource_dict(module.params['managed_zone'], 'name') + } + return "https://www.googleapis.com/dns/v1/projects/{project}/managedZones/{managed_zone}/rrsets".format(**res) + + +def fetch_list(module, link): + auth = GcpSession(module, 'dns') + response = auth.get(link) + return return_if_object(module, response) + + +def return_if_object(module, response): + # If not found, return nothing. + if response.status_code == 404: + return None + + # If no content, return nothing. + if response.status_code == 204: + return None + + try: + module.raise_for_status(response) + result = response.json() + except getattr(json.decoder, 'JSONDecodeError', ValueError) as inst: + module.fail_json(msg="Invalid JSON response with error: %s" % inst) + + if navigate_hash(result, ['error', 'errors']): + module.fail_json(msg=navigate_hash(result, ['error', 'errors'])) + + return result + + +if __name__ == "__main__": + main() diff --git a/lib/ansible/modules/cloud/google/gcp_pubsub_subscription.py b/lib/ansible/modules/cloud/google/gcp_pubsub_subscription.py index 463f913bdb9439..cde8dff25d487a 100644 --- a/lib/ansible/modules/cloud/google/gcp_pubsub_subscription.py +++ b/lib/ansible/modules/cloud/google/gcp_pubsub_subscription.py @@ -319,7 +319,7 @@ def decode_request(response, module): def encode_request(request, module): request['topic'] = '/'.join(['projects', module.params['project'], - 'topics', module.params['topic']]) + 'topics', module.params['topic']['name']]) request['name'] = '/'.join(['projects', module.params['project'], 'subscriptions', module.params['name']]) diff --git a/lib/ansible/modules/cloud/google/gcp_pubsub_subscription_facts.py b/lib/ansible/modules/cloud/google/gcp_pubsub_subscription_facts.py new file mode 100644 index 00000000000000..93e102cedf5b87 --- /dev/null +++ b/lib/ansible/modules/cloud/google/gcp_pubsub_subscription_facts.py @@ -0,0 +1,167 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# +# Copyright (C) 2017 Google +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) +# ---------------------------------------------------------------------------- +# +# *** AUTO GENERATED CODE *** AUTO GENERATED CODE *** +# +# ---------------------------------------------------------------------------- +# +# This file is automatically generated by Magic Modules and manual +# changes will be clobbered when the file is regenerated. +# +# Please read more about how to change this file at +# https://www.github.com/GoogleCloudPlatform/magic-modules +# +# ---------------------------------------------------------------------------- + +from __future__ import absolute_import, division, print_function +__metaclass__ = type + +################################################################################ +# Documentation +################################################################################ + +ANSIBLE_METADATA = {'metadata_version': '1.1', + 'status': ["preview"], + 'supported_by': 'community'} + +DOCUMENTATION = ''' +--- +module: gcp_pubsub_subscription_facts +description: + - Gather facts for GCP Subscription +short_description: Gather facts for GCP Subscription +version_added: 2.7 +author: Google Inc. (@googlecloudplatform) +requirements: + - python >= 2.6 + - requests >= 2.18.4 + - google-auth >= 1.3.0 +extends_documentation_fragment: gcp +''' + +EXAMPLES = ''' +- name: a subscription facts + gcp_pubsub_subscription_facts: + project: test_project + auth_kind: serviceaccount + service_account_file: "/tmp/auth.pem" +''' + +RETURN = ''' +items: + description: List of items + returned: always + type: complex + contains: + name: + description: + - Name of the subscription. + returned: success + type: str + topic: + description: + - A reference to a Topic resource. + returned: success + type: dict + push_config: + description: + - If push delivery is used with this subscription, this field is used to configure + it. An empty pushConfig signifies that the subscriber will pull and ack messages + using API methods. + returned: success + type: complex + contains: + push_endpoint: + description: + - A URL locating the endpoint to which messages should be pushed. + - For example, a Webhook endpoint might use "U(https://example.com/push".) + returned: success + type: str + ack_deadline_seconds: + description: + - This value is the maximum time after a subscriber receives a message before the + subscriber should acknowledge the message. After message delivery but before the + ack deadline expires and before the message is acknowledged, it is an outstanding + message and will not be delivered again during that time (on a best-effort basis). + - For pull subscriptions, this value is used as the initial value for the ack deadline. + To override this value for a given message, call subscriptions.modifyAckDeadline + with the corresponding ackId if using pull. The minimum custom deadline you can + specify is 10 seconds. The maximum custom deadline you can specify is 600 seconds + (10 minutes). + - If this parameter is 0, a default value of 10 seconds is used. + - For push delivery, this value is also used to set the request timeout for the call + to the push endpoint. + - If the subscriber never acknowledges the message, the Pub/Sub system will eventually + redeliver the message. + returned: success + type: int +''' + +################################################################################ +# Imports +################################################################################ +from ansible.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest +import json + +################################################################################ +# Main +################################################################################ + + +def main(): + module = GcpModule( + argument_spec=dict( + ) + ) + + if 'scopes' not in module.params: + module.params['scopes'] = ['https://www.googleapis.com/auth/pubsub'] + + items = fetch_list(module, collection(module)) + if items.get('subscriptions'): + items = items.get('subscriptions') + else: + items = [] + return_value = { + 'items': items + } + module.exit_json(**return_value) + + +def collection(module): + return "https://pubsub.googleapis.com/v1/projects/{project}/subscriptions".format(**module.params) + + +def fetch_list(module, link): + auth = GcpSession(module, 'pubsub') + response = auth.get(link) + return return_if_object(module, response) + + +def return_if_object(module, response): + # If not found, return nothing. + if response.status_code == 404: + return None + + # If no content, return nothing. + if response.status_code == 204: + return None + + try: + module.raise_for_status(response) + result = response.json() + except getattr(json.decoder, 'JSONDecodeError', ValueError) as inst: + module.fail_json(msg="Invalid JSON response with error: %s" % inst) + + if navigate_hash(result, ['error', 'errors']): + module.fail_json(msg=navigate_hash(result, ['error', 'errors'])) + + return result + + +if __name__ == "__main__": + main() diff --git a/lib/ansible/modules/cloud/google/gcp_pubsub_topic_facts.py b/lib/ansible/modules/cloud/google/gcp_pubsub_topic_facts.py new file mode 100644 index 00000000000000..a8363e3fb2bc7c --- /dev/null +++ b/lib/ansible/modules/cloud/google/gcp_pubsub_topic_facts.py @@ -0,0 +1,130 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# +# Copyright (C) 2017 Google +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) +# ---------------------------------------------------------------------------- +# +# *** AUTO GENERATED CODE *** AUTO GENERATED CODE *** +# +# ---------------------------------------------------------------------------- +# +# This file is automatically generated by Magic Modules and manual +# changes will be clobbered when the file is regenerated. +# +# Please read more about how to change this file at +# https://www.github.com/GoogleCloudPlatform/magic-modules +# +# ---------------------------------------------------------------------------- + +from __future__ import absolute_import, division, print_function +__metaclass__ = type + +################################################################################ +# Documentation +################################################################################ + +ANSIBLE_METADATA = {'metadata_version': '1.1', + 'status': ["preview"], + 'supported_by': 'community'} + +DOCUMENTATION = ''' +--- +module: gcp_pubsub_topic_facts +description: + - Gather facts for GCP Topic +short_description: Gather facts for GCP Topic +version_added: 2.7 +author: Google Inc. (@googlecloudplatform) +requirements: + - python >= 2.6 + - requests >= 2.18.4 + - google-auth >= 1.3.0 +extends_documentation_fragment: gcp +''' + +EXAMPLES = ''' +- name: a topic facts + gcp_pubsub_topic_facts: + project: test_project + auth_kind: serviceaccount + service_account_file: "/tmp/auth.pem" +''' + +RETURN = ''' +items: + description: List of items + returned: always + type: complex + contains: + name: + description: + - Name of the topic. + returned: success + type: str +''' + +################################################################################ +# Imports +################################################################################ +from ansible.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest +import json + +################################################################################ +# Main +################################################################################ + + +def main(): + module = GcpModule( + argument_spec=dict( + ) + ) + + if 'scopes' not in module.params: + module.params['scopes'] = ['https://www.googleapis.com/auth/pubsub'] + + items = fetch_list(module, collection(module)) + if items.get('topics'): + items = items.get('topics') + else: + items = [] + return_value = { + 'items': items + } + module.exit_json(**return_value) + + +def collection(module): + return "https://pubsub.googleapis.com/v1/projects/{project}/topics".format(**module.params) + + +def fetch_list(module, link): + auth = GcpSession(module, 'pubsub') + response = auth.get(link) + return return_if_object(module, response) + + +def return_if_object(module, response): + # If not found, return nothing. + if response.status_code == 404: + return None + + # If no content, return nothing. + if response.status_code == 204: + return None + + try: + module.raise_for_status(response) + result = response.json() + except getattr(json.decoder, 'JSONDecodeError', ValueError) as inst: + module.fail_json(msg="Invalid JSON response with error: %s" % inst) + + if navigate_hash(result, ['error', 'errors']): + module.fail_json(msg=navigate_hash(result, ['error', 'errors'])) + + return result + + +if __name__ == "__main__": + main() diff --git a/test/integration/targets/gcp_container_node_pool/tasks/main.yml b/test/integration/targets/gcp_container_node_pool/tasks/main.yml index 0d120990e43c3b..c3dfcbceff11a5 100644 --- a/test/integration/targets/gcp_container_node_pool/tasks/main.yml +++ b/test/integration/targets/gcp_container_node_pool/tasks/main.yml @@ -53,7 +53,7 @@ gcp_container_node_pool_facts: filters: - name = {{ resource_name }} - cluster: {{ cluster }} + cluster: "{{ cluster }}" zone: us-central1-a project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" @@ -101,7 +101,7 @@ gcp_container_node_pool_facts: filters: - name = {{ resource_name }} - cluster: {{ cluster }} + cluster: "{{ cluster }}" zone: us-central1-a project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" diff --git a/test/integration/targets/gcp_dns_managed_zone/tasks/main.yml b/test/integration/targets/gcp_dns_managed_zone/tasks/main.yml index e4ce07a36c10d3..ec4e4c250abcb7 100644 --- a/test/integration/targets/gcp_dns_managed_zone/tasks/main.yml +++ b/test/integration/targets/gcp_dns_managed_zone/tasks/main.yml @@ -39,13 +39,18 @@ - result.changed == true - "result.kind == 'dns#managedZone'" - name: verify that managed_zone was created - shell: | - gcloud dns managed-zones describe --project="{{ gcp_project }}" "{{ resource_name }}" + gcp_dns_managed_zone_facts: + dns_name: test.somewild2.example.com. + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + scopes: + - https://www.googleapis.com/auth/ndev.clouddns.readwrite register: results - name: verify that command succeeded assert: that: - - results.rc == 0 + - results['items'] | length == 1 # ---------------------------------------------------------------------------- - name: create a managed zone that already exists gcp_dns_managed_zone: @@ -79,15 +84,18 @@ - result.changed == true - result.has_key('kind') == False - name: verify that managed_zone was deleted - shell: | - gcloud dns managed-zones describe --project="{{ gcp_project }}" "{{ resource_name }}" + gcp_dns_managed_zone_facts: + dns_name: test.somewild2.example.com. + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + scopes: + - https://www.googleapis.com/auth/ndev.clouddns.readwrite register: results - failed_when: results.rc == 0 - name: verify that command succeeded assert: that: - - results.rc == 1 - - "\"{{ resource_name }} was not found.\" in results.stderr" + - results['items'] | length == 0 # ---------------------------------------------------------------------------- - name: delete a managed zone that does not exist gcp_dns_managed_zone: diff --git a/test/integration/targets/gcp_dns_resource_record_set/tasks/main.yml b/test/integration/targets/gcp_dns_resource_record_set/tasks/main.yml index b60b513c63d329..d9866d4f151de8 100644 --- a/test/integration/targets/gcp_dns_resource_record_set/tasks/main.yml +++ b/test/integration/targets/gcp_dns_resource_record_set/tasks/main.yml @@ -56,6 +56,19 @@ that: - result.changed == true - "result.kind == 'dns#resourceRecordSet'" +- name: verify that resource_record_set was created + gcp_dns_resource_record_set_facts: + managed_zone: "{{ managed_zone }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + scopes: + - https://www.googleapis.com/auth/ndev.clouddns.readwrite + register: results +- name: verify that command succeeded + assert: + that: + - results['items'] | length >= 2 # ---------------------------------------------------------------------------- - name: create a resource record set that already exists gcp_dns_resource_record_set: @@ -96,6 +109,19 @@ that: - result.changed == true - result.has_key('kind') == False +- name: verify that resource_record_set was deleted + gcp_dns_resource_record_set_facts: + managed_zone: "{{ managed_zone }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + scopes: + - https://www.googleapis.com/auth/ndev.clouddns.readwrite + register: results +- name: verify that command succeeded + assert: + that: + - results['items'] | length >= 2 # ---------------------------------------------------------------------------- - name: delete a resource record set that does not exist gcp_dns_resource_record_set: diff --git a/test/integration/targets/gcp_pubsub_subscription/tasks/main.yml b/test/integration/targets/gcp_pubsub_subscription/tasks/main.yml index 548bf63c556b27..6afc20203e7fac 100644 --- a/test/integration/targets/gcp_pubsub_subscription/tasks/main.yml +++ b/test/integration/targets/gcp_pubsub_subscription/tasks/main.yml @@ -50,13 +50,17 @@ that: - result.changed == true - name: verify that subscription was created - shell: | - gcloud beta pubsub subscriptions list --project="{{ gcp_project}}" | grep "{{ resource_name }}" | grep 'test-topic1' + gcp_pubsub_subscription_facts: + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + scopes: + - https://www.googleapis.com/auth/pubsub register: results - name: verify that command succeeded assert: that: - - results.rc == 0 + - results['items'] | length == 1 # ---------------------------------------------------------------------------- - name: create a subscription that already exists gcp_pubsub_subscription: @@ -92,15 +96,17 @@ that: - result.changed == true - name: verify that subscription was deleted - shell: | - gcloud beta pubsub subscriptions list --project="{{ gcp_project}}" | grep "{{ resource_name }}" | grep 'test-topic1' + gcp_pubsub_subscription_facts: + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + scopes: + - https://www.googleapis.com/auth/pubsub register: results - failed_when: results.rc == 0 - name: verify that command succeeded assert: that: - - results.rc == 1 - - "\"{{ resource_name }} was not found.\" in results.stderr" + - results['items'] | length == 0 # ---------------------------------------------------------------------------- - name: delete a subscription that does not exist gcp_pubsub_subscription: diff --git a/test/integration/targets/gcp_pubsub_topic/tasks/main.yml b/test/integration/targets/gcp_pubsub_topic/tasks/main.yml index b0c2903a51a600..8d1a0635c58173 100644 --- a/test/integration/targets/gcp_pubsub_topic/tasks/main.yml +++ b/test/integration/targets/gcp_pubsub_topic/tasks/main.yml @@ -34,13 +34,17 @@ that: - result.changed == true - name: verify that topic was created - shell: | - gcloud beta pubsub topics list --project="{{ gcp_project}}"| grep 'topic: projects/.*/test-topic1' + gcp_pubsub_topic_facts: + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + scopes: + - https://www.googleapis.com/auth/pubsub register: results - name: verify that command succeeded assert: that: - - results.rc == 0 + - results['items'] | length == 1 # ---------------------------------------------------------------------------- - name: create a topic that already exists gcp_pubsub_topic: @@ -68,15 +72,17 @@ that: - result.changed == true - name: verify that topic was deleted - shell: | - gcloud beta pubsub topics list --project="{{ gcp_project}}"| grep 'topic: projects/.*/test-topic1' + gcp_pubsub_topic_facts: + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + scopes: + - https://www.googleapis.com/auth/pubsub register: results - failed_when: results.rc == 0 - name: verify that command succeeded assert: that: - - results.rc == 1 - - "\"{{ resource_name }} was not found.\" in results.stderr" + - results['items'] | length == 0 # ---------------------------------------------------------------------------- - name: delete a topic that does not exist gcp_pubsub_topic: diff --git a/test/integration/targets/gcp_sql_user/tasks/main.yml b/test/integration/targets/gcp_sql_user/tasks/main.yml index 4cc772c7710d95..a481b394b7a0ae 100644 --- a/test/integration/targets/gcp_sql_user/tasks/main.yml +++ b/test/integration/targets/gcp_sql_user/tasks/main.yml @@ -59,7 +59,7 @@ gcp_sql_user_facts: filters: - name = test-user - instance: {{ instance }} + instance: "{{ instance }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" @@ -108,7 +108,7 @@ gcp_sql_user_facts: filters: - name = test-user - instance: {{ instance }} + instance: "{{ instance }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" From 6c32e1f2d0769da546c2bc6bf62dad605ced1e5b Mon Sep 17 00:00:00 2001 From: The Magician Date: Fri, 21 Sep 2018 13:27:34 -0700 Subject: [PATCH 034/144] return_if_object should only allow 404 on certain situations (#93) /cc @rambleraptor --- lib/ansible/modules/cloud/google/gcp_compute_address.py | 8 ++++---- .../modules/cloud/google/gcp_compute_backend_bucket.py | 8 ++++---- .../modules/cloud/google/gcp_compute_backend_service.py | 8 ++++---- lib/ansible/modules/cloud/google/gcp_compute_disk.py | 8 ++++---- lib/ansible/modules/cloud/google/gcp_compute_firewall.py | 8 ++++---- .../modules/cloud/google/gcp_compute_forwarding_rule.py | 8 ++++---- .../modules/cloud/google/gcp_compute_global_address.py | 8 ++++---- .../cloud/google/gcp_compute_global_forwarding_rule.py | 8 ++++---- .../modules/cloud/google/gcp_compute_health_check.py | 8 ++++---- .../modules/cloud/google/gcp_compute_http_health_check.py | 8 ++++---- .../cloud/google/gcp_compute_https_health_check.py | 8 ++++---- lib/ansible/modules/cloud/google/gcp_compute_image.py | 8 ++++---- lib/ansible/modules/cloud/google/gcp_compute_instance.py | 8 ++++---- .../modules/cloud/google/gcp_compute_instance_group.py | 8 ++++---- .../cloud/google/gcp_compute_instance_group_manager.py | 8 ++++---- .../modules/cloud/google/gcp_compute_instance_template.py | 8 ++++---- lib/ansible/modules/cloud/google/gcp_compute_network.py | 8 ++++---- lib/ansible/modules/cloud/google/gcp_compute_route.py | 8 ++++---- lib/ansible/modules/cloud/google/gcp_compute_router.py | 8 ++++---- .../modules/cloud/google/gcp_compute_ssl_certificate.py | 8 ++++---- .../modules/cloud/google/gcp_compute_ssl_policy.py | 8 ++++---- .../modules/cloud/google/gcp_compute_subnetwork.py | 8 ++++---- .../modules/cloud/google/gcp_compute_target_http_proxy.py | 8 ++++---- .../cloud/google/gcp_compute_target_https_proxy.py | 8 ++++---- .../modules/cloud/google/gcp_compute_target_pool.py | 8 ++++---- .../modules/cloud/google/gcp_compute_target_ssl_proxy.py | 8 ++++---- .../modules/cloud/google/gcp_compute_target_tcp_proxy.py | 8 ++++---- .../cloud/google/gcp_compute_target_vpn_gateway.py | 8 ++++---- lib/ansible/modules/cloud/google/gcp_compute_url_map.py | 8 ++++---- .../modules/cloud/google/gcp_compute_vpn_tunnel.py | 8 ++++---- lib/ansible/modules/cloud/google/gcp_container_cluster.py | 8 ++++---- .../modules/cloud/google/gcp_container_node_pool.py | 8 ++++---- lib/ansible/modules/cloud/google/gcp_dns_managed_zone.py | 8 ++++---- .../modules/cloud/google/gcp_dns_resource_record_set.py | 8 ++++---- .../modules/cloud/google/gcp_pubsub_subscription.py | 8 ++++---- lib/ansible/modules/cloud/google/gcp_pubsub_topic.py | 8 ++++---- lib/ansible/modules/cloud/google/gcp_spanner_database.py | 8 ++++---- lib/ansible/modules/cloud/google/gcp_spanner_instance.py | 8 ++++---- lib/ansible/modules/cloud/google/gcp_sql_database.py | 6 +++--- lib/ansible/modules/cloud/google/gcp_sql_instance.py | 6 +++--- lib/ansible/modules/cloud/google/gcp_sql_user.py | 6 +++--- lib/ansible/modules/cloud/google/gcp_storage_bucket.py | 8 ++++---- .../cloud/google/gcp_storage_bucket_access_control.py | 8 ++++---- 43 files changed, 169 insertions(+), 169 deletions(-) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_address.py b/lib/ansible/modules/cloud/google/gcp_compute_address.py index b442082a9c5d7f..15ba8757411fd2 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_address.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_address.py @@ -258,9 +258,9 @@ def resource_to_request(module): return return_vals -def fetch_resource(module, link, kind): +def fetch_resource(module, link, kind, allow_not_found=True): auth = GcpSession(module, 'compute') - return return_if_object(module, auth.get(link), kind) + return return_if_object(module, auth.get(link), kind, allow_not_found) def self_link(module): @@ -271,9 +271,9 @@ def collection(module): return "https://www.googleapis.com/compute/v1/projects/{project}/regions/{region}/addresses".format(**module.params) -def return_if_object(module, response, kind): +def return_if_object(module, response, kind, allow_not_found=False): # If not found, return nothing. - if response.status_code == 404: + if allow_not_found and response.status_code == 404: return None # If no content, return nothing. diff --git a/lib/ansible/modules/cloud/google/gcp_compute_backend_bucket.py b/lib/ansible/modules/cloud/google/gcp_compute_backend_bucket.py index a4c822094d298b..8f98bd6894a6e9 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_backend_bucket.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_backend_bucket.py @@ -227,9 +227,9 @@ def resource_to_request(module): return return_vals -def fetch_resource(module, link, kind): +def fetch_resource(module, link, kind, allow_not_found=True): auth = GcpSession(module, 'compute') - return return_if_object(module, auth.get(link), kind) + return return_if_object(module, auth.get(link), kind, allow_not_found) def self_link(module): @@ -240,9 +240,9 @@ def collection(module): return "https://www.googleapis.com/compute/v1/projects/{project}/global/backendBuckets".format(**module.params) -def return_if_object(module, response, kind): +def return_if_object(module, response, kind, allow_not_found=False): # If not found, return nothing. - if response.status_code == 404: + if allow_not_found and response.status_code == 404: return None # If no content, return nothing. diff --git a/lib/ansible/modules/cloud/google/gcp_compute_backend_service.py b/lib/ansible/modules/cloud/google/gcp_compute_backend_service.py index 7f46f4705317b5..257a6a46429512 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_backend_service.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_backend_service.py @@ -703,9 +703,9 @@ def resource_to_request(module): return return_vals -def fetch_resource(module, link, kind): +def fetch_resource(module, link, kind, allow_not_found=True): auth = GcpSession(module, 'compute') - return return_if_object(module, auth.get(link), kind) + return return_if_object(module, auth.get(link), kind, allow_not_found) def self_link(module): @@ -716,9 +716,9 @@ def collection(module): return "https://www.googleapis.com/compute/v1/projects/{project}/global/backendServices".format(**module.params) -def return_if_object(module, response, kind): +def return_if_object(module, response, kind, allow_not_found=False): # If not found, return nothing. - if response.status_code == 404: + if allow_not_found and response.status_code == 404: return None # If no content, return nothing. diff --git a/lib/ansible/modules/cloud/google/gcp_compute_disk.py b/lib/ansible/modules/cloud/google/gcp_compute_disk.py index 5ab9da55a13934..8816ed9844fa7c 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_disk.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_disk.py @@ -523,9 +523,9 @@ def resource_to_request(module): return return_vals -def fetch_resource(module, link, kind): +def fetch_resource(module, link, kind, allow_not_found=True): auth = GcpSession(module, 'compute') - return return_if_object(module, auth.get(link), kind) + return return_if_object(module, auth.get(link), kind, allow_not_found) def self_link(module): @@ -536,9 +536,9 @@ def collection(module): return "https://www.googleapis.com/compute/v1/projects/{project}/zones/{zone}/disks".format(**module.params) -def return_if_object(module, response, kind): +def return_if_object(module, response, kind, allow_not_found=False): # If not found, return nothing. - if response.status_code == 404: + if allow_not_found and response.status_code == 404: return None # If no content, return nothing. diff --git a/lib/ansible/modules/cloud/google/gcp_compute_firewall.py b/lib/ansible/modules/cloud/google/gcp_compute_firewall.py index 76ff0a3ac3d374..c128de9b4abafa 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_firewall.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_firewall.py @@ -485,9 +485,9 @@ def resource_to_request(module): return return_vals -def fetch_resource(module, link, kind): +def fetch_resource(module, link, kind, allow_not_found=True): auth = GcpSession(module, 'compute') - return return_if_object(module, auth.get(link), kind) + return return_if_object(module, auth.get(link), kind, allow_not_found) def self_link(module): @@ -498,9 +498,9 @@ def collection(module): return "https://www.googleapis.com/compute/v1/projects/{project}/global/firewalls".format(**module.params) -def return_if_object(module, response, kind): +def return_if_object(module, response, kind, allow_not_found=False): # If not found, return nothing. - if response.status_code == 404: + if allow_not_found and response.status_code == 404: return None # If no content, return nothing. diff --git a/lib/ansible/modules/cloud/google/gcp_compute_forwarding_rule.py b/lib/ansible/modules/cloud/google/gcp_compute_forwarding_rule.py index bab25c7b12f4f0..94978d047422f9 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_forwarding_rule.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_forwarding_rule.py @@ -481,9 +481,9 @@ def resource_to_request(module): return return_vals -def fetch_resource(module, link, kind): +def fetch_resource(module, link, kind, allow_not_found=True): auth = GcpSession(module, 'compute') - return return_if_object(module, auth.get(link), kind) + return return_if_object(module, auth.get(link), kind, allow_not_found) def self_link(module): @@ -494,9 +494,9 @@ def collection(module): return "https://www.googleapis.com/compute/v1/projects/{project}/regions/{region}/forwardingRules".format(**module.params) -def return_if_object(module, response, kind): +def return_if_object(module, response, kind, allow_not_found=False): # If not found, return nothing. - if response.status_code == 404: + if allow_not_found and response.status_code == 404: return None # If no content, return nothing. diff --git a/lib/ansible/modules/cloud/google/gcp_compute_global_address.py b/lib/ansible/modules/cloud/google/gcp_compute_global_address.py index 88f7adcf4b537f..dbe434f7ea4bc3 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_global_address.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_global_address.py @@ -238,9 +238,9 @@ def resource_to_request(module): return return_vals -def fetch_resource(module, link, kind): +def fetch_resource(module, link, kind, allow_not_found=True): auth = GcpSession(module, 'compute') - return return_if_object(module, auth.get(link), kind) + return return_if_object(module, auth.get(link), kind, allow_not_found) def self_link(module): @@ -251,9 +251,9 @@ def collection(module): return "https://www.googleapis.com/compute/v1/projects/{project}/global/addresses".format(**module.params) -def return_if_object(module, response, kind): +def return_if_object(module, response, kind, allow_not_found=False): # If not found, return nothing. - if response.status_code == 404: + if allow_not_found and response.status_code == 404: return None # If no content, return nothing. diff --git a/lib/ansible/modules/cloud/google/gcp_compute_global_forwarding_rule.py b/lib/ansible/modules/cloud/google/gcp_compute_global_forwarding_rule.py index 8158c40a0cdd2c..05fa393d52c182 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_global_forwarding_rule.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_global_forwarding_rule.py @@ -476,9 +476,9 @@ def resource_to_request(module): return return_vals -def fetch_resource(module, link, kind): +def fetch_resource(module, link, kind, allow_not_found=True): auth = GcpSession(module, 'compute') - return return_if_object(module, auth.get(link), kind) + return return_if_object(module, auth.get(link), kind, allow_not_found) def self_link(module): @@ -489,9 +489,9 @@ def collection(module): return "https://www.googleapis.com/compute/v1/projects/{project}/global/forwardingRules".format(**module.params) -def return_if_object(module, response, kind): +def return_if_object(module, response, kind, allow_not_found=False): # If not found, return nothing. - if response.status_code == 404: + if allow_not_found and response.status_code == 404: return None # If no content, return nothing. 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 0ac627d31f6f0f..47c3c23f1e47ab 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_health_check.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_health_check.py @@ -595,9 +595,9 @@ def resource_to_request(module): return return_vals -def fetch_resource(module, link, kind): +def fetch_resource(module, link, kind, allow_not_found=True): auth = GcpSession(module, 'compute') - return return_if_object(module, auth.get(link), kind) + return return_if_object(module, auth.get(link), kind, allow_not_found) def self_link(module): @@ -608,9 +608,9 @@ def collection(module): return "https://www.googleapis.com/compute/v1/projects/{project}/global/healthChecks".format(**module.params) -def return_if_object(module, response, kind): +def return_if_object(module, response, kind, allow_not_found=False): # If not found, return nothing. - if response.status_code == 404: + if allow_not_found and response.status_code == 404: return None # If no content, return nothing. diff --git a/lib/ansible/modules/cloud/google/gcp_compute_http_health_check.py b/lib/ansible/modules/cloud/google/gcp_compute_http_health_check.py index fc09c76974a377..de7f5361ea4793 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_http_health_check.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_http_health_check.py @@ -289,9 +289,9 @@ def resource_to_request(module): return return_vals -def fetch_resource(module, link, kind): +def fetch_resource(module, link, kind, allow_not_found=True): auth = GcpSession(module, 'compute') - return return_if_object(module, auth.get(link), kind) + return return_if_object(module, auth.get(link), kind, allow_not_found) def self_link(module): @@ -302,9 +302,9 @@ def collection(module): return "https://www.googleapis.com/compute/v1/projects/{project}/global/httpHealthChecks".format(**module.params) -def return_if_object(module, response, kind): +def return_if_object(module, response, kind, allow_not_found=False): # If not found, return nothing. - if response.status_code == 404: + if allow_not_found and response.status_code == 404: return None # If no content, return nothing. diff --git a/lib/ansible/modules/cloud/google/gcp_compute_https_health_check.py b/lib/ansible/modules/cloud/google/gcp_compute_https_health_check.py index a2bdfbc6fcc53f..8ee572ddd0d434 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_https_health_check.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_https_health_check.py @@ -287,9 +287,9 @@ def resource_to_request(module): return return_vals -def fetch_resource(module, link, kind): +def fetch_resource(module, link, kind, allow_not_found=True): auth = GcpSession(module, 'compute') - return return_if_object(module, auth.get(link), kind) + return return_if_object(module, auth.get(link), kind, allow_not_found) def self_link(module): @@ -300,9 +300,9 @@ def collection(module): return "https://www.googleapis.com/compute/v1/projects/{project}/global/httpsHealthChecks".format(**module.params) -def return_if_object(module, response, kind): +def return_if_object(module, response, kind, allow_not_found=False): # If not found, return nothing. - if response.status_code == 404: + if allow_not_found and response.status_code == 404: return None # If no content, return nothing. diff --git a/lib/ansible/modules/cloud/google/gcp_compute_image.py b/lib/ansible/modules/cloud/google/gcp_compute_image.py index 13e54c2f0ab1dc..8eb3b1507ee13e 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_image.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_image.py @@ -515,9 +515,9 @@ def resource_to_request(module): return return_vals -def fetch_resource(module, link, kind): +def fetch_resource(module, link, kind, allow_not_found=True): auth = GcpSession(module, 'compute') - return return_if_object(module, auth.get(link), kind) + return return_if_object(module, auth.get(link), kind, allow_not_found) def self_link(module): @@ -528,9 +528,9 @@ def collection(module): return "https://www.googleapis.com/compute/v1/projects/{project}/global/images".format(**module.params) -def return_if_object(module, response, kind): +def return_if_object(module, response, kind, allow_not_found=False): # If not found, return nothing. - if response.status_code == 404: + if allow_not_found and response.status_code == 404: return None # If no content, return nothing. diff --git a/lib/ansible/modules/cloud/google/gcp_compute_instance.py b/lib/ansible/modules/cloud/google/gcp_compute_instance.py index 4588a55ed2a908..8978f8827a113d 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_instance.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_instance.py @@ -969,9 +969,9 @@ def resource_to_request(module): return return_vals -def fetch_resource(module, link, kind): +def fetch_resource(module, link, kind, allow_not_found=True): auth = GcpSession(module, 'compute') - return return_if_object(module, auth.get(link), kind) + return return_if_object(module, auth.get(link), kind, allow_not_found) def self_link(module): @@ -982,9 +982,9 @@ def collection(module): return "https://www.googleapis.com/compute/v1/projects/{project}/zones/{zone}/instances".format(**module.params) -def return_if_object(module, response, kind): +def return_if_object(module, response, kind, allow_not_found=False): # If not found, return nothing. - if response.status_code == 404: + if allow_not_found and response.status_code == 404: return None # If no content, return nothing. diff --git a/lib/ansible/modules/cloud/google/gcp_compute_instance_group.py b/lib/ansible/modules/cloud/google/gcp_compute_instance_group.py index 882c947c0b6e49..621045b2dbee52 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_instance_group.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_instance_group.py @@ -307,9 +307,9 @@ def resource_to_request(module): return return_vals -def fetch_resource(module, link, kind): +def fetch_resource(module, link, kind, allow_not_found=True): auth = GcpSession(module, 'compute') - return return_if_object(module, auth.get(link), kind) + return return_if_object(module, auth.get(link), kind, allow_not_found) def self_link(module): @@ -320,9 +320,9 @@ def collection(module): return "https://www.googleapis.com/compute/v1/projects/{project}/zones/{zone}/instanceGroups".format(**module.params) -def return_if_object(module, response, kind): +def return_if_object(module, response, kind, allow_not_found=False): # If not found, return nothing. - if response.status_code == 404: + if allow_not_found and response.status_code == 404: return None # If no content, return nothing. diff --git a/lib/ansible/modules/cloud/google/gcp_compute_instance_group_manager.py b/lib/ansible/modules/cloud/google/gcp_compute_instance_group_manager.py index 29555e842e1e75..abe584512ef062 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_instance_group_manager.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_instance_group_manager.py @@ -407,9 +407,9 @@ def resource_to_request(module): return return_vals -def fetch_resource(module, link, kind): +def fetch_resource(module, link, kind, allow_not_found=True): auth = GcpSession(module, 'compute') - return return_if_object(module, auth.get(link), kind) + return return_if_object(module, auth.get(link), kind, allow_not_found) def self_link(module): @@ -420,9 +420,9 @@ def collection(module): return "https://www.googleapis.com/compute/v1/projects/{project}/zones/{zone}/instanceGroupManagers".format(**module.params) -def return_if_object(module, response, kind): +def return_if_object(module, response, kind, allow_not_found=False): # If not found, return nothing. - if response.status_code == 404: + if allow_not_found and response.status_code == 404: return None # If no content, return nothing. diff --git a/lib/ansible/modules/cloud/google/gcp_compute_instance_template.py b/lib/ansible/modules/cloud/google/gcp_compute_instance_template.py index 11fc872452b8e9..42f26997c95d0a 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_instance_template.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_instance_template.py @@ -932,9 +932,9 @@ def resource_to_request(module): return return_vals -def fetch_resource(module, link, kind): +def fetch_resource(module, link, kind, allow_not_found=True): auth = GcpSession(module, 'compute') - return return_if_object(module, auth.get(link), kind) + return return_if_object(module, auth.get(link), kind, allow_not_found) def self_link(module): @@ -945,9 +945,9 @@ def collection(module): return "https://www.googleapis.com/compute/v1/projects/{project}/global/instanceTemplates".format(**module.params) -def return_if_object(module, response, kind): +def return_if_object(module, response, kind, allow_not_found=False): # If not found, return nothing. - if response.status_code == 404: + if allow_not_found and response.status_code == 404: return None # If no content, return nothing. diff --git a/lib/ansible/modules/cloud/google/gcp_compute_network.py b/lib/ansible/modules/cloud/google/gcp_compute_network.py index e4092713f9fc0b..4ed2e2cab53b79 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_network.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_network.py @@ -250,9 +250,9 @@ def resource_to_request(module): return return_vals -def fetch_resource(module, link, kind): +def fetch_resource(module, link, kind, allow_not_found=True): auth = GcpSession(module, 'compute') - return return_if_object(module, auth.get(link), kind) + return return_if_object(module, auth.get(link), kind, allow_not_found) def self_link(module): @@ -263,9 +263,9 @@ def collection(module): return "https://www.googleapis.com/compute/v1/projects/{project}/global/networks".format(**module.params) -def return_if_object(module, response, kind): +def return_if_object(module, response, kind, allow_not_found=False): # If not found, return nothing. - if response.status_code == 404: + if allow_not_found and response.status_code == 404: return None # If no content, return nothing. diff --git a/lib/ansible/modules/cloud/google/gcp_compute_route.py b/lib/ansible/modules/cloud/google/gcp_compute_route.py index 95db3f8c8bb6ad..b4102eb977df71 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_route.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_route.py @@ -325,9 +325,9 @@ def resource_to_request(module): return return_vals -def fetch_resource(module, link, kind): +def fetch_resource(module, link, kind, allow_not_found=True): auth = GcpSession(module, 'compute') - return return_if_object(module, auth.get(link), kind) + return return_if_object(module, auth.get(link), kind, allow_not_found) def self_link(module): @@ -338,9 +338,9 @@ def collection(module): return "https://www.googleapis.com/compute/v1/projects/{project}/global/routes".format(**module.params) -def return_if_object(module, response, kind): +def return_if_object(module, response, kind, allow_not_found=False): # If not found, return nothing. - if response.status_code == 404: + if allow_not_found and response.status_code == 404: return None # If no content, return nothing. diff --git a/lib/ansible/modules/cloud/google/gcp_compute_router.py b/lib/ansible/modules/cloud/google/gcp_compute_router.py index 4dde20a2991839..e1f945310f8231 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_router.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_router.py @@ -324,9 +324,9 @@ def resource_to_request(module): return return_vals -def fetch_resource(module, link, kind): +def fetch_resource(module, link, kind, allow_not_found=True): auth = GcpSession(module, 'compute') - return return_if_object(module, auth.get(link), kind) + return return_if_object(module, auth.get(link), kind, allow_not_found) def self_link(module): @@ -337,9 +337,9 @@ def collection(module): return "https://www.googleapis.com/compute/v1/projects/{project}/regions/{region}/routers".format(**module.params) -def return_if_object(module, response, kind): +def return_if_object(module, response, kind, allow_not_found=False): # If not found, return nothing. - if response.status_code == 404: + if allow_not_found and response.status_code == 404: return None # If no content, return nothing. diff --git a/lib/ansible/modules/cloud/google/gcp_compute_ssl_certificate.py b/lib/ansible/modules/cloud/google/gcp_compute_ssl_certificate.py index b4267dc6f3c2f4..612d20ceaa532a 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_ssl_certificate.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_ssl_certificate.py @@ -238,9 +238,9 @@ def resource_to_request(module): return return_vals -def fetch_resource(module, link, kind): +def fetch_resource(module, link, kind, allow_not_found=True): auth = GcpSession(module, 'compute') - return return_if_object(module, auth.get(link), kind) + return return_if_object(module, auth.get(link), kind, allow_not_found) def self_link(module): @@ -251,9 +251,9 @@ def collection(module): return "https://www.googleapis.com/compute/v1/projects/{project}/global/sslCertificates".format(**module.params) -def return_if_object(module, response, kind): +def return_if_object(module, response, kind, allow_not_found=False): # If not found, return nothing. - if response.status_code == 404: + if allow_not_found and response.status_code == 404: return None # If no content, return nothing. diff --git a/lib/ansible/modules/cloud/google/gcp_compute_ssl_policy.py b/lib/ansible/modules/cloud/google/gcp_compute_ssl_policy.py index ebe3a01b916166..4726228965ca65 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_ssl_policy.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_ssl_policy.py @@ -267,9 +267,9 @@ def resource_to_request(module): return return_vals -def fetch_resource(module, link, kind): +def fetch_resource(module, link, kind, allow_not_found=True): auth = GcpSession(module, 'compute') - return return_if_object(module, auth.get(link), kind) + return return_if_object(module, auth.get(link), kind, allow_not_found) def self_link(module): @@ -280,9 +280,9 @@ def collection(module): return "https://www.googleapis.com/compute/v1/projects/{project}/global/sslPolicies".format(**module.params) -def return_if_object(module, response, kind): +def return_if_object(module, response, kind, allow_not_found=False): # If not found, return nothing. - if response.status_code == 404: + if allow_not_found and response.status_code == 404: return None # If no content, return nothing. diff --git a/lib/ansible/modules/cloud/google/gcp_compute_subnetwork.py b/lib/ansible/modules/cloud/google/gcp_compute_subnetwork.py index 82f7c272336989..d2fe01110c72b2 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_subnetwork.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_subnetwork.py @@ -313,9 +313,9 @@ def resource_to_request(module): return return_vals -def fetch_resource(module, link, kind): +def fetch_resource(module, link, kind, allow_not_found=True): auth = GcpSession(module, 'compute') - return return_if_object(module, auth.get(link), kind) + return return_if_object(module, auth.get(link), kind, allow_not_found) def self_link(module): @@ -326,9 +326,9 @@ def collection(module): return "https://www.googleapis.com/compute/v1/projects/{project}/regions/{region}/subnetworks".format(**module.params) -def return_if_object(module, response, kind): +def return_if_object(module, response, kind, allow_not_found=False): # If not found, return nothing. - if response.status_code == 404: + if allow_not_found and response.status_code == 404: return None # If no content, return nothing. diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_http_proxy.py b/lib/ansible/modules/cloud/google/gcp_compute_target_http_proxy.py index a2dd5b3d6199f9..5bd7524b15b85b 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_http_proxy.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_http_proxy.py @@ -265,9 +265,9 @@ def resource_to_request(module): return return_vals -def fetch_resource(module, link, kind): +def fetch_resource(module, link, kind, allow_not_found=True): auth = GcpSession(module, 'compute') - return return_if_object(module, auth.get(link), kind) + return return_if_object(module, auth.get(link), kind, allow_not_found) def self_link(module): @@ -278,9 +278,9 @@ def collection(module): return "https://www.googleapis.com/compute/v1/projects/{project}/global/targetHttpProxies".format(**module.params) -def return_if_object(module, response, kind): +def return_if_object(module, response, kind, allow_not_found=False): # If not found, return nothing. - if response.status_code == 404: + if allow_not_found and response.status_code == 404: return None # If no content, return nothing. diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_https_proxy.py b/lib/ansible/modules/cloud/google/gcp_compute_target_https_proxy.py index 926e7de3568cef..568fafa83c25c4 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_https_proxy.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_https_proxy.py @@ -365,9 +365,9 @@ def resource_to_request(module): return return_vals -def fetch_resource(module, link, kind): +def fetch_resource(module, link, kind, allow_not_found=True): auth = GcpSession(module, 'compute') - return return_if_object(module, auth.get(link), kind) + return return_if_object(module, auth.get(link), kind, allow_not_found) def self_link(module): @@ -378,9 +378,9 @@ def collection(module): return "https://www.googleapis.com/compute/v1/projects/{project}/global/targetHttpsProxies".format(**module.params) -def return_if_object(module, response, kind): +def return_if_object(module, response, kind, allow_not_found=False): # If not found, return nothing. - if response.status_code == 404: + if allow_not_found and response.status_code == 404: return None # If no content, return nothing. diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_pool.py b/lib/ansible/modules/cloud/google/gcp_compute_target_pool.py index 171a39485db75d..9a1c608f8e6459 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_pool.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_pool.py @@ -312,9 +312,9 @@ def resource_to_request(module): return return_vals -def fetch_resource(module, link, kind): +def fetch_resource(module, link, kind, allow_not_found=True): auth = GcpSession(module, 'compute') - return return_if_object(module, auth.get(link), kind) + return return_if_object(module, auth.get(link), kind, allow_not_found) def self_link(module): @@ -325,9 +325,9 @@ def collection(module): return "https://www.googleapis.com/compute/v1/projects/{project}/regions/{region}/targetPools".format(**module.params) -def return_if_object(module, response, kind): +def return_if_object(module, response, kind, allow_not_found=False): # If not found, return nothing. - if response.status_code == 404: + if allow_not_found and response.status_code == 404: return None # If no content, return nothing. diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_ssl_proxy.py b/lib/ansible/modules/cloud/google/gcp_compute_target_ssl_proxy.py index 5edd255e37078a..a8db3628205940 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_ssl_proxy.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_ssl_proxy.py @@ -352,9 +352,9 @@ def resource_to_request(module): return return_vals -def fetch_resource(module, link, kind): +def fetch_resource(module, link, kind, allow_not_found=True): auth = GcpSession(module, 'compute') - return return_if_object(module, auth.get(link), kind) + return return_if_object(module, auth.get(link), kind, allow_not_found) def self_link(module): @@ -365,9 +365,9 @@ def collection(module): return "https://www.googleapis.com/compute/v1/projects/{project}/global/targetSslProxies".format(**module.params) -def return_if_object(module, response, kind): +def return_if_object(module, response, kind, allow_not_found=False): # If not found, return nothing. - if response.status_code == 404: + if allow_not_found and response.status_code == 404: return None # If no content, return nothing. diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_tcp_proxy.py b/lib/ansible/modules/cloud/google/gcp_compute_target_tcp_proxy.py index 0161e24cf9311d..05f1580bfc8b5c 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_tcp_proxy.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_tcp_proxy.py @@ -289,9 +289,9 @@ def resource_to_request(module): return return_vals -def fetch_resource(module, link, kind): +def fetch_resource(module, link, kind, allow_not_found=True): auth = GcpSession(module, 'compute') - return return_if_object(module, auth.get(link), kind) + return return_if_object(module, auth.get(link), kind, allow_not_found) def self_link(module): @@ -302,9 +302,9 @@ def collection(module): return "https://www.googleapis.com/compute/v1/projects/{project}/global/targetTcpProxies".format(**module.params) -def return_if_object(module, response, kind): +def return_if_object(module, response, kind, allow_not_found=False): # If not found, return nothing. - if response.status_code == 404: + if allow_not_found and response.status_code == 404: return None # If no content, return nothing. diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_vpn_gateway.py b/lib/ansible/modules/cloud/google/gcp_compute_target_vpn_gateway.py index c065c2cce325db..89a02ea61e8c84 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_vpn_gateway.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_vpn_gateway.py @@ -237,9 +237,9 @@ def resource_to_request(module): return return_vals -def fetch_resource(module, link, kind): +def fetch_resource(module, link, kind, allow_not_found=True): auth = GcpSession(module, 'compute') - return return_if_object(module, auth.get(link), kind) + return return_if_object(module, auth.get(link), kind, allow_not_found) def self_link(module): @@ -250,9 +250,9 @@ def collection(module): return "https://www.googleapis.com/compute/v1/projects/{project}/regions/{region}/targetVpnGateways".format(**module.params) -def return_if_object(module, response, kind): +def return_if_object(module, response, kind, allow_not_found=False): # If not found, return nothing. - if response.status_code == 404: + if allow_not_found and response.status_code == 404: return None # If no content, return nothing. diff --git a/lib/ansible/modules/cloud/google/gcp_compute_url_map.py b/lib/ansible/modules/cloud/google/gcp_compute_url_map.py index a109044d323409..de594bf50bd66d 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_url_map.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_url_map.py @@ -426,9 +426,9 @@ def resource_to_request(module): return return_vals -def fetch_resource(module, link, kind): +def fetch_resource(module, link, kind, allow_not_found=True): auth = GcpSession(module, 'compute') - return return_if_object(module, auth.get(link), kind) + return return_if_object(module, auth.get(link), kind, allow_not_found) def self_link(module): @@ -439,9 +439,9 @@ def collection(module): return "https://www.googleapis.com/compute/v1/projects/{project}/global/urlMaps".format(**module.params) -def return_if_object(module, response, kind): +def return_if_object(module, response, kind, allow_not_found=False): # If not found, return nothing. - if response.status_code == 404: + if allow_not_found and response.status_code == 404: return None # If no content, return nothing. diff --git a/lib/ansible/modules/cloud/google/gcp_compute_vpn_tunnel.py b/lib/ansible/modules/cloud/google/gcp_compute_vpn_tunnel.py index f40b50480c3871..2308285aafe0fe 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_vpn_tunnel.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_vpn_tunnel.py @@ -370,9 +370,9 @@ def resource_to_request(module): return return_vals -def fetch_resource(module, link, kind): +def fetch_resource(module, link, kind, allow_not_found=True): auth = GcpSession(module, 'compute') - return return_if_object(module, auth.get(link), kind) + return return_if_object(module, auth.get(link), kind, allow_not_found) def self_link(module): @@ -383,9 +383,9 @@ def collection(module): return "https://www.googleapis.com/compute/v1/projects/{project}/regions/{region}/vpnTunnels".format(**module.params) -def return_if_object(module, response, kind): +def return_if_object(module, response, kind, allow_not_found=False): # If not found, return nothing. - if response.status_code == 404: + if allow_not_found and response.status_code == 404: return None # If no content, return nothing. diff --git a/lib/ansible/modules/cloud/google/gcp_container_cluster.py b/lib/ansible/modules/cloud/google/gcp_container_cluster.py index 3baf720f82eed2..e8fde7a8e71f3e 100644 --- a/lib/ansible/modules/cloud/google/gcp_container_cluster.py +++ b/lib/ansible/modules/cloud/google/gcp_container_cluster.py @@ -689,9 +689,9 @@ def resource_to_request(module): return return_vals -def fetch_resource(module, link): +def fetch_resource(module, link, allow_not_found=True): auth = GcpSession(module, 'container') - return return_if_object(module, auth.get(link)) + return return_if_object(module, auth.get(link), allow_not_found) def self_link(module): @@ -702,9 +702,9 @@ def collection(module): return "https://container.googleapis.com/v1/projects/{project}/zones/{zone}/clusters".format(**module.params) -def return_if_object(module, response): +def return_if_object(module, response, allow_not_found=False): # If not found, return nothing. - if response.status_code == 404: + if allow_not_found and response.status_code == 404: return None # If no content, return nothing. diff --git a/lib/ansible/modules/cloud/google/gcp_container_node_pool.py b/lib/ansible/modules/cloud/google/gcp_container_node_pool.py index 17ebbedc1b1919..7358b10b7bed32 100644 --- a/lib/ansible/modules/cloud/google/gcp_container_node_pool.py +++ b/lib/ansible/modules/cloud/google/gcp_container_node_pool.py @@ -524,9 +524,9 @@ def resource_to_request(module): return return_vals -def fetch_resource(module, link): +def fetch_resource(module, link, allow_not_found=True): auth = GcpSession(module, 'container') - return return_if_object(module, auth.get(link)) + return return_if_object(module, auth.get(link), allow_not_found) def self_link(module): @@ -548,9 +548,9 @@ def collection(module): return "https://container.googleapis.com/v1/projects/{project}/zones/{zone}/clusters/{cluster}/nodePools".format(**res) -def return_if_object(module, response): +def return_if_object(module, response, allow_not_found=False): # If not found, return nothing. - if response.status_code == 404: + if allow_not_found and response.status_code == 404: return None # If no content, return nothing. diff --git a/lib/ansible/modules/cloud/google/gcp_dns_managed_zone.py b/lib/ansible/modules/cloud/google/gcp_dns_managed_zone.py index 9d0a12981408be..df606e69196ed5 100644 --- a/lib/ansible/modules/cloud/google/gcp_dns_managed_zone.py +++ b/lib/ansible/modules/cloud/google/gcp_dns_managed_zone.py @@ -211,9 +211,9 @@ def resource_to_request(module): return return_vals -def fetch_resource(module, link, kind): +def fetch_resource(module, link, kind, allow_not_found=True): auth = GcpSession(module, 'dns') - return return_if_object(module, auth.get(link), kind) + return return_if_object(module, auth.get(link), kind, allow_not_found) def self_link(module): @@ -224,9 +224,9 @@ def collection(module): return "https://www.googleapis.com/dns/v1/projects/{project}/managedZones".format(**module.params) -def return_if_object(module, response, kind): +def return_if_object(module, response, kind, allow_not_found=False): # If not found, return nothing. - if response.status_code == 404: + if allow_not_found and response.status_code == 404: return None # If no content, return nothing. diff --git a/lib/ansible/modules/cloud/google/gcp_dns_resource_record_set.py b/lib/ansible/modules/cloud/google/gcp_dns_resource_record_set.py index aae7f8a263ee1a..85851f763f502f 100644 --- a/lib/ansible/modules/cloud/google/gcp_dns_resource_record_set.py +++ b/lib/ansible/modules/cloud/google/gcp_dns_resource_record_set.py @@ -238,9 +238,9 @@ def resource_to_request(module): return return_vals -def fetch_resource(module, link, kind): +def fetch_resource(module, link, kind, allow_not_found=True): auth = GcpSession(module, 'dns') - return return_if_object(module, auth.get(link), kind) + return return_if_object(module, auth.get(link), kind, allow_not_found) def fetch_wrapped_resource(module, kind, wrap_kind, wrap_path): @@ -277,9 +277,9 @@ def collection(module, extra_url=''): return "https://www.googleapis.com/dns/v1/projects/{project}/managedZones/{managed_zone}/changes".format(**res) + extra_url -def return_if_object(module, response, kind): +def return_if_object(module, response, kind, allow_not_found=False): # If not found, return nothing. - if response.status_code == 404: + if allow_not_found and response.status_code == 404: return None # If no content, return nothing. diff --git a/lib/ansible/modules/cloud/google/gcp_pubsub_subscription.py b/lib/ansible/modules/cloud/google/gcp_pubsub_subscription.py index cde8dff25d487a..50d1b735a59703 100644 --- a/lib/ansible/modules/cloud/google/gcp_pubsub_subscription.py +++ b/lib/ansible/modules/cloud/google/gcp_pubsub_subscription.py @@ -241,9 +241,9 @@ def resource_to_request(module): return return_vals -def fetch_resource(module, link): +def fetch_resource(module, link, allow_not_found=True): auth = GcpSession(module, 'pubsub') - return return_if_object(module, auth.get(link)) + return return_if_object(module, auth.get(link), allow_not_found) def self_link(module): @@ -254,9 +254,9 @@ def collection(module): return "https://pubsub.googleapis.com/v1/projects/{project}/subscriptions".format(**module.params) -def return_if_object(module, response): +def return_if_object(module, response, allow_not_found=False): # If not found, return nothing. - if response.status_code == 404: + if allow_not_found and response.status_code == 404: return None # If no content, return nothing. diff --git a/lib/ansible/modules/cloud/google/gcp_pubsub_topic.py b/lib/ansible/modules/cloud/google/gcp_pubsub_topic.py index 0b1b468f64335f..b715f89c4583a4 100644 --- a/lib/ansible/modules/cloud/google/gcp_pubsub_topic.py +++ b/lib/ansible/modules/cloud/google/gcp_pubsub_topic.py @@ -150,9 +150,9 @@ def resource_to_request(module): return return_vals -def fetch_resource(module, link): +def fetch_resource(module, link, allow_not_found=True): auth = GcpSession(module, 'pubsub') - return return_if_object(module, auth.get(link)) + return return_if_object(module, auth.get(link), allow_not_found) def self_link(module): @@ -163,9 +163,9 @@ def collection(module): return "https://pubsub.googleapis.com/v1/projects/{project}/topics".format(**module.params) -def return_if_object(module, response): +def return_if_object(module, response, allow_not_found=False): # If not found, return nothing. - if response.status_code == 404: + if allow_not_found and response.status_code == 404: return None # If no content, return nothing. diff --git a/lib/ansible/modules/cloud/google/gcp_spanner_database.py b/lib/ansible/modules/cloud/google/gcp_spanner_database.py index bbb37d2020f0c1..fbfb6fff70d5f7 100644 --- a/lib/ansible/modules/cloud/google/gcp_spanner_database.py +++ b/lib/ansible/modules/cloud/google/gcp_spanner_database.py @@ -194,9 +194,9 @@ def resource_to_request(module): return return_vals -def fetch_resource(module, link): +def fetch_resource(module, link, allow_not_found=True): auth = GcpSession(module, 'spanner') - return return_if_object(module, auth.get(link)) + return return_if_object(module, auth.get(link), allow_not_found) def self_link(module): @@ -216,9 +216,9 @@ def collection(module): return "https://spanner.googleapis.com/v1/projects/{project}/instances/{instance}/databases".format(**res) -def return_if_object(module, response): +def return_if_object(module, response, allow_not_found=False): # If not found, return nothing. - if response.status_code == 404: + if allow_not_found and response.status_code == 404: return None # If no content, return nothing. diff --git a/lib/ansible/modules/cloud/google/gcp_spanner_instance.py b/lib/ansible/modules/cloud/google/gcp_spanner_instance.py index d91a6e0103d18c..55b26f805baa53 100644 --- a/lib/ansible/modules/cloud/google/gcp_spanner_instance.py +++ b/lib/ansible/modules/cloud/google/gcp_spanner_instance.py @@ -238,9 +238,9 @@ def resource_to_request(module): return return_vals -def fetch_resource(module, link): +def fetch_resource(module, link, allow_not_found=True): auth = GcpSession(module, 'spanner') - return return_if_object(module, auth.get(link)) + return return_if_object(module, auth.get(link), allow_not_found) def self_link(module): @@ -251,9 +251,9 @@ def collection(module): return "https://spanner.googleapis.com/v1/projects/{project}/instances".format(**module.params) -def return_if_object(module, response): +def return_if_object(module, response, allow_not_found=False): # If not found, return nothing. - if response.status_code == 404: + if allow_not_found and response.status_code == 404: return None # If no content, return nothing. diff --git a/lib/ansible/modules/cloud/google/gcp_sql_database.py b/lib/ansible/modules/cloud/google/gcp_sql_database.py index b8a9f3c9de9686..fd6987c93ef1d6 100644 --- a/lib/ansible/modules/cloud/google/gcp_sql_database.py +++ b/lib/ansible/modules/cloud/google/gcp_sql_database.py @@ -204,9 +204,9 @@ def resource_to_request(module): return return_vals -def fetch_resource(module, link, kind): +def fetch_resource(module, link, kind, allow_not_found=True): auth = GcpSession(module, 'sql') - return return_if_object(module, auth.get(link), kind) + return return_if_object(module, auth.get(link), kind, allow_not_found) def self_link(module): @@ -226,7 +226,7 @@ def collection(module): return "https://www.googleapis.com/sql/v1beta4/projects/{project}/instances/{instance}/databases".format(**res) -def return_if_object(module, response, kind): +def return_if_object(module, response, kind, allow_not_found=False): # If not found, return nothing. if response.status_code == 404: return None diff --git a/lib/ansible/modules/cloud/google/gcp_sql_instance.py b/lib/ansible/modules/cloud/google/gcp_sql_instance.py index 765df28baedd7e..2db17c7bd2daa0 100644 --- a/lib/ansible/modules/cloud/google/gcp_sql_instance.py +++ b/lib/ansible/modules/cloud/google/gcp_sql_instance.py @@ -666,9 +666,9 @@ def resource_to_request(module): return return_vals -def fetch_resource(module, link, kind): +def fetch_resource(module, link, kind, allow_not_found=True): auth = GcpSession(module, 'sql') - return return_if_object(module, auth.get(link), kind) + return return_if_object(module, auth.get(link), kind, allow_not_found) def self_link(module): @@ -679,7 +679,7 @@ def collection(module): return "https://www.googleapis.com/sql/v1beta4/projects/{project}/instances".format(**module.params) -def return_if_object(module, response, kind): +def return_if_object(module, response, kind, allow_not_found=False): # If not found, return nothing. if response.status_code == 404: return None diff --git a/lib/ansible/modules/cloud/google/gcp_sql_user.py b/lib/ansible/modules/cloud/google/gcp_sql_user.py index e94b531e22fd1c..32d39fc630a563 100644 --- a/lib/ansible/modules/cloud/google/gcp_sql_user.py +++ b/lib/ansible/modules/cloud/google/gcp_sql_user.py @@ -231,9 +231,9 @@ def unwrap_resource(result, module): return None -def fetch_resource(module, link, kind): +def fetch_resource(module, link, kind, allow_not_found=True): auth = GcpSession(module, 'sql') - return return_if_object(module, auth.get(link), kind) + return return_if_object(module, auth.get(link), kind, allow_not_found) def fetch_wrapped_resource(module, kind, wrap_kind, wrap_path): @@ -270,7 +270,7 @@ def collection(module): return "https://www.googleapis.com/sql/v1beta4/projects/{project}/instances/{instance}/users".format(**res) -def return_if_object(module, response, kind): +def return_if_object(module, response, kind, allow_not_found=False): # If not found, return nothing. if response.status_code == 404: return None diff --git a/lib/ansible/modules/cloud/google/gcp_storage_bucket.py b/lib/ansible/modules/cloud/google/gcp_storage_bucket.py index 459396afe2b5f7..0014dcae63bd1b 100644 --- a/lib/ansible/modules/cloud/google/gcp_storage_bucket.py +++ b/lib/ansible/modules/cloud/google/gcp_storage_bucket.py @@ -899,9 +899,9 @@ def resource_to_request(module): return return_vals -def fetch_resource(module, link, kind): +def fetch_resource(module, link, kind, allow_not_found=True): auth = GcpSession(module, 'storage') - return return_if_object(module, auth.get(link), kind) + return return_if_object(module, auth.get(link), kind, allow_not_found) def self_link(module): @@ -912,9 +912,9 @@ def collection(module): return "https://www.googleapis.com/storage/v1/b?project={project}".format(**module.params) -def return_if_object(module, response, kind): +def return_if_object(module, response, kind, allow_not_found=False): # If not found, return nothing. - if response.status_code == 404: + if allow_not_found and response.status_code == 404: return None # If no content, return nothing. diff --git a/lib/ansible/modules/cloud/google/gcp_storage_bucket_access_control.py b/lib/ansible/modules/cloud/google/gcp_storage_bucket_access_control.py index d6ce92cf70c3fe..cf46384356ab0a 100644 --- a/lib/ansible/modules/cloud/google/gcp_storage_bucket_access_control.py +++ b/lib/ansible/modules/cloud/google/gcp_storage_bucket_access_control.py @@ -267,9 +267,9 @@ def resource_to_request(module): return return_vals -def fetch_resource(module, link, kind): +def fetch_resource(module, link, kind, allow_not_found=True): auth = GcpSession(module, 'storage') - return return_if_object(module, auth.get(link), kind) + return return_if_object(module, auth.get(link), kind, allow_not_found) def self_link(module): @@ -280,9 +280,9 @@ def collection(module): return "https://www.googleapis.com/storage/v1/b/{bucket}/acl".format(**module.params) -def return_if_object(module, response, kind): +def return_if_object(module, response, kind, allow_not_found=False): # If not found, return nothing. - if response.status_code == 404: + if allow_not_found and response.status_code == 404: return None # If no content, return nothing. From cbffb787a29076b964d747c1c48546664ad53fc3 Mon Sep 17 00:00:00 2001 From: The Magician Date: Fri, 21 Sep 2018 13:34:13 -0700 Subject: [PATCH 035/144] Return values should be camelcase instead of underscored (#95) --- .../cloud/google/gcp_compute_address.py | 4 +- .../cloud/google/gcp_compute_address_facts.py | 4 +- .../google/gcp_compute_backend_bucket.py | 6 +- .../gcp_compute_backend_bucket_facts.py | 6 +- .../google/gcp_compute_backend_service.py | 54 ++++++++-------- .../gcp_compute_backend_service_facts.py | 54 ++++++++-------- .../modules/cloud/google/gcp_compute_disk.py | 30 ++++----- .../cloud/google/gcp_compute_disk_facts.py | 30 ++++----- .../cloud/google/gcp_compute_firewall.py | 14 ++-- .../google/gcp_compute_firewall_facts.py | 14 ++-- .../google/gcp_compute_forwarding_rule.py | 16 ++--- .../gcp_compute_forwarding_rule_facts.py | 16 ++--- .../google/gcp_compute_global_address.py | 6 +- .../gcp_compute_global_address_facts.py | 6 +- .../gcp_compute_global_forwarding_rule.py | 14 ++-- ...cp_compute_global_forwarding_rule_facts.py | 14 ++-- .../cloud/google/gcp_compute_health_check.py | 38 +++++------ .../google/gcp_compute_health_check_facts.py | 38 +++++------ .../google/gcp_compute_http_health_check.py | 12 ++-- .../gcp_compute_http_health_check_facts.py | 12 ++-- .../google/gcp_compute_https_health_check.py | 12 ++-- .../gcp_compute_https_health_check_facts.py | 12 ++-- .../modules/cloud/google/gcp_compute_image.py | 28 ++++---- .../cloud/google/gcp_compute_image_facts.py | 28 ++++---- .../cloud/google/gcp_compute_instance.py | 64 +++++++++---------- .../google/gcp_compute_instance_facts.py | 64 +++++++++---------- .../google/gcp_compute_instance_group.py | 4 +- .../gcp_compute_instance_group_facts.py | 4 +- .../gcp_compute_instance_group_manager.py | 18 +++--- ...cp_compute_instance_group_manager_facts.py | 18 +++--- .../google/gcp_compute_instance_template.py | 56 ++++++++-------- .../gcp_compute_instance_template_facts.py | 56 ++++++++-------- .../cloud/google/gcp_compute_network.py | 4 +- .../cloud/google/gcp_compute_network_facts.py | 4 +- .../modules/cloud/google/gcp_compute_route.py | 12 ++-- .../cloud/google/gcp_compute_route_facts.py | 12 ++-- .../cloud/google/gcp_compute_router.py | 8 +-- .../cloud/google/gcp_compute_router_facts.py | 8 +-- .../google/gcp_compute_ssl_certificate.py | 4 +- .../gcp_compute_ssl_certificate_facts.py | 4 +- .../cloud/google/gcp_compute_ssl_policy.py | 8 +-- .../google/gcp_compute_ssl_policy_facts.py | 8 +-- .../cloud/google/gcp_compute_subnetwork.py | 8 +-- .../google/gcp_compute_subnetwork_facts.py | 8 +-- .../google/gcp_compute_target_http_proxy.py | 4 +- .../gcp_compute_target_http_proxy_facts.py | 4 +- .../google/gcp_compute_target_https_proxy.py | 8 +-- .../gcp_compute_target_https_proxy_facts.py | 8 +-- .../cloud/google/gcp_compute_target_pool.py | 10 +-- .../google/gcp_compute_target_pool_facts.py | 10 +-- .../google/gcp_compute_target_ssl_proxy.py | 6 +- .../gcp_compute_target_ssl_proxy_facts.py | 6 +- .../google/gcp_compute_target_tcp_proxy.py | 4 +- .../gcp_compute_target_tcp_proxy_facts.py | 4 +- .../google/gcp_compute_target_vpn_gateway.py | 4 +- .../gcp_compute_target_vpn_gateway_facts.py | 4 +- .../cloud/google/gcp_compute_url_map.py | 14 ++-- .../cloud/google/gcp_compute_url_map_facts.py | 14 ++-- .../cloud/google/gcp_compute_vpn_tunnel.py | 18 +++--- .../google/gcp_compute_vpn_tunnel_facts.py | 18 +++--- .../cloud/google/gcp_container_cluster.py | 52 +++++++-------- .../cloud/google/gcp_container_node_pool.py | 26 ++++---- .../cloud/google/gcp_dns_managed_zone.py | 8 +-- .../google/gcp_dns_managed_zone_facts.py | 8 +-- .../cloud/google/gcp_pubsub_subscription.py | 6 +- .../google/gcp_pubsub_subscription_facts.py | 6 +- .../cloud/google/gcp_spanner_database.py | 2 +- .../cloud/google/gcp_spanner_instance.py | 4 +- .../modules/cloud/google/gcp_sql_instance.py | 60 ++++++++--------- .../cloud/google/gcp_storage_bucket.py | 48 +++++++------- .../gcp_storage_bucket_access_control.py | 6 +- 71 files changed, 601 insertions(+), 601 deletions(-) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_address.py b/lib/ansible/modules/cloud/google/gcp_compute_address.py index 15ba8757411fd2..c1e8896fbbea6c 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_address.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_address.py @@ -119,13 +119,13 @@ be inside the specified subnetwork, if any. returned: success type: str - address_type: + addressType: description: - The type of address to reserve, either INTERNAL or EXTERNAL. - If unspecified, defaults to EXTERNAL. returned: success type: str - creation_timestamp: + creationTimestamp: description: - Creation timestamp in RFC3339 text format. returned: success diff --git a/lib/ansible/modules/cloud/google/gcp_compute_address_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_address_facts.py index 5be5e6e4c41477..bfe295fb6bc72b 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_address_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_address_facts.py @@ -79,13 +79,13 @@ be inside the specified subnetwork, if any. returned: success type: str - address_type: + addressType: description: - The type of address to reserve, either INTERNAL or EXTERNAL. - If unspecified, defaults to EXTERNAL. returned: success type: str - creation_timestamp: + creationTimestamp: description: - Creation timestamp in RFC3339 text format. returned: success diff --git a/lib/ansible/modules/cloud/google/gcp_compute_backend_bucket.py b/lib/ansible/modules/cloud/google/gcp_compute_backend_bucket.py index 8f98bd6894a6e9..e1d2d6b36103a0 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_backend_bucket.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_backend_bucket.py @@ -102,12 +102,12 @@ ''' RETURN = ''' - bucket_name: + bucketName: description: - Cloud Storage bucket name. returned: success type: str - creation_timestamp: + creationTimestamp: description: - Creation timestamp in RFC3339 text format. returned: success @@ -118,7 +118,7 @@ resource is created. returned: success type: str - enable_cdn: + enableCdn: description: - If true, enable Cloud CDN for this BackendBucket. returned: success diff --git a/lib/ansible/modules/cloud/google/gcp_compute_backend_bucket_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_backend_bucket_facts.py index 7674b8e9bd4b3c..29a7dea6039d82 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_backend_bucket_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_backend_bucket_facts.py @@ -66,12 +66,12 @@ returned: always type: complex contains: - bucket_name: + bucketName: description: - Cloud Storage bucket name. returned: success type: str - creation_timestamp: + creationTimestamp: description: - Creation timestamp in RFC3339 text format. returned: success @@ -82,7 +82,7 @@ resource is created. returned: success type: str - enable_cdn: + enableCdn: description: - If true, enable Cloud CDN for this BackendBucket. returned: success diff --git a/lib/ansible/modules/cloud/google/gcp_compute_backend_service.py b/lib/ansible/modules/cloud/google/gcp_compute_backend_service.py index 257a6a46429512..b001d92ce54cbb 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_backend_service.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_backend_service.py @@ -311,7 +311,7 @@ ''' RETURN = ''' - affinity_cookie_ttl_sec: + affinityCookieTtlSec: description: - Lifetime of cookies in seconds if session_affinity is GENERATED_COOKIE. If set to 0, the cookie is non-persistent and lasts only until the end of the browser session @@ -325,7 +325,7 @@ returned: success type: complex contains: - balancing_mode: + balancingMode: description: - Specifies the balancing mode for this backend. - For global HTTP(S) or TCP/SSL load balancing, the default is UTILIZATION. Valid @@ -333,7 +333,7 @@ - This cannot be used for internal load balancing. returned: success type: str - capacity_scaler: + capacityScaler: description: - A multiplier applied to the group's maximum servicing capacity (based on UTILIZATION, RATE or CONNECTION). @@ -359,7 +359,7 @@ be in a zone within the same region as the BackendService. returned: success type: dict - max_connections: + maxConnections: description: - The max number of simultaneous connections for the group. Can be used with either CONNECTION or UTILIZATION balancing modes. @@ -368,7 +368,7 @@ - This cannot be used for internal load balancing. returned: success type: int - max_connections_per_instance: + maxConnectionsPerInstance: description: - The max number of simultaneous connections that a single backend instance can handle. This is used to calculate the capacity of the group. Can be used in either CONNECTION @@ -378,7 +378,7 @@ - This cannot be used for internal load balancing. returned: success type: int - max_rate: + maxRate: description: - The max requests per second (RPS) of the group. - Can be used with either RATE or UTILIZATION balancing modes, but required if RATE @@ -386,7 +386,7 @@ - This cannot be used for internal load balancing. returned: success type: int - max_rate_per_instance: + maxRatePerInstance: description: - The max requests per second (RPS) that a single backend instance can handle. This is used to calculate the capacity of the group. Can be used in either balancing @@ -394,43 +394,43 @@ - This cannot be used for internal load balancing. returned: success type: str - max_utilization: + maxUtilization: description: - Used when balancingMode is UTILIZATION. This ratio defines the CPU utilization target for the group. The default is 0.8. Valid range is [0.0, 1.0]. - This cannot be used for internal load balancing. returned: success type: str - cdn_policy: + cdnPolicy: description: - Cloud CDN configuration for this BackendService. returned: success type: complex contains: - cache_key_policy: + cacheKeyPolicy: description: - The CacheKeyPolicy for this CdnPolicy. returned: success type: complex contains: - include_host: + includeHost: description: - If true requests to different hosts will be cached separately. returned: success type: bool - include_protocol: + includeProtocol: description: - If true, http and https requests will be cached separately. returned: success type: bool - include_query_string: + includeQueryString: description: - If true, include query string parameters in the cache key according to query_string_whitelist and query_string_blacklist. If neither is set, the entire query string will be included. - If false, the query string will be excluded from the cache key entirely. returned: success type: bool - query_string_blacklist: + queryStringBlacklist: description: - Names of query string parameters to exclude in cache keys. - All other parameters will be included. Either specify query_string_whitelist or @@ -438,7 +438,7 @@ - "'&' and '=' will be percent encoded and not treated as delimiters." returned: success type: list - query_string_whitelist: + queryStringWhitelist: description: - Names of query string parameters to include in cache keys. - All other parameters will be excluded. Either specify query_string_whitelist or @@ -446,19 +446,19 @@ - "'&' and '=' will be percent encoded and not treated as delimiters." returned: success type: list - connection_draining: + connectionDraining: description: - Settings for connection draining. returned: success type: complex contains: - draining_timeout_sec: + drainingTimeoutSec: description: - Time for which instance will be drained (not accept new connections, but still work to finish started). returned: success type: int - creation_timestamp: + creationTimestamp: description: - Creation timestamp in RFC3339 text format. returned: success @@ -468,13 +468,13 @@ - An optional description of this resource. returned: success type: str - enable_cdn: + enableCDN: description: - If true, enable Cloud CDN for this BackendService. - When the load balancing scheme is INTERNAL, this field is not used. returned: success type: bool - health_checks: + healthChecks: description: - The list of URLs to the HttpHealthCheck or HttpsHealthCheck resource for health checking this BackendService. Currently at most one health check can be specified, @@ -498,22 +498,22 @@ - Enables IAP. returned: success type: bool - oauth2_client_id: + oauth2ClientId: description: - OAuth2 Client ID for IAP. returned: success type: str - oauth2_client_secret: + oauth2ClientSecret: description: - OAuth2 Client Secret for IAP. returned: success type: str - oauth2_client_secret_sha256: + oauth2ClientSecretSha256: description: - OAuth2 Client Secret SHA-256 for IAP. returned: success type: str - load_balancing_scheme: + loadBalancingScheme: description: - Indicates whether the backend service will be used with internal or external load balancing. A backend service created for one type of load balancing cannot be used @@ -530,7 +530,7 @@ be a dash. returned: success type: str - port_name: + portName: description: - Name of backend port. The same name should appear in the instance groups referenced by this service. Required when the load balancing scheme is EXTERNAL. @@ -551,7 +551,7 @@ - This field is not applicable to global backend services. returned: success type: str - session_affinity: + sessionAffinity: description: - Type of session affinity to use. The default is NONE. - When the load balancing scheme is EXTERNAL, can be NONE, CLIENT_IP, or GENERATED_COOKIE. @@ -560,7 +560,7 @@ - When the protocol is UDP, this field is not used. returned: success type: str - timeout_sec: + timeoutSec: description: - How many seconds to wait for the backend before considering it a failed request. Default is 30 seconds. Valid range is [1, 86400]. diff --git a/lib/ansible/modules/cloud/google/gcp_compute_backend_service_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_backend_service_facts.py index 1c50fb3e963172..c303c756866767 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_backend_service_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_backend_service_facts.py @@ -66,7 +66,7 @@ returned: always type: complex contains: - affinity_cookie_ttl_sec: + affinityCookieTtlSec: description: - Lifetime of cookies in seconds if session_affinity is GENERATED_COOKIE. If set to 0, the cookie is non-persistent and lasts only until the end of the browser session @@ -80,7 +80,7 @@ returned: success type: complex contains: - balancing_mode: + balancingMode: description: - Specifies the balancing mode for this backend. - For global HTTP(S) or TCP/SSL load balancing, the default is UTILIZATION. Valid @@ -88,7 +88,7 @@ - This cannot be used for internal load balancing. returned: success type: str - capacity_scaler: + capacityScaler: description: - A multiplier applied to the group's maximum servicing capacity (based on UTILIZATION, RATE or CONNECTION). @@ -114,7 +114,7 @@ be in a zone within the same region as the BackendService. returned: success type: dict - max_connections: + maxConnections: description: - The max number of simultaneous connections for the group. Can be used with either CONNECTION or UTILIZATION balancing modes. @@ -123,7 +123,7 @@ - This cannot be used for internal load balancing. returned: success type: int - max_connections_per_instance: + maxConnectionsPerInstance: description: - The max number of simultaneous connections that a single backend instance can handle. This is used to calculate the capacity of the group. Can be used in either CONNECTION @@ -133,7 +133,7 @@ - This cannot be used for internal load balancing. returned: success type: int - max_rate: + maxRate: description: - The max requests per second (RPS) of the group. - Can be used with either RATE or UTILIZATION balancing modes, but required if RATE @@ -141,7 +141,7 @@ - This cannot be used for internal load balancing. returned: success type: int - max_rate_per_instance: + maxRatePerInstance: description: - The max requests per second (RPS) that a single backend instance can handle. This is used to calculate the capacity of the group. Can be used in either balancing @@ -149,43 +149,43 @@ - This cannot be used for internal load balancing. returned: success type: str - max_utilization: + maxUtilization: description: - Used when balancingMode is UTILIZATION. This ratio defines the CPU utilization target for the group. The default is 0.8. Valid range is [0.0, 1.0]. - This cannot be used for internal load balancing. returned: success type: str - cdn_policy: + cdnPolicy: description: - Cloud CDN configuration for this BackendService. returned: success type: complex contains: - cache_key_policy: + cacheKeyPolicy: description: - The CacheKeyPolicy for this CdnPolicy. returned: success type: complex contains: - include_host: + includeHost: description: - If true requests to different hosts will be cached separately. returned: success type: bool - include_protocol: + includeProtocol: description: - If true, http and https requests will be cached separately. returned: success type: bool - include_query_string: + includeQueryString: description: - If true, include query string parameters in the cache key according to query_string_whitelist and query_string_blacklist. If neither is set, the entire query string will be included. - If false, the query string will be excluded from the cache key entirely. returned: success type: bool - query_string_blacklist: + queryStringBlacklist: description: - Names of query string parameters to exclude in cache keys. - All other parameters will be included. Either specify query_string_whitelist or @@ -193,7 +193,7 @@ - "'&' and '=' will be percent encoded and not treated as delimiters." returned: success type: list - query_string_whitelist: + queryStringWhitelist: description: - Names of query string parameters to include in cache keys. - All other parameters will be excluded. Either specify query_string_whitelist or @@ -201,19 +201,19 @@ - "'&' and '=' will be percent encoded and not treated as delimiters." returned: success type: list - connection_draining: + connectionDraining: description: - Settings for connection draining. returned: success type: complex contains: - draining_timeout_sec: + drainingTimeoutSec: description: - Time for which instance will be drained (not accept new connections, but still work to finish started). returned: success type: int - creation_timestamp: + creationTimestamp: description: - Creation timestamp in RFC3339 text format. returned: success @@ -223,13 +223,13 @@ - An optional description of this resource. returned: success type: str - enable_cdn: + enableCDN: description: - If true, enable Cloud CDN for this BackendService. - When the load balancing scheme is INTERNAL, this field is not used. returned: success type: bool - health_checks: + healthChecks: description: - The list of URLs to the HttpHealthCheck or HttpsHealthCheck resource for health checking this BackendService. Currently at most one health check can be specified, @@ -253,22 +253,22 @@ - Enables IAP. returned: success type: bool - oauth2_client_id: + oauth2ClientId: description: - OAuth2 Client ID for IAP. returned: success type: str - oauth2_client_secret: + oauth2ClientSecret: description: - OAuth2 Client Secret for IAP. returned: success type: str - oauth2_client_secret_sha256: + oauth2ClientSecretSha256: description: - OAuth2 Client Secret SHA-256 for IAP. returned: success type: str - load_balancing_scheme: + loadBalancingScheme: description: - Indicates whether the backend service will be used with internal or external load balancing. A backend service created for one type of load balancing cannot be used @@ -285,7 +285,7 @@ be a dash. returned: success type: str - port_name: + portName: description: - Name of backend port. The same name should appear in the instance groups referenced by this service. Required when the load balancing scheme is EXTERNAL. @@ -306,7 +306,7 @@ - This field is not applicable to global backend services. returned: success type: str - session_affinity: + sessionAffinity: description: - Type of session affinity to use. The default is NONE. - When the load balancing scheme is EXTERNAL, can be NONE, CLIENT_IP, or GENERATED_COOKIE. @@ -315,7 +315,7 @@ - When the protocol is UDP, this field is not used. returned: success type: str - timeout_sec: + timeoutSec: description: - How many seconds to wait for the backend before considering it a failed request. Default is 30 seconds. Valid range is [1, 86400]. diff --git a/lib/ansible/modules/cloud/google/gcp_compute_disk.py b/lib/ansible/modules/cloud/google/gcp_compute_disk.py index 8816ed9844fa7c..bae9d5cd3c2c55 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_disk.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_disk.py @@ -193,13 +193,13 @@ ''' RETURN = ''' - label_fingerprint: + labelFingerprint: description: - The fingerprint used for optimistic locking of this resource. Used internally during updates. returned: success type: str - creation_timestamp: + creationTimestamp: description: - Creation timestamp in RFC3339 text format. returned: success @@ -215,12 +215,12 @@ - The unique identifier for the resource. returned: success type: int - last_attach_timestamp: + lastAttachTimestamp: description: - Last attach timestamp in RFC3339 text format. returned: success type: str - last_detach_timestamp: + lastDetachTimestamp: description: - Last dettach timestamp in RFC3339 text format. returned: success @@ -245,7 +245,7 @@ be a dash. returned: success type: str - size_gb: + sizeGb: description: - Size of the persistent disk, specified in GB. You can specify this field when creating a persistent disk using the sourceImage or sourceSnapshot parameter, or specify @@ -266,7 +266,7 @@ Provide this when creating the disk. returned: success type: str - source_image: + sourceImage: description: - The source image used to create this disk. If the source image is deleted, this field will not be set. @@ -286,14 +286,14 @@ - A reference to the zone where the disk resides. returned: success type: str - source_image_encryption_key: + sourceImageEncryptionKey: description: - The customer-supplied encryption key of the source image. Required if the source image is protected by a customer-supplied encryption key. returned: success type: complex contains: - raw_key: + rawKey: description: - Specifies a 256-bit customer-supplied encryption key, encoded in RFC 4648 base64 to either encrypt or decrypt this resource. @@ -305,7 +305,7 @@ that protects this resource. returned: success type: str - source_image_id: + sourceImageId: description: - The ID value of the image used to create this disk. This value identifies the exact image that was used to create this persistent disk. For example, if you created @@ -314,7 +314,7 @@ was used. returned: success type: str - disk_encryption_key: + diskEncryptionKey: description: - Encrypts the disk using a customer-supplied encryption key. - After you encrypt a disk with a customer-supplied key, you must provide the same @@ -327,7 +327,7 @@ returned: success type: complex contains: - raw_key: + rawKey: description: - Specifies a 256-bit customer-supplied encryption key, encoded in RFC 4648 base64 to either encrypt or decrypt this resource. @@ -339,7 +339,7 @@ that protects this resource. returned: success type: str - source_snapshot: + sourceSnapshot: description: - 'The source snapshot used to create this disk. You can provide this as a partial or full URL to the resource. For example, the following are valid values: * @@ -347,14 +347,14 @@ * `projects/project/global/snapshots/snapshot` * `global/snapshots/snapshot` .' returned: success type: dict - source_snapshot_encryption_key: + sourceSnapshotEncryptionKey: description: - The customer-supplied encryption key of the source snapshot. Required if the source snapshot is protected by a customer-supplied encryption key. returned: success type: complex contains: - raw_key: + rawKey: description: - Specifies a 256-bit customer-supplied encryption key, encoded in RFC 4648 base64 to either encrypt or decrypt this resource. @@ -366,7 +366,7 @@ that protects this resource. returned: success type: str - source_snapshot_id: + sourceSnapshotId: description: - The unique ID of the snapshot used to create this disk. This value identifies the exact snapshot that was used to create this persistent disk. For example, if you diff --git a/lib/ansible/modules/cloud/google/gcp_compute_disk_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_disk_facts.py index b944ce0793c7b5..5c7795d013a52a 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_disk_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_disk_facts.py @@ -71,13 +71,13 @@ returned: always type: complex contains: - label_fingerprint: + labelFingerprint: description: - The fingerprint used for optimistic locking of this resource. Used internally during updates. returned: success type: str - creation_timestamp: + creationTimestamp: description: - Creation timestamp in RFC3339 text format. returned: success @@ -93,12 +93,12 @@ - The unique identifier for the resource. returned: success type: int - last_attach_timestamp: + lastAttachTimestamp: description: - Last attach timestamp in RFC3339 text format. returned: success type: str - last_detach_timestamp: + lastDetachTimestamp: description: - Last dettach timestamp in RFC3339 text format. returned: success @@ -123,7 +123,7 @@ be a dash. returned: success type: str - size_gb: + sizeGb: description: - Size of the persistent disk, specified in GB. You can specify this field when creating a persistent disk using the sourceImage or sourceSnapshot parameter, or specify @@ -144,7 +144,7 @@ Provide this when creating the disk. returned: success type: str - source_image: + sourceImage: description: - The source image used to create this disk. If the source image is deleted, this field will not be set. @@ -164,14 +164,14 @@ - A reference to the zone where the disk resides. returned: success type: str - source_image_encryption_key: + sourceImageEncryptionKey: description: - The customer-supplied encryption key of the source image. Required if the source image is protected by a customer-supplied encryption key. returned: success type: complex contains: - raw_key: + rawKey: description: - Specifies a 256-bit customer-supplied encryption key, encoded in RFC 4648 base64 to either encrypt or decrypt this resource. @@ -183,7 +183,7 @@ that protects this resource. returned: success type: str - source_image_id: + sourceImageId: description: - The ID value of the image used to create this disk. This value identifies the exact image that was used to create this persistent disk. For example, if you created @@ -192,7 +192,7 @@ was used. returned: success type: str - disk_encryption_key: + diskEncryptionKey: description: - Encrypts the disk using a customer-supplied encryption key. - After you encrypt a disk with a customer-supplied key, you must provide the same @@ -205,7 +205,7 @@ returned: success type: complex contains: - raw_key: + rawKey: description: - Specifies a 256-bit customer-supplied encryption key, encoded in RFC 4648 base64 to either encrypt or decrypt this resource. @@ -217,7 +217,7 @@ that protects this resource. returned: success type: str - source_snapshot: + sourceSnapshot: description: - 'The source snapshot used to create this disk. You can provide this as a partial or full URL to the resource. For example, the following are valid values: * @@ -225,14 +225,14 @@ * `projects/project/global/snapshots/snapshot` * `global/snapshots/snapshot` .' returned: success type: dict - source_snapshot_encryption_key: + sourceSnapshotEncryptionKey: description: - The customer-supplied encryption key of the source snapshot. Required if the source snapshot is protected by a customer-supplied encryption key. returned: success type: complex contains: - raw_key: + rawKey: description: - Specifies a 256-bit customer-supplied encryption key, encoded in RFC 4648 base64 to either encrypt or decrypt this resource. @@ -244,7 +244,7 @@ that protects this resource. returned: success type: str - source_snapshot_id: + sourceSnapshotId: description: - The unique ID of the snapshot used to create this disk. This value identifies the exact snapshot that was used to create this persistent disk. For example, if you diff --git a/lib/ansible/modules/cloud/google/gcp_compute_firewall.py b/lib/ansible/modules/cloud/google/gcp_compute_firewall.py index c128de9b4abafa..7eafd91412aa44 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_firewall.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_firewall.py @@ -238,7 +238,7 @@ - 'Example inputs include: ["22"], ["80","443"], and ["12345-12349"].' returned: success type: list - creation_timestamp: + creationTimestamp: description: - Creation timestamp in RFC3339 text format. returned: success @@ -271,7 +271,7 @@ the resource. returned: success type: str - destination_ranges: + destinationRanges: description: - If destination ranges are specified, the firewall will apply only to traffic that has destination IP address in these ranges. These ranges must be expressed in CIDR @@ -320,7 +320,7 @@ precedence over ALLOW rules having equal priority. returned: success type: int - source_ranges: + sourceRanges: description: - If source ranges are specified, the firewall will apply only to traffic that has source IP address in these ranges. These ranges must be expressed in CIDR format. @@ -330,7 +330,7 @@ does not need to match both properties for the firewall to apply. Only IPv4 is supported. returned: success type: list - source_service_accounts: + sourceServiceAccounts: description: - If source service accounts are specified, the firewall will apply only to traffic originating from an instance with a service account in this list. Source service @@ -343,7 +343,7 @@ cannot be used at the same time as sourceTags or targetTags. returned: success type: list - source_tags: + sourceTags: description: - If source tags are specified, the firewall will apply only to traffic with source IP that belongs to a tag listed in source tags. Source tags cannot be used to control @@ -355,7 +355,7 @@ firewall to apply. returned: success type: list - target_service_accounts: + targetServiceAccounts: description: - A list of service accounts indicating sets of instances located in the network that may make network connections as specified in allowed[]. @@ -364,7 +364,7 @@ applies to all instances on the specified network. returned: success type: list - target_tags: + targetTags: description: - A list of instance tags indicating sets of instances located in the network that may make network connections as specified in allowed[]. diff --git a/lib/ansible/modules/cloud/google/gcp_compute_firewall_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_firewall_facts.py index 0767c9849d48d5..0914ba8c8c77e6 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_firewall_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_firewall_facts.py @@ -88,7 +88,7 @@ - 'Example inputs include: ["22"], ["80","443"], and ["12345-12349"].' returned: success type: list - creation_timestamp: + creationTimestamp: description: - Creation timestamp in RFC3339 text format. returned: success @@ -121,7 +121,7 @@ the resource. returned: success type: str - destination_ranges: + destinationRanges: description: - If destination ranges are specified, the firewall will apply only to traffic that has destination IP address in these ranges. These ranges must be expressed in CIDR @@ -170,7 +170,7 @@ precedence over ALLOW rules having equal priority. returned: success type: int - source_ranges: + sourceRanges: description: - If source ranges are specified, the firewall will apply only to traffic that has source IP address in these ranges. These ranges must be expressed in CIDR format. @@ -180,7 +180,7 @@ does not need to match both properties for the firewall to apply. Only IPv4 is supported. returned: success type: list - source_service_accounts: + sourceServiceAccounts: description: - If source service accounts are specified, the firewall will apply only to traffic originating from an instance with a service account in this list. Source service @@ -193,7 +193,7 @@ cannot be used at the same time as sourceTags or targetTags. returned: success type: list - source_tags: + sourceTags: description: - If source tags are specified, the firewall will apply only to traffic with source IP that belongs to a tag listed in source tags. Source tags cannot be used to control @@ -205,7 +205,7 @@ firewall to apply. returned: success type: list - target_service_accounts: + targetServiceAccounts: description: - A list of service accounts indicating sets of instances located in the network that may make network connections as specified in allowed[]. @@ -214,7 +214,7 @@ applies to all instances on the specified network. returned: success type: list - target_tags: + targetTags: description: - A list of instance tags indicating sets of instances located in the network that may make network connections as specified in allowed[]. diff --git a/lib/ansible/modules/cloud/google/gcp_compute_forwarding_rule.py b/lib/ansible/modules/cloud/google/gcp_compute_forwarding_rule.py index 94978d047422f9..f19d2e3182d89f 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_forwarding_rule.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_forwarding_rule.py @@ -204,7 +204,7 @@ ''' RETURN = ''' - creation_timestamp: + creationTimestamp: description: - Creation timestamp in RFC3339 text format. returned: success @@ -220,7 +220,7 @@ - The unique identifier for the resource. returned: success type: int - ip_address: + IPAddress: description: - The IP address that this forwarding rule is serving on behalf of. - Addresses are restricted based on the forwarding rule's load balancing scheme (EXTERNAL @@ -241,27 +241,27 @@ * global/addresses/address * address .' returned: success type: str - ip_protocol: + IPProtocol: description: - The IP protocol to which this rule applies. Valid options are TCP, UDP, ESP, AH, SCTP or ICMP. - When the load balancing scheme is INTERNAL, only TCP and UDP are valid. returned: success type: str - backend_service: + backendService: description: - A reference to a BackendService to receive the matched traffic. - This is used for internal load balancing. - "(not used for external load balancing) ." returned: success type: dict - ip_version: + ipVersion: description: - The IP Version that will be used by this forwarding rule. Valid options are IPV4 or IPV6. This can only be specified for a global forwarding rule. returned: success type: str - load_balancing_scheme: + loadBalancingScheme: description: - 'This signifies what the ForwardingRule will be used for and can only take the following values: INTERNAL, EXTERNAL The value of INTERNAL means that this will be used for @@ -288,7 +288,7 @@ - This field is not used for external load balancing. returned: success type: dict - port_range: + portRange: description: - This field is used along with the target field for TargetHttpProxy, TargetHttpsProxy, TargetSslProxy, TargetTcpProxy, TargetVpnGateway, TargetPool, TargetInstance. @@ -331,7 +331,7 @@ - This field is not used for internal load balancing. returned: success type: dict - label_fingerprint: + labelFingerprint: description: - The fingerprint used for optimistic locking of this resource. Used internally during updates. diff --git a/lib/ansible/modules/cloud/google/gcp_compute_forwarding_rule_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_forwarding_rule_facts.py index 67497f1a9ae22c..109dbdcc0bf3e3 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_forwarding_rule_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_forwarding_rule_facts.py @@ -72,7 +72,7 @@ returned: always type: complex contains: - creation_timestamp: + creationTimestamp: description: - Creation timestamp in RFC3339 text format. returned: success @@ -88,7 +88,7 @@ - The unique identifier for the resource. returned: success type: int - ip_address: + IPAddress: description: - The IP address that this forwarding rule is serving on behalf of. - Addresses are restricted based on the forwarding rule's load balancing scheme (EXTERNAL @@ -109,27 +109,27 @@ * global/addresses/address * address .' returned: success type: str - ip_protocol: + IPProtocol: description: - The IP protocol to which this rule applies. Valid options are TCP, UDP, ESP, AH, SCTP or ICMP. - When the load balancing scheme is INTERNAL, only TCP and UDP are valid. returned: success type: str - backend_service: + backendService: description: - A reference to a BackendService to receive the matched traffic. - This is used for internal load balancing. - "(not used for external load balancing) ." returned: success type: dict - ip_version: + ipVersion: description: - The IP Version that will be used by this forwarding rule. Valid options are IPV4 or IPV6. This can only be specified for a global forwarding rule. returned: success type: str - load_balancing_scheme: + loadBalancingScheme: description: - 'This signifies what the ForwardingRule will be used for and can only take the following values: INTERNAL, EXTERNAL The value of INTERNAL means that this will be used for @@ -156,7 +156,7 @@ - This field is not used for external load balancing. returned: success type: dict - port_range: + portRange: description: - This field is used along with the target field for TargetHttpProxy, TargetHttpsProxy, TargetSslProxy, TargetTcpProxy, TargetVpnGateway, TargetPool, TargetInstance. @@ -199,7 +199,7 @@ - This field is not used for internal load balancing. returned: success type: dict - label_fingerprint: + labelFingerprint: description: - The fingerprint used for optimistic locking of this resource. Used internally during updates. diff --git a/lib/ansible/modules/cloud/google/gcp_compute_global_address.py b/lib/ansible/modules/cloud/google/gcp_compute_global_address.py index dbe434f7ea4bc3..024b49cd89e2f1 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_global_address.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_global_address.py @@ -89,7 +89,7 @@ - The static external IP address represented by this resource. returned: success type: str - creation_timestamp: + creationTimestamp: description: - Creation timestamp in RFC3339 text format. returned: success @@ -115,13 +115,13 @@ be a dash. returned: success type: str - label_fingerprint: + labelFingerprint: description: - The fingerprint used for optimistic locking of this resource. Used internally during updates. returned: success type: str - ip_version: + ipVersion: description: - The IP Version that will be used by this address. Valid options are IPV4 or IPV6. The default value is IPV4. diff --git a/lib/ansible/modules/cloud/google/gcp_compute_global_address_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_global_address_facts.py index 2bdfb6cdaefa91..26020122b32178 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_global_address_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_global_address_facts.py @@ -71,7 +71,7 @@ - The static external IP address represented by this resource. returned: success type: str - creation_timestamp: + creationTimestamp: description: - Creation timestamp in RFC3339 text format. returned: success @@ -97,13 +97,13 @@ be a dash. returned: success type: str - label_fingerprint: + labelFingerprint: description: - The fingerprint used for optimistic locking of this resource. Used internally during updates. returned: success type: str - ip_version: + ipVersion: description: - The IP Version that will be used by this address. Valid options are IPV4 or IPV6. The default value is IPV4. diff --git a/lib/ansible/modules/cloud/google/gcp_compute_global_forwarding_rule.py b/lib/ansible/modules/cloud/google/gcp_compute_global_forwarding_rule.py index 05fa393d52c182..07515b210beca3 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_global_forwarding_rule.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_global_forwarding_rule.py @@ -240,7 +240,7 @@ ''' RETURN = ''' - creation_timestamp: + creationTimestamp: description: - Creation timestamp in RFC3339 text format. returned: success @@ -256,7 +256,7 @@ - The unique identifier for the resource. returned: success type: int - ip_address: + IPAddress: description: - The IP address that this forwarding rule is serving on behalf of. - Addresses are restricted based on the forwarding rule's load balancing scheme (EXTERNAL @@ -277,27 +277,27 @@ * global/addresses/address * address .' returned: success type: str - ip_protocol: + IPProtocol: description: - The IP protocol to which this rule applies. Valid options are TCP, UDP, ESP, AH, SCTP or ICMP. - When the load balancing scheme is INTERNAL, only TCP and UDP are valid. returned: success type: str - backend_service: + backendService: description: - A reference to a BackendService to receive the matched traffic. - This is used for internal load balancing. - "(not used for external load balancing) ." returned: success type: dict - ip_version: + ipVersion: description: - The IP Version that will be used by this forwarding rule. Valid options are IPV4 or IPV6. This can only be specified for a global forwarding rule. returned: success type: str - load_balancing_scheme: + loadBalancingScheme: description: - 'This signifies what the ForwardingRule will be used for and can only take the following values: INTERNAL, EXTERNAL The value of INTERNAL means that this will be used for @@ -324,7 +324,7 @@ - This field is not used for external load balancing. returned: success type: dict - port_range: + portRange: description: - This field is used along with the target field for TargetHttpProxy, TargetHttpsProxy, TargetSslProxy, TargetTcpProxy, TargetVpnGateway, TargetPool, TargetInstance. diff --git a/lib/ansible/modules/cloud/google/gcp_compute_global_forwarding_rule_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_global_forwarding_rule_facts.py index 9295d27f6e14c3..3c25d67d0078c5 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_global_forwarding_rule_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_global_forwarding_rule_facts.py @@ -66,7 +66,7 @@ returned: always type: complex contains: - creation_timestamp: + creationTimestamp: description: - Creation timestamp in RFC3339 text format. returned: success @@ -82,7 +82,7 @@ - The unique identifier for the resource. returned: success type: int - ip_address: + IPAddress: description: - The IP address that this forwarding rule is serving on behalf of. - Addresses are restricted based on the forwarding rule's load balancing scheme (EXTERNAL @@ -103,27 +103,27 @@ * global/addresses/address * address .' returned: success type: str - ip_protocol: + IPProtocol: description: - The IP protocol to which this rule applies. Valid options are TCP, UDP, ESP, AH, SCTP or ICMP. - When the load balancing scheme is INTERNAL, only TCP and UDP are valid. returned: success type: str - backend_service: + backendService: description: - A reference to a BackendService to receive the matched traffic. - This is used for internal load balancing. - "(not used for external load balancing) ." returned: success type: dict - ip_version: + ipVersion: description: - The IP Version that will be used by this forwarding rule. Valid options are IPV4 or IPV6. This can only be specified for a global forwarding rule. returned: success type: str - load_balancing_scheme: + loadBalancingScheme: description: - 'This signifies what the ForwardingRule will be used for and can only take the following values: INTERNAL, EXTERNAL The value of INTERNAL means that this will be used for @@ -150,7 +150,7 @@ - This field is not used for external load balancing. returned: success type: dict - port_range: + portRange: description: - This field is used along with the target field for TargetHttpProxy, TargetHttpsProxy, TargetSslProxy, TargetTcpProxy, TargetVpnGateway, TargetPool, TargetInstance. 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 47c3c23f1e47ab..0bad74a2782ab5 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_health_check.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_health_check.py @@ -261,12 +261,12 @@ ''' RETURN = ''' - check_interval_sec: + checkIntervalSec: description: - How often (in seconds) to send a health check. The default value is 5 seconds. returned: success type: int - creation_timestamp: + creationTimestamp: description: - Creation timestamp in RFC3339 text format. returned: success @@ -277,7 +277,7 @@ the resource. returned: success type: str - healthy_threshold: + healthyThreshold: description: - A so-far unhealthy instance will be marked healthy after this many consecutive successes. The default value is 2. @@ -298,14 +298,14 @@ be a dash. returned: success type: str - timeout_sec: + timeoutSec: description: - How long (in seconds) to wait before claiming failure. - The default value is 5 seconds. It is invalid for timeoutSec to have greater value than checkIntervalSec. returned: success type: int - unhealthy_threshold: + unhealthyThreshold: description: - A so-far healthy instance will be marked unhealthy after this many consecutive failures. The default value is 2. @@ -318,7 +318,7 @@ be specified, which must match type field. returned: success type: str - http_health_check: + httpHealthCheck: description: - A nested object resource. returned: success @@ -331,7 +331,7 @@ is performed will be used. returned: success type: str - request_path: + requestPath: description: - The request path of the HTTP health check request. - The default value is /. @@ -343,19 +343,19 @@ - The default value is 80. returned: success type: int - port_name: + portName: description: - Port name as defined in InstanceGroup#NamedPort#name. If both port and port_name are defined, port takes precedence. returned: success type: str - proxy_header: + proxyHeader: description: - Specifies the type of proxy header to append before sending data to the backend, either NONE or PROXY_V1. The default is NONE. returned: success type: str - https_health_check: + httpsHealthCheck: description: - A nested object resource. returned: success @@ -368,7 +368,7 @@ is performed will be used. returned: success type: str - request_path: + requestPath: description: - The request path of the HTTPS health check request. - The default value is /. @@ -380,19 +380,19 @@ - The default value is 443. returned: success type: int - port_name: + portName: description: - Port name as defined in InstanceGroup#NamedPort#name. If both port and port_name are defined, port takes precedence. returned: success type: str - proxy_header: + proxyHeader: description: - Specifies the type of proxy header to append before sending data to the backend, either NONE or PROXY_V1. The default is NONE. returned: success type: str - tcp_health_check: + tcpHealthCheck: description: - A nested object resource. returned: success @@ -418,19 +418,19 @@ - The default value is 443. returned: success type: int - port_name: + portName: description: - Port name as defined in InstanceGroup#NamedPort#name. If both port and port_name are defined, port takes precedence. returned: success type: str - proxy_header: + proxyHeader: description: - Specifies the type of proxy header to append before sending data to the backend, either NONE or PROXY_V1. The default is NONE. returned: success type: str - ssl_health_check: + sslHealthCheck: description: - A nested object resource. returned: success @@ -456,13 +456,13 @@ - The default value is 443. returned: success type: int - port_name: + portName: description: - Port name as defined in InstanceGroup#NamedPort#name. If both port and port_name are defined, port takes precedence. returned: success type: str - proxy_header: + proxyHeader: description: - Specifies the type of proxy header to append before sending data to the backend, either NONE or PROXY_V1. The default is NONE. 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 fce02448256ff4..4fb8fc5e43694f 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 @@ -66,12 +66,12 @@ returned: always type: complex contains: - check_interval_sec: + checkIntervalSec: description: - How often (in seconds) to send a health check. The default value is 5 seconds. returned: success type: int - creation_timestamp: + creationTimestamp: description: - Creation timestamp in RFC3339 text format. returned: success @@ -82,7 +82,7 @@ the resource. returned: success type: str - healthy_threshold: + healthyThreshold: description: - A so-far unhealthy instance will be marked healthy after this many consecutive successes. The default value is 2. @@ -103,14 +103,14 @@ be a dash. returned: success type: str - timeout_sec: + timeoutSec: description: - How long (in seconds) to wait before claiming failure. - The default value is 5 seconds. It is invalid for timeoutSec to have greater value than checkIntervalSec. returned: success type: int - unhealthy_threshold: + unhealthyThreshold: description: - A so-far healthy instance will be marked unhealthy after this many consecutive failures. The default value is 2. @@ -123,7 +123,7 @@ be specified, which must match type field. returned: success type: str - http_health_check: + httpHealthCheck: description: - A nested object resource. returned: success @@ -136,7 +136,7 @@ is performed will be used. returned: success type: str - request_path: + requestPath: description: - The request path of the HTTP health check request. - The default value is /. @@ -148,19 +148,19 @@ - The default value is 80. returned: success type: int - port_name: + portName: description: - Port name as defined in InstanceGroup#NamedPort#name. If both port and port_name are defined, port takes precedence. returned: success type: str - proxy_header: + proxyHeader: description: - Specifies the type of proxy header to append before sending data to the backend, either NONE or PROXY_V1. The default is NONE. returned: success type: str - https_health_check: + httpsHealthCheck: description: - A nested object resource. returned: success @@ -173,7 +173,7 @@ is performed will be used. returned: success type: str - request_path: + requestPath: description: - The request path of the HTTPS health check request. - The default value is /. @@ -185,19 +185,19 @@ - The default value is 443. returned: success type: int - port_name: + portName: description: - Port name as defined in InstanceGroup#NamedPort#name. If both port and port_name are defined, port takes precedence. returned: success type: str - proxy_header: + proxyHeader: description: - Specifies the type of proxy header to append before sending data to the backend, either NONE or PROXY_V1. The default is NONE. returned: success type: str - tcp_health_check: + tcpHealthCheck: description: - A nested object resource. returned: success @@ -223,19 +223,19 @@ - The default value is 443. returned: success type: int - port_name: + portName: description: - Port name as defined in InstanceGroup#NamedPort#name. If both port and port_name are defined, port takes precedence. returned: success type: str - proxy_header: + proxyHeader: description: - Specifies the type of proxy header to append before sending data to the backend, either NONE or PROXY_V1. The default is NONE. returned: success type: str - ssl_health_check: + sslHealthCheck: description: - A nested object resource. returned: success @@ -261,13 +261,13 @@ - The default value is 443. returned: success type: int - port_name: + portName: description: - Port name as defined in InstanceGroup#NamedPort#name. If both port and port_name are defined, port takes precedence. returned: success type: str - proxy_header: + proxyHeader: description: - Specifies the type of proxy header to append before sending data to the backend, either NONE or PROXY_V1. The default is NONE. diff --git a/lib/ansible/modules/cloud/google/gcp_compute_http_health_check.py b/lib/ansible/modules/cloud/google/gcp_compute_http_health_check.py index de7f5361ea4793..3906b5aa525d39 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_http_health_check.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_http_health_check.py @@ -121,12 +121,12 @@ ''' RETURN = ''' - check_interval_sec: + checkIntervalSec: description: - How often (in seconds) to send a health check. The default value is 5 seconds. returned: success type: int - creation_timestamp: + creationTimestamp: description: - Creation timestamp in RFC3339 text format. returned: success @@ -137,7 +137,7 @@ the resource. returned: success type: str - healthy_threshold: + healthyThreshold: description: - A so-far unhealthy instance will be marked healthy after this many consecutive successes. The default value is 2. @@ -171,20 +171,20 @@ - The default value is 80. returned: success type: int - request_path: + requestPath: description: - The request path of the HTTP health check request. - The default value is /. returned: success type: str - timeout_sec: + timeoutSec: description: - How long (in seconds) to wait before claiming failure. - The default value is 5 seconds. It is invalid for timeoutSec to have greater value than checkIntervalSec. returned: success type: int - unhealthy_threshold: + unhealthyThreshold: description: - A so-far healthy instance will be marked unhealthy after this many consecutive failures. The default value is 2. diff --git a/lib/ansible/modules/cloud/google/gcp_compute_http_health_check_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_http_health_check_facts.py index 00ba7096a3e36a..6fc063d0230944 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_http_health_check_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_http_health_check_facts.py @@ -66,12 +66,12 @@ returned: always type: complex contains: - check_interval_sec: + checkIntervalSec: description: - How often (in seconds) to send a health check. The default value is 5 seconds. returned: success type: int - creation_timestamp: + creationTimestamp: description: - Creation timestamp in RFC3339 text format. returned: success @@ -82,7 +82,7 @@ the resource. returned: success type: str - healthy_threshold: + healthyThreshold: description: - A so-far unhealthy instance will be marked healthy after this many consecutive successes. The default value is 2. @@ -116,20 +116,20 @@ - The default value is 80. returned: success type: int - request_path: + requestPath: description: - The request path of the HTTP health check request. - The default value is /. returned: success type: str - timeout_sec: + timeoutSec: description: - How long (in seconds) to wait before claiming failure. - The default value is 5 seconds. It is invalid for timeoutSec to have greater value than checkIntervalSec. returned: success type: int - unhealthy_threshold: + unhealthyThreshold: description: - A so-far healthy instance will be marked unhealthy after this many consecutive failures. The default value is 2. diff --git a/lib/ansible/modules/cloud/google/gcp_compute_https_health_check.py b/lib/ansible/modules/cloud/google/gcp_compute_https_health_check.py index 8ee572ddd0d434..35c2a25ee90d7d 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_https_health_check.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_https_health_check.py @@ -119,12 +119,12 @@ ''' RETURN = ''' - check_interval_sec: + checkIntervalSec: description: - How often (in seconds) to send a health check. The default value is 5 seconds. returned: success type: int - creation_timestamp: + creationTimestamp: description: - Creation timestamp in RFC3339 text format. returned: success @@ -135,7 +135,7 @@ the resource. returned: success type: str - healthy_threshold: + healthyThreshold: description: - A so-far unhealthy instance will be marked healthy after this many consecutive successes. The default value is 2. @@ -169,20 +169,20 @@ - The default value is 80. returned: success type: int - request_path: + requestPath: description: - The request path of the HTTPS health check request. - The default value is /. returned: success type: str - timeout_sec: + timeoutSec: description: - How long (in seconds) to wait before claiming failure. - The default value is 5 seconds. It is invalid for timeoutSec to have greater value than checkIntervalSec. returned: success type: int - unhealthy_threshold: + unhealthyThreshold: description: - A so-far healthy instance will be marked unhealthy after this many consecutive failures. The default value is 2. diff --git a/lib/ansible/modules/cloud/google/gcp_compute_https_health_check_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_https_health_check_facts.py index e22bf26ca1f237..5a599f764dec93 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_https_health_check_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_https_health_check_facts.py @@ -66,12 +66,12 @@ returned: always type: complex contains: - check_interval_sec: + checkIntervalSec: description: - How often (in seconds) to send a health check. The default value is 5 seconds. returned: success type: int - creation_timestamp: + creationTimestamp: description: - Creation timestamp in RFC3339 text format. returned: success @@ -82,7 +82,7 @@ the resource. returned: success type: str - healthy_threshold: + healthyThreshold: description: - A so-far unhealthy instance will be marked healthy after this many consecutive successes. The default value is 2. @@ -116,20 +116,20 @@ - The default value is 80. returned: success type: int - request_path: + requestPath: description: - The request path of the HTTPS health check request. - The default value is /. returned: success type: str - timeout_sec: + timeoutSec: description: - How long (in seconds) to wait before claiming failure. - The default value is 5 seconds. It is invalid for timeoutSec to have greater value than checkIntervalSec. returned: success type: int - unhealthy_threshold: + unhealthyThreshold: description: - A so-far healthy instance will be marked unhealthy after this many consecutive failures. The default value is 2. diff --git a/lib/ansible/modules/cloud/google/gcp_compute_image.py b/lib/ansible/modules/cloud/google/gcp_compute_image.py index 8eb3b1507ee13e..25f630258ef36d 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_image.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_image.py @@ -202,12 +202,12 @@ ''' RETURN = ''' - archive_size_bytes: + archiveSizeBytes: description: - Size of the image tar.gz archive stored in Google Cloud Storage (in bytes). returned: success type: int - creation_timestamp: + creationTimestamp: description: - Creation timestamp in RFC3339 text format. returned: success @@ -261,7 +261,7 @@ the resource. returned: success type: str - disk_size_gb: + diskSizeGb: description: - Size of the image when restored onto a persistent disk (in GB). returned: success @@ -274,7 +274,7 @@ comply with RFC1035. returned: success type: str - guest_os_features: + guestOsFeatures: description: - A list of features to enable on the guest OS. Applicable for bootable images only. Currently, only one feature can be enabled, VIRTIO_SCSI_MULTIQUEUE, which allows @@ -300,7 +300,7 @@ - The unique identifier for the resource. This identifier is defined by the server. returned: success type: int - image_encryption_key: + imageEncryptionKey: description: - Encrypts the image using a customer-supplied encryption key. - After you encrypt an image with a customer-supplied key, you must provide the same @@ -308,7 +308,7 @@ returned: success type: complex contains: - raw_key: + rawKey: description: - Specifies a 256-bit customer-supplied encryption key, encoded in RFC 4648 base64 to either encrypt or decrypt this resource. @@ -335,20 +335,20 @@ be a dash. returned: success type: str - raw_disk: + rawDisk: description: - The parameters of the raw disk image. returned: success type: complex contains: - container_type: + containerType: description: - The format used to encode and transmit the block device, which should be TAR. This is just a container and transmission format and not a runtime format. Provided by the client when the disk image is created. returned: success type: str - sha1_checksum: + sha1Checksum: description: - An optional SHA1 checksum of the disk image before unpackaging. - This is provided by the client when the disk image is created. @@ -360,20 +360,20 @@ either this property or the sourceDisk property but not both. returned: success type: str - source_disk: + sourceDisk: description: - Refers to a gcompute_disk object You must provide either this property or the rawDisk.source property but not both to create an image. returned: success type: dict - source_disk_encryption_key: + sourceDiskEncryptionKey: description: - The customer-supplied encryption key of the source disk. Required if the source disk is protected by a customer-supplied encryption key. returned: success type: complex contains: - raw_key: + rawKey: description: - Specifies a 256-bit customer-supplied encryption key, encoded in RFC 4648 base64 to either encrypt or decrypt this resource. @@ -385,14 +385,14 @@ that protects this resource. returned: success type: str - source_disk_id: + sourceDiskId: description: - The ID value of the disk used to create this image. This value may be used to determine whether the image was taken from the current or a previous instance of a given disk name. returned: success type: str - source_type: + sourceType: description: - The type of the image used to create this disk. The default and only value is RAW . diff --git a/lib/ansible/modules/cloud/google/gcp_compute_image_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_image_facts.py index 3187ca01e60228..17ecd7a8d08ac8 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_image_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_image_facts.py @@ -66,12 +66,12 @@ returned: always type: complex contains: - archive_size_bytes: + archiveSizeBytes: description: - Size of the image tar.gz archive stored in Google Cloud Storage (in bytes). returned: success type: int - creation_timestamp: + creationTimestamp: description: - Creation timestamp in RFC3339 text format. returned: success @@ -125,7 +125,7 @@ the resource. returned: success type: str - disk_size_gb: + diskSizeGb: description: - Size of the image when restored onto a persistent disk (in GB). returned: success @@ -138,7 +138,7 @@ comply with RFC1035. returned: success type: str - guest_os_features: + guestOsFeatures: description: - A list of features to enable on the guest OS. Applicable for bootable images only. Currently, only one feature can be enabled, VIRTIO_SCSI_MULTIQUEUE, which allows @@ -164,7 +164,7 @@ - The unique identifier for the resource. This identifier is defined by the server. returned: success type: int - image_encryption_key: + imageEncryptionKey: description: - Encrypts the image using a customer-supplied encryption key. - After you encrypt an image with a customer-supplied key, you must provide the same @@ -172,7 +172,7 @@ returned: success type: complex contains: - raw_key: + rawKey: description: - Specifies a 256-bit customer-supplied encryption key, encoded in RFC 4648 base64 to either encrypt or decrypt this resource. @@ -199,20 +199,20 @@ be a dash. returned: success type: str - raw_disk: + rawDisk: description: - The parameters of the raw disk image. returned: success type: complex contains: - container_type: + containerType: description: - The format used to encode and transmit the block device, which should be TAR. This is just a container and transmission format and not a runtime format. Provided by the client when the disk image is created. returned: success type: str - sha1_checksum: + sha1Checksum: description: - An optional SHA1 checksum of the disk image before unpackaging. - This is provided by the client when the disk image is created. @@ -224,20 +224,20 @@ either this property or the sourceDisk property but not both. returned: success type: str - source_disk: + sourceDisk: description: - Refers to a gcompute_disk object You must provide either this property or the rawDisk.source property but not both to create an image. returned: success type: dict - source_disk_encryption_key: + sourceDiskEncryptionKey: description: - The customer-supplied encryption key of the source disk. Required if the source disk is protected by a customer-supplied encryption key. returned: success type: complex contains: - raw_key: + rawKey: description: - Specifies a 256-bit customer-supplied encryption key, encoded in RFC 4648 base64 to either encrypt or decrypt this resource. @@ -249,14 +249,14 @@ that protects this resource. returned: success type: str - source_disk_id: + sourceDiskId: description: - The ID value of the disk used to create this image. This value may be used to determine whether the image was taken from the current or a previous instance of a given disk name. returned: success type: str - source_type: + sourceType: description: - The type of the image used to create this disk. The default and only value is RAW . diff --git a/lib/ansible/modules/cloud/google/gcp_compute_instance.py b/lib/ansible/modules/cloud/google/gcp_compute_instance.py index 8978f8827a113d..35d103f4dd621d 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_instance.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_instance.py @@ -423,18 +423,18 @@ ''' RETURN = ''' - can_ip_forward: + canIpForward: description: - Allows this instance to send and receive packets with non-matching destination or source IPs. This is required if you plan to use this instance to forward routes. returned: success type: bool - cpu_platform: + cpuPlatform: description: - The CPU platform used by this instance. returned: success type: str - creation_timestamp: + creationTimestamp: description: - Creation timestamp in RFC3339 text format. returned: success @@ -446,7 +446,7 @@ returned: success type: complex contains: - auto_delete: + autoDelete: description: - Specifies whether the disk will be auto-deleted when the instance is deleted (but not when the disk is detached from the instance). @@ -460,26 +460,26 @@ of the disk for its root filesystem. returned: success type: bool - device_name: + deviceName: description: - Specifies a unique device name of your choice that is reflected into the /dev/disk/by-id/google-* tree of a Linux operating system running within the instance. This name can be used to reference the device for mounting, resizing, and so on, from within the instance. returned: success type: str - disk_encryption_key: + diskEncryptionKey: description: - Encrypts or decrypts a disk using a customer-supplied encryption key. returned: success type: complex contains: - raw_key: + rawKey: description: - Specifies a 256-bit customer-supplied encryption key, encoded in RFC 4648 base64 to either encrypt or decrypt this resource. returned: success type: str - rsa_encrypted_key: + rsaEncryptedKey: description: - Specifies an RFC 4648 base64 encoded, RSA-wrapped 2048-bit customer-supplied encryption key to either encrypt or decrypt this resource. @@ -498,7 +498,7 @@ a unique index number. If not specified, the server will choose an appropriate value. returned: success type: int - initialize_params: + initializeParams: description: - Specifies the parameters for a new disk that will be created alongside the new instance. Use initialization parameters to create boot disks or local SSDs attached to the @@ -506,32 +506,32 @@ returned: success type: complex contains: - disk_name: + diskName: description: - Specifies the disk name. If not specified, the default is to use the name of the instance. returned: success type: str - disk_size_gb: + diskSizeGb: description: - Specifies the size of the disk in base-2 GB. returned: success type: int - disk_type: + diskType: description: - Reference to a gcompute_disk_type resource. - Specifies the disk type to use to create the instance. - If not specified, the default is pd-standard. returned: success type: str - source_image: + sourceImage: description: - The source image to create this disk. When creating a new instance, one of initializeParams.sourceImage or disks.source is required. To create a disk with one of the public operating system images, specify the image by its family name. returned: success type: str - source_image_encryption_key: + sourceImageEncryptionKey: description: - The customer-supplied encryption key of the source image. Required if the source image is protected by a customer-supplied encryption key. @@ -541,7 +541,7 @@ returned: success type: complex contains: - raw_key: + rawKey: description: - Specifies a 256-bit customer-supplied encryption key, encoded in RFC 4648 base64 to either encrypt or decrypt this resource. @@ -581,18 +581,18 @@ the default is PERSISTENT. returned: success type: str - guest_accelerators: + guestAccelerators: description: - List of the type and count of accelerator cards attached to the instance . returned: success type: complex contains: - accelerator_count: + acceleratorCount: description: - The number of the guest accelerator cards exposed to this instance. returned: success type: int - accelerator_type: + acceleratorType: description: - Full or partial URL of the accelerator type resource to expose to this instance. returned: success @@ -602,7 +602,7 @@ - The unique identifier for the resource. This identifier is defined by the server. returned: success type: int - label_fingerprint: + labelFingerprint: description: - A fingerprint for this request, which is essentially a hash of the metadata's contents and used for optimistic locking. The fingerprint is initially generated by Compute @@ -616,12 +616,12 @@ These pairs can consist of custom metadata or predefined keys. returned: success type: dict - machine_type: + machineType: description: - A reference to a machine type which defines VM kind. returned: success type: str - min_cpu_platform: + minCpuPlatform: description: - Specifies a minimum CPU platform for the VM instance. Applicable values are the friendly names of CPU platforms . @@ -637,7 +637,7 @@ be a dash. returned: success type: str - network_interfaces: + networkInterfaces: description: - An array of configurations for this interface. This specifies how this interface is configured to interact with other network services, such as connecting to the @@ -645,7 +645,7 @@ returned: success type: complex contains: - access_configs: + accessConfigs: description: - An array of configurations for this interface. Currently, only one access config, ONE_TO_ONE_NAT, is supported. If there are no accessConfigs specified, then this @@ -660,7 +660,7 @@ IP or Network Access. returned: success type: str - nat_ip: + natIP: description: - Specifies the title of a gcompute_address. - An external IP address associated with this instance. @@ -675,14 +675,14 @@ - The type of configuration. The default and only option is ONE_TO_ONE_NAT. returned: success type: str - alias_ip_ranges: + aliasIpRanges: description: - An array of alias IP ranges for this network interface. Can only be specified for network interfaces on subnet-mode networks. returned: success type: complex contains: - ip_cidr_range: + ipCidrRange: description: - The IP CIDR range represented by this alias IP range. - This IP CIDR range must belong to the specified subnetwork and cannot contain IP @@ -691,7 +691,7 @@ (e.g. 10.1.2.0/24). returned: success type: str - subnetwork_range_name: + subnetworkRangeName: description: - Optional subnetwork secondary range name specifying the secondary range from which to allocate the IP CIDR range for this alias IP range. If left unspecified, the @@ -712,7 +712,7 @@ is inferred. returned: success type: dict - network_ip: + networkIP: description: - An IPv4 internal network address to assign to the instance for this network interface. If not specified by the user, an unused internal IP is assigned by the system. @@ -732,7 +732,7 @@ returned: success type: complex contains: - automatic_restart: + automaticRestart: description: - Specifies whether the instance should be automatically restarted if it is terminated by Compute Engine (not terminated by a user). @@ -740,7 +740,7 @@ instances cannot be automatically restarted. returned: success type: bool - on_host_maintenance: + onHostMaintenance: description: - Defines the maintenance behavior for this instance. For standard instances, the default behavior is MIGRATE. For preemptible instances, the default and only possible @@ -754,7 +754,7 @@ creation, it cannot be set or changed after the instance has been created. returned: success type: bool - service_accounts: + serviceAccounts: description: - A list of service accounts, with their specified scopes, authorized for this instance. Only one service account per VM instance is supported. @@ -777,7 +777,7 @@ RUNNING, STOPPING, SUSPENDING, SUSPENDED, and TERMINATED.' returned: success type: str - status_message: + statusMessage: description: - An optional, human-readable explanation of the status. returned: success diff --git a/lib/ansible/modules/cloud/google/gcp_compute_instance_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_instance_facts.py index a9dee77fc8f09d..1d1096b8c3fbac 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_instance_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_instance_facts.py @@ -71,18 +71,18 @@ returned: always type: complex contains: - can_ip_forward: + canIpForward: description: - Allows this instance to send and receive packets with non-matching destination or source IPs. This is required if you plan to use this instance to forward routes. returned: success type: bool - cpu_platform: + cpuPlatform: description: - The CPU platform used by this instance. returned: success type: str - creation_timestamp: + creationTimestamp: description: - Creation timestamp in RFC3339 text format. returned: success @@ -94,7 +94,7 @@ returned: success type: complex contains: - auto_delete: + autoDelete: description: - Specifies whether the disk will be auto-deleted when the instance is deleted (but not when the disk is detached from the instance). @@ -108,26 +108,26 @@ of the disk for its root filesystem. returned: success type: bool - device_name: + deviceName: description: - Specifies a unique device name of your choice that is reflected into the /dev/disk/by-id/google-* tree of a Linux operating system running within the instance. This name can be used to reference the device for mounting, resizing, and so on, from within the instance. returned: success type: str - disk_encryption_key: + diskEncryptionKey: description: - Encrypts or decrypts a disk using a customer-supplied encryption key. returned: success type: complex contains: - raw_key: + rawKey: description: - Specifies a 256-bit customer-supplied encryption key, encoded in RFC 4648 base64 to either encrypt or decrypt this resource. returned: success type: str - rsa_encrypted_key: + rsaEncryptedKey: description: - Specifies an RFC 4648 base64 encoded, RSA-wrapped 2048-bit customer-supplied encryption key to either encrypt or decrypt this resource. @@ -146,7 +146,7 @@ a unique index number. If not specified, the server will choose an appropriate value. returned: success type: int - initialize_params: + initializeParams: description: - Specifies the parameters for a new disk that will be created alongside the new instance. Use initialization parameters to create boot disks or local SSDs attached to the @@ -154,32 +154,32 @@ returned: success type: complex contains: - disk_name: + diskName: description: - Specifies the disk name. If not specified, the default is to use the name of the instance. returned: success type: str - disk_size_gb: + diskSizeGb: description: - Specifies the size of the disk in base-2 GB. returned: success type: int - disk_type: + diskType: description: - Reference to a gcompute_disk_type resource. - Specifies the disk type to use to create the instance. - If not specified, the default is pd-standard. returned: success type: str - source_image: + sourceImage: description: - The source image to create this disk. When creating a new instance, one of initializeParams.sourceImage or disks.source is required. To create a disk with one of the public operating system images, specify the image by its family name. returned: success type: str - source_image_encryption_key: + sourceImageEncryptionKey: description: - The customer-supplied encryption key of the source image. Required if the source image is protected by a customer-supplied encryption key. @@ -189,7 +189,7 @@ returned: success type: complex contains: - raw_key: + rawKey: description: - Specifies a 256-bit customer-supplied encryption key, encoded in RFC 4648 base64 to either encrypt or decrypt this resource. @@ -229,18 +229,18 @@ the default is PERSISTENT. returned: success type: str - guest_accelerators: + guestAccelerators: description: - List of the type and count of accelerator cards attached to the instance . returned: success type: complex contains: - accelerator_count: + acceleratorCount: description: - The number of the guest accelerator cards exposed to this instance. returned: success type: int - accelerator_type: + acceleratorType: description: - Full or partial URL of the accelerator type resource to expose to this instance. returned: success @@ -250,7 +250,7 @@ - The unique identifier for the resource. This identifier is defined by the server. returned: success type: int - label_fingerprint: + labelFingerprint: description: - A fingerprint for this request, which is essentially a hash of the metadata's contents and used for optimistic locking. The fingerprint is initially generated by Compute @@ -264,12 +264,12 @@ These pairs can consist of custom metadata or predefined keys. returned: success type: dict - machine_type: + machineType: description: - A reference to a machine type which defines VM kind. returned: success type: str - min_cpu_platform: + minCpuPlatform: description: - Specifies a minimum CPU platform for the VM instance. Applicable values are the friendly names of CPU platforms . @@ -285,7 +285,7 @@ be a dash. returned: success type: str - network_interfaces: + networkInterfaces: description: - An array of configurations for this interface. This specifies how this interface is configured to interact with other network services, such as connecting to the @@ -293,7 +293,7 @@ returned: success type: complex contains: - access_configs: + accessConfigs: description: - An array of configurations for this interface. Currently, only one access config, ONE_TO_ONE_NAT, is supported. If there are no accessConfigs specified, then this @@ -308,7 +308,7 @@ IP or Network Access. returned: success type: str - nat_ip: + natIP: description: - Specifies the title of a gcompute_address. - An external IP address associated with this instance. @@ -323,14 +323,14 @@ - The type of configuration. The default and only option is ONE_TO_ONE_NAT. returned: success type: str - alias_ip_ranges: + aliasIpRanges: description: - An array of alias IP ranges for this network interface. Can only be specified for network interfaces on subnet-mode networks. returned: success type: complex contains: - ip_cidr_range: + ipCidrRange: description: - The IP CIDR range represented by this alias IP range. - This IP CIDR range must belong to the specified subnetwork and cannot contain IP @@ -339,7 +339,7 @@ (e.g. 10.1.2.0/24). returned: success type: str - subnetwork_range_name: + subnetworkRangeName: description: - Optional subnetwork secondary range name specifying the secondary range from which to allocate the IP CIDR range for this alias IP range. If left unspecified, the @@ -360,7 +360,7 @@ is inferred. returned: success type: dict - network_ip: + networkIP: description: - An IPv4 internal network address to assign to the instance for this network interface. If not specified by the user, an unused internal IP is assigned by the system. @@ -380,7 +380,7 @@ returned: success type: complex contains: - automatic_restart: + automaticRestart: description: - Specifies whether the instance should be automatically restarted if it is terminated by Compute Engine (not terminated by a user). @@ -388,7 +388,7 @@ instances cannot be automatically restarted. returned: success type: bool - on_host_maintenance: + onHostMaintenance: description: - Defines the maintenance behavior for this instance. For standard instances, the default behavior is MIGRATE. For preemptible instances, the default and only possible @@ -402,7 +402,7 @@ creation, it cannot be set or changed after the instance has been created. returned: success type: bool - service_accounts: + serviceAccounts: description: - A list of service accounts, with their specified scopes, authorized for this instance. Only one service account per VM instance is supported. @@ -425,7 +425,7 @@ RUNNING, STOPPING, SUSPENDING, SUSPENDED, and TERMINATED.' returned: success type: str - status_message: + statusMessage: description: - An optional, human-readable explanation of the status. returned: success diff --git a/lib/ansible/modules/cloud/google/gcp_compute_instance_group.py b/lib/ansible/modules/cloud/google/gcp_compute_instance_group.py index 621045b2dbee52..2576d8218e2420 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_instance_group.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_instance_group.py @@ -131,7 +131,7 @@ ''' RETURN = ''' - creation_timestamp: + creationTimestamp: description: - Creation timestamp in RFC3339 text format. returned: success @@ -153,7 +153,7 @@ - The name must be 1-63 characters long, and comply with RFC1035. returned: success type: str - named_ports: + namedPorts: description: - Assigns a name to a port number. - 'For example: {name: "http", port: 80}.' diff --git a/lib/ansible/modules/cloud/google/gcp_compute_instance_group_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_instance_group_facts.py index 01dfc77a71475b..952363ec5abc60 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_instance_group_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_instance_group_facts.py @@ -71,7 +71,7 @@ returned: always type: complex contains: - creation_timestamp: + creationTimestamp: description: - Creation timestamp in RFC3339 text format. returned: success @@ -93,7 +93,7 @@ - The name must be 1-63 characters long, and comply with RFC1035. returned: success type: str - named_ports: + namedPorts: description: - Assigns a name to a port number. - 'For example: {name: "http", port: 80}.' diff --git a/lib/ansible/modules/cloud/google/gcp_compute_instance_group_manager.py b/lib/ansible/modules/cloud/google/gcp_compute_instance_group_manager.py index abe584512ef062..c83b8a431c6636 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_instance_group_manager.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_instance_group_manager.py @@ -162,7 +162,7 @@ ''' RETURN = ''' - base_instance_name: + baseInstanceName: description: - The base instance name to use for instances in this group. The value must be 1-58 characters long. Instances are named by appending a hyphen and a random four-character @@ -170,12 +170,12 @@ - The base instance name must comply with RFC1035. returned: success type: str - creation_timestamp: + creationTimestamp: description: - The creation timestamp for this managed instance group in RFC3339 text format. returned: success type: str - current_actions: + currentActions: description: - The list of instance actions and the number of instances in this managed instance group that are scheduled for each of those actions. @@ -198,7 +198,7 @@ the creatingWithoutRetries field will be populated. returned: success type: int - creating_without_retries: + creatingWithoutRetries: description: - The number of instances that the managed instance group will attempt to create. The group attempts to create each instance only once. If the group fails to create @@ -249,12 +249,12 @@ - A unique identifier for this resource. returned: success type: int - instance_group: + instanceGroup: description: - The instance group being managed. returned: success type: dict - instance_template: + instanceTemplate: description: - The instance template that is specified for this managed instance group. The group uses this template to create all new instances in the managed instance group. @@ -266,7 +266,7 @@ comply with RFC1035. returned: success type: str - named_ports: + namedPorts: description: - Named ports configured for the Instance Groups complementary to this Instance Group Manager. @@ -289,14 +289,14 @@ - The region this managed instance group resides (for regional resources). returned: success type: str - target_pools: + targetPools: description: - TargetPool resources to which instances in the instanceGroup field are added. The target pools automatically apply to all of the instances in the managed instance group. returned: success type: list - target_size: + targetSize: description: - The target number of running instances for this managed instance group. Deleting or abandoning instances reduces this number. Resizing the group changes this number. diff --git a/lib/ansible/modules/cloud/google/gcp_compute_instance_group_manager_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_instance_group_manager_facts.py index a0b331b170ef9a..5db47bbdb1998b 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_instance_group_manager_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_instance_group_manager_facts.py @@ -71,7 +71,7 @@ returned: always type: complex contains: - base_instance_name: + baseInstanceName: description: - The base instance name to use for instances in this group. The value must be 1-58 characters long. Instances are named by appending a hyphen and a random four-character @@ -79,12 +79,12 @@ - The base instance name must comply with RFC1035. returned: success type: str - creation_timestamp: + creationTimestamp: description: - The creation timestamp for this managed instance group in RFC3339 text format. returned: success type: str - current_actions: + currentActions: description: - The list of instance actions and the number of instances in this managed instance group that are scheduled for each of those actions. @@ -107,7 +107,7 @@ the creatingWithoutRetries field will be populated. returned: success type: int - creating_without_retries: + creatingWithoutRetries: description: - The number of instances that the managed instance group will attempt to create. The group attempts to create each instance only once. If the group fails to create @@ -158,12 +158,12 @@ - A unique identifier for this resource. returned: success type: int - instance_group: + instanceGroup: description: - The instance group being managed. returned: success type: dict - instance_template: + instanceTemplate: description: - The instance template that is specified for this managed instance group. The group uses this template to create all new instances in the managed instance group. @@ -175,7 +175,7 @@ comply with RFC1035. returned: success type: str - named_ports: + namedPorts: description: - Named ports configured for the Instance Groups complementary to this Instance Group Manager. @@ -198,14 +198,14 @@ - The region this managed instance group resides (for regional resources). returned: success type: str - target_pools: + targetPools: description: - TargetPool resources to which instances in the instanceGroup field are added. The target pools automatically apply to all of the instances in the managed instance group. returned: success type: list - target_size: + targetSize: description: - The target number of running instances for this managed instance group. Deleting or abandoning instances reduces this number. Resizing the group changes this number. diff --git a/lib/ansible/modules/cloud/google/gcp_compute_instance_template.py b/lib/ansible/modules/cloud/google/gcp_compute_instance_template.py index 42f26997c95d0a..9ef3a83f402dbc 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_instance_template.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_instance_template.py @@ -413,7 +413,7 @@ ''' RETURN = ''' - creation_timestamp: + creationTimestamp: description: - Creation timestamp in RFC3339 text format. returned: success @@ -440,7 +440,7 @@ returned: success type: complex contains: - can_ip_forward: + canIpForward: description: - Enables instances created based on this template to send packets with source IP addresses other than their own and receive packets with destination IP addresses @@ -462,7 +462,7 @@ returned: success type: complex contains: - auto_delete: + autoDelete: description: - Specifies whether the disk will be auto-deleted when the instance is deleted (but not when the disk is detached from the instance). @@ -476,26 +476,26 @@ of the disk for its root filesystem. returned: success type: bool - device_name: + deviceName: description: - Specifies a unique device name of your choice that is reflected into the /dev/disk/by-id/google-* tree of a Linux operating system running within the instance. This name can be used to reference the device for mounting, resizing, and so on, from within the instance. returned: success type: str - disk_encryption_key: + diskEncryptionKey: description: - Encrypts or decrypts a disk using a customer-supplied encryption key. returned: success type: complex contains: - raw_key: + rawKey: description: - Specifies a 256-bit customer-supplied encryption key, encoded in RFC 4648 base64 to either encrypt or decrypt this resource. returned: success type: str - rsa_encrypted_key: + rsaEncryptedKey: description: - Specifies an RFC 4648 base64 encoded, RSA-wrapped 2048-bit customer-supplied encryption key to either encrypt or decrypt this resource. @@ -514,7 +514,7 @@ a unique index number. If not specified, the server will choose an appropriate value. returned: success type: int - initialize_params: + initializeParams: description: - Specifies the parameters for a new disk that will be created alongside the new instance. Use initialization parameters to create boot disks or local SSDs attached to the @@ -522,32 +522,32 @@ returned: success type: complex contains: - disk_name: + diskName: description: - Specifies the disk name. If not specified, the default is to use the name of the instance. returned: success type: str - disk_size_gb: + diskSizeGb: description: - Specifies the size of the disk in base-2 GB. returned: success type: int - disk_type: + diskType: description: - Reference to a gcompute_disk_type resource. - Specifies the disk type to use to create the instance. - If not specified, the default is pd-standard. returned: success type: str - source_image: + sourceImage: description: - The source image to create this disk. When creating a new instance, one of initializeParams.sourceImage or disks.source is required. To create a disk with one of the public operating system images, specify the image by its family name. returned: success type: str - source_image_encryption_key: + sourceImageEncryptionKey: description: - The customer-supplied encryption key of the source image. Required if the source image is protected by a customer-supplied encryption key. @@ -557,7 +557,7 @@ returned: success type: complex contains: - raw_key: + rawKey: description: - Specifies a 256-bit customer-supplied encryption key, encoded in RFC 4648 base64 to either encrypt or decrypt this resource. @@ -598,7 +598,7 @@ the default is PERSISTENT. returned: success type: str - machine_type: + machineType: description: - Reference to a gcompute_machine_type resource. returned: success @@ -609,23 +609,23 @@ These pairs can consist of custom metadata or predefined keys. returned: success type: dict - guest_accelerators: + guestAccelerators: description: - List of the type and count of accelerator cards attached to the instance . returned: success type: complex contains: - accelerator_count: + acceleratorCount: description: - The number of the guest accelerator cards exposed to this instance. returned: success type: int - accelerator_type: + acceleratorType: description: - Full or partial URL of the accelerator type resource to expose to this instance. returned: success type: str - network_interfaces: + networkInterfaces: description: - An array of configurations for this interface. This specifies how this interface is configured to interact with other network services, such as connecting to the @@ -633,7 +633,7 @@ returned: success type: complex contains: - access_configs: + accessConfigs: description: - An array of configurations for this interface. Currently, only one access config, ONE_TO_ONE_NAT, is supported. If there are no accessConfigs specified, then this @@ -648,7 +648,7 @@ IP or Network Access. returned: success type: str - nat_ip: + natIP: description: - Specifies the title of a gcompute_address. - An external IP address associated with this instance. @@ -663,14 +663,14 @@ - The type of configuration. The default and only option is ONE_TO_ONE_NAT. returned: success type: str - alias_ip_ranges: + aliasIpRanges: description: - An array of alias IP ranges for this network interface. Can only be specified for network interfaces on subnet-mode networks. returned: success type: complex contains: - ip_cidr_range: + ipCidrRange: description: - The IP CIDR range represented by this alias IP range. - This IP CIDR range must belong to the specified subnetwork and cannot contain IP @@ -679,7 +679,7 @@ (e.g. 10.1.2.0/24). returned: success type: str - subnetwork_range_name: + subnetworkRangeName: description: - Optional subnetwork secondary range name specifying the secondary range from which to allocate the IP CIDR range for this alias IP range. If left unspecified, the @@ -700,7 +700,7 @@ is inferred. returned: success type: dict - network_ip: + networkIP: description: - An IPv4 internal network address to assign to the instance for this network interface. If not specified by the user, an unused internal IP is assigned by the system. @@ -720,7 +720,7 @@ returned: success type: complex contains: - automatic_restart: + automaticRestart: description: - Specifies whether the instance should be automatically restarted if it is terminated by Compute Engine (not terminated by a user). @@ -728,7 +728,7 @@ instances cannot be automatically restarted. returned: success type: bool - on_host_maintenance: + onHostMaintenance: description: - Defines the maintenance behavior for this instance. For standard instances, the default behavior is MIGRATE. For preemptible instances, the default and only possible @@ -742,7 +742,7 @@ creation, it cannot be set or changed after the instance has been created. returned: success type: bool - service_accounts: + serviceAccounts: description: - A list of service accounts, with their specified scopes, authorized for this instance. Only one service account per VM instance is supported. diff --git a/lib/ansible/modules/cloud/google/gcp_compute_instance_template_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_instance_template_facts.py index 1c2c994e7c679f..5d687b9d9284ae 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_instance_template_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_instance_template_facts.py @@ -66,7 +66,7 @@ returned: always type: complex contains: - creation_timestamp: + creationTimestamp: description: - Creation timestamp in RFC3339 text format. returned: success @@ -93,7 +93,7 @@ returned: success type: complex contains: - can_ip_forward: + canIpForward: description: - Enables instances created based on this template to send packets with source IP addresses other than their own and receive packets with destination IP addresses @@ -115,7 +115,7 @@ returned: success type: complex contains: - auto_delete: + autoDelete: description: - Specifies whether the disk will be auto-deleted when the instance is deleted (but not when the disk is detached from the instance). @@ -129,26 +129,26 @@ of the disk for its root filesystem. returned: success type: bool - device_name: + deviceName: description: - Specifies a unique device name of your choice that is reflected into the /dev/disk/by-id/google-* tree of a Linux operating system running within the instance. This name can be used to reference the device for mounting, resizing, and so on, from within the instance. returned: success type: str - disk_encryption_key: + diskEncryptionKey: description: - Encrypts or decrypts a disk using a customer-supplied encryption key. returned: success type: complex contains: - raw_key: + rawKey: description: - Specifies a 256-bit customer-supplied encryption key, encoded in RFC 4648 base64 to either encrypt or decrypt this resource. returned: success type: str - rsa_encrypted_key: + rsaEncryptedKey: description: - Specifies an RFC 4648 base64 encoded, RSA-wrapped 2048-bit customer-supplied encryption key to either encrypt or decrypt this resource. @@ -167,7 +167,7 @@ a unique index number. If not specified, the server will choose an appropriate value. returned: success type: int - initialize_params: + initializeParams: description: - Specifies the parameters for a new disk that will be created alongside the new instance. Use initialization parameters to create boot disks or local SSDs attached to the @@ -175,32 +175,32 @@ returned: success type: complex contains: - disk_name: + diskName: description: - Specifies the disk name. If not specified, the default is to use the name of the instance. returned: success type: str - disk_size_gb: + diskSizeGb: description: - Specifies the size of the disk in base-2 GB. returned: success type: int - disk_type: + diskType: description: - Reference to a gcompute_disk_type resource. - Specifies the disk type to use to create the instance. - If not specified, the default is pd-standard. returned: success type: str - source_image: + sourceImage: description: - The source image to create this disk. When creating a new instance, one of initializeParams.sourceImage or disks.source is required. To create a disk with one of the public operating system images, specify the image by its family name. returned: success type: str - source_image_encryption_key: + sourceImageEncryptionKey: description: - The customer-supplied encryption key of the source image. Required if the source image is protected by a customer-supplied encryption key. @@ -210,7 +210,7 @@ returned: success type: complex contains: - raw_key: + rawKey: description: - Specifies a 256-bit customer-supplied encryption key, encoded in RFC 4648 base64 to either encrypt or decrypt this resource. @@ -251,7 +251,7 @@ the default is PERSISTENT. returned: success type: str - machine_type: + machineType: description: - Reference to a gcompute_machine_type resource. returned: success @@ -262,23 +262,23 @@ These pairs can consist of custom metadata or predefined keys. returned: success type: dict - guest_accelerators: + guestAccelerators: description: - List of the type and count of accelerator cards attached to the instance . returned: success type: complex contains: - accelerator_count: + acceleratorCount: description: - The number of the guest accelerator cards exposed to this instance. returned: success type: int - accelerator_type: + acceleratorType: description: - Full or partial URL of the accelerator type resource to expose to this instance. returned: success type: str - network_interfaces: + networkInterfaces: description: - An array of configurations for this interface. This specifies how this interface is configured to interact with other network services, such as connecting to the @@ -286,7 +286,7 @@ returned: success type: complex contains: - access_configs: + accessConfigs: description: - An array of configurations for this interface. Currently, only one access config, ONE_TO_ONE_NAT, is supported. If there are no accessConfigs specified, then this @@ -301,7 +301,7 @@ IP or Network Access. returned: success type: str - nat_ip: + natIP: description: - Specifies the title of a gcompute_address. - An external IP address associated with this instance. @@ -316,14 +316,14 @@ - The type of configuration. The default and only option is ONE_TO_ONE_NAT. returned: success type: str - alias_ip_ranges: + aliasIpRanges: description: - An array of alias IP ranges for this network interface. Can only be specified for network interfaces on subnet-mode networks. returned: success type: complex contains: - ip_cidr_range: + ipCidrRange: description: - The IP CIDR range represented by this alias IP range. - This IP CIDR range must belong to the specified subnetwork and cannot contain IP @@ -332,7 +332,7 @@ (e.g. 10.1.2.0/24). returned: success type: str - subnetwork_range_name: + subnetworkRangeName: description: - Optional subnetwork secondary range name specifying the secondary range from which to allocate the IP CIDR range for this alias IP range. If left unspecified, the @@ -353,7 +353,7 @@ is inferred. returned: success type: dict - network_ip: + networkIP: description: - An IPv4 internal network address to assign to the instance for this network interface. If not specified by the user, an unused internal IP is assigned by the system. @@ -373,7 +373,7 @@ returned: success type: complex contains: - automatic_restart: + automaticRestart: description: - Specifies whether the instance should be automatically restarted if it is terminated by Compute Engine (not terminated by a user). @@ -381,7 +381,7 @@ instances cannot be automatically restarted. returned: success type: bool - on_host_maintenance: + onHostMaintenance: description: - Defines the maintenance behavior for this instance. For standard instances, the default behavior is MIGRATE. For preemptible instances, the default and only possible @@ -395,7 +395,7 @@ creation, it cannot be set or changed after the instance has been created. returned: success type: bool - service_accounts: + serviceAccounts: description: - A list of service accounts, with their specified scopes, authorized for this instance. Only one service account per VM instance is supported. diff --git a/lib/ansible/modules/cloud/google/gcp_compute_network.py b/lib/ansible/modules/cloud/google/gcp_compute_network.py index 4ed2e2cab53b79..a7b52018bc9f2f 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_network.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_network.py @@ -146,7 +146,7 @@ - Server-defined fully-qualified URLs for all subnetworks in this network. returned: success type: list - auto_create_subnetworks: + autoCreateSubnetworks: description: - When set to true, the network is created in "auto subnet mode". When set to false, the network is in "custom subnet mode". @@ -154,7 +154,7 @@ and it automatically creates one subnetwork per region. returned: success type: bool - creation_timestamp: + creationTimestamp: description: - Creation timestamp in RFC3339 text format. returned: success diff --git a/lib/ansible/modules/cloud/google/gcp_compute_network_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_network_facts.py index 5cebe4725b98d1..6ba8542a1bbd9d 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_network_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_network_facts.py @@ -106,7 +106,7 @@ - Server-defined fully-qualified URLs for all subnetworks in this network. returned: success type: list - auto_create_subnetworks: + autoCreateSubnetworks: description: - When set to true, the network is created in "auto subnet mode". When set to false, the network is in "custom subnet mode". @@ -114,7 +114,7 @@ and it automatically creates one subnetwork per region. returned: success type: bool - creation_timestamp: + creationTimestamp: description: - Creation timestamp in RFC3339 text format. returned: success diff --git a/lib/ansible/modules/cloud/google/gcp_compute_route.py b/lib/ansible/modules/cloud/google/gcp_compute_route.py index b4102eb977df71..8cdfedf71a12a1 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_route.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_route.py @@ -152,7 +152,7 @@ ''' RETURN = ''' - dest_range: + destRange: description: - The destination range of outgoing packets that this route applies to. - Only IPv4 is supported. @@ -193,7 +193,7 @@ - A list of instance tags to which this route applies. returned: success type: list - next_hop_gateway: + nextHopGateway: description: - URL to a gateway that should handle matching packets. - 'Currently, you can only specify the internet gateway, using a full or partial valid @@ -202,7 +202,7 @@ .' returned: success type: str - next_hop_instance: + nextHopInstance: description: - URL to an instance that should handle matching packets. - 'You can specify this as a full or partial URL. For example: * U(https://www.googleapis.com/compute/v1/projects/project/zones/zone/) @@ -210,17 +210,17 @@ .' returned: success type: str - next_hop_ip: + nextHopIp: description: - Network IP address of an instance that should handle matching packets. returned: success type: str - next_hop_vpn_tunnel: + nextHopVpnTunnel: description: - URL to a VpnTunnel that should handle matching packets. returned: success type: str - next_hop_network: + nextHopNetwork: description: - URL to a Network that should handle matching packets. returned: success diff --git a/lib/ansible/modules/cloud/google/gcp_compute_route_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_route_facts.py index 84dad393332e67..312d9af00cf598 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_route_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_route_facts.py @@ -66,7 +66,7 @@ returned: always type: complex contains: - dest_range: + destRange: description: - The destination range of outgoing packets that this route applies to. - Only IPv4 is supported. @@ -107,7 +107,7 @@ - A list of instance tags to which this route applies. returned: success type: list - next_hop_gateway: + nextHopGateway: description: - URL to a gateway that should handle matching packets. - 'Currently, you can only specify the internet gateway, using a full or partial valid @@ -116,7 +116,7 @@ .' returned: success type: str - next_hop_instance: + nextHopInstance: description: - URL to an instance that should handle matching packets. - 'You can specify this as a full or partial URL. For example: * U(https://www.googleapis.com/compute/v1/projects/project/zones/zone/) @@ -124,17 +124,17 @@ .' returned: success type: str - next_hop_ip: + nextHopIp: description: - Network IP address of an instance that should handle matching packets. returned: success type: str - next_hop_vpn_tunnel: + nextHopVpnTunnel: description: - URL to a VpnTunnel that should handle matching packets. returned: success type: str - next_hop_network: + nextHopNetwork: description: - URL to a Network that should handle matching packets. returned: success diff --git a/lib/ansible/modules/cloud/google/gcp_compute_router.py b/lib/ansible/modules/cloud/google/gcp_compute_router.py index e1f945310f8231..000ce527b99fa6 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_router.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_router.py @@ -149,7 +149,7 @@ - The unique identifier for the resource. returned: success type: int - creation_timestamp: + creationTimestamp: description: - Creation timestamp in RFC3339 text format. returned: success @@ -186,13 +186,13 @@ that link to this router will have the same local ASN. returned: success type: int - advertise_mode: + advertiseMode: description: - User-specified flag to indicate which mode to use for advertisement. - 'Valid values of this enum field are: DEFAULT, CUSTOM .' returned: success type: str - advertised_groups: + advertisedGroups: description: - User-specified list of prefix groups to advertise in custom mode. - This field can only be populated if advertiseMode is CUSTOM and is advertised to @@ -201,7 +201,7 @@ - 'This enum field has the one valid value: ALL_SUBNETS .' returned: success type: list - advertised_ip_ranges: + advertisedIpRanges: description: - User-specified list of individual IP ranges to advertise in custom mode. This field can only be populated if advertiseMode is CUSTOM and is advertised to all peers diff --git a/lib/ansible/modules/cloud/google/gcp_compute_router_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_router_facts.py index fcc962972d06f0..ae9057d727fb8a 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_router_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_router_facts.py @@ -76,7 +76,7 @@ - The unique identifier for the resource. returned: success type: int - creation_timestamp: + creationTimestamp: description: - Creation timestamp in RFC3339 text format. returned: success @@ -113,13 +113,13 @@ that link to this router will have the same local ASN. returned: success type: int - advertise_mode: + advertiseMode: description: - User-specified flag to indicate which mode to use for advertisement. - 'Valid values of this enum field are: DEFAULT, CUSTOM .' returned: success type: str - advertised_groups: + advertisedGroups: description: - User-specified list of prefix groups to advertise in custom mode. - This field can only be populated if advertiseMode is CUSTOM and is advertised to @@ -128,7 +128,7 @@ - 'This enum field has the one valid value: ALL_SUBNETS .' returned: success type: list - advertised_ip_ranges: + advertisedIpRanges: description: - User-specified list of individual IP ranges to advertise in custom mode. This field can only be populated if advertiseMode is CUSTOM and is advertised to all peers diff --git a/lib/ansible/modules/cloud/google/gcp_compute_ssl_certificate.py b/lib/ansible/modules/cloud/google/gcp_compute_ssl_certificate.py index 612d20ceaa532a..853c1bde987818 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_ssl_certificate.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_ssl_certificate.py @@ -120,7 +120,7 @@ - The chain must include at least one intermediate cert. returned: success type: str - creation_timestamp: + creationTimestamp: description: - Creation timestamp in RFC3339 text format. returned: success @@ -145,7 +145,7 @@ be a dash. returned: success type: str - private_key: + privateKey: description: - The write-only private key in PEM format. returned: success diff --git a/lib/ansible/modules/cloud/google/gcp_compute_ssl_certificate_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_ssl_certificate_facts.py index a922fbbb96f3c8..4fc37c9483f34f 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_ssl_certificate_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_ssl_certificate_facts.py @@ -73,7 +73,7 @@ - The chain must include at least one intermediate cert. returned: success type: str - creation_timestamp: + creationTimestamp: description: - Creation timestamp in RFC3339 text format. returned: success @@ -98,7 +98,7 @@ be a dash. returned: success type: str - private_key: + privateKey: description: - The write-only private key in PEM format. returned: success diff --git a/lib/ansible/modules/cloud/google/gcp_compute_ssl_policy.py b/lib/ansible/modules/cloud/google/gcp_compute_ssl_policy.py index 4726228965ca65..2cf9aaf8a0f707 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_ssl_policy.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_ssl_policy.py @@ -102,7 +102,7 @@ ''' RETURN = ''' - creation_timestamp: + creationTimestamp: description: - Creation timestamp in RFC3339 text format. returned: success @@ -135,18 +135,18 @@ in the `customFeatures` field. returned: success type: str - min_tls_version: + minTlsVersion: description: - The minimum version of SSL protocol that can be used by the clients to establish a connection with the load balancer. This can be one of `TLS_1_0`, `TLS_1_1`, `TLS_1_2`. returned: success type: str - enabled_features: + enabledFeatures: description: - The list of features enabled in the SSL policy. returned: success type: list - custom_features: + customFeatures: description: - A list of features enabled when the selected profile is CUSTOM. The method returns the set of features that can be specified in this list. This field must be empty diff --git a/lib/ansible/modules/cloud/google/gcp_compute_ssl_policy_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_ssl_policy_facts.py index 1c15a8b327696b..80de3606b99228 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_ssl_policy_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_ssl_policy_facts.py @@ -66,7 +66,7 @@ returned: always type: complex contains: - creation_timestamp: + creationTimestamp: description: - Creation timestamp in RFC3339 text format. returned: success @@ -99,18 +99,18 @@ in the `customFeatures` field. returned: success type: str - min_tls_version: + minTlsVersion: description: - The minimum version of SSL protocol that can be used by the clients to establish a connection with the load balancer. This can be one of `TLS_1_0`, `TLS_1_1`, `TLS_1_2`. returned: success type: str - enabled_features: + enabledFeatures: description: - The list of features enabled in the SSL policy. returned: success type: list - custom_features: + customFeatures: description: - A list of features enabled when the selected profile is CUSTOM. The method returns the set of features that can be specified in this list. This field must be empty diff --git a/lib/ansible/modules/cloud/google/gcp_compute_subnetwork.py b/lib/ansible/modules/cloud/google/gcp_compute_subnetwork.py index d2fe01110c72b2..4310c68a24ad23 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_subnetwork.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_subnetwork.py @@ -129,7 +129,7 @@ ''' RETURN = ''' - creation_timestamp: + creationTimestamp: description: - Creation timestamp in RFC3339 text format. returned: success @@ -140,7 +140,7 @@ the resource. This field can be set only at resource creation time. returned: success type: str - gateway_address: + gatewayAddress: description: - The gateway address for default routes to reach destination addresses outside this subnetwork. @@ -151,7 +151,7 @@ - The unique identifier for the resource. returned: success type: int - ip_cidr_range: + ipCidrRange: description: - The range of internal addresses that are owned by this subnetwork. - Provide this property when you create the subnetwork. For example, 10.0.0.0/8 or @@ -175,7 +175,7 @@ - Only networks that are in the distributed mode can have subnetworks. returned: success type: dict - private_ip_google_access: + privateIpGoogleAccess: description: - Whether the VMs in this subnet can access Google services without assigned external IP addresses. diff --git a/lib/ansible/modules/cloud/google/gcp_compute_subnetwork_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_subnetwork_facts.py index 38918a6fca08bf..f48a1191f85163 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_subnetwork_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_subnetwork_facts.py @@ -71,7 +71,7 @@ returned: always type: complex contains: - creation_timestamp: + creationTimestamp: description: - Creation timestamp in RFC3339 text format. returned: success @@ -82,7 +82,7 @@ the resource. This field can be set only at resource creation time. returned: success type: str - gateway_address: + gatewayAddress: description: - The gateway address for default routes to reach destination addresses outside this subnetwork. @@ -93,7 +93,7 @@ - The unique identifier for the resource. returned: success type: int - ip_cidr_range: + ipCidrRange: description: - The range of internal addresses that are owned by this subnetwork. - Provide this property when you create the subnetwork. For example, 10.0.0.0/8 or @@ -117,7 +117,7 @@ - Only networks that are in the distributed mode can have subnetworks. returned: success type: dict - private_ip_google_access: + privateIpGoogleAccess: description: - Whether the VMs in this subnet can access Google services without assigned external IP addresses. diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_http_proxy.py b/lib/ansible/modules/cloud/google/gcp_compute_target_http_proxy.py index 5bd7524b15b85b..cfe530b98f6594 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_http_proxy.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_http_proxy.py @@ -129,7 +129,7 @@ ''' RETURN = ''' - creation_timestamp: + creationTimestamp: description: - Creation timestamp in RFC3339 text format. returned: success @@ -154,7 +154,7 @@ be a dash. returned: success type: str - url_map: + urlMap: description: - A reference to the UrlMap resource that defines the mapping from URL to the BackendService. returned: success diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_http_proxy_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_target_http_proxy_facts.py index c17e74dadaf2d8..0506a929cacfa8 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_http_proxy_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_http_proxy_facts.py @@ -66,7 +66,7 @@ returned: always type: complex contains: - creation_timestamp: + creationTimestamp: description: - Creation timestamp in RFC3339 text format. returned: success @@ -91,7 +91,7 @@ be a dash. returned: success type: str - url_map: + urlMap: description: - A reference to the UrlMap resource that defines the mapping from URL to the BackendService. returned: success diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_https_proxy.py b/lib/ansible/modules/cloud/google/gcp_compute_target_https_proxy.py index 568fafa83c25c4..cf6255e7719317 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_https_proxy.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_https_proxy.py @@ -180,7 +180,7 @@ ''' RETURN = ''' - creation_timestamp: + creationTimestamp: description: - Creation timestamp in RFC3339 text format. returned: success @@ -205,7 +205,7 @@ be a dash. returned: success type: str - quic_override: + quicOverride: description: - Specifies the QUIC override policy for this resource. This determines whether the load balancer will attempt to negotiate QUIC with clients or not. Can specify one @@ -214,13 +214,13 @@ to specifying NONE. returned: success type: str - ssl_certificates: + sslCertificates: description: - A list of SslCertificate resources that are used to authenticate connections between users and the load balancer. Currently, exactly one SSL certificate must be specified. returned: success type: list - url_map: + urlMap: description: - A reference to the UrlMap resource that defines the mapping from URL to the BackendService. returned: success diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_https_proxy_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_target_https_proxy_facts.py index 9b746963994cf7..1b536b643bba2d 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_https_proxy_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_https_proxy_facts.py @@ -66,7 +66,7 @@ returned: always type: complex contains: - creation_timestamp: + creationTimestamp: description: - Creation timestamp in RFC3339 text format. returned: success @@ -91,7 +91,7 @@ be a dash. returned: success type: str - quic_override: + quicOverride: description: - Specifies the QUIC override policy for this resource. This determines whether the load balancer will attempt to negotiate QUIC with clients or not. Can specify one @@ -100,13 +100,13 @@ to specifying NONE. returned: success type: str - ssl_certificates: + sslCertificates: description: - A list of SslCertificate resources that are used to authenticate connections between users and the load balancer. Currently, exactly one SSL certificate must be specified. returned: success type: list - url_map: + urlMap: description: - A reference to the UrlMap resource that defines the mapping from URL to the BackendService. returned: success diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_pool.py b/lib/ansible/modules/cloud/google/gcp_compute_target_pool.py index 9a1c608f8e6459..8ce682cecb5440 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_pool.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_pool.py @@ -131,7 +131,7 @@ ''' RETURN = ''' - backup_pool: + backupPool: description: - This field is applicable only when the containing target pool is serving a forwarding rule as the primary pool, and its failoverRatio field is properly set to a value @@ -146,7 +146,7 @@ with the best effort, or to all instances when no instance is healthy. returned: success type: dict - creation_timestamp: + creationTimestamp: description: - Creation timestamp in RFC3339 text format. returned: success @@ -156,7 +156,7 @@ - An optional description of this resource. returned: success type: str - failover_ratio: + failoverRatio: description: - This field is applicable only when the containing target pool is serving a forwarding rule as the primary pool (i.e., not as a backup pool to some other target pool). @@ -171,7 +171,7 @@ or to all instances when no instance is healthy. returned: success type: str - health_check: + healthCheck: description: - A reference to a HttpHealthCheck resource. - A member instance in this pool is considered healthy if and only if the health checks @@ -200,7 +200,7 @@ be a dash. returned: success type: str - session_affinity: + sessionAffinity: description: - 'Session affinity option. Must be one of these values: - NONE: Connections from the same client IP may go to any instance in the pool.' diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_pool_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_target_pool_facts.py index 2699076fb6fd78..a7383290418309 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_pool_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_pool_facts.py @@ -71,7 +71,7 @@ returned: always type: complex contains: - backup_pool: + backupPool: description: - This field is applicable only when the containing target pool is serving a forwarding rule as the primary pool, and its failoverRatio field is properly set to a value @@ -86,7 +86,7 @@ with the best effort, or to all instances when no instance is healthy. returned: success type: dict - creation_timestamp: + creationTimestamp: description: - Creation timestamp in RFC3339 text format. returned: success @@ -96,7 +96,7 @@ - An optional description of this resource. returned: success type: str - failover_ratio: + failoverRatio: description: - This field is applicable only when the containing target pool is serving a forwarding rule as the primary pool (i.e., not as a backup pool to some other target pool). @@ -111,7 +111,7 @@ or to all instances when no instance is healthy. returned: success type: str - health_check: + healthCheck: description: - A reference to a HttpHealthCheck resource. - A member instance in this pool is considered healthy if and only if the health checks @@ -140,7 +140,7 @@ be a dash. returned: success type: str - session_affinity: + sessionAffinity: description: - 'Session affinity option. Must be one of these values: - NONE: Connections from the same client IP may go to any instance in the pool.' diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_ssl_proxy.py b/lib/ansible/modules/cloud/google/gcp_compute_target_ssl_proxy.py index a8db3628205940..08a4321f81ad97 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_ssl_proxy.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_ssl_proxy.py @@ -170,7 +170,7 @@ ''' RETURN = ''' - creation_timestamp: + creationTimestamp: description: - Creation timestamp in RFC3339 text format. returned: success @@ -195,7 +195,7 @@ be a dash. returned: success type: str - proxy_header: + proxyHeader: description: - Specifies the type of proxy header to append before sending data to the backend, either NONE or PROXY_V1. The default is NONE. @@ -206,7 +206,7 @@ - A reference to the BackendService resource. returned: success type: dict - ssl_certificates: + sslCertificates: description: - A list of SslCertificate resources that are used to authenticate connections between users and the load balancer. Currently, exactly one SSL certificate must be specified. diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_ssl_proxy_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_target_ssl_proxy_facts.py index dcfc8baa4355ee..47c4a707ff4300 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_ssl_proxy_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_ssl_proxy_facts.py @@ -66,7 +66,7 @@ returned: always type: complex contains: - creation_timestamp: + creationTimestamp: description: - Creation timestamp in RFC3339 text format. returned: success @@ -91,7 +91,7 @@ be a dash. returned: success type: str - proxy_header: + proxyHeader: description: - Specifies the type of proxy header to append before sending data to the backend, either NONE or PROXY_V1. The default is NONE. @@ -102,7 +102,7 @@ - A reference to the BackendService resource. returned: success type: dict - ssl_certificates: + sslCertificates: description: - A list of SslCertificate resources that are used to authenticate connections between users and the load balancer. Currently, exactly one SSL certificate must be specified. diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_tcp_proxy.py b/lib/ansible/modules/cloud/google/gcp_compute_target_tcp_proxy.py index 05f1580bfc8b5c..93a1ec23869b8a 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_tcp_proxy.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_tcp_proxy.py @@ -130,7 +130,7 @@ ''' RETURN = ''' - creation_timestamp: + creationTimestamp: description: - Creation timestamp in RFC3339 text format. returned: success @@ -155,7 +155,7 @@ be a dash. returned: success type: str - proxy_header: + proxyHeader: description: - Specifies the type of proxy header to append before sending data to the backend, either NONE or PROXY_V1. The default is NONE. diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_tcp_proxy_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_target_tcp_proxy_facts.py index a52c9f27ae9b28..158198ced71297 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_tcp_proxy_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_tcp_proxy_facts.py @@ -66,7 +66,7 @@ returned: always type: complex contains: - creation_timestamp: + creationTimestamp: description: - Creation timestamp in RFC3339 text format. returned: success @@ -91,7 +91,7 @@ be a dash. returned: success type: str - proxy_header: + proxyHeader: description: - Specifies the type of proxy header to append before sending data to the backend, either NONE or PROXY_V1. The default is NONE. diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_vpn_gateway.py b/lib/ansible/modules/cloud/google/gcp_compute_target_vpn_gateway.py index 89a02ea61e8c84..4cee5e0518f324 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_vpn_gateway.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_vpn_gateway.py @@ -105,7 +105,7 @@ ''' RETURN = ''' - creation_timestamp: + creationTimestamp: description: - Creation timestamp in RFC3339 text format. returned: success @@ -140,7 +140,7 @@ - A list of references to VpnTunnel resources associated to this VPN gateway. returned: success type: list - forwarding_rules: + forwardingRules: description: - A list of references to the ForwardingRule resources associated to this VPN gateway. returned: success diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_vpn_gateway_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_target_vpn_gateway_facts.py index b68ed93e832289..f2d65dca94f2a5 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_vpn_gateway_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_vpn_gateway_facts.py @@ -71,7 +71,7 @@ returned: always type: complex contains: - creation_timestamp: + creationTimestamp: description: - Creation timestamp in RFC3339 text format. returned: success @@ -106,7 +106,7 @@ - A list of references to VpnTunnel resources associated to this VPN gateway. returned: success type: list - forwarding_rules: + forwardingRules: description: - A list of references to the ForwardingRule resources associated to this VPN gateway. returned: success diff --git a/lib/ansible/modules/cloud/google/gcp_compute_url_map.py b/lib/ansible/modules/cloud/google/gcp_compute_url_map.py index de594bf50bd66d..3c3e0ff8857607 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_url_map.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_url_map.py @@ -193,12 +193,12 @@ ''' RETURN = ''' - creation_timestamp: + creationTimestamp: description: - Creation timestamp in RFC3339 text format. returned: success type: str - default_service: + defaultService: description: - A reference to BackendService resource if none of the hostRules match. returned: success @@ -209,7 +209,7 @@ the resource. returned: success type: str - host_rules: + hostRules: description: - The list of HostRules to use against the URL. returned: success @@ -228,7 +228,7 @@ must be followed in the pattern by either - or . returned: success type: list - path_matcher: + pathMatcher: description: - The name of the PathMatcher to use to match the path portion of the URL if the hostRule matches the URL's host portion. @@ -249,13 +249,13 @@ be a dash. returned: success type: str - path_matchers: + pathMatchers: description: - The list of named PathMatchers to use against the URL. returned: success type: complex contains: - default_service: + defaultService: description: - A reference to a BackendService resource. This will be used if none of the pathRules defined by this PathMatcher is matched by the URL's path portion. @@ -271,7 +271,7 @@ - The name to which this PathMatcher is referred by the HostRule. returned: success type: str - path_rules: + pathRules: description: - The list of path rules. returned: success diff --git a/lib/ansible/modules/cloud/google/gcp_compute_url_map_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_url_map_facts.py index ca5c6762faae7b..6636e474dbc229 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_url_map_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_url_map_facts.py @@ -66,12 +66,12 @@ returned: always type: complex contains: - creation_timestamp: + creationTimestamp: description: - Creation timestamp in RFC3339 text format. returned: success type: str - default_service: + defaultService: description: - A reference to BackendService resource if none of the hostRules match. returned: success @@ -82,7 +82,7 @@ the resource. returned: success type: str - host_rules: + hostRules: description: - The list of HostRules to use against the URL. returned: success @@ -101,7 +101,7 @@ must be followed in the pattern by either - or . returned: success type: list - path_matcher: + pathMatcher: description: - The name of the PathMatcher to use to match the path portion of the URL if the hostRule matches the URL's host portion. @@ -122,13 +122,13 @@ be a dash. returned: success type: str - path_matchers: + pathMatchers: description: - The list of named PathMatchers to use against the URL. returned: success type: complex contains: - default_service: + defaultService: description: - A reference to a BackendService resource. This will be used if none of the pathRules defined by this PathMatcher is matched by the URL's path portion. @@ -144,7 +144,7 @@ - The name to which this PathMatcher is referred by the HostRule. returned: success type: str - path_rules: + pathRules: description: - The list of path rules. returned: success diff --git a/lib/ansible/modules/cloud/google/gcp_compute_vpn_tunnel.py b/lib/ansible/modules/cloud/google/gcp_compute_vpn_tunnel.py index 2308285aafe0fe..82ab6a4fc52a80 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_vpn_tunnel.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_vpn_tunnel.py @@ -164,7 +164,7 @@ ''' RETURN = ''' - creation_timestamp: + creationTimestamp: description: - Creation timestamp in RFC3339 text format. returned: success @@ -183,7 +183,7 @@ - An optional description of this resource. returned: success type: str - target_vpn_gateway: + targetVpnGateway: description: - URL of the Target VPN gateway with which this VPN tunnel is associated. returned: success @@ -193,29 +193,29 @@ - URL of router resource to be used for dynamic routing. returned: success type: dict - peer_ip: + peerIp: description: - IP address of the peer VPN gateway. Only IPv4 is supported. returned: success type: str - shared_secret: + sharedSecret: description: - Shared secret used to set the secure session between the Cloud VPN gateway and the peer VPN gateway. returned: success type: str - shared_secret_hash: + sharedSecretHash: description: - Hash of the shared secret. returned: success type: str - ike_version: + ikeVersion: description: - IKE protocol version to use when establishing the VPN tunnel with peer VPN gateway. - Acceptable IKE versions are 1 or 2. Default version is 2. returned: success type: int - local_traffic_selector: + localTrafficSelector: description: - Local traffic selector to use when establishing the VPN tunnel with peer VPN gateway. The value should be a CIDR formatted string, for example `192.168.0.0/16`. The ranges @@ -223,7 +223,7 @@ - Only IPv4 is supported. returned: success type: list - remote_traffic_selector: + remoteTrafficSelector: description: - Remote traffic selector to use when establishing the VPN tunnel with peer VPN gateway. The value should be a CIDR formatted string, for example `192.168.0.0/16`. The ranges @@ -236,7 +236,7 @@ - Labels to apply to this VpnTunnel. returned: success type: dict - label_fingerprint: + labelFingerprint: description: - The fingerprint used for optimistic locking of this resource. Used internally during updates. diff --git a/lib/ansible/modules/cloud/google/gcp_compute_vpn_tunnel_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_vpn_tunnel_facts.py index 437ce212577f1f..f1f479205da84e 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_vpn_tunnel_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_vpn_tunnel_facts.py @@ -71,7 +71,7 @@ returned: always type: complex contains: - creation_timestamp: + creationTimestamp: description: - Creation timestamp in RFC3339 text format. returned: success @@ -90,7 +90,7 @@ - An optional description of this resource. returned: success type: str - target_vpn_gateway: + targetVpnGateway: description: - URL of the Target VPN gateway with which this VPN tunnel is associated. returned: success @@ -100,29 +100,29 @@ - URL of router resource to be used for dynamic routing. returned: success type: dict - peer_ip: + peerIp: description: - IP address of the peer VPN gateway. Only IPv4 is supported. returned: success type: str - shared_secret: + sharedSecret: description: - Shared secret used to set the secure session between the Cloud VPN gateway and the peer VPN gateway. returned: success type: str - shared_secret_hash: + sharedSecretHash: description: - Hash of the shared secret. returned: success type: str - ike_version: + ikeVersion: description: - IKE protocol version to use when establishing the VPN tunnel with peer VPN gateway. - Acceptable IKE versions are 1 or 2. Default version is 2. returned: success type: int - local_traffic_selector: + localTrafficSelector: description: - Local traffic selector to use when establishing the VPN tunnel with peer VPN gateway. The value should be a CIDR formatted string, for example `192.168.0.0/16`. The ranges @@ -130,7 +130,7 @@ - Only IPv4 is supported. returned: success type: list - remote_traffic_selector: + remoteTrafficSelector: description: - Remote traffic selector to use when establishing the VPN tunnel with peer VPN gateway. The value should be a CIDR formatted string, for example `192.168.0.0/16`. The ranges @@ -143,7 +143,7 @@ - Labels to apply to this VpnTunnel. returned: success type: dict - label_fingerprint: + labelFingerprint: description: - The fingerprint used for optimistic locking of this resource. Used internally during updates. diff --git a/lib/ansible/modules/cloud/google/gcp_container_cluster.py b/lib/ansible/modules/cloud/google/gcp_container_cluster.py index e8fde7a8e71f3e..c8ac6742f5c2d5 100644 --- a/lib/ansible/modules/cloud/google/gcp_container_cluster.py +++ b/lib/ansible/modules/cloud/google/gcp_container_cluster.py @@ -286,7 +286,7 @@ - An optional description of this cluster. returned: success type: str - initial_node_count: + initialNodeCount: description: - The number of nodes to create in this cluster. You must ensure that your Compute Engine resource quota is sufficient for this number of instances. You must also @@ -296,7 +296,7 @@ this and a nodePool at the same time. returned: success type: int - node_config: + nodeConfig: description: - Parameters used in creating the cluster's nodes. - For requests, this field should only be used in lieu of a "nodePool" object, since @@ -307,19 +307,19 @@ returned: success type: complex contains: - machine_type: + machineType: description: - The name of a Google Compute Engine machine type (e.g. - n1-standard-1). If unspecified, the default machine type is n1-standard-1. returned: success type: str - disk_size_gb: + diskSizeGb: description: - Size of the disk attached to each node, specified in GB. The smallest allowed disk size is 10GB. If unspecified, the default disk size is 100GB. returned: success type: int - oauth_scopes: + oauthScopes: description: - The set of Google API scopes to be made available on all of the node VMs under the "default" service account. @@ -332,7 +332,7 @@ enabled, in which case their required scopes will be added. returned: success type: list - service_account: + serviceAccount: description: - The Google Cloud Platform Service Account to be used by the node VMs. If no Service Account is specified, the "default" service account is used. @@ -353,7 +353,7 @@ - 'Example: { "name": "wrench", "mass": "1.3kg", "count": "3" }.' returned: success type: dict - image_type: + imageType: description: - The image type to use for this node. Note that for a given image type, the latest version of it will be used. @@ -371,7 +371,7 @@ - 'Example: { "name": "wrench", "mass": "1.3kg", "count": "3" }.' returned: success type: dict - local_ssd_count: + localSsdCount: description: - The number of local SSD disks to be attached to the node. - 'The limit for this value is dependant upon the maximum number of disks available @@ -392,7 +392,7 @@ for more inforamtion about preemptible VM instances.' returned: success type: bool - master_auth: + masterAuth: description: - The authentication information for accessing the master endpoint. returned: success @@ -409,23 +409,23 @@ the master endpoint is open to the Internet, you should create a strong password. returned: success type: str - cluster_ca_certificate: + clusterCaCertificate: description: - Base64-encoded public certificate that is the root of trust for the cluster. returned: success type: str - client_certificate: + clientCertificate: description: - Base64-encoded public certificate used by clients to authenticate to the cluster endpoint. returned: success type: str - client_key: + clientKey: description: - Base64-encoded private key used by clients to authenticate to the cluster endpoint. returned: success type: str - logging_service: + loggingService: description: - 'The logging service the cluster should use to write logs. Currently available options: logging.googleapis.com - the Google Cloud Logging service.' @@ -433,7 +433,7 @@ - if left as an empty string,logging.googleapis.com will be used. returned: success type: str - monitoring_service: + monitoringService: description: - The monitoring service the cluster should use to write metrics. - 'Currently available options: monitoring.googleapis.com - the Google Cloud Monitoring @@ -450,20 +450,20 @@ resource. returned: success type: str - cluster_ipv4_cidr: + clusterIpv4Cidr: description: - The IP address range of the container pods in this cluster, in CIDR notation (e.g. 10.96.0.0/14). Leave blank to have one automatically chosen or specify a /14 block in 10.0.0.0/8. returned: success type: str - addons_config: + addonsConfig: description: - Configurations for the various addons available to run in the cluster. returned: success type: complex contains: - http_load_balancing: + httpLoadBalancing: description: - Configuration for the HTTP (L7) load balancing controller addon, which makes it easy to set up HTTP load balancers for services in a cluster. @@ -476,7 +476,7 @@ it runs a small pod in the cluster that manages the load balancers. returned: success type: bool - horizontal_pod_autoscaling: + horizontalPodAutoscaling: description: - Configuration for the horizontal pod autoscaling feature, which increases or decreases the number of replica pods a replication controller has based on the resource usage @@ -509,48 +509,48 @@ the masterAuth property of this resource for username and password information. returned: success type: str - initial_cluster_version: + initialClusterVersion: description: - The software version of the master endpoint and kubelets used in the cluster when it was first created. The version can be upgraded over time. returned: success type: str - current_master_version: + currentMasterVersion: description: - The current software version of the master endpoint. returned: success type: str - current_node_version: + currentNodeVersion: description: - The current version of the node software components. If they are currently at multiple versions because they're in the process of being upgraded, this reflects the minimum version of all nodes. returned: success type: str - create_time: + createTime: description: - The time the cluster was created, in RFC3339 text format. returned: success type: str - node_ipv4_cidr_size: + nodeIpv4CidrSize: description: - The size of the address space on each node for hosting containers. - This is provisioned from within the container_ipv4_cidr range. returned: success type: int - services_ipv4_cidr: + servicesIpv4Cidr: description: - The IP address range of the Kubernetes services in this cluster, in CIDR notation (e.g. 1.2.3.4/29). Service addresses are typically put in the last /16 from the container CIDR. returned: success type: str - current_node_count: + currentNodeCount: description: - The number of nodes currently in the cluster. returned: success type: int - expire_time: + expireTime: description: - The time the cluster will be automatically deleted in RFC3339 text format. returned: success diff --git a/lib/ansible/modules/cloud/google/gcp_container_node_pool.py b/lib/ansible/modules/cloud/google/gcp_container_node_pool.py index 7358b10b7bed32..7d7b400e6c9f7c 100644 --- a/lib/ansible/modules/cloud/google/gcp_container_node_pool.py +++ b/lib/ansible/modules/cloud/google/gcp_container_node_pool.py @@ -242,19 +242,19 @@ returned: success type: complex contains: - machine_type: + machineType: description: - The name of a Google Compute Engine machine type (e.g. - n1-standard-1). If unspecified, the default machine type is n1-standard-1. returned: success type: str - disk_size_gb: + diskSizeGb: description: - Size of the disk attached to each node, specified in GB. The smallest allowed disk size is 10GB. If unspecified, the default disk size is 100GB. returned: success type: int - oauth_scopes: + oauthScopes: description: - The set of Google API scopes to be made available on all of the node VMs under the "default" service account. @@ -267,7 +267,7 @@ enabled, in which case their required scopes will be added. returned: success type: list - service_account: + serviceAccount: description: - The Google Cloud Platform Service Account to be used by the node VMs. If no Service Account is specified, the "default" service account is used. @@ -288,7 +288,7 @@ - 'Example: { "name": "wrench", "mass": "1.3kg", "count": "3" }.' returned: success type: dict - image_type: + imageType: description: - The image type to use for this node. Note that for a given image type, the latest version of it will be used. @@ -306,7 +306,7 @@ - 'Example: { "name": "wrench", "mass": "1.3kg", "count": "3" }.' returned: success type: dict - local_ssd_count: + localSsdCount: description: - The number of local SSD disks to be attached to the node. - 'The limit for this value is dependant upon the maximum number of disks available @@ -327,7 +327,7 @@ for more inforamtion about preemptible VM instances.' returned: success type: bool - initial_node_count: + initialNodeCount: description: - The initial node count for the pool. You must ensure that your Compute Engine resource quota is sufficient for this number of instances. You must also have available firewall @@ -351,12 +351,12 @@ - Is autoscaling enabled for this node pool. returned: success type: bool - min_node_count: + minNodeCount: description: - Minimum number of nodes in the NodePool. Must be >= 1 and <= maxNodeCount. returned: success type: int - max_node_count: + maxNodeCount: description: - Maximum number of nodes in the NodePool. Must be >= minNodeCount. - There has to enough quota to scale up the cluster. @@ -368,27 +368,27 @@ returned: success type: complex contains: - auto_upgrade: + autoUpgrade: description: - A flag that specifies whether node auto-upgrade is enabled for the node pool. If enabled, node auto-upgrade helps keep the nodes in your node pool up to date with the latest release version of Kubernetes. returned: success type: bool - auto_repair: + autoRepair: description: - A flag that specifies whether the node auto-repair is enabled for the node pool. If enabled, the nodes in this node pool will be monitored and, if they fail health checks too many times, an automatic repair action will be triggered. returned: success type: bool - upgrade_options: + upgradeOptions: description: - Specifies the Auto Upgrade knobs for the node pool. returned: success type: complex contains: - auto_upgrade_start_time: + autoUpgradeStartTime: description: - This field is set when upgrades are about to commence with the approximate start time for the upgrades, in RFC3339 text format. diff --git a/lib/ansible/modules/cloud/google/gcp_dns_managed_zone.py b/lib/ansible/modules/cloud/google/gcp_dns_managed_zone.py index df606e69196ed5..ed99f30d040aa5 100644 --- a/lib/ansible/modules/cloud/google/gcp_dns_managed_zone.py +++ b/lib/ansible/modules/cloud/google/gcp_dns_managed_zone.py @@ -89,7 +89,7 @@ user's convenience. Has no effect on the managed zone's function. returned: success type: str - dns_name: + dnsName: description: - The DNS name of this managed zone, for instance "example.com.". returned: success @@ -105,20 +105,20 @@ - Must be unique within the project. returned: success type: str - name_servers: + nameServers: description: - Delegate your managed_zone to these virtual name servers; defined by the server . returned: success type: list - name_server_set: + nameServerSet: description: - Optionally specifies the NameServerSet for this ManagedZone. A NameServerSet is a set of DNS name servers that all host the same ManagedZones. Most users will leave this field unset. returned: success type: list - creation_time: + creationTime: description: - The time that this resource was created on the server. - This is in RFC3339 text format. diff --git a/lib/ansible/modules/cloud/google/gcp_dns_managed_zone_facts.py b/lib/ansible/modules/cloud/google/gcp_dns_managed_zone_facts.py index 04618a2718e6d6..48adc7b350bf8c 100644 --- a/lib/ansible/modules/cloud/google/gcp_dns_managed_zone_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_dns_managed_zone_facts.py @@ -68,7 +68,7 @@ user's convenience. Has no effect on the managed zone's function. returned: success type: str - dns_name: + dnsName: description: - The DNS name of this managed zone, for instance "example.com.". returned: success @@ -84,20 +84,20 @@ - Must be unique within the project. returned: success type: str - name_servers: + nameServers: description: - Delegate your managed_zone to these virtual name servers; defined by the server . returned: success type: list - name_server_set: + nameServerSet: description: - Optionally specifies the NameServerSet for this ManagedZone. A NameServerSet is a set of DNS name servers that all host the same ManagedZones. Most users will leave this field unset. returned: success type: list - creation_time: + creationTime: description: - The time that this resource was created on the server. - This is in RFC3339 text format. diff --git a/lib/ansible/modules/cloud/google/gcp_pubsub_subscription.py b/lib/ansible/modules/cloud/google/gcp_pubsub_subscription.py index 50d1b735a59703..fa604a5ef20825 100644 --- a/lib/ansible/modules/cloud/google/gcp_pubsub_subscription.py +++ b/lib/ansible/modules/cloud/google/gcp_pubsub_subscription.py @@ -121,7 +121,7 @@ - A reference to a Topic resource. returned: success type: dict - push_config: + pushConfig: description: - If push delivery is used with this subscription, this field is used to configure it. An empty pushConfig signifies that the subscriber will pull and ack messages @@ -129,13 +129,13 @@ returned: success type: complex contains: - push_endpoint: + pushEndpoint: description: - A URL locating the endpoint to which messages should be pushed. - For example, a Webhook endpoint might use "U(https://example.com/push".) returned: success type: str - ack_deadline_seconds: + ackDeadlineSeconds: description: - This value is the maximum time after a subscriber receives a message before the subscriber should acknowledge the message. After message delivery but before the diff --git a/lib/ansible/modules/cloud/google/gcp_pubsub_subscription_facts.py b/lib/ansible/modules/cloud/google/gcp_pubsub_subscription_facts.py index 93e102cedf5b87..fc75d954e78da3 100644 --- a/lib/ansible/modules/cloud/google/gcp_pubsub_subscription_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_pubsub_subscription_facts.py @@ -67,7 +67,7 @@ - A reference to a Topic resource. returned: success type: dict - push_config: + pushConfig: description: - If push delivery is used with this subscription, this field is used to configure it. An empty pushConfig signifies that the subscriber will pull and ack messages @@ -75,13 +75,13 @@ returned: success type: complex contains: - push_endpoint: + pushEndpoint: description: - A URL locating the endpoint to which messages should be pushed. - For example, a Webhook endpoint might use "U(https://example.com/push".) returned: success type: str - ack_deadline_seconds: + ackDeadlineSeconds: description: - This value is the maximum time after a subscriber receives a message before the subscriber should acknowledge the message. After message delivery but before the diff --git a/lib/ansible/modules/cloud/google/gcp_spanner_database.py b/lib/ansible/modules/cloud/google/gcp_spanner_database.py index fbfb6fff70d5f7..17b156ef19c67d 100644 --- a/lib/ansible/modules/cloud/google/gcp_spanner_database.py +++ b/lib/ansible/modules/cloud/google/gcp_spanner_database.py @@ -98,7 +98,7 @@ The final segment of the name must be between 6 and 30 characters in length. returned: success type: str - extra_statements: + extraStatements: description: - 'An optional list of DDL statements to run inside the newly created database. Statements can create tables, indexes, etc. These statements execute atomically with the creation diff --git a/lib/ansible/modules/cloud/google/gcp_spanner_instance.py b/lib/ansible/modules/cloud/google/gcp_spanner_instance.py index 55b26f805baa53..50d0ee1a92cf3f 100644 --- a/lib/ansible/modules/cloud/google/gcp_spanner_instance.py +++ b/lib/ansible/modules/cloud/google/gcp_spanner_instance.py @@ -117,13 +117,13 @@ - A reference to the instance configuration. returned: success type: str - display_name: + displayName: description: - The descriptive name for this instance as it appears in UIs. Must be unique per project and between 4 and 30 characters in length. returned: success type: str - node_count: + nodeCount: description: - The number of nodes allocated to this instance. returned: success diff --git a/lib/ansible/modules/cloud/google/gcp_sql_instance.py b/lib/ansible/modules/cloud/google/gcp_sql_instance.py index 2db17c7bd2daa0..3cb7e522876cb9 100644 --- a/lib/ansible/modules/cloud/google/gcp_sql_instance.py +++ b/lib/ansible/modules/cloud/google/gcp_sql_instance.py @@ -273,19 +273,19 @@ ''' RETURN = ''' - backend_type: + backendType: description: - "* FIRST_GEN: First Generation instance. MySQL only." - "* SECOND_GEN: Second Generation instance or PostgreSQL instance." - "* EXTERNAL: A database server that is not managed by Google." returned: success type: str - connection_name: + connectionName: description: - Connection name of the Cloud SQL instance used in connection strings. returned: success type: str - database_version: + databaseVersion: description: - The database engine type and version. For First Generation instances, can be MYSQL_5_5, or MYSQL_5_6. For Second Generation instances, can be MYSQL_5_6 or MYSQL_5_7. Defaults @@ -294,7 +294,7 @@ after instance creation.' returned: success type: str - failover_replica: + failoverReplica: description: - The name and status of the failover replica. This property is applicable only to Second Generation instances. @@ -315,7 +315,7 @@ property is applicable only to Second Generation instances. returned: success type: str - instance_type: + instanceType: description: - The instance type. This can be one of the following. - "* CLOUD_SQL_INSTANCE: A Cloud SQL instance that is not replicating from a master." @@ -323,18 +323,18 @@ - "* READ_REPLICA_INSTANCE: A Cloud SQL instance configured as a read-replica." returned: success type: str - ip_addresses: + ipAddresses: description: - The assigned IP addresses for the instance. returned: success type: complex contains: - ip_address: + ipAddress: description: - The IP address assigned. returned: success type: str - time_to_retire: + timeToRetire: description: - The due time for this IP to be retired in RFC 3339 format, for example 2012-11-15T16:19:00.094Z. This field is only available when the IP is scheduled to be retired. @@ -347,18 +347,18 @@ from the instance, if supported. returned: success type: str - ipv6_address: + ipv6Address: description: - The IPv6 address assigned to the instance. This property is applicable only to First Generation instances. returned: success type: str - master_instance_name: + masterInstanceName: description: - The name of the instance which will act as master in the replication setup. returned: success type: str - max_disk_size: + maxDiskSize: description: - The maximum disk size of the instance in bytes. returned: success @@ -374,13 +374,13 @@ instance type (First Generation or Second Generation/PostgreSQL). returned: success type: str - replica_configuration: + replicaConfiguration: description: - Configuration specific to failover replicas and read replicas. returned: success type: complex contains: - failover_target: + failoverTarget: description: - Specifies if the replica is the failover target. If the field is set to true the replica will be designated as a failover replica. @@ -390,7 +390,7 @@ in different zone with the master instance. returned: success type: bool - mysql_replica_configuration: + mysqlReplicaConfiguration: description: - MySQL specific configuration when replicating from a MySQL on-premises master. Replication configuration information such as the username, password, certificates, and keys @@ -400,28 +400,28 @@ returned: success type: complex contains: - ca_certificate: + caCertificate: description: - PEM representation of the trusted CA's x509 certificate. returned: success type: str - client_certificate: + clientCertificate: description: - PEM representation of the slave's x509 certificate . returned: success type: str - client_key: + clientKey: description: - PEM representation of the slave's private key. The corresponsing public key is encoded in the client's asf asd certificate. returned: success type: str - connect_retry_interval: + connectRetryInterval: description: - Seconds to wait between connect retries. MySQL's default is 60 seconds. returned: success type: int - dump_file_path: + dumpFilePath: description: - Path to a SQL dump file in Google Cloud Storage from which the slave instance is to be created. The URI is in the form gs://bucketName/fileName. Compressed gzip @@ -430,7 +430,7 @@ when using mysqldump. returned: success type: str - master_heartbeat_period: + masterHeartbeatPeriod: description: - Interval in milliseconds between replication heartbeats. returned: success @@ -440,7 +440,7 @@ - The password for the replication connection. returned: success type: str - ssl_cipher: + sslCipher: description: - A list of permissible ciphers to use for SSL encryption. returned: success @@ -450,18 +450,18 @@ - The username for the replication connection. returned: success type: str - verify_server_certificate: + verifyServerCertificate: description: - Whether or not to check the master's Common Name value in the certificate that it sends during the SSL handshake. returned: success type: bool - replica_names: + replicaNames: description: - The replicas of the instance. returned: success type: list - service_account_email_address: + serviceAccountEmailAddress: description: - The service account email address assigned to the instance. This property is applicable only to Second Generation instances. @@ -473,7 +473,7 @@ returned: success type: complex contains: - ip_configuration: + ipConfiguration: description: - The settings for IP Management. This allows to enable or disable the instance IP and manage which external networks can connect to the instance. The IPv4 address @@ -481,19 +481,19 @@ returned: success type: complex contains: - ipv4_enabled: + ipv4Enabled: description: - Whether the instance should be assigned an IP address or not. returned: success type: bool - authorized_networks: + authorizedNetworks: description: - The list of external networks that are allowed to connect to the instance using the IP. In CIDR notation, also known as 'slash' notation (e.g. 192.168.100.0/24). returned: success type: complex contains: - expiration_time: + expirationTime: description: - The time when this access control entry expires in RFC 3339 format, for example 2012-11-15T16:19:00.094Z. @@ -511,7 +511,7 @@ or subnet here. returned: success type: str - require_ssl: + requireSsl: description: - Whether the mysqld should default to 'REQUIRE X509' for users connecting over IP. returned: success @@ -523,7 +523,7 @@ or First Generation. returned: success type: str - settings_version: + settingsVersion: description: - The version of instance settings. This is a required field for update method to make sure concurrent updates are handled properly. During update, use the most diff --git a/lib/ansible/modules/cloud/google/gcp_storage_bucket.py b/lib/ansible/modules/cloud/google/gcp_storage_bucket.py index 0014dcae63bd1b..8103fcd5f80e1d 100644 --- a/lib/ansible/modules/cloud/google/gcp_storage_bucket.py +++ b/lib/ansible/modules/cloud/google/gcp_storage_bucket.py @@ -396,7 +396,7 @@ entity would be domain-example.com. returned: success type: str - entity_id: + entityId: description: - The ID for the entity. returned: success @@ -406,13 +406,13 @@ - The ID of the access-control entry. returned: success type: str - project_team: + projectTeam: description: - The project team associated with the entity. returned: success type: complex contains: - project_number: + projectNumber: description: - The project team associated with the entity. returned: success @@ -433,7 +433,7 @@ returned: success type: complex contains: - max_age_seconds: + maxAgeSeconds: description: - The value, in seconds, to return in the Access-Control-Max-Age header used in preflight responses. @@ -451,13 +451,13 @@ - 'Note: "*" is permitted in the list of origins, and means "any Origin".' returned: success type: list - response_header: + responseHeader: description: - The list of HTTP headers other than the simple response headers to give permission for the user-agent to share across domains. returned: success type: list - default_object_acl: + defaultObjectAcl: description: - Default access controls to apply to new objects when no ACL is provided. returned: success @@ -489,7 +489,7 @@ entity would be domain-example.com. returned: success type: str - entity_id: + entityId: description: - The ID for the entity. returned: success @@ -509,13 +509,13 @@ - The name of the object, if applied to an object. returned: success type: str - project_team: + projectTeam: description: - The project team associated with the entity. returned: success type: complex contains: - project_number: + projectNumber: description: - The project team associated with the entity. returned: success @@ -555,7 +555,7 @@ returned: success type: complex contains: - storage_class: + storageClass: description: - Target storage class. Required iff the type of the action is SetStorageClass. returned: success @@ -571,32 +571,32 @@ returned: success type: complex contains: - age_days: + ageDays: description: - Age of an object (in days). This condition is satisfied when an object reaches the specified age. returned: success type: int - created_before: + createdBefore: description: - A date in RFC 3339 format with only the date part (for instance, "2013-01-15"). This condition is satisfied when an object is created before midnight of the specified date in UTC. returned: success type: str - is_live: + isLive: description: - Relevant only for versioned objects. If the value is true, this condition matches live objects; if the value is false, it matches archived objects. returned: success type: bool - matches_storage_class: + matchesStorageClass: description: - Objects having any of the storage classes specified by this condition will be matched. Values include MULTI_REGIONAL, REGIONAL, NEARLINE, COLDLINE, STANDARD, and DURABLE_REDUCED_AVAILABILITY. returned: success type: list - num_newer_versions: + numNewerVersions: description: - Relevant only for versioned objects. If the value is N, this condition is satisfied when there are at least N versions (including the live version) newer than this @@ -617,12 +617,12 @@ returned: success type: complex contains: - log_bucket: + logBucket: description: - The destination bucket where the current bucket's logs should be placed. returned: success type: str - log_object_prefix: + logObjectPrefix: description: - A prefix for log object names. returned: success @@ -648,17 +648,17 @@ - The entity, in the form project-owner-projectId. returned: success type: str - entity_id: + entityId: description: - The ID for the entity. returned: success type: str - project_number: + projectNumber: description: - The project number of the project the bucket belongs to. returned: success type: int - storage_class: + storageClass: description: - The bucket's default storage class, used whenever no storageClass is specified for a newly-created object. This defines how objects in the bucket are stored and determines @@ -668,7 +668,7 @@ For more information, see storage classes. returned: success type: str - time_created: + timeCreated: description: - The creation time of the bucket in RFC 3339 format. returned: success @@ -696,14 +696,14 @@ returned: success type: complex contains: - main_page_suffix: + mainPageSuffix: description: - If the requested object path is missing, the service will ensure the path has a trailing '/', append this suffix, and attempt to retrieve the resulting object. This allows the creation of index.html objects to represent directory pages. returned: success type: str - not_found_page: + notFoundPage: description: - If the requested object path is missing, and any mainPageSuffix object is missing, if applicable, the service will return the named object from this bucket as the @@ -715,7 +715,7 @@ - A valid API project identifier. returned: success type: str - predefined_default_object_acl: + predefinedDefaultObjectAcl: description: - Apply a predefined set of default object access controls to this bucket. - 'Acceptable values are: - "authenticatedRead": Object owner gets OWNER access, diff --git a/lib/ansible/modules/cloud/google/gcp_storage_bucket_access_control.py b/lib/ansible/modules/cloud/google/gcp_storage_bucket_access_control.py index cf46384356ab0a..e7b1f0922e9b22 100644 --- a/lib/ansible/modules/cloud/google/gcp_storage_bucket_access_control.py +++ b/lib/ansible/modules/cloud/google/gcp_storage_bucket_access_control.py @@ -143,7 +143,7 @@ entity would be domain-example.com. returned: success type: str - entity_id: + entityId: description: - The ID for the entity. returned: success @@ -153,13 +153,13 @@ - The ID of the access-control entry. returned: success type: str - project_team: + projectTeam: description: - The project team associated with the entity. returned: success type: complex contains: - project_number: + projectNumber: description: - The project team associated with the entity. returned: success From 8e73ec0449ac8b1425663785dc5bb60499e59037 Mon Sep 17 00:00:00 2001 From: The Magician Date: Fri, 21 Sep 2018 16:41:07 -0700 Subject: [PATCH 036/144] 2.8 changes (#98) --- .../modules/cloud/google/gcp_compute_firewall.py | 12 ++++++------ .../cloud/google/gcp_compute_instance_group.py | 2 +- .../cloud/google/gcp_dns_managed_zone_facts.py | 2 +- .../cloud/google/gcp_dns_resource_record_set.py | 2 +- .../google/gcp_dns_resource_record_set_facts.py | 2 +- .../cloud/google/gcp_pubsub_subscription_facts.py | 2 +- .../modules/cloud/google/gcp_pubsub_topic_facts.py | 2 +- test/runner/lib/cloud/gcp.py | 5 +++++ 8 files changed, 17 insertions(+), 12 deletions(-) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_firewall.py b/lib/ansible/modules/cloud/google/gcp_compute_firewall.py index 7eafd91412aa44..48e07435d8eb45 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_firewall.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_firewall.py @@ -77,7 +77,7 @@ - The list of DENY rules specified by this firewall. Each rule specifies a protocol and port-range tuple that describes a denied connection. required: false - version_added: 2.7 + version_added: 2.8 suboptions: ip_protocol: description: @@ -103,14 +103,14 @@ has destination IP address in these ranges. These ranges must be expressed in CIDR format. Only IPv4 is supported. required: false - version_added: 2.7 + version_added: 2.8 direction: description: - 'Direction of traffic to which this firewall applies; default is INGRESS. Note: For INGRESS traffic, it is NOT supported to specify destinationRanges; For EGRESS traffic, it is NOT supported to specify sourceRanges OR sourceTags.' required: false - version_added: 2.7 + version_added: 2.8 choices: ['INGRESS', 'EGRESS'] name: description: @@ -140,7 +140,7 @@ precedence over ALLOW rules having equal priority. required: false default: 1000 - version_added: 2.7 + version_added: 2.8 source_ranges: description: - If source ranges are specified, the firewall will apply only to traffic that has @@ -162,7 +162,7 @@ connection does not need to match both properties for the firewall to apply. sourceServiceAccounts cannot be used at the same time as sourceTags or targetTags. required: false - version_added: 2.7 + version_added: 2.8 source_tags: description: - If source tags are specified, the firewall will apply only to traffic with source @@ -182,7 +182,7 @@ If neither targetServiceAccounts nor targetTags are specified, the firewall rule applies to all instances on the specified network. required: false - version_added: 2.7 + version_added: 2.8 target_tags: description: - A list of instance tags indicating sets of instances located in the network that diff --git a/lib/ansible/modules/cloud/google/gcp_compute_instance_group.py b/lib/ansible/modules/cloud/google/gcp_compute_instance_group.py index 2576d8218e2420..fa40e5929b07eb 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_instance_group.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_instance_group.py @@ -102,7 +102,7 @@ be deleted. - Only the full identifier of the instance will be returned. required: false - version_added: 2.7 + version_added: 2.8 extends_documentation_fragment: gcp ''' diff --git a/lib/ansible/modules/cloud/google/gcp_dns_managed_zone_facts.py b/lib/ansible/modules/cloud/google/gcp_dns_managed_zone_facts.py index 48adc7b350bf8c..d795b802165d7c 100644 --- a/lib/ansible/modules/cloud/google/gcp_dns_managed_zone_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_dns_managed_zone_facts.py @@ -34,7 +34,7 @@ description: - Gather facts for GCP ManagedZone short_description: Gather facts for GCP ManagedZone -version_added: 2.7 +version_added: 2.8 author: Google Inc. (@googlecloudplatform) requirements: - python >= 2.6 diff --git a/lib/ansible/modules/cloud/google/gcp_dns_resource_record_set.py b/lib/ansible/modules/cloud/google/gcp_dns_resource_record_set.py index 85851f763f502f..7d4e5fe8748067 100644 --- a/lib/ansible/modules/cloud/google/gcp_dns_resource_record_set.py +++ b/lib/ansible/modules/cloud/google/gcp_dns_resource_record_set.py @@ -38,7 +38,7 @@ - The record will include the domain/subdomain name, a type (i.e. A, AAA, CAA, MX, CNAME, NS, etc) . short_description: Creates a GCP ResourceRecordSet -version_added: 2.5 +version_added: 2.6 author: Google Inc. (@googlecloudplatform) requirements: - python >= 2.6 diff --git a/lib/ansible/modules/cloud/google/gcp_dns_resource_record_set_facts.py b/lib/ansible/modules/cloud/google/gcp_dns_resource_record_set_facts.py index fff16074a7ed1e..99fc6aea6e1879 100644 --- a/lib/ansible/modules/cloud/google/gcp_dns_resource_record_set_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_dns_resource_record_set_facts.py @@ -34,7 +34,7 @@ description: - Gather facts for GCP ResourceRecordSet short_description: Gather facts for GCP ResourceRecordSet -version_added: 2.7 +version_added: 2.8 author: Google Inc. (@googlecloudplatform) requirements: - python >= 2.6 diff --git a/lib/ansible/modules/cloud/google/gcp_pubsub_subscription_facts.py b/lib/ansible/modules/cloud/google/gcp_pubsub_subscription_facts.py index fc75d954e78da3..244d6a4fa87beb 100644 --- a/lib/ansible/modules/cloud/google/gcp_pubsub_subscription_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_pubsub_subscription_facts.py @@ -34,7 +34,7 @@ description: - Gather facts for GCP Subscription short_description: Gather facts for GCP Subscription -version_added: 2.7 +version_added: 2.8 author: Google Inc. (@googlecloudplatform) requirements: - python >= 2.6 diff --git a/lib/ansible/modules/cloud/google/gcp_pubsub_topic_facts.py b/lib/ansible/modules/cloud/google/gcp_pubsub_topic_facts.py index a8363e3fb2bc7c..14e4b0d60ac004 100644 --- a/lib/ansible/modules/cloud/google/gcp_pubsub_topic_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_pubsub_topic_facts.py @@ -34,7 +34,7 @@ description: - Gather facts for GCP Topic short_description: Gather facts for GCP Topic -version_added: 2.7 +version_added: 2.8 author: Google Inc. (@googlecloudplatform) requirements: - python >= 2.6 diff --git a/test/runner/lib/cloud/gcp.py b/test/runner/lib/cloud/gcp.py index 26fd0cb37cb9af..2f3255fbd94246 100644 --- a/test/runner/lib/cloud/gcp.py +++ b/test/runner/lib/cloud/gcp.py @@ -6,7 +6,9 @@ import os from lib.util import ( + ApplicationError, display, + is_shippable, ) from lib.cloud import ( @@ -14,6 +16,9 @@ CloudEnvironment, ) +from lib.core_ci import ( + AnsibleCoreCI, ) + class GcpCloudProvider(CloudProvider): """GCP cloud provider plugin. Sets up cloud resources before delegation.""" From 84ff8150e525efe405a20b3f054f8e1d14cf1cdf Mon Sep 17 00:00:00 2001 From: The Magician Date: Mon, 24 Sep 2018 10:46:28 -0700 Subject: [PATCH 037/144] Magic Modules changes. (#97) Ensure that Ansible always returns full resource after update + no op --- lib/ansible/modules/cloud/google/gcp_compute_address.py | 5 ++--- .../modules/cloud/google/gcp_compute_backend_bucket.py | 5 ++--- .../modules/cloud/google/gcp_compute_backend_service.py | 5 ++--- lib/ansible/modules/cloud/google/gcp_compute_disk.py | 5 ++--- lib/ansible/modules/cloud/google/gcp_compute_firewall.py | 5 ++--- .../modules/cloud/google/gcp_compute_forwarding_rule.py | 5 ++--- .../modules/cloud/google/gcp_compute_global_address.py | 5 ++--- .../cloud/google/gcp_compute_global_forwarding_rule.py | 5 ++--- lib/ansible/modules/cloud/google/gcp_compute_health_check.py | 5 ++--- .../modules/cloud/google/gcp_compute_http_health_check.py | 5 ++--- .../modules/cloud/google/gcp_compute_https_health_check.py | 5 ++--- lib/ansible/modules/cloud/google/gcp_compute_image.py | 5 ++--- lib/ansible/modules/cloud/google/gcp_compute_instance.py | 5 ++--- .../modules/cloud/google/gcp_compute_instance_group.py | 5 ++--- .../cloud/google/gcp_compute_instance_group_manager.py | 5 ++--- .../modules/cloud/google/gcp_compute_instance_template.py | 5 ++--- lib/ansible/modules/cloud/google/gcp_compute_network.py | 5 ++--- lib/ansible/modules/cloud/google/gcp_compute_route.py | 5 ++--- lib/ansible/modules/cloud/google/gcp_compute_router.py | 5 ++--- .../modules/cloud/google/gcp_compute_ssl_certificate.py | 5 ++--- lib/ansible/modules/cloud/google/gcp_compute_ssl_policy.py | 5 ++--- lib/ansible/modules/cloud/google/gcp_compute_subnetwork.py | 5 ++--- .../modules/cloud/google/gcp_compute_target_http_proxy.py | 5 ++--- .../modules/cloud/google/gcp_compute_target_https_proxy.py | 5 ++--- lib/ansible/modules/cloud/google/gcp_compute_target_pool.py | 5 ++--- .../modules/cloud/google/gcp_compute_target_ssl_proxy.py | 5 ++--- .../modules/cloud/google/gcp_compute_target_tcp_proxy.py | 5 ++--- .../modules/cloud/google/gcp_compute_target_vpn_gateway.py | 5 ++--- lib/ansible/modules/cloud/google/gcp_compute_url_map.py | 5 ++--- lib/ansible/modules/cloud/google/gcp_compute_vpn_tunnel.py | 5 ++--- lib/ansible/modules/cloud/google/gcp_container_cluster.py | 5 ++--- lib/ansible/modules/cloud/google/gcp_container_node_pool.py | 5 ++--- lib/ansible/modules/cloud/google/gcp_dns_managed_zone.py | 5 ++--- .../modules/cloud/google/gcp_dns_resource_record_set.py | 5 ++--- lib/ansible/modules/cloud/google/gcp_pubsub_subscription.py | 5 ++--- lib/ansible/modules/cloud/google/gcp_pubsub_topic.py | 5 ++--- lib/ansible/modules/cloud/google/gcp_spanner_database.py | 5 ++--- lib/ansible/modules/cloud/google/gcp_spanner_instance.py | 5 ++--- lib/ansible/modules/cloud/google/gcp_sql_database.py | 5 ++--- lib/ansible/modules/cloud/google/gcp_sql_instance.py | 5 ++--- lib/ansible/modules/cloud/google/gcp_sql_user.py | 5 ++--- lib/ansible/modules/cloud/google/gcp_storage_bucket.py | 5 ++--- .../cloud/google/gcp_storage_bucket_access_control.py | 5 ++--- 43 files changed, 86 insertions(+), 129 deletions(-) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_address.py b/lib/ansible/modules/cloud/google/gcp_compute_address.py index c1e8896fbbea6c..b22d55c1b6ebb3 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_address.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_address.py @@ -209,7 +209,8 @@ def main(): if fetch: if state == 'present': if is_different(module, fetch): - fetch = update(module, self_link(module), kind) + update(module, self_link(module), kind) + fetch = fetch_resource(module, self_link(module), kind) changed = True else: delete(module, self_link(module), kind) @@ -219,8 +220,6 @@ def main(): if state == 'present': fetch = create(module, collection(module), kind) changed = True - else: - fetch = {} fetch.update({'changed': changed}) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_backend_bucket.py b/lib/ansible/modules/cloud/google/gcp_compute_backend_bucket.py index e1d2d6b36103a0..8b69920845e9cb 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_backend_bucket.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_backend_bucket.py @@ -178,7 +178,8 @@ def main(): if fetch: if state == 'present': if is_different(module, fetch): - fetch = update(module, self_link(module), kind) + update(module, self_link(module), kind) + fetch = fetch_resource(module, self_link(module), kind) changed = True else: delete(module, self_link(module), kind) @@ -188,8 +189,6 @@ def main(): if state == 'present': fetch = create(module, collection(module), kind) changed = True - else: - fetch = {} fetch.update({'changed': changed}) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_backend_service.py b/lib/ansible/modules/cloud/google/gcp_compute_backend_service.py index b001d92ce54cbb..24bd0990f0ec40 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_backend_service.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_backend_service.py @@ -643,7 +643,8 @@ def main(): if fetch: if state == 'present': if is_different(module, fetch): - fetch = update(module, self_link(module), kind) + update(module, self_link(module), kind) + fetch = fetch_resource(module, self_link(module), kind) changed = True else: delete(module, self_link(module), kind) @@ -653,8 +654,6 @@ def main(): if state == 'present': fetch = create(module, collection(module), kind) changed = True - else: - fetch = {} fetch.update({'changed': changed}) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_disk.py b/lib/ansible/modules/cloud/google/gcp_compute_disk.py index bae9d5cd3c2c55..e7613fe1e2de89 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_disk.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_disk.py @@ -433,7 +433,8 @@ def main(): if fetch: if state == 'present': if is_different(module, fetch): - fetch = update(module, self_link(module), kind, fetch) + update(module, self_link(module), kind, fetch) + fetch = fetch_resource(module, self_link(module), kind) changed = True else: delete(module, self_link(module), kind) @@ -443,8 +444,6 @@ def main(): if state == 'present': fetch = create(module, collection(module), kind) changed = True - else: - fetch = {} fetch.update({'changed': changed}) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_firewall.py b/lib/ansible/modules/cloud/google/gcp_compute_firewall.py index 48e07435d8eb45..add7cfeb46d6d0 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_firewall.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_firewall.py @@ -427,7 +427,8 @@ def main(): if fetch: if state == 'present': if is_different(module, fetch): - fetch = update(module, self_link(module), kind) + update(module, self_link(module), kind) + fetch = fetch_resource(module, self_link(module), kind) changed = True else: delete(module, self_link(module), kind) @@ -437,8 +438,6 @@ def main(): if state == 'present': fetch = create(module, collection(module), kind) changed = True - else: - fetch = {} fetch.update({'changed': changed}) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_forwarding_rule.py b/lib/ansible/modules/cloud/google/gcp_compute_forwarding_rule.py index f19d2e3182d89f..40f498b3b808b7 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_forwarding_rule.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_forwarding_rule.py @@ -392,7 +392,8 @@ def main(): if fetch: if state == 'present': if is_different(module, fetch): - fetch = update(module, self_link(module), kind, fetch) + update(module, self_link(module), kind, fetch) + fetch = fetch_resource(module, self_link(module), kind) changed = True else: delete(module, self_link(module), kind) @@ -402,8 +403,6 @@ def main(): if state == 'present': fetch = create(module, collection(module), kind) changed = True - else: - fetch = {} fetch.update({'changed': changed}) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_global_address.py b/lib/ansible/modules/cloud/google/gcp_compute_global_address.py index 024b49cd89e2f1..83864d8d006f3a 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_global_address.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_global_address.py @@ -172,7 +172,8 @@ def main(): if fetch: if state == 'present': if is_different(module, fetch): - fetch = update(module, self_link(module), kind, fetch) + update(module, self_link(module), kind, fetch) + fetch = fetch_resource(module, self_link(module), kind) changed = True else: delete(module, self_link(module), kind) @@ -182,8 +183,6 @@ def main(): if state == 'present': fetch = create(module, collection(module), kind) changed = True - else: - fetch = {} fetch.update({'changed': changed}) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_global_forwarding_rule.py b/lib/ansible/modules/cloud/google/gcp_compute_global_forwarding_rule.py index 07515b210beca3..2dc94c95166678 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_global_forwarding_rule.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_global_forwarding_rule.py @@ -419,7 +419,8 @@ def main(): if fetch: if state == 'present': if is_different(module, fetch): - fetch = update(module, self_link(module), kind) + update(module, self_link(module), kind) + fetch = fetch_resource(module, self_link(module), kind) changed = True else: delete(module, self_link(module), kind) @@ -429,8 +430,6 @@ def main(): if state == 'present': fetch = create(module, collection(module), kind) changed = True - else: - fetch = {} fetch.update({'changed': changed}) 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 0bad74a2782ab5..fa8876e5e1f381 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_health_check.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_health_check.py @@ -539,7 +539,8 @@ def main(): if fetch: if state == 'present': if is_different(module, fetch): - fetch = update(module, self_link(module), kind) + update(module, self_link(module), kind) + fetch = fetch_resource(module, self_link(module), kind) changed = True else: delete(module, self_link(module), kind) @@ -549,8 +550,6 @@ def main(): if state == 'present': fetch = create(module, collection(module), kind) changed = True - else: - fetch = {} fetch.update({'changed': changed}) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_http_health_check.py b/lib/ansible/modules/cloud/google/gcp_compute_http_health_check.py index 3906b5aa525d39..0eee29353f6456 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_http_health_check.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_http_health_check.py @@ -235,7 +235,8 @@ def main(): if fetch: if state == 'present': if is_different(module, fetch): - fetch = update(module, self_link(module), kind) + update(module, self_link(module), kind) + fetch = fetch_resource(module, self_link(module), kind) changed = True else: delete(module, self_link(module), kind) @@ -245,8 +246,6 @@ def main(): if state == 'present': fetch = create(module, collection(module), kind) changed = True - else: - fetch = {} fetch.update({'changed': changed}) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_https_health_check.py b/lib/ansible/modules/cloud/google/gcp_compute_https_health_check.py index 35c2a25ee90d7d..e607e7c801cc81 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_https_health_check.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_https_health_check.py @@ -233,7 +233,8 @@ def main(): if fetch: if state == 'present': if is_different(module, fetch): - fetch = update(module, self_link(module), kind) + update(module, self_link(module), kind) + fetch = fetch_resource(module, self_link(module), kind) changed = True else: delete(module, self_link(module), kind) @@ -243,8 +244,6 @@ def main(): if state == 'present': fetch = create(module, collection(module), kind) changed = True - else: - fetch = {} fetch.update({'changed': changed}) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_image.py b/lib/ansible/modules/cloud/google/gcp_compute_image.py index 25f630258ef36d..08ea2ab60c66f7 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_image.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_image.py @@ -458,7 +458,8 @@ def main(): if fetch: if state == 'present': if is_different(module, fetch): - fetch = update(module, self_link(module), kind) + update(module, self_link(module), kind) + fetch = fetch_resource(module, self_link(module), kind) changed = True else: delete(module, self_link(module), kind) @@ -468,8 +469,6 @@ def main(): if state == 'present': fetch = create(module, collection(module), kind) changed = True - else: - fetch = {} fetch.update({'changed': changed}) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_instance.py b/lib/ansible/modules/cloud/google/gcp_compute_instance.py index 35d103f4dd621d..100b6659445f34 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_instance.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_instance.py @@ -911,7 +911,8 @@ def main(): if fetch: if state == 'present': if is_different(module, fetch): - fetch = update(module, self_link(module), kind) + update(module, self_link(module), kind) + fetch = fetch_resource(module, self_link(module), kind) changed = True else: delete(module, self_link(module), kind) @@ -921,8 +922,6 @@ def main(): if state == 'present': fetch = create(module, collection(module), kind) changed = True - else: - fetch = {} fetch.update({'changed': changed}) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_instance_group.py b/lib/ansible/modules/cloud/google/gcp_compute_instance_group.py index fa40e5929b07eb..33680c9e1a021a 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_instance_group.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_instance_group.py @@ -252,7 +252,8 @@ def main(): if fetch: if state == 'present': if is_different(module, fetch): - fetch = update(module, self_link(module), kind) + update(module, self_link(module), kind) + fetch = fetch_resource(module, self_link(module), kind) changed = True else: delete(module, self_link(module), kind) @@ -262,8 +263,6 @@ def main(): if state == 'present': fetch = create(module, collection(module), kind) changed = True - else: - fetch = {} if fetch: instance = InstanceLogic(module) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_instance_group_manager.py b/lib/ansible/modules/cloud/google/gcp_compute_instance_group_manager.py index c83b8a431c6636..f975f329d874e1 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_instance_group_manager.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_instance_group_manager.py @@ -355,7 +355,8 @@ def main(): if fetch: if state == 'present': if is_different(module, fetch): - fetch = update(module, self_link(module), kind) + update(module, self_link(module), kind) + fetch = fetch_resource(module, self_link(module), kind) changed = True else: delete(module, self_link(module), kind) @@ -365,8 +366,6 @@ def main(): if state == 'present': fetch = create(module, collection(module), kind) changed = True - else: - fetch = {} fetch.update({'changed': changed}) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_instance_template.py b/lib/ansible/modules/cloud/google/gcp_compute_instance_template.py index 9ef3a83f402dbc..231712c9feaf46 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_instance_template.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_instance_template.py @@ -884,7 +884,8 @@ def main(): if fetch: if state == 'present': if is_different(module, fetch): - fetch = update(module, self_link(module), kind) + update(module, self_link(module), kind) + fetch = fetch_resource(module, self_link(module), kind) changed = True else: delete(module, self_link(module), kind) @@ -894,8 +895,6 @@ def main(): if state == 'present': fetch = create(module, collection(module), kind) changed = True - else: - fetch = {} fetch.update({'changed': changed}) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_network.py b/lib/ansible/modules/cloud/google/gcp_compute_network.py index a7b52018bc9f2f..b4e31d9954e162 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_network.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_network.py @@ -200,7 +200,8 @@ def main(): if fetch: if state == 'present': if is_different(module, fetch): - fetch = update(module, self_link(module), kind) + update(module, self_link(module), kind) + fetch = fetch_resource(module, self_link(module), kind) changed = True else: delete(module, self_link(module), kind) @@ -210,8 +211,6 @@ def main(): if state == 'present': fetch = create(module, collection(module), kind) changed = True - else: - fetch = {} fetch.update({'changed': changed}) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_route.py b/lib/ansible/modules/cloud/google/gcp_compute_route.py index 8cdfedf71a12a1..0ae43ff0ebc4cb 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_route.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_route.py @@ -271,7 +271,8 @@ def main(): if fetch: if state == 'present': if is_different(module, fetch): - fetch = update(module, self_link(module), kind) + update(module, self_link(module), kind) + fetch = fetch_resource(module, self_link(module), kind) changed = True else: delete(module, self_link(module), kind) @@ -281,8 +282,6 @@ def main(): if state == 'present': fetch = create(module, collection(module), kind) changed = True - else: - fetch = {} fetch.update({'changed': changed}) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_router.py b/lib/ansible/modules/cloud/google/gcp_compute_router.py index 000ce527b99fa6..b306ff5125cd7d 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_router.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_router.py @@ -274,7 +274,8 @@ def main(): if fetch: if state == 'present': if is_different(module, fetch): - fetch = update(module, self_link(module), kind) + update(module, self_link(module), kind) + fetch = fetch_resource(module, self_link(module), kind) changed = True else: delete(module, self_link(module), kind) @@ -284,8 +285,6 @@ def main(): if state == 'present': fetch = create(module, collection(module), kind) changed = True - else: - fetch = {} fetch.update({'changed': changed}) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_ssl_certificate.py b/lib/ansible/modules/cloud/google/gcp_compute_ssl_certificate.py index 853c1bde987818..d4c4e5704a9433 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_ssl_certificate.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_ssl_certificate.py @@ -190,7 +190,8 @@ def main(): if fetch: if state == 'present': if is_different(module, fetch): - fetch = update(module, self_link(module), kind) + update(module, self_link(module), kind) + fetch = fetch_resource(module, self_link(module), kind) changed = True else: delete(module, self_link(module), kind) @@ -200,8 +201,6 @@ def main(): if state == 'present': fetch = create(module, collection(module), kind) changed = True - else: - fetch = {} fetch.update({'changed': changed}) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_ssl_policy.py b/lib/ansible/modules/cloud/google/gcp_compute_ssl_policy.py index 2cf9aaf8a0f707..d318c1e3752687 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_ssl_policy.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_ssl_policy.py @@ -217,7 +217,8 @@ def main(): if fetch: if state == 'present': if is_different(module, fetch): - fetch = update(module, self_link(module), kind) + update(module, self_link(module), kind) + fetch = fetch_resource(module, self_link(module), kind) changed = True else: delete(module, self_link(module), kind) @@ -227,8 +228,6 @@ def main(): if state == 'present': fetch = create(module, collection(module), kind) changed = True - else: - fetch = {} fetch.update({'changed': changed}) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_subnetwork.py b/lib/ansible/modules/cloud/google/gcp_compute_subnetwork.py index 4310c68a24ad23..9a2b8bfe3e90df 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_subnetwork.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_subnetwork.py @@ -228,7 +228,8 @@ def main(): if fetch: if state == 'present': if is_different(module, fetch): - fetch = update(module, self_link(module), kind, fetch) + update(module, self_link(module), kind, fetch) + fetch = fetch_resource(module, self_link(module), kind) changed = True else: delete(module, self_link(module), kind) @@ -238,8 +239,6 @@ def main(): if state == 'present': fetch = create(module, collection(module), kind) changed = True - else: - fetch = {} fetch.update({'changed': changed}) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_http_proxy.py b/lib/ansible/modules/cloud/google/gcp_compute_target_http_proxy.py index cfe530b98f6594..15ed282a42f13e 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_http_proxy.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_http_proxy.py @@ -198,7 +198,8 @@ def main(): if fetch: if state == 'present': if is_different(module, fetch): - fetch = update(module, self_link(module), kind, fetch) + update(module, self_link(module), kind, fetch) + fetch = fetch_resource(module, self_link(module), kind) changed = True else: delete(module, self_link(module), kind) @@ -208,8 +209,6 @@ def main(): if state == 'present': fetch = create(module, collection(module), kind) changed = True - else: - fetch = {} fetch.update({'changed': changed}) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_https_proxy.py b/lib/ansible/modules/cloud/google/gcp_compute_target_https_proxy.py index cf6255e7719317..3d835646c91f97 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_https_proxy.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_https_proxy.py @@ -266,7 +266,8 @@ def main(): if fetch: if state == 'present': if is_different(module, fetch): - fetch = update(module, self_link(module), kind, fetch) + update(module, self_link(module), kind, fetch) + fetch = fetch_resource(module, self_link(module), kind) changed = True else: delete(module, self_link(module), kind) @@ -276,8 +277,6 @@ def main(): if state == 'present': fetch = create(module, collection(module), kind) changed = True - else: - fetch = {} fetch.update({'changed': changed}) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_pool.py b/lib/ansible/modules/cloud/google/gcp_compute_target_pool.py index 8ce682cecb5440..6f8dc91d5bb996 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_pool.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_pool.py @@ -259,7 +259,8 @@ def main(): if fetch: if state == 'present': if is_different(module, fetch): - fetch = update(module, self_link(module), kind) + update(module, self_link(module), kind) + fetch = fetch_resource(module, self_link(module), kind) changed = True else: delete(module, self_link(module), kind) @@ -269,8 +270,6 @@ def main(): if state == 'present': fetch = create(module, collection(module), kind) changed = True - else: - fetch = {} fetch.update({'changed': changed}) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_ssl_proxy.py b/lib/ansible/modules/cloud/google/gcp_compute_target_ssl_proxy.py index 08a4321f81ad97..da8dfde0e61093 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_ssl_proxy.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_ssl_proxy.py @@ -253,7 +253,8 @@ def main(): if fetch: if state == 'present': if is_different(module, fetch): - fetch = update(module, self_link(module), kind, fetch) + update(module, self_link(module), kind, fetch) + fetch = fetch_resource(module, self_link(module), kind) changed = True else: delete(module, self_link(module), kind) @@ -263,8 +264,6 @@ def main(): if state == 'present': fetch = create(module, collection(module), kind) changed = True - else: - fetch = {} fetch.update({'changed': changed}) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_tcp_proxy.py b/lib/ansible/modules/cloud/google/gcp_compute_target_tcp_proxy.py index 93a1ec23869b8a..2de7c0af16f248 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_tcp_proxy.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_tcp_proxy.py @@ -206,7 +206,8 @@ def main(): if fetch: if state == 'present': if is_different(module, fetch): - fetch = update(module, self_link(module), kind, fetch) + update(module, self_link(module), kind, fetch) + fetch = fetch_resource(module, self_link(module), kind) changed = True else: delete(module, self_link(module), kind) @@ -216,8 +217,6 @@ def main(): if state == 'present': fetch = create(module, collection(module), kind) changed = True - else: - fetch = {} fetch.update({'changed': changed}) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_vpn_gateway.py b/lib/ansible/modules/cloud/google/gcp_compute_target_vpn_gateway.py index 4cee5e0518f324..061dc5805a5b5f 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_vpn_gateway.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_vpn_gateway.py @@ -190,7 +190,8 @@ def main(): if fetch: if state == 'present': if is_different(module, fetch): - fetch = update(module, self_link(module), kind) + update(module, self_link(module), kind) + fetch = fetch_resource(module, self_link(module), kind) changed = True else: delete(module, self_link(module), kind) @@ -200,8 +201,6 @@ def main(): if state == 'present': fetch = create(module, collection(module), kind) changed = True - else: - fetch = {} fetch.update({'changed': changed}) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_url_map.py b/lib/ansible/modules/cloud/google/gcp_compute_url_map.py index 3c3e0ff8857607..dc151bb5471a33 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_url_map.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_url_map.py @@ -375,7 +375,8 @@ def main(): if fetch: if state == 'present': if is_different(module, fetch): - fetch = update(module, self_link(module), kind) + update(module, self_link(module), kind) + fetch = fetch_resource(module, self_link(module), kind) changed = True else: delete(module, self_link(module), kind) @@ -385,8 +386,6 @@ def main(): if state == 'present': fetch = create(module, collection(module), kind) changed = True - else: - fetch = {} fetch.update({'changed': changed}) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_vpn_tunnel.py b/lib/ansible/modules/cloud/google/gcp_compute_vpn_tunnel.py index 82ab6a4fc52a80..9f1cd04dafd6bf 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_vpn_tunnel.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_vpn_tunnel.py @@ -294,7 +294,8 @@ def main(): if fetch: if state == 'present': if is_different(module, fetch): - fetch = update(module, self_link(module), kind, fetch) + update(module, self_link(module), kind, fetch) + fetch = fetch_resource(module, self_link(module), kind) changed = True else: delete(module, self_link(module), kind) @@ -305,8 +306,6 @@ def main(): fetch = create(module, collection(module), kind) labels_update(module, module.params, fetch) changed = True - else: - fetch = {} fetch.update({'changed': changed}) diff --git a/lib/ansible/modules/cloud/google/gcp_container_cluster.py b/lib/ansible/modules/cloud/google/gcp_container_cluster.py index c8ac6742f5c2d5..9be9e8596addce 100644 --- a/lib/ansible/modules/cloud/google/gcp_container_cluster.py +++ b/lib/ansible/modules/cloud/google/gcp_container_cluster.py @@ -632,7 +632,8 @@ def main(): if fetch: if state == 'present': if is_different(module, fetch): - fetch = update(module, self_link(module)) + update(module, self_link(module)) + fetch = fetch_resource(module, self_link(module)) changed = True else: delete(module, self_link(module)) @@ -642,8 +643,6 @@ def main(): if state == 'present': fetch = create(module, collection(module)) changed = True - else: - fetch = {} fetch.update({'changed': changed}) diff --git a/lib/ansible/modules/cloud/google/gcp_container_node_pool.py b/lib/ansible/modules/cloud/google/gcp_container_node_pool.py index 7d7b400e6c9f7c..4a69d4d3d7660b 100644 --- a/lib/ansible/modules/cloud/google/gcp_container_node_pool.py +++ b/lib/ansible/modules/cloud/google/gcp_container_node_pool.py @@ -474,7 +474,8 @@ def main(): if fetch: if state == 'present': if is_different(module, fetch): - fetch = update(module, self_link(module)) + update(module, self_link(module)) + fetch = fetch_resource(module, self_link(module)) changed = True else: delete(module, self_link(module)) @@ -484,8 +485,6 @@ def main(): if state == 'present': fetch = create(module, collection(module)) changed = True - else: - fetch = {} fetch.update({'changed': changed}) diff --git a/lib/ansible/modules/cloud/google/gcp_dns_managed_zone.py b/lib/ansible/modules/cloud/google/gcp_dns_managed_zone.py index ed99f30d040aa5..37f0d474aa9275 100644 --- a/lib/ansible/modules/cloud/google/gcp_dns_managed_zone.py +++ b/lib/ansible/modules/cloud/google/gcp_dns_managed_zone.py @@ -163,7 +163,8 @@ def main(): if fetch: if state == 'present': if is_different(module, fetch): - fetch = update(module, self_link(module), kind) + update(module, self_link(module), kind) + fetch = fetch_resource(module, self_link(module), kind) changed = True else: delete(module, self_link(module), kind) @@ -173,8 +174,6 @@ def main(): if state == 'present': fetch = create(module, collection(module), kind) changed = True - else: - fetch = {} fetch.update({'changed': changed}) diff --git a/lib/ansible/modules/cloud/google/gcp_dns_resource_record_set.py b/lib/ansible/modules/cloud/google/gcp_dns_resource_record_set.py index 7d4e5fe8748067..a935a8191a82b4 100644 --- a/lib/ansible/modules/cloud/google/gcp_dns_resource_record_set.py +++ b/lib/ansible/modules/cloud/google/gcp_dns_resource_record_set.py @@ -174,7 +174,8 @@ def main(): if fetch: if state == 'present': if is_different(module, fetch): - fetch = update(module, self_link(module), kind, fetch) + update(module, self_link(module), kind, fetch) + fetch = fetch_resource(module, self_link(module), kind) changed = True else: delete(module, self_link(module), kind, fetch) @@ -184,8 +185,6 @@ def main(): if state == 'present': fetch = create(module, collection(module), kind) changed = True - else: - fetch = {} fetch.update({'changed': changed}) diff --git a/lib/ansible/modules/cloud/google/gcp_pubsub_subscription.py b/lib/ansible/modules/cloud/google/gcp_pubsub_subscription.py index fa604a5ef20825..19c18d911aef5a 100644 --- a/lib/ansible/modules/cloud/google/gcp_pubsub_subscription.py +++ b/lib/ansible/modules/cloud/google/gcp_pubsub_subscription.py @@ -193,7 +193,8 @@ def main(): if fetch: if state == 'present': if is_different(module, fetch): - fetch = update(module, self_link(module)) + update(module, self_link(module)) + fetch = fetch_resource(module, self_link(module)) changed = True else: delete(module, self_link(module)) @@ -203,8 +204,6 @@ def main(): if state == 'present': fetch = create(module, self_link(module)) changed = True - else: - fetch = {} fetch.update({'changed': changed}) diff --git a/lib/ansible/modules/cloud/google/gcp_pubsub_topic.py b/lib/ansible/modules/cloud/google/gcp_pubsub_topic.py index b715f89c4583a4..29daa43d6e9862 100644 --- a/lib/ansible/modules/cloud/google/gcp_pubsub_topic.py +++ b/lib/ansible/modules/cloud/google/gcp_pubsub_topic.py @@ -104,7 +104,8 @@ def main(): if fetch: if state == 'present': if is_different(module, fetch): - fetch = update(module, self_link(module)) + update(module, self_link(module)) + fetch = fetch_resource(module, self_link(module)) changed = True else: delete(module, self_link(module)) @@ -114,8 +115,6 @@ def main(): if state == 'present': fetch = create(module, self_link(module)) changed = True - else: - fetch = {} fetch.update({'changed': changed}) diff --git a/lib/ansible/modules/cloud/google/gcp_spanner_database.py b/lib/ansible/modules/cloud/google/gcp_spanner_database.py index 17b156ef19c67d..346348f60d90b0 100644 --- a/lib/ansible/modules/cloud/google/gcp_spanner_database.py +++ b/lib/ansible/modules/cloud/google/gcp_spanner_database.py @@ -147,7 +147,8 @@ def main(): if fetch: if state == 'present': if is_different(module, fetch): - fetch = update(module, self_link(module)) + update(module, self_link(module)) + fetch = fetch_resource(module, self_link(module)) changed = True else: delete(module, self_link(module)) @@ -157,8 +158,6 @@ def main(): if state == 'present': fetch = create(module, collection(module)) changed = True - else: - fetch = {} fetch.update({'changed': changed}) diff --git a/lib/ansible/modules/cloud/google/gcp_spanner_instance.py b/lib/ansible/modules/cloud/google/gcp_spanner_instance.py index 50d0ee1a92cf3f..e881c0a3b75660 100644 --- a/lib/ansible/modules/cloud/google/gcp_spanner_instance.py +++ b/lib/ansible/modules/cloud/google/gcp_spanner_instance.py @@ -189,7 +189,8 @@ def main(): if fetch: if state == 'present': if is_different(module, fetch): - fetch = update(module, self_link(module)) + update(module, self_link(module)) + fetch = fetch_resource(module, self_link(module)) changed = True else: delete(module, self_link(module)) @@ -199,8 +200,6 @@ def main(): if state == 'present': fetch = create(module, collection(module)) changed = True - else: - fetch = {} fetch.update({'changed': changed}) diff --git a/lib/ansible/modules/cloud/google/gcp_sql_database.py b/lib/ansible/modules/cloud/google/gcp_sql_database.py index fd6987c93ef1d6..2b2587fe84dc58 100644 --- a/lib/ansible/modules/cloud/google/gcp_sql_database.py +++ b/lib/ansible/modules/cloud/google/gcp_sql_database.py @@ -156,7 +156,8 @@ def main(): if fetch: if state == 'present': if is_different(module, fetch): - fetch = update(module, self_link(module), kind) + update(module, self_link(module), kind) + fetch = fetch_resource(module, self_link(module), kind) changed = True else: delete(module, self_link(module), kind) @@ -166,8 +167,6 @@ def main(): if state == 'present': fetch = create(module, collection(module), kind) changed = True - else: - fetch = {} fetch.update({'changed': changed}) diff --git a/lib/ansible/modules/cloud/google/gcp_sql_instance.py b/lib/ansible/modules/cloud/google/gcp_sql_instance.py index 3cb7e522876cb9..f7e714d7047ec6 100644 --- a/lib/ansible/modules/cloud/google/gcp_sql_instance.py +++ b/lib/ansible/modules/cloud/google/gcp_sql_instance.py @@ -609,7 +609,8 @@ def main(): if fetch: if state == 'present': if is_different(module, fetch): - fetch = update(module, self_link(module), kind, fetch) + update(module, self_link(module), kind, fetch) + fetch = fetch_resource(module, self_link(module), kind) changed = True else: delete(module, self_link(module), kind, fetch) @@ -619,8 +620,6 @@ def main(): if state == 'present': fetch = create(module, collection(module), kind) changed = True - else: - fetch = {} fetch.update({'changed': changed}) diff --git a/lib/ansible/modules/cloud/google/gcp_sql_user.py b/lib/ansible/modules/cloud/google/gcp_sql_user.py index 32d39fc630a563..f16b8d535fa759 100644 --- a/lib/ansible/modules/cloud/google/gcp_sql_user.py +++ b/lib/ansible/modules/cloud/google/gcp_sql_user.py @@ -161,7 +161,8 @@ def main(): if fetch: if state == 'present': if is_different(module, fetch): - fetch = update(module, self_link(module), kind) + update(module, self_link(module), kind) + fetch = fetch_resource(module, self_link(module), kind) changed = True else: delete(module, self_link(module), kind) @@ -171,8 +172,6 @@ def main(): if state == 'present': fetch = create(module, collection(module), kind) changed = True - else: - fetch = {} fetch.update({'changed': changed}) diff --git a/lib/ansible/modules/cloud/google/gcp_storage_bucket.py b/lib/ansible/modules/cloud/google/gcp_storage_bucket.py index 8103fcd5f80e1d..9f123a8f6a2a7c 100644 --- a/lib/ansible/modules/cloud/google/gcp_storage_bucket.py +++ b/lib/ansible/modules/cloud/google/gcp_storage_bucket.py @@ -840,7 +840,8 @@ def main(): if fetch: if state == 'present': if is_different(module, fetch): - fetch = update(module, self_link(module), kind) + update(module, self_link(module), kind) + fetch = fetch_resource(module, self_link(module), kind) changed = True else: delete(module, self_link(module), kind) @@ -850,8 +851,6 @@ def main(): if state == 'present': fetch = create(module, collection(module), kind) changed = True - else: - fetch = {} fetch.update({'changed': changed}) diff --git a/lib/ansible/modules/cloud/google/gcp_storage_bucket_access_control.py b/lib/ansible/modules/cloud/google/gcp_storage_bucket_access_control.py index e7b1f0922e9b22..74af6916cee879 100644 --- a/lib/ansible/modules/cloud/google/gcp_storage_bucket_access_control.py +++ b/lib/ansible/modules/cloud/google/gcp_storage_bucket_access_control.py @@ -217,7 +217,8 @@ def main(): if fetch: if state == 'present': if is_different(module, fetch): - fetch = update(module, self_link(module), kind) + update(module, self_link(module), kind) + fetch = fetch_resource(module, self_link(module), kind) changed = True else: delete(module, self_link(module), kind) @@ -227,8 +228,6 @@ def main(): if state == 'present': fetch = create(module, collection(module), kind) changed = True - else: - fetch = {} fetch.update({'changed': changed}) From 3bd384f82ac225f13de62fe1e4be2a8a76265eee Mon Sep 17 00:00:00 2001 From: The Magician Date: Mon, 24 Sep 2018 16:14:39 -0700 Subject: [PATCH 038/144] Better documentation for how a resourceref works (#96) /cc @rambleraptor --- .../cloud/google/gcp_compute_address.py | 5 +++++ .../google/gcp_compute_backend_service.py | 5 +++++ .../modules/cloud/google/gcp_compute_disk.py | 5 +++++ .../cloud/google/gcp_compute_firewall.py | 5 +++++ .../google/gcp_compute_forwarding_rule.py | 20 +++++++++++++++++++ .../gcp_compute_global_forwarding_rule.py | 15 ++++++++++++++ .../modules/cloud/google/gcp_compute_image.py | 5 +++++ .../cloud/google/gcp_compute_instance.py | 20 +++++++++++++++++++ .../google/gcp_compute_instance_group.py | 10 ++++++++++ .../gcp_compute_instance_group_manager.py | 5 +++++ .../google/gcp_compute_instance_template.py | 20 +++++++++++++++++++ .../modules/cloud/google/gcp_compute_route.py | 5 +++++ .../cloud/google/gcp_compute_router.py | 5 +++++ .../cloud/google/gcp_compute_subnetwork.py | 5 +++++ .../google/gcp_compute_target_http_proxy.py | 5 +++++ .../google/gcp_compute_target_https_proxy.py | 5 +++++ .../cloud/google/gcp_compute_target_pool.py | 10 ++++++++++ .../google/gcp_compute_target_ssl_proxy.py | 5 +++++ .../google/gcp_compute_target_tcp_proxy.py | 5 +++++ .../google/gcp_compute_target_vpn_gateway.py | 5 +++++ .../cloud/google/gcp_compute_url_map.py | 20 +++++++++++++++++++ .../cloud/google/gcp_compute_vpn_tunnel.py | 10 ++++++++++ .../cloud/google/gcp_container_node_pool.py | 5 +++++ .../google/gcp_dns_resource_record_set.py | 5 +++++ .../gcp_dns_resource_record_set_facts.py | 5 +++++ .../cloud/google/gcp_pubsub_subscription.py | 5 +++++ .../cloud/google/gcp_spanner_database.py | 5 +++++ .../modules/cloud/google/gcp_sql_database.py | 5 +++++ .../modules/cloud/google/gcp_sql_user.py | 5 +++++ .../cloud/google/gcp_storage_bucket.py | 10 ++++++++++ .../gcp_storage_bucket_access_control.py | 5 +++++ 31 files changed, 245 insertions(+) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_address.py b/lib/ansible/modules/cloud/google/gcp_compute_address.py index b22d55c1b6ebb3..921fe70824c9b9 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_address.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_address.py @@ -86,6 +86,11 @@ - The URL of the subnetwork in which to reserve the address. If an IP address is specified, it must be within the subnetwork's IP range. - This field can only be used with INTERNAL type with GCE_ENDPOINT/DNS_RESOLVER purposes. + - 'This field represents a link to a Subnetwork resource in GCP. It can be specified + in two ways. You can add `register: name-of-resource` to a gcp_compute_subnetwork + task and then set this subnetwork field to "{{ name-of-resource }}" Alternatively, + you can set this subnetwork to a dictionary with the selfLink key where the value + is the selfLink of your Subnetwork.' required: false version_added: 2.7 region: diff --git a/lib/ansible/modules/cloud/google/gcp_compute_backend_service.py b/lib/ansible/modules/cloud/google/gcp_compute_backend_service.py index 24bd0990f0ec40..6315e14bec20c1 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_backend_service.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_backend_service.py @@ -89,6 +89,11 @@ - 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. + - 'This field represents a link to a InstanceGroup resource in GCP. It can be specified + in two ways. You can add `register: name-of-resource` to a gcp_compute_instance_group + task and then set this group field to "{{ name-of-resource }}" Alternatively, you + can set this group to a dictionary with the selfLink key where the value is the + selfLink of your InstanceGroup.' required: false max_connections: description: diff --git a/lib/ansible/modules/cloud/google/gcp_compute_disk.py b/lib/ansible/modules/cloud/google/gcp_compute_disk.py index e7613fe1e2de89..575e8976786ce6 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_disk.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_disk.py @@ -155,6 +155,11 @@ full URL to the resource. For example, the following are valid values: * `U(https://www.googleapis.com/compute/v1/projects/project/global/snapshots/snapshot`) * `projects/project/global/snapshots/snapshot` * `global/snapshots/snapshot` .' + - 'This field represents a link to a Snapshot resource in GCP. It can be specified + in two ways. You can add `register: name-of-resource` to a gcp_compute_snapshot + task and then set this source_snapshot field to "{{ name-of-resource }}" Alternatively, + you can set this source_snapshot to a dictionary with the selfLink key where the + value is the selfLink of your Snapshot.' required: false source_snapshot_encryption_key: description: diff --git a/lib/ansible/modules/cloud/google/gcp_compute_firewall.py b/lib/ansible/modules/cloud/google/gcp_compute_firewall.py index add7cfeb46d6d0..be7eb78e2a6d57 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_firewall.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_firewall.py @@ -130,6 +130,11 @@ U(https://www.googleapis.com/compute/v1/projects/myproject/global/) networks/my-network projects/myproject/global/networks/my-network global/networks/default .' + - 'This field represents a link to a Network resource in GCP. It can be specified + in two ways. You can add `register: name-of-resource` to a gcp_compute_network task + and then set this network field to "{{ name-of-resource }}" Alternatively, you can + set this network to a dictionary with the selfLink key where the value is the selfLink + of your Network.' required: true priority: description: diff --git a/lib/ansible/modules/cloud/google/gcp_compute_forwarding_rule.py b/lib/ansible/modules/cloud/google/gcp_compute_forwarding_rule.py index 40f498b3b808b7..f8c3768f4437f7 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_forwarding_rule.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_forwarding_rule.py @@ -85,6 +85,11 @@ - A reference to a BackendService to receive the matched traffic. - This is used for internal load balancing. - "(not used for external load balancing) ." + - 'This field represents a link to a BackendService resource in GCP. It can be specified + in two ways. You can add `register: name-of-resource` to a gcp_compute_backend_service + task and then set this backend_service field to "{{ name-of-resource }}" Alternatively, + you can set this backend_service to a dictionary with the selfLink key where the + value is the selfLink of your BackendService.' required: false ip_version: description: @@ -116,6 +121,11 @@ IP should belong to for this Forwarding Rule. If this field is not specified, the default network will be used. - This field is not used for external load balancing. + - 'This field represents a link to a Network resource in GCP. It can be specified + in two ways. You can add `register: name-of-resource` to a gcp_compute_network task + and then set this network field to "{{ name-of-resource }}" Alternatively, you can + set this network to a dictionary with the selfLink key where the value is the selfLink + of your Network.' required: false port_range: description: @@ -147,6 +157,11 @@ - If the network specified is in auto subnet mode, this field is optional. However, if the network is in custom subnet mode, a subnetwork must be specified. - This field is not used for external load balancing. + - 'This field represents a link to a Subnetwork resource in GCP. It can be specified + in two ways. You can add `register: name-of-resource` to a gcp_compute_subnetwork + task and then set this subnetwork field to "{{ name-of-resource }}" Alternatively, + you can set this subnetwork to a dictionary with the selfLink key where the value + is the selfLink of your Subnetwork.' required: false target: description: @@ -155,6 +170,11 @@ rule. For global forwarding rules, this target must be a global load balancing resource. The forwarded traffic must be of a type appropriate to the target object. - This field is not used for internal load balancing. + - 'This field represents a link to a TargetPool resource in GCP. It can be specified + in two ways. You can add `register: name-of-resource` to a gcp_compute_target_pool + task and then set this target field to "{{ name-of-resource }}" Alternatively, you + can set this target to a dictionary with the selfLink key where the value is the + selfLink of your TargetPool.' required: false version_added: 2.7 region: diff --git a/lib/ansible/modules/cloud/google/gcp_compute_global_forwarding_rule.py b/lib/ansible/modules/cloud/google/gcp_compute_global_forwarding_rule.py index 2dc94c95166678..b267161bffc453 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_global_forwarding_rule.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_global_forwarding_rule.py @@ -87,6 +87,11 @@ - A reference to a BackendService to receive the matched traffic. - This is used for internal load balancing. - "(not used for external load balancing) ." + - 'This field represents a link to a BackendService resource in GCP. It can be specified + in two ways. You can add `register: name-of-resource` to a gcp_compute_backend_service + task and then set this backend_service field to "{{ name-of-resource }}" Alternatively, + you can set this backend_service to a dictionary with the selfLink key where the + value is the selfLink of your BackendService.' required: false ip_version: description: @@ -118,6 +123,11 @@ IP should belong to for this Forwarding Rule. If this field is not specified, the default network will be used. - This field is not used for external load balancing. + - 'This field represents a link to a Network resource in GCP. It can be specified + in two ways. You can add `register: name-of-resource` to a gcp_compute_network task + and then set this network field to "{{ name-of-resource }}" Alternatively, you can + set this network to a dictionary with the selfLink key where the value is the selfLink + of your Network.' required: false port_range: description: @@ -149,6 +159,11 @@ - If the network specified is in auto subnet mode, this field is optional. However, if the network is in custom subnet mode, a subnetwork must be specified. - This field is not used for external load balancing. + - 'This field represents a link to a Subnetwork resource in GCP. It can be specified + in two ways. You can add `register: name-of-resource` to a gcp_compute_subnetwork + task and then set this subnetwork field to "{{ name-of-resource }}" Alternatively, + you can set this subnetwork to a dictionary with the selfLink key where the value + is the selfLink of your Subnetwork.' required: false target: description: diff --git a/lib/ansible/modules/cloud/google/gcp_compute_image.py b/lib/ansible/modules/cloud/google/gcp_compute_image.py index 08ea2ab60c66f7..3982250721b450 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_image.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_image.py @@ -148,6 +148,11 @@ description: - Refers to a gcompute_disk object You must provide either this property or the rawDisk.source property but not both to create an image. + - 'This field represents a link to a Disk resource in GCP. It can be specified in + two ways. You can add `register: name-of-resource` to a gcp_compute_disk task and + then set this source_disk field to "{{ name-of-resource }}" Alternatively, you can + set this source_disk to a dictionary with the selfLink key where the value is the + selfLink of your Disk.' required: false source_disk_encryption_key: description: diff --git a/lib/ansible/modules/cloud/google/gcp_compute_instance.py b/lib/ansible/modules/cloud/google/gcp_compute_instance.py index 100b6659445f34..b57c830f0756a6 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_instance.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_instance.py @@ -171,6 +171,11 @@ or disks.source is required. - If desired, you can also attach existing non-root persistent disks using this property. This field is only applicable for persistent disks. + - 'This field represents a link to a Disk resource in GCP. It can be specified in + two ways. You can add `register: name-of-resource` to a gcp_compute_disk task and + then set this source field to "{{ name-of-resource }}" Alternatively, you can set + this source to a dictionary with the selfLink key where the value is the selfLink + of your Disk.' required: false type: description: @@ -249,6 +254,11 @@ field undefined to use an IP from a shared ephemeral IP address pool. If you specify a static external IP address, it must live in the same region as the zone of the instance. + - 'This field represents a link to a Address resource in GCP. It can be specified + in two ways. You can add `register: name-of-resource` to a gcp_compute_address task + and then set this nat_ip field to "{{ name-of-resource }}" Alternatively, you can + set this nat_ip to a dictionary with the address key where the value is the address + of your Address.' required: false type: description: @@ -286,6 +296,11 @@ if neither the network nor the subnetwork is specified, the default network global/networks/default is used; if the network is not specified but the subnetwork is specified, the network is inferred. + - 'This field represents a link to a Network resource in GCP. It can be specified + in two ways. You can add `register: name-of-resource` to a gcp_compute_network task + and then set this network field to "{{ name-of-resource }}" Alternatively, you can + set this network to a dictionary with the selfLink key where the value is the selfLink + of your Network.' required: false network_ip: description: @@ -298,6 +313,11 @@ - If the network resource is in legacy mode, do not provide this property. If the network is in auto subnet mode, providing the subnetwork is optional. If the network is in custom subnet mode, then this field should be specified. + - 'This field represents a link to a Subnetwork resource in GCP. It can be specified + in two ways. You can add `register: name-of-resource` to a gcp_compute_subnetwork + task and then set this subnetwork field to "{{ name-of-resource }}" Alternatively, + you can set this subnetwork to a dictionary with the selfLink key where the value + is the selfLink of your Subnetwork.' required: false scheduling: description: diff --git a/lib/ansible/modules/cloud/google/gcp_compute_instance_group.py b/lib/ansible/modules/cloud/google/gcp_compute_instance_group.py index 33680c9e1a021a..79eb79e5671ce7 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_instance_group.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_instance_group.py @@ -81,6 +81,11 @@ network: description: - The network to which all instances in the instance group belong. + - 'This field represents a link to a Network resource in GCP. It can be specified + in two ways. You can add `register: name-of-resource` to a gcp_compute_network task + and then set this network field to "{{ name-of-resource }}" Alternatively, you can + set this network to a dictionary with the selfLink key where the value is the selfLink + of your Network.' required: false region: description: @@ -89,6 +94,11 @@ subnetwork: description: - The subnetwork to which all instances in the instance group belong. + - 'This field represents a link to a Subnetwork resource in GCP. It can be specified + in two ways. You can add `register: name-of-resource` to a gcp_compute_subnetwork + task and then set this subnetwork field to "{{ name-of-resource }}" Alternatively, + you can set this subnetwork to a dictionary with the selfLink key where the value + is the selfLink of your Subnetwork.' required: false zone: description: diff --git a/lib/ansible/modules/cloud/google/gcp_compute_instance_group_manager.py b/lib/ansible/modules/cloud/google/gcp_compute_instance_group_manager.py index f975f329d874e1..bbea008909bb8a 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_instance_group_manager.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_instance_group_manager.py @@ -67,6 +67,11 @@ description: - The instance template that is specified for this managed instance group. The group uses this template to create all new instances in the managed instance group. + - 'This field represents a link to a InstanceTemplate resource in GCP. It can be specified + in two ways. You can add `register: name-of-resource` to a gcp_compute_instance_template + task and then set this instance_template field to "{{ name-of-resource }}" Alternatively, + you can set this instance_template to a dictionary with the selfLink key where the + value is the selfLink of your InstanceTemplate.' required: true name: description: diff --git a/lib/ansible/modules/cloud/google/gcp_compute_instance_template.py b/lib/ansible/modules/cloud/google/gcp_compute_instance_template.py index 231712c9feaf46..374b2139f8f862 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_instance_template.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_instance_template.py @@ -200,6 +200,11 @@ - If desired, you can also attach existing non-root persistent disks using this property. This field is only applicable for persistent disks. - Note that for InstanceTemplate, specify the disk name, not the URL for the disk. + - 'This field represents a link to a Disk resource in GCP. It can be specified in + two ways. You can add `register: name-of-resource` to a gcp_compute_disk task and + then set this source field to "{{ name-of-resource }}" Alternatively, you can set + this source to a dictionary with the name key where the value is the name of your + Disk.' required: false type: description: @@ -257,6 +262,11 @@ field undefined to use an IP from a shared ephemeral IP address pool. If you specify a static external IP address, it must live in the same region as the zone of the instance. + - 'This field represents a link to a Address resource in GCP. It can be specified + in two ways. You can add `register: name-of-resource` to a gcp_compute_address task + and then set this nat_ip field to "{{ name-of-resource }}" Alternatively, you can + set this nat_ip to a dictionary with the address key where the value is the address + of your Address.' required: false type: description: @@ -294,6 +304,11 @@ if neither the network nor the subnetwork is specified, the default network global/networks/default is used; if the network is not specified but the subnetwork is specified, the network is inferred. + - 'This field represents a link to a Network resource in GCP. It can be specified + in two ways. You can add `register: name-of-resource` to a gcp_compute_network task + and then set this network field to "{{ name-of-resource }}" Alternatively, you can + set this network to a dictionary with the selfLink key where the value is the selfLink + of your Network.' required: false network_ip: description: @@ -306,6 +321,11 @@ - If the network resource is in legacy mode, do not provide this property. If the network is in auto subnet mode, providing the subnetwork is optional. If the network is in custom subnet mode, then this field should be specified. + - 'This field represents a link to a Subnetwork resource in GCP. It can be specified + in two ways. You can add `register: name-of-resource` to a gcp_compute_subnetwork + task and then set this subnetwork field to "{{ name-of-resource }}" Alternatively, + you can set this subnetwork to a dictionary with the selfLink key where the value + is the selfLink of your Subnetwork.' required: false scheduling: description: diff --git a/lib/ansible/modules/cloud/google/gcp_compute_route.py b/lib/ansible/modules/cloud/google/gcp_compute_route.py index 0ae43ff0ebc4cb..2a29db4f72cb3f 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_route.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_route.py @@ -84,6 +84,11 @@ network: description: - The network that this route applies to. + - 'This field represents a link to a Network resource in GCP. It can be specified + in two ways. You can add `register: name-of-resource` to a gcp_compute_network task + and then set this network field to "{{ name-of-resource }}" Alternatively, you can + set this network to a dictionary with the selfLink key where the value is the selfLink + of your Network.' required: true priority: description: diff --git a/lib/ansible/modules/cloud/google/gcp_compute_router.py b/lib/ansible/modules/cloud/google/gcp_compute_router.py index b306ff5125cd7d..b637877c4a2b18 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_router.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_router.py @@ -61,6 +61,11 @@ network: description: - A reference to the network to which this router belongs. + - 'This field represents a link to a Network resource in GCP. It can be specified + in two ways. You can add `register: name-of-resource` to a gcp_compute_network task + and then set this network field to "{{ name-of-resource }}" Alternatively, you can + set this network to a dictionary with the selfLink key where the value is the selfLink + of your Network.' required: true bgp: description: diff --git a/lib/ansible/modules/cloud/google/gcp_compute_subnetwork.py b/lib/ansible/modules/cloud/google/gcp_compute_subnetwork.py index 9a2b8bfe3e90df..755d9e80ebd705 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_subnetwork.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_subnetwork.py @@ -87,6 +87,11 @@ description: - The network this subnet belongs to. - Only networks that are in the distributed mode can have subnetworks. + - 'This field represents a link to a Network resource in GCP. It can be specified + in two ways. You can add `register: name-of-resource` to a gcp_compute_network task + and then set this network field to "{{ name-of-resource }}" Alternatively, you can + set this network to a dictionary with the selfLink key where the value is the selfLink + of your Network.' required: true private_ip_google_access: description: diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_http_proxy.py b/lib/ansible/modules/cloud/google/gcp_compute_target_http_proxy.py index 15ed282a42f13e..430a3bafd6012d 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_http_proxy.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_http_proxy.py @@ -63,6 +63,11 @@ url_map: description: - A reference to the UrlMap resource that defines the mapping from URL to the BackendService. + - 'This field represents a link to a UrlMap resource in GCP. It can be specified in + two ways. You can add `register: name-of-resource` to a gcp_compute_url_map task + and then set this url_map field to "{{ name-of-resource }}" Alternatively, you can + set this url_map to a dictionary with the selfLink key where the value is the selfLink + of your UrlMap.' required: true extends_documentation_fragment: gcp notes: diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_https_proxy.py b/lib/ansible/modules/cloud/google/gcp_compute_target_https_proxy.py index 3d835646c91f97..f41f3fb2462730 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_https_proxy.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_https_proxy.py @@ -78,6 +78,11 @@ url_map: description: - A reference to the UrlMap resource that defines the mapping from URL to the BackendService. + - 'This field represents a link to a UrlMap resource in GCP. It can be specified in + two ways. You can add `register: name-of-resource` to a gcp_compute_url_map task + and then set this url_map field to "{{ name-of-resource }}" Alternatively, you can + set this url_map to a dictionary with the selfLink key where the value is the selfLink + of your UrlMap.' required: true extends_documentation_fragment: gcp notes: diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_pool.py b/lib/ansible/modules/cloud/google/gcp_compute_target_pool.py index 6f8dc91d5bb996..1bc92b755ceb87 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_pool.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_pool.py @@ -59,6 +59,11 @@ the backup pool are unhealthy, the traffic will be directed back to the primary pool in the "force" mode, where traffic will be spread to the healthy instances with the best effort, or to all instances when no instance is healthy. + - 'This field represents a link to a TargetPool resource in GCP. It can be specified + in two ways. You can add `register: name-of-resource` to a gcp_compute_target_pool + task and then set this backup_pool field to "{{ name-of-resource }}" Alternatively, + you can set this backup_pool to a dictionary with the selfLink key where the value + is the selfLink of your TargetPool.' required: false description: description: @@ -84,6 +89,11 @@ - A member instance in this pool is considered healthy if and only if the health checks pass. If not specified it means all member instances will be considered healthy at all times. + - 'This field represents a link to a HttpHealthCheck resource in GCP. It can be specified + in two ways. You can add `register: name-of-resource` to a gcp_compute_http_health_check + task and then set this health_check field to "{{ name-of-resource }}" Alternatively, + you can set this health_check to a dictionary with the selfLink key where the value + is the selfLink of your HttpHealthCheck.' required: false instances: description: diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_ssl_proxy.py b/lib/ansible/modules/cloud/google/gcp_compute_target_ssl_proxy.py index da8dfde0e61093..5de42d97281f65 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_ssl_proxy.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_ssl_proxy.py @@ -69,6 +69,11 @@ service: description: - A reference to the BackendService resource. + - 'This field represents a link to a BackendService resource in GCP. It can be specified + in two ways. You can add `register: name-of-resource` to a gcp_compute_backend_service + task and then set this service field to "{{ name-of-resource }}" Alternatively, + you can set this service to a dictionary with the selfLink key where the value is + the selfLink of your BackendService.' required: true ssl_certificates: description: diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_tcp_proxy.py b/lib/ansible/modules/cloud/google/gcp_compute_target_tcp_proxy.py index 2de7c0af16f248..696db170c997ad 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_tcp_proxy.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_tcp_proxy.py @@ -69,6 +69,11 @@ service: description: - A reference to the BackendService resource. + - 'This field represents a link to a BackendService resource in GCP. It can be specified + in two ways. You can add `register: name-of-resource` to a gcp_compute_backend_service + task and then set this service field to "{{ name-of-resource }}" Alternatively, + you can set this service to a dictionary with the selfLink key where the value is + the selfLink of your BackendService.' required: true extends_documentation_fragment: gcp notes: diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_vpn_gateway.py b/lib/ansible/modules/cloud/google/gcp_compute_target_vpn_gateway.py index 061dc5805a5b5f..5245bc29eb02da 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_vpn_gateway.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_vpn_gateway.py @@ -63,6 +63,11 @@ network: description: - The network this VPN gateway is accepting traffic for. + - 'This field represents a link to a Network resource in GCP. It can be specified + in two ways. You can add `register: name-of-resource` to a gcp_compute_network task + and then set this network field to "{{ name-of-resource }}" Alternatively, you can + set this network to a dictionary with the selfLink key where the value is the selfLink + of your Network.' required: true region: description: diff --git a/lib/ansible/modules/cloud/google/gcp_compute_url_map.py b/lib/ansible/modules/cloud/google/gcp_compute_url_map.py index dc151bb5471a33..4808542f940fc8 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_url_map.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_url_map.py @@ -50,6 +50,11 @@ default_service: description: - A reference to BackendService resource if none of the hostRules match. + - 'This field represents a link to a BackendService resource in GCP. It can be specified + in two ways. You can add `register: name-of-resource` to a gcp_compute_backend_service + task and then set this default_service field to "{{ name-of-resource }}" Alternatively, + you can set this default_service to a dictionary with the selfLink key where the + value is the selfLink of your BackendService.' required: true description: description: @@ -95,6 +100,11 @@ description: - A reference to a BackendService resource. This will be used if none of the pathRules defined by this PathMatcher is matched by the URL's path portion. + - 'This field represents a link to a BackendService resource in GCP. It can be specified + in two ways. You can add `register: name-of-resource` to a gcp_compute_backend_service + task and then set this default_service field to "{{ name-of-resource }}" Alternatively, + you can set this default_service to a dictionary with the selfLink key where the + value is the selfLink of your BackendService.' required: false description: description: @@ -118,6 +128,11 @@ service: description: - A reference to the BackendService resource if this rule is matched. + - 'This field represents a link to a BackendService resource in GCP. It can be specified + in two ways. You can add `register: name-of-resource` to a gcp_compute_backend_service + task and then set this service field to "{{ name-of-resource }}" Alternatively, + you can set this service to a dictionary with the selfLink key where the value is + the selfLink of your BackendService.' required: false tests: description: @@ -140,6 +155,11 @@ service: description: - A reference to expected BackendService resource the given URL should be mapped to. + - 'This field represents a link to a BackendService resource in GCP. It can be specified + in two ways. You can add `register: name-of-resource` to a gcp_compute_backend_service + task and then set this service field to "{{ name-of-resource }}" Alternatively, + you can set this service to a dictionary with the selfLink key where the value is + the selfLink of your BackendService.' required: false extends_documentation_fragment: gcp ''' diff --git a/lib/ansible/modules/cloud/google/gcp_compute_vpn_tunnel.py b/lib/ansible/modules/cloud/google/gcp_compute_vpn_tunnel.py index 9f1cd04dafd6bf..393129a4db6bd2 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_vpn_tunnel.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_vpn_tunnel.py @@ -61,10 +61,20 @@ target_vpn_gateway: description: - URL of the Target VPN gateway with which this VPN tunnel is associated. + - 'This field represents a link to a TargetVpnGateway resource in GCP. It can be specified + in two ways. You can add `register: name-of-resource` to a gcp_compute_target_vpn_gateway + task and then set this target_vpn_gateway field to "{{ name-of-resource }}" Alternatively, + you can set this target_vpn_gateway to a dictionary with the selfLink key where + the value is the selfLink of your TargetVpnGateway.' required: true router: description: - URL of router resource to be used for dynamic routing. + - 'This field represents a link to a Router resource in GCP. It can be specified in + two ways. You can add `register: name-of-resource` to a gcp_compute_router task + and then set this router field to "{{ name-of-resource }}" Alternatively, you can + set this router to a dictionary with the selfLink key where the value is the selfLink + of your Router.' required: false peer_ip: description: diff --git a/lib/ansible/modules/cloud/google/gcp_container_node_pool.py b/lib/ansible/modules/cloud/google/gcp_container_node_pool.py index 4a69d4d3d7660b..2a53c3a52aae76 100644 --- a/lib/ansible/modules/cloud/google/gcp_container_node_pool.py +++ b/lib/ansible/modules/cloud/google/gcp_container_node_pool.py @@ -198,6 +198,11 @@ cluster: description: - The cluster this node pool belongs to. + - 'This field represents a link to a Cluster resource in GCP. It can be specified + in two ways. You can add `register: name-of-resource` to a gcp_container_cluster + task and then set this cluster field to "{{ name-of-resource }}" Alternatively, + you can set this cluster to a dictionary with the name key where the value is the + name of your Cluster.' required: true zone: description: diff --git a/lib/ansible/modules/cloud/google/gcp_dns_resource_record_set.py b/lib/ansible/modules/cloud/google/gcp_dns_resource_record_set.py index a935a8191a82b4..e69122587c3d84 100644 --- a/lib/ansible/modules/cloud/google/gcp_dns_resource_record_set.py +++ b/lib/ansible/modules/cloud/google/gcp_dns_resource_record_set.py @@ -71,6 +71,11 @@ description: - Identifies the managed zone addressed by this request. - Can be the managed zone name or id. + - 'This field represents a link to a ManagedZone resource in GCP. It can be specified + in two ways. You can add `register: name-of-resource` to a gcp_dns_managed_zone + task and then set this managed_zone field to "{{ name-of-resource }}" Alternatively, + you can set this managed_zone to a dictionary with the name key where the value + is the name of your ManagedZone.' required: true extends_documentation_fragment: gcp ''' diff --git a/lib/ansible/modules/cloud/google/gcp_dns_resource_record_set_facts.py b/lib/ansible/modules/cloud/google/gcp_dns_resource_record_set_facts.py index 99fc6aea6e1879..edafba4cfc93e4 100644 --- a/lib/ansible/modules/cloud/google/gcp_dns_resource_record_set_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_dns_resource_record_set_facts.py @@ -45,6 +45,11 @@ description: - Identifies the managed zone addressed by this request. - Can be the managed zone name or id. + - 'This field represents a link to a ManagedZone resource in GCP. It can be specified + in two ways. You can add `register: name-of-resource` to a gcp_dns_managed_zone + task and then set this managed_zone field to "{{ name-of-resource }}" Alternatively, + you can set this managed_zone to a dictionary with the name key where the value + is the name of your ManagedZone.' required: true extends_documentation_fragment: gcp ''' diff --git a/lib/ansible/modules/cloud/google/gcp_pubsub_subscription.py b/lib/ansible/modules/cloud/google/gcp_pubsub_subscription.py index 19c18d911aef5a..733fa2332438bb 100644 --- a/lib/ansible/modules/cloud/google/gcp_pubsub_subscription.py +++ b/lib/ansible/modules/cloud/google/gcp_pubsub_subscription.py @@ -54,6 +54,11 @@ topic: description: - A reference to a Topic resource. + - 'This field represents a link to a Topic resource in GCP. It can be specified in + two ways. You can add `register: name-of-resource` to a gcp_pubsub_topic task and + then set this topic field to "{{ name-of-resource }}" Alternatively, you can set + this topic to a dictionary with the name key where the value is the name of your + Topic.' required: false push_config: description: diff --git a/lib/ansible/modules/cloud/google/gcp_spanner_database.py b/lib/ansible/modules/cloud/google/gcp_spanner_database.py index 346348f60d90b0..1e05e459753bee 100644 --- a/lib/ansible/modules/cloud/google/gcp_spanner_database.py +++ b/lib/ansible/modules/cloud/google/gcp_spanner_database.py @@ -61,6 +61,11 @@ instance: description: - The instance to create the database on. + - 'This field represents a link to a Instance resource in GCP. It can be specified + in two ways. You can add `register: name-of-resource` to a gcp_spanner_instance + task and then set this instance field to "{{ name-of-resource }}" Alternatively, + you can set this instance to a dictionary with the name key where the value is the + name of your Instance.' required: true extends_documentation_fragment: gcp ''' diff --git a/lib/ansible/modules/cloud/google/gcp_sql_database.py b/lib/ansible/modules/cloud/google/gcp_sql_database.py index 2b2587fe84dc58..dd1984cb475f53 100644 --- a/lib/ansible/modules/cloud/google/gcp_sql_database.py +++ b/lib/ansible/modules/cloud/google/gcp_sql_database.py @@ -62,6 +62,11 @@ instance: description: - The name of the Cloud SQL instance. This does not include the project ID. + - 'This field represents a link to a Instance resource in GCP. It can be specified + in two ways. You can add `register: name-of-resource` to a gcp_sql_instance task + and then set this instance field to "{{ name-of-resource }}" Alternatively, you + can set this instance to a dictionary with the name key where the value is the name + of your Instance.' required: true extends_documentation_fragment: gcp ''' diff --git a/lib/ansible/modules/cloud/google/gcp_sql_user.py b/lib/ansible/modules/cloud/google/gcp_sql_user.py index f16b8d535fa759..e67d40a6e8eca6 100644 --- a/lib/ansible/modules/cloud/google/gcp_sql_user.py +++ b/lib/ansible/modules/cloud/google/gcp_sql_user.py @@ -59,6 +59,11 @@ instance: description: - The name of the Cloud SQL instance. This does not include the project ID. + - 'This field represents a link to a Instance resource in GCP. It can be specified + in two ways. You can add `register: name-of-resource` to a gcp_sql_instance task + and then set this instance field to "{{ name-of-resource }}" Alternatively, you + can set this instance to a dictionary with the name key where the value is the name + of your Instance.' required: true password: description: diff --git a/lib/ansible/modules/cloud/google/gcp_storage_bucket.py b/lib/ansible/modules/cloud/google/gcp_storage_bucket.py index 9f123a8f6a2a7c..e5093dc6f2347b 100644 --- a/lib/ansible/modules/cloud/google/gcp_storage_bucket.py +++ b/lib/ansible/modules/cloud/google/gcp_storage_bucket.py @@ -59,6 +59,11 @@ bucket: description: - The name of the bucket. + - 'This field represents a link to a Bucket resource in GCP. It can be specified in + two ways. You can add `register: name-of-resource` to a gcp_storage_bucket task + and then set this bucket field to "{{ name-of-resource }}" Alternatively, you can + set this bucket to a dictionary with the name key where the value is the name of + your Bucket.' required: true domain: description: @@ -139,6 +144,11 @@ bucket: description: - The name of the bucket. + - 'This field represents a link to a Bucket resource in GCP. It can be specified in + two ways. You can add `register: name-of-resource` to a gcp_storage_bucket task + and then set this bucket field to "{{ name-of-resource }}" Alternatively, you can + set this bucket to a dictionary with the name key where the value is the name of + your Bucket.' required: true domain: description: diff --git a/lib/ansible/modules/cloud/google/gcp_storage_bucket_access_control.py b/lib/ansible/modules/cloud/google/gcp_storage_bucket_access_control.py index 74af6916cee879..650742ba3c5354 100644 --- a/lib/ansible/modules/cloud/google/gcp_storage_bucket_access_control.py +++ b/lib/ansible/modules/cloud/google/gcp_storage_bucket_access_control.py @@ -58,6 +58,11 @@ bucket: description: - The name of the bucket. + - 'This field represents a link to a Bucket resource in GCP. It can be specified in + two ways. You can add `register: name-of-resource` to a gcp_storage_bucket task + and then set this bucket field to "{{ name-of-resource }}" Alternatively, you can + set this bucket to a dictionary with the name key where the value is the name of + your Bucket.' required: true entity: description: From fb5ed3abee883cbe368028b4c0a8f20bb3f2388a Mon Sep 17 00:00:00 2001 From: Riley Karson Date: Tue, 25 Sep 2018 22:29:29 +0000 Subject: [PATCH 039/144] Add additional properties to VPC Network. --- .../cloud/google/gcp_compute_network.py | 123 +++++++++++++++--- .../cloud/google/gcp_compute_network_facts.py | 15 +++ 2 files changed, 117 insertions(+), 21 deletions(-) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_network.py b/lib/ansible/modules/cloud/google/gcp_compute_network.py index b4e31d9954e162..59997b02519ca5 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_network.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_network.py @@ -62,12 +62,6 @@ - An optional description of this resource. Provide this property when you create the resource. required: false - gateway_ipv4: - description: - - A gateway address for default routing to other networks. This value is read only - and is selected by the Google Compute Engine, typically as the first usable address - in the IPv4Range. - required: false ipv4_range: description: - 'The range of internal addresses that are legal on this network. This range is a @@ -82,7 +76,7 @@ which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash. - required: false + required: true auto_create_subnetworks: description: - When set to true, the network is created in "auto subnet mode". When set to false, @@ -91,7 +85,25 @@ and it automatically creates one subnetwork per region. required: false type: bool + routing_config: + description: + - The network-level routing configuration for this network. Used by Cloud Router to + determine what type of network-wide routing behavior to enforce. + required: false + version_added: 2.8 + suboptions: + routing_mode: + description: + - The network-wide routing mode to use. If set to REGIONAL, this network's cloud routers + will only advertise routes with subnetworks of this network in the same region as + the router. If set to GLOBAL, this network's cloud routers will advertise routes + with all subnetworks of this network, across regions. + required: true + choices: ['REGIONAL', 'GLOBAL'] extends_documentation_fragment: gcp +notes: + - "API Reference: U(https://cloud.google.com/compute/docs/reference/rest/v1/networks)" + - "Official Documentation: U(https://cloud.google.com/vpc/docs/vpc)" ''' EXAMPLES = ''' @@ -159,13 +171,28 @@ - Creation timestamp in RFC3339 text format. returned: success type: str + routingConfig: + description: + - The network-level routing configuration for this network. Used by Cloud Router to + determine what type of network-wide routing behavior to enforce. + returned: success + type: complex + contains: + routingMode: + description: + - The network-wide routing mode to use. If set to REGIONAL, this network's cloud routers + will only advertise routes with subnetworks of this network in the same region as + the router. If set to GLOBAL, this network's cloud routers will advertise routes + with all subnetworks of this network, across regions. + returned: success + type: str ''' ################################################################################ # Imports ################################################################################ -from ansible.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest, replace_resource_dict +from ansible.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest, remove_nones_from_dict, replace_resource_dict import json import time @@ -181,10 +208,12 @@ def main(): argument_spec=dict( state=dict(default='present', choices=['present', 'absent'], type='str'), description=dict(type='str'), - gateway_ipv4=dict(type='str'), ipv4_range=dict(type='str'), - name=dict(type='str'), - auto_create_subnetworks=dict(type='bool') + name=dict(required=True, type='str'), + auto_create_subnetworks=dict(type='bool'), + routing_config=dict(type='list', elements='dict', options=dict( + routing_mode=dict(required=True, type='str', choices=['REGIONAL', 'GLOBAL']) + )) ) ) @@ -200,7 +229,7 @@ def main(): if fetch: if state == 'present': if is_different(module, fetch): - update(module, self_link(module), kind) + update(module, self_link(module), kind, fetch) fetch = fetch_resource(module, self_link(module), kind) changed = True else: @@ -222,9 +251,29 @@ def create(module, link, kind): return wait_for_operation(module, auth.post(link, resource_to_request(module))) -def update(module, link, kind): +def update(module, link, kind, fetch): + update_fields(module, resource_to_request(module), + response_to_hash(module, fetch)) auth = GcpSession(module, 'compute') - return wait_for_operation(module, auth.put(link, resource_to_request(module))) + return wait_for_operation(module, auth.patch(link, resource_to_request(module))) + + +def update_fields(module, request, response): + if response.get('routingConfig') != request.get('routingConfig'): + routing_config_update(module, request, response) + + +def routing_config_update(module, request, response): + auth = GcpSession(module, 'compute') + auth.patch( + ''.join([ + "https://www.googleapis.com/compute/v1/", + "projects/{project}/regions/{region}/subnetworks/{name}" + ]).format(**module.params), + { + u'routingConfig': NetworkRoutingConfigArray(module.params.get('routing_config', []), module).to_request() + } + ) def delete(module, link, kind): @@ -236,10 +285,10 @@ def resource_to_request(module): request = { u'kind': 'compute#network', u'description': module.params.get('description'), - u'gatewayIPv4': module.params.get('gateway_ipv4'), u'IPv4Range': module.params.get('ipv4_range'), u'name': module.params.get('name'), - u'autoCreateSubnetworks': module.params.get('auto_create_subnetworks') + u'autoCreateSubnetworks': module.params.get('auto_create_subnetworks'), + u'routingConfig': NetworkRoutingConfigArray(module.params.get('routing_config', []), module).to_request() } return_vals = {} for k, v in request.items(): @@ -305,14 +354,15 @@ def is_different(module, response): # This is for doing comparisons with Ansible's current parameters. def response_to_hash(module, response): return { - u'description': response.get(u'description'), + u'description': module.params.get('description'), u'gatewayIPv4': response.get(u'gateway_ipv4'), u'id': response.get(u'id'), - u'IPv4Range': response.get(u'ipv4_range'), - u'name': response.get(u'name'), + u'IPv4Range': module.params.get('ipv4_range'), + u'name': module.params.get('name'), u'subnetworks': response.get(u'subnetworks'), - u'autoCreateSubnetworks': response.get(u'autoCreateSubnetworks'), - u'creationTimestamp': response.get(u'creationTimestamp') + u'autoCreateSubnetworks': module.params.get('auto_create_subnetworks'), + u'creationTimestamp': response.get(u'creationTimestamp'), + u'routingConfig': NetworkRoutingConfigArray(response.get(u'routingConfig', []), module).from_response() } @@ -353,5 +403,36 @@ def raise_if_errors(response, err_path, module): module.fail_json(msg=errors) +class NetworkRoutingConfigArray(object): + def __init__(self, request, module): + self.module = module + if request: + self.request = request + else: + self.request = [] + + def to_request(self): + items = [] + for item in self.request: + items.append(self._request_for_item(item)) + return items + + def from_response(self): + items = [] + for item in self.request: + items.append(self._response_from_item(item)) + return items + + def _request_for_item(self, item): + return remove_nones_from_dict({ + u'routingMode': item.get('routing_mode') + }) + + def _response_from_item(self, item): + return remove_nones_from_dict({ + u'routingMode': item.get(u'routingMode') + }) + + if __name__ == '__main__': main() diff --git a/lib/ansible/modules/cloud/google/gcp_compute_network_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_network_facts.py index 6ba8542a1bbd9d..f7c87a316c6d6e 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_network_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_network_facts.py @@ -119,6 +119,21 @@ - Creation timestamp in RFC3339 text format. returned: success type: str + routingConfig: + description: + - The network-level routing configuration for this network. Used by Cloud Router to + determine what type of network-wide routing behavior to enforce. + returned: success + type: complex + contains: + routingMode: + description: + - The network-wide routing mode to use. If set to REGIONAL, this network's cloud routers + will only advertise routes with subnetworks of this network in the same region as + the router. If set to GLOBAL, this network's cloud routers will advertise routes + with all subnetworks of this network, across regions. + returned: success + type: str ''' ################################################################################ From ddd734740f002008275623eb173031ccd220a202 Mon Sep 17 00:00:00 2001 From: The Magician Date: Fri, 28 Sep 2018 12:47:18 -0700 Subject: [PATCH 040/144] Metadata encoder/decoder should allow empty values /cc @rambleraptor --- lib/ansible/modules/cloud/google/gcp_compute_instance.py | 4 ++-- .../modules/cloud/google/gcp_compute_instance_template.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_instance.py b/lib/ansible/modules/cloud/google/gcp_compute_instance.py index b57c830f0756a6..6e79c684bf0181 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_instance.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_instance.py @@ -1123,13 +1123,13 @@ def raise_if_errors(response, err_path, module): def encode_request(request, module): - if 'metadata' in request: + if 'metadata' in request and request['metadata'] is not None: request['metadata'] = metadata_encoder(request['metadata']) return request def decode_response(response, module): - if 'metadata' in response: + if 'metadata' in response and response['metadata'] is not None: response['metadata'] = metadata_decoder(response['metadata']) return response diff --git a/lib/ansible/modules/cloud/google/gcp_compute_instance_template.py b/lib/ansible/modules/cloud/google/gcp_compute_instance_template.py index 374b2139f8f862..ace7e8e43d8a74 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_instance_template.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_instance_template.py @@ -1065,13 +1065,13 @@ def raise_if_errors(response, err_path, module): def encode_request(request, module): - if 'metadata' in request: + if 'metadata' in request and request['metadata'] is not None: request['metadata'] = metadata_encoder(request['metadata']) return request def decode_response(response, module): - if 'metadata' in response: + if 'metadata' in response and response['metadata'] is not None: response['metadata'] = metadata_decoder(response['metadata']) return response From d139fa740843398d6916846ab3c4d141a76dac4e Mon Sep 17 00:00:00 2001 From: The Magician Date: Fri, 28 Sep 2018 12:57:40 -0700 Subject: [PATCH 041/144] Reverting template change (#104) --- lib/ansible/modules/cloud/google/gcp_compute_address.py | 2 ++ lib/ansible/modules/cloud/google/gcp_compute_backend_bucket.py | 2 ++ lib/ansible/modules/cloud/google/gcp_compute_backend_service.py | 2 ++ lib/ansible/modules/cloud/google/gcp_compute_disk.py | 2 ++ lib/ansible/modules/cloud/google/gcp_compute_firewall.py | 2 ++ lib/ansible/modules/cloud/google/gcp_compute_forwarding_rule.py | 2 ++ lib/ansible/modules/cloud/google/gcp_compute_global_address.py | 2 ++ .../modules/cloud/google/gcp_compute_global_forwarding_rule.py | 2 ++ lib/ansible/modules/cloud/google/gcp_compute_health_check.py | 2 ++ .../modules/cloud/google/gcp_compute_http_health_check.py | 2 ++ .../modules/cloud/google/gcp_compute_https_health_check.py | 2 ++ lib/ansible/modules/cloud/google/gcp_compute_image.py | 2 ++ lib/ansible/modules/cloud/google/gcp_compute_instance.py | 2 ++ lib/ansible/modules/cloud/google/gcp_compute_instance_group.py | 2 ++ .../modules/cloud/google/gcp_compute_instance_group_manager.py | 2 ++ .../modules/cloud/google/gcp_compute_instance_template.py | 2 ++ lib/ansible/modules/cloud/google/gcp_compute_network.py | 2 ++ lib/ansible/modules/cloud/google/gcp_compute_route.py | 2 ++ lib/ansible/modules/cloud/google/gcp_compute_router.py | 2 ++ lib/ansible/modules/cloud/google/gcp_compute_ssl_certificate.py | 2 ++ lib/ansible/modules/cloud/google/gcp_compute_ssl_policy.py | 2 ++ lib/ansible/modules/cloud/google/gcp_compute_subnetwork.py | 2 ++ .../modules/cloud/google/gcp_compute_target_http_proxy.py | 2 ++ .../modules/cloud/google/gcp_compute_target_https_proxy.py | 2 ++ lib/ansible/modules/cloud/google/gcp_compute_target_pool.py | 2 ++ .../modules/cloud/google/gcp_compute_target_ssl_proxy.py | 2 ++ .../modules/cloud/google/gcp_compute_target_tcp_proxy.py | 2 ++ .../modules/cloud/google/gcp_compute_target_vpn_gateway.py | 2 ++ lib/ansible/modules/cloud/google/gcp_compute_url_map.py | 2 ++ lib/ansible/modules/cloud/google/gcp_compute_vpn_tunnel.py | 2 ++ lib/ansible/modules/cloud/google/gcp_container_cluster.py | 2 ++ lib/ansible/modules/cloud/google/gcp_container_node_pool.py | 2 ++ lib/ansible/modules/cloud/google/gcp_dns_managed_zone.py | 2 ++ lib/ansible/modules/cloud/google/gcp_dns_resource_record_set.py | 2 ++ lib/ansible/modules/cloud/google/gcp_pubsub_subscription.py | 2 ++ lib/ansible/modules/cloud/google/gcp_pubsub_topic.py | 2 ++ lib/ansible/modules/cloud/google/gcp_spanner_database.py | 2 ++ lib/ansible/modules/cloud/google/gcp_spanner_instance.py | 2 ++ lib/ansible/modules/cloud/google/gcp_sql_database.py | 2 ++ lib/ansible/modules/cloud/google/gcp_sql_instance.py | 2 ++ lib/ansible/modules/cloud/google/gcp_sql_user.py | 2 ++ lib/ansible/modules/cloud/google/gcp_storage_bucket.py | 2 ++ .../modules/cloud/google/gcp_storage_bucket_access_control.py | 2 ++ 43 files changed, 86 insertions(+) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_address.py b/lib/ansible/modules/cloud/google/gcp_compute_address.py index 921fe70824c9b9..9d62ece7fb8bba 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_address.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_address.py @@ -225,6 +225,8 @@ def main(): if state == 'present': fetch = create(module, collection(module), kind) changed = True + else: + fetch = {} fetch.update({'changed': changed}) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_backend_bucket.py b/lib/ansible/modules/cloud/google/gcp_compute_backend_bucket.py index 8b69920845e9cb..0ef41ad3c86294 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_backend_bucket.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_backend_bucket.py @@ -189,6 +189,8 @@ def main(): if state == 'present': fetch = create(module, collection(module), kind) changed = True + else: + fetch = {} fetch.update({'changed': changed}) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_backend_service.py b/lib/ansible/modules/cloud/google/gcp_compute_backend_service.py index 6315e14bec20c1..56c77ac556885c 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_backend_service.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_backend_service.py @@ -659,6 +659,8 @@ def main(): if state == 'present': fetch = create(module, collection(module), kind) changed = True + else: + fetch = {} fetch.update({'changed': changed}) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_disk.py b/lib/ansible/modules/cloud/google/gcp_compute_disk.py index 575e8976786ce6..ff840386d248aa 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_disk.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_disk.py @@ -449,6 +449,8 @@ def main(): if state == 'present': fetch = create(module, collection(module), kind) changed = True + else: + fetch = {} fetch.update({'changed': changed}) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_firewall.py b/lib/ansible/modules/cloud/google/gcp_compute_firewall.py index be7eb78e2a6d57..f622ce71ebb77c 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_firewall.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_firewall.py @@ -443,6 +443,8 @@ def main(): if state == 'present': fetch = create(module, collection(module), kind) changed = True + else: + fetch = {} fetch.update({'changed': changed}) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_forwarding_rule.py b/lib/ansible/modules/cloud/google/gcp_compute_forwarding_rule.py index f8c3768f4437f7..336add18c78e2b 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_forwarding_rule.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_forwarding_rule.py @@ -423,6 +423,8 @@ def main(): if state == 'present': fetch = create(module, collection(module), kind) changed = True + else: + fetch = {} fetch.update({'changed': changed}) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_global_address.py b/lib/ansible/modules/cloud/google/gcp_compute_global_address.py index 83864d8d006f3a..670d3a2de73882 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_global_address.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_global_address.py @@ -183,6 +183,8 @@ def main(): if state == 'present': fetch = create(module, collection(module), kind) changed = True + else: + fetch = {} fetch.update({'changed': changed}) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_global_forwarding_rule.py b/lib/ansible/modules/cloud/google/gcp_compute_global_forwarding_rule.py index b267161bffc453..09e563396cc091 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_global_forwarding_rule.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_global_forwarding_rule.py @@ -445,6 +445,8 @@ def main(): if state == 'present': fetch = create(module, collection(module), kind) changed = True + else: + fetch = {} fetch.update({'changed': changed}) 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 fa8876e5e1f381..a7c2f4a330df37 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_health_check.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_health_check.py @@ -550,6 +550,8 @@ def main(): if state == 'present': fetch = create(module, collection(module), kind) changed = True + else: + fetch = {} fetch.update({'changed': changed}) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_http_health_check.py b/lib/ansible/modules/cloud/google/gcp_compute_http_health_check.py index 0eee29353f6456..df8c7f67580532 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_http_health_check.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_http_health_check.py @@ -246,6 +246,8 @@ def main(): if state == 'present': fetch = create(module, collection(module), kind) changed = True + else: + fetch = {} fetch.update({'changed': changed}) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_https_health_check.py b/lib/ansible/modules/cloud/google/gcp_compute_https_health_check.py index e607e7c801cc81..96e0101babd639 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_https_health_check.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_https_health_check.py @@ -244,6 +244,8 @@ def main(): if state == 'present': fetch = create(module, collection(module), kind) changed = True + else: + fetch = {} fetch.update({'changed': changed}) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_image.py b/lib/ansible/modules/cloud/google/gcp_compute_image.py index 3982250721b450..bf3307b9856fa8 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_image.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_image.py @@ -474,6 +474,8 @@ def main(): if state == 'present': fetch = create(module, collection(module), kind) changed = True + else: + fetch = {} fetch.update({'changed': changed}) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_instance.py b/lib/ansible/modules/cloud/google/gcp_compute_instance.py index 6e79c684bf0181..1c7935d7011989 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_instance.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_instance.py @@ -942,6 +942,8 @@ def main(): if state == 'present': fetch = create(module, collection(module), kind) changed = True + else: + fetch = {} fetch.update({'changed': changed}) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_instance_group.py b/lib/ansible/modules/cloud/google/gcp_compute_instance_group.py index 79eb79e5671ce7..f1b711e03f9aa4 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_instance_group.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_instance_group.py @@ -273,6 +273,8 @@ def main(): if state == 'present': fetch = create(module, collection(module), kind) changed = True + else: + fetch = {} if fetch: instance = InstanceLogic(module) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_instance_group_manager.py b/lib/ansible/modules/cloud/google/gcp_compute_instance_group_manager.py index bbea008909bb8a..f48f8c2d69749f 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_instance_group_manager.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_instance_group_manager.py @@ -371,6 +371,8 @@ def main(): if state == 'present': fetch = create(module, collection(module), kind) changed = True + else: + fetch = {} fetch.update({'changed': changed}) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_instance_template.py b/lib/ansible/modules/cloud/google/gcp_compute_instance_template.py index ace7e8e43d8a74..519f965f156676 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_instance_template.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_instance_template.py @@ -915,6 +915,8 @@ def main(): if state == 'present': fetch = create(module, collection(module), kind) changed = True + else: + fetch = {} fetch.update({'changed': changed}) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_network.py b/lib/ansible/modules/cloud/google/gcp_compute_network.py index b4e31d9954e162..3545c9fdce3612 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_network.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_network.py @@ -211,6 +211,8 @@ def main(): if state == 'present': fetch = create(module, collection(module), kind) changed = True + else: + fetch = {} fetch.update({'changed': changed}) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_route.py b/lib/ansible/modules/cloud/google/gcp_compute_route.py index 2a29db4f72cb3f..bbda85c765e77f 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_route.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_route.py @@ -287,6 +287,8 @@ def main(): if state == 'present': fetch = create(module, collection(module), kind) changed = True + else: + fetch = {} fetch.update({'changed': changed}) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_router.py b/lib/ansible/modules/cloud/google/gcp_compute_router.py index b637877c4a2b18..40d88a7d9e9996 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_router.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_router.py @@ -290,6 +290,8 @@ def main(): if state == 'present': fetch = create(module, collection(module), kind) changed = True + else: + fetch = {} fetch.update({'changed': changed}) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_ssl_certificate.py b/lib/ansible/modules/cloud/google/gcp_compute_ssl_certificate.py index d4c4e5704a9433..5fdd494b04bbfa 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_ssl_certificate.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_ssl_certificate.py @@ -201,6 +201,8 @@ def main(): if state == 'present': fetch = create(module, collection(module), kind) changed = True + else: + fetch = {} fetch.update({'changed': changed}) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_ssl_policy.py b/lib/ansible/modules/cloud/google/gcp_compute_ssl_policy.py index d318c1e3752687..003eaf34eb07e2 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_ssl_policy.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_ssl_policy.py @@ -228,6 +228,8 @@ def main(): if state == 'present': fetch = create(module, collection(module), kind) changed = True + else: + fetch = {} fetch.update({'changed': changed}) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_subnetwork.py b/lib/ansible/modules/cloud/google/gcp_compute_subnetwork.py index 755d9e80ebd705..20a9b80a7343dc 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_subnetwork.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_subnetwork.py @@ -244,6 +244,8 @@ def main(): if state == 'present': fetch = create(module, collection(module), kind) changed = True + else: + fetch = {} fetch.update({'changed': changed}) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_http_proxy.py b/lib/ansible/modules/cloud/google/gcp_compute_target_http_proxy.py index 430a3bafd6012d..808d4d3c28bff1 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_http_proxy.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_http_proxy.py @@ -214,6 +214,8 @@ def main(): if state == 'present': fetch = create(module, collection(module), kind) changed = True + else: + fetch = {} fetch.update({'changed': changed}) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_https_proxy.py b/lib/ansible/modules/cloud/google/gcp_compute_target_https_proxy.py index f41f3fb2462730..fc298bdc89ba78 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_https_proxy.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_https_proxy.py @@ -282,6 +282,8 @@ def main(): if state == 'present': fetch = create(module, collection(module), kind) changed = True + else: + fetch = {} fetch.update({'changed': changed}) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_pool.py b/lib/ansible/modules/cloud/google/gcp_compute_target_pool.py index 1bc92b755ceb87..b6fab8bb0f256e 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_pool.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_pool.py @@ -280,6 +280,8 @@ def main(): if state == 'present': fetch = create(module, collection(module), kind) changed = True + else: + fetch = {} fetch.update({'changed': changed}) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_ssl_proxy.py b/lib/ansible/modules/cloud/google/gcp_compute_target_ssl_proxy.py index 5de42d97281f65..8f6b10d91aa8d8 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_ssl_proxy.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_ssl_proxy.py @@ -269,6 +269,8 @@ def main(): if state == 'present': fetch = create(module, collection(module), kind) changed = True + else: + fetch = {} fetch.update({'changed': changed}) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_tcp_proxy.py b/lib/ansible/modules/cloud/google/gcp_compute_target_tcp_proxy.py index 696db170c997ad..fe805985a9a3ec 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_tcp_proxy.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_tcp_proxy.py @@ -222,6 +222,8 @@ def main(): if state == 'present': fetch = create(module, collection(module), kind) changed = True + else: + fetch = {} fetch.update({'changed': changed}) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_vpn_gateway.py b/lib/ansible/modules/cloud/google/gcp_compute_target_vpn_gateway.py index 5245bc29eb02da..480c2f02ed4c4c 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_vpn_gateway.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_vpn_gateway.py @@ -206,6 +206,8 @@ def main(): if state == 'present': fetch = create(module, collection(module), kind) changed = True + else: + fetch = {} fetch.update({'changed': changed}) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_url_map.py b/lib/ansible/modules/cloud/google/gcp_compute_url_map.py index 4808542f940fc8..d5a5ce217fbca8 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_url_map.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_url_map.py @@ -406,6 +406,8 @@ def main(): if state == 'present': fetch = create(module, collection(module), kind) changed = True + else: + fetch = {} fetch.update({'changed': changed}) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_vpn_tunnel.py b/lib/ansible/modules/cloud/google/gcp_compute_vpn_tunnel.py index 393129a4db6bd2..1a5ea665d0ed6d 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_vpn_tunnel.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_vpn_tunnel.py @@ -316,6 +316,8 @@ def main(): fetch = create(module, collection(module), kind) labels_update(module, module.params, fetch) changed = True + else: + fetch = {} fetch.update({'changed': changed}) diff --git a/lib/ansible/modules/cloud/google/gcp_container_cluster.py b/lib/ansible/modules/cloud/google/gcp_container_cluster.py index 9be9e8596addce..d0677315eb2ced 100644 --- a/lib/ansible/modules/cloud/google/gcp_container_cluster.py +++ b/lib/ansible/modules/cloud/google/gcp_container_cluster.py @@ -643,6 +643,8 @@ def main(): if state == 'present': fetch = create(module, collection(module)) changed = True + else: + fetch = {} fetch.update({'changed': changed}) diff --git a/lib/ansible/modules/cloud/google/gcp_container_node_pool.py b/lib/ansible/modules/cloud/google/gcp_container_node_pool.py index 2a53c3a52aae76..68b267a1330dd4 100644 --- a/lib/ansible/modules/cloud/google/gcp_container_node_pool.py +++ b/lib/ansible/modules/cloud/google/gcp_container_node_pool.py @@ -490,6 +490,8 @@ def main(): if state == 'present': fetch = create(module, collection(module)) changed = True + else: + fetch = {} fetch.update({'changed': changed}) diff --git a/lib/ansible/modules/cloud/google/gcp_dns_managed_zone.py b/lib/ansible/modules/cloud/google/gcp_dns_managed_zone.py index 37f0d474aa9275..08fdc31eada6bb 100644 --- a/lib/ansible/modules/cloud/google/gcp_dns_managed_zone.py +++ b/lib/ansible/modules/cloud/google/gcp_dns_managed_zone.py @@ -174,6 +174,8 @@ def main(): if state == 'present': fetch = create(module, collection(module), kind) changed = True + else: + fetch = {} fetch.update({'changed': changed}) diff --git a/lib/ansible/modules/cloud/google/gcp_dns_resource_record_set.py b/lib/ansible/modules/cloud/google/gcp_dns_resource_record_set.py index e69122587c3d84..f5b1042feae3d8 100644 --- a/lib/ansible/modules/cloud/google/gcp_dns_resource_record_set.py +++ b/lib/ansible/modules/cloud/google/gcp_dns_resource_record_set.py @@ -190,6 +190,8 @@ def main(): if state == 'present': fetch = create(module, collection(module), kind) changed = True + else: + fetch = {} fetch.update({'changed': changed}) diff --git a/lib/ansible/modules/cloud/google/gcp_pubsub_subscription.py b/lib/ansible/modules/cloud/google/gcp_pubsub_subscription.py index 733fa2332438bb..d5eeeee253598b 100644 --- a/lib/ansible/modules/cloud/google/gcp_pubsub_subscription.py +++ b/lib/ansible/modules/cloud/google/gcp_pubsub_subscription.py @@ -209,6 +209,8 @@ def main(): if state == 'present': fetch = create(module, self_link(module)) changed = True + else: + fetch = {} fetch.update({'changed': changed}) diff --git a/lib/ansible/modules/cloud/google/gcp_pubsub_topic.py b/lib/ansible/modules/cloud/google/gcp_pubsub_topic.py index 29daa43d6e9862..1a266d46ebca68 100644 --- a/lib/ansible/modules/cloud/google/gcp_pubsub_topic.py +++ b/lib/ansible/modules/cloud/google/gcp_pubsub_topic.py @@ -115,6 +115,8 @@ def main(): if state == 'present': fetch = create(module, self_link(module)) changed = True + else: + fetch = {} fetch.update({'changed': changed}) diff --git a/lib/ansible/modules/cloud/google/gcp_spanner_database.py b/lib/ansible/modules/cloud/google/gcp_spanner_database.py index 1e05e459753bee..3b23cef1dc97cf 100644 --- a/lib/ansible/modules/cloud/google/gcp_spanner_database.py +++ b/lib/ansible/modules/cloud/google/gcp_spanner_database.py @@ -163,6 +163,8 @@ def main(): if state == 'present': fetch = create(module, collection(module)) changed = True + else: + fetch = {} fetch.update({'changed': changed}) diff --git a/lib/ansible/modules/cloud/google/gcp_spanner_instance.py b/lib/ansible/modules/cloud/google/gcp_spanner_instance.py index e881c0a3b75660..dcac37f969ca21 100644 --- a/lib/ansible/modules/cloud/google/gcp_spanner_instance.py +++ b/lib/ansible/modules/cloud/google/gcp_spanner_instance.py @@ -200,6 +200,8 @@ def main(): if state == 'present': fetch = create(module, collection(module)) changed = True + else: + fetch = {} fetch.update({'changed': changed}) diff --git a/lib/ansible/modules/cloud/google/gcp_sql_database.py b/lib/ansible/modules/cloud/google/gcp_sql_database.py index dd1984cb475f53..2069aeded45224 100644 --- a/lib/ansible/modules/cloud/google/gcp_sql_database.py +++ b/lib/ansible/modules/cloud/google/gcp_sql_database.py @@ -172,6 +172,8 @@ def main(): if state == 'present': fetch = create(module, collection(module), kind) changed = True + else: + fetch = {} fetch.update({'changed': changed}) diff --git a/lib/ansible/modules/cloud/google/gcp_sql_instance.py b/lib/ansible/modules/cloud/google/gcp_sql_instance.py index f7e714d7047ec6..e298130935a7cd 100644 --- a/lib/ansible/modules/cloud/google/gcp_sql_instance.py +++ b/lib/ansible/modules/cloud/google/gcp_sql_instance.py @@ -620,6 +620,8 @@ def main(): if state == 'present': fetch = create(module, collection(module), kind) changed = True + else: + fetch = {} fetch.update({'changed': changed}) diff --git a/lib/ansible/modules/cloud/google/gcp_sql_user.py b/lib/ansible/modules/cloud/google/gcp_sql_user.py index e67d40a6e8eca6..d0ab9e7ac10732 100644 --- a/lib/ansible/modules/cloud/google/gcp_sql_user.py +++ b/lib/ansible/modules/cloud/google/gcp_sql_user.py @@ -177,6 +177,8 @@ def main(): if state == 'present': fetch = create(module, collection(module), kind) changed = True + else: + fetch = {} fetch.update({'changed': changed}) diff --git a/lib/ansible/modules/cloud/google/gcp_storage_bucket.py b/lib/ansible/modules/cloud/google/gcp_storage_bucket.py index e5093dc6f2347b..644f6a8d023a35 100644 --- a/lib/ansible/modules/cloud/google/gcp_storage_bucket.py +++ b/lib/ansible/modules/cloud/google/gcp_storage_bucket.py @@ -861,6 +861,8 @@ def main(): if state == 'present': fetch = create(module, collection(module), kind) changed = True + else: + fetch = {} fetch.update({'changed': changed}) diff --git a/lib/ansible/modules/cloud/google/gcp_storage_bucket_access_control.py b/lib/ansible/modules/cloud/google/gcp_storage_bucket_access_control.py index 650742ba3c5354..0f48f4aaf320cf 100644 --- a/lib/ansible/modules/cloud/google/gcp_storage_bucket_access_control.py +++ b/lib/ansible/modules/cloud/google/gcp_storage_bucket_access_control.py @@ -233,6 +233,8 @@ def main(): if state == 'present': fetch = create(module, collection(module), kind) changed = True + else: + fetch = {} fetch.update({'changed': changed}) From d77223f21f522abcb4cb684371bb4fbcfdf2461f Mon Sep 17 00:00:00 2001 From: Riley Karson Date: Fri, 28 Sep 2018 22:54:37 +0000 Subject: [PATCH 042/144] Update urlMap properties --- .../cloud/google/gcp_compute_url_map.py | 45 +++++++++++-------- .../cloud/google/gcp_compute_url_map_facts.py | 6 +++ 2 files changed, 32 insertions(+), 19 deletions(-) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_url_map.py b/lib/ansible/modules/cloud/google/gcp_compute_url_map.py index d5a5ce217fbca8..60753392d9d438 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_url_map.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_url_map.py @@ -76,12 +76,12 @@ - The list of host patterns to match. They must be valid hostnames, except * will match any string of ([a-z0-9-.]*). In that case, * must be the first character and must be followed in the pattern by either - or . - required: false + required: true path_matcher: description: - The name of the PathMatcher to use to match the path portion of the URL if the hostRule matches the URL's host portion. - required: false + required: true name: description: - Name of the resource. Provided by the client when the resource is created. The name @@ -90,7 +90,7 @@ which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash. - required: false + required: true path_matchers: description: - The list of named PathMatchers to use against the URL. @@ -105,7 +105,7 @@ task and then set this default_service field to "{{ name-of-resource }}" Alternatively, you can set this default_service to a dictionary with the selfLink key where the value is the selfLink of your BackendService.' - required: false + required: true description: description: - An optional description of this resource. @@ -113,7 +113,7 @@ name: description: - The name to which this PathMatcher is referred by the HostRule. - required: false + required: true path_rules: description: - The list of path rules. @@ -133,7 +133,7 @@ task and then set this service field to "{{ name-of-resource }}" Alternatively, you can set this service to a dictionary with the selfLink key where the value is the selfLink of your BackendService.' - required: false + required: true tests: description: - The list of expected URL mappings. Request to update this UrlMap will succeed only @@ -147,11 +147,11 @@ host: description: - Host portion of the URL. - required: false + required: true path: description: - Path portion of the URL. - required: false + required: true service: description: - A reference to expected BackendService resource the given URL should be mapped to. @@ -160,7 +160,7 @@ task and then set this service field to "{{ name-of-resource }}" Alternatively, you can set this service to a dictionary with the selfLink key where the value is the selfLink of your BackendService.' - required: false + required: true extends_documentation_fragment: gcp ''' @@ -259,6 +259,12 @@ - The unique identifier for the resource. returned: success type: int + fingerprint: + description: + - Fingerprint of this resource. This field is used internally during updates of this + resource. + returned: success + type: str name: description: - Name of the resource. Provided by the client when the resource is created. The name @@ -361,24 +367,24 @@ def main(): description=dict(type='str'), host_rules=dict(type='list', elements='dict', options=dict( description=dict(type='str'), - hosts=dict(type='list', elements='str'), - path_matcher=dict(type='str') + hosts=dict(required=True, type='list', elements='str'), + path_matcher=dict(required=True, type='str') )), - name=dict(type='str'), + name=dict(required=True, type='str'), path_matchers=dict(type='list', elements='dict', options=dict( - default_service=dict(type='dict'), + default_service=dict(required=True, type='dict'), description=dict(type='str'), - name=dict(type='str'), + name=dict(required=True, type='str'), path_rules=dict(type='list', elements='dict', options=dict( paths=dict(type='list', elements='str'), - service=dict(type='dict') + service=dict(required=True, type='dict') )) )), tests=dict(type='list', elements='dict', options=dict( description=dict(type='str'), - host=dict(type='str'), - path=dict(type='str'), - service=dict(type='dict') + host=dict(required=True, type='str'), + path=dict(required=True, type='str'), + service=dict(required=True, type='dict') )) ) ) @@ -508,7 +514,8 @@ def response_to_hash(module, response): u'description': response.get(u'description'), u'hostRules': UrlMapHostRulesArray(response.get(u'hostRules', []), module).from_response(), u'id': response.get(u'id'), - u'name': response.get(u'name'), + u'fingerprint': response.get(u'fingerprint'), + u'name': module.params.get('name'), u'pathMatchers': UrlMapPathMatchersArray(response.get(u'pathMatchers', []), module).from_response(), u'tests': UrlMapTestsArray(response.get(u'tests', []), module).from_response() } diff --git a/lib/ansible/modules/cloud/google/gcp_compute_url_map_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_url_map_facts.py index 6636e474dbc229..55d114e58cc8e9 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_url_map_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_url_map_facts.py @@ -112,6 +112,12 @@ - The unique identifier for the resource. returned: success type: int + fingerprint: + description: + - Fingerprint of this resource. This field is used internally during updates of this + resource. + returned: success + type: str name: description: - Name of the resource. Provided by the client when the resource is created. The name From f13fc0ac3ad28db41555115c1c4d3a156f5587b9 Mon Sep 17 00:00:00 2001 From: Dana Hoffman Date: Thu, 4 Oct 2018 03:11:37 +0000 Subject: [PATCH 043/144] remove min_version from a bunch of fields that are in GA now --- .../cloud/google/gcp_compute_address.py | 18 + .../cloud/google/gcp_compute_address_facts.py | 7 + .../cloud/google/gcp_compute_firewall.py | 20 + .../google/gcp_compute_firewall_facts.py | 8 + .../google/gcp_compute_forwarding_rule.py | 22 +- .../gcp_compute_forwarding_rule_facts.py | 7 + .../google/gcp_compute_global_address.py | 25 +- .../gcp_compute_global_address_facts.py | 7 + .../cloud/google/gcp_compute_region_disk.py | 634 ++++++++++++++++++ .../google/gcp_compute_region_disk_facts.py | 303 +++++++++ .../cloud/google/gcp_compute_subnetwork.py | 123 +++- .../google/gcp_compute_subnetwork_facts.py | 34 + .../targets/gcp_compute_region_disk/aliases | 2 + .../gcp_compute_region_disk/defaults/main.yml | 3 + .../gcp_compute_region_disk/meta/main.yml | 0 .../gcp_compute_region_disk/tasks/main.yml | 143 ++++ 16 files changed, 1350 insertions(+), 6 deletions(-) create mode 100644 lib/ansible/modules/cloud/google/gcp_compute_region_disk.py create mode 100644 lib/ansible/modules/cloud/google/gcp_compute_region_disk_facts.py create mode 100644 test/integration/targets/gcp_compute_region_disk/aliases create mode 100644 test/integration/targets/gcp_compute_region_disk/defaults/main.yml create mode 100644 test/integration/targets/gcp_compute_region_disk/meta/main.yml create mode 100644 test/integration/targets/gcp_compute_region_disk/tasks/main.yml diff --git a/lib/ansible/modules/cloud/google/gcp_compute_address.py b/lib/ansible/modules/cloud/google/gcp_compute_address.py index 9d62ece7fb8bba..7ac0cbec6944de 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_address.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_address.py @@ -81,6 +81,14 @@ letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash. required: true + network_tier: + description: + - 'The networking tier used for configuring this address. This field can take the + following values: PREMIUM or STANDARD. If this field is not specified, it is assumed + to be PREMIUM.' + required: false + version_added: 2.8 + choices: ['PREMIUM', 'STANDARD'] subnetwork: description: - The URL of the subnetwork in which to reserve the address. If an IP address is specified, @@ -154,6 +162,13 @@ except the last character, which cannot be a dash. returned: success type: str + networkTier: + description: + - 'The networking tier used for configuring this address. This field can take the + following values: PREMIUM or STANDARD. If this field is not specified, it is assumed + to be PREMIUM.' + returned: success + type: str subnetwork: description: - The URL of the subnetwork in which to reserve the address. If an IP address is specified, @@ -197,6 +212,7 @@ def main(): address_type=dict(default='EXTERNAL', type='str', choices=['INTERNAL', 'EXTERNAL']), description=dict(type='str'), name=dict(required=True, type='str'), + network_tier=dict(type='str', choices=['PREMIUM', 'STANDARD']), subnetwork=dict(type='dict'), region=dict(required=True, type='str') ) @@ -254,6 +270,7 @@ def resource_to_request(module): u'addressType': module.params.get('address_type'), u'description': module.params.get('description'), u'name': module.params.get('name'), + u'networkTier': module.params.get('network_tier'), u'subnetwork': replace_resource_dict(module.params.get(u'subnetwork', {}), 'selfLink') } return_vals = {} @@ -326,6 +343,7 @@ def response_to_hash(module, response): u'description': response.get(u'description'), u'id': response.get(u'id'), u'name': response.get(u'name'), + u'networkTier': response.get(u'networkTier'), u'subnetwork': response.get(u'subnetwork'), u'users': response.get(u'users') } diff --git a/lib/ansible/modules/cloud/google/gcp_compute_address_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_address_facts.py index bfe295fb6bc72b..4e6ed2792dfcf4 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_address_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_address_facts.py @@ -109,6 +109,13 @@ except the last character, which cannot be a dash. returned: success type: str + networkTier: + description: + - 'The networking tier used for configuring this address. This field can take the + following values: PREMIUM or STANDARD. If this field is not specified, it is assumed + to be PREMIUM.' + returned: success + type: str subnetwork: description: - The URL of the subnetwork in which to reserve the address. If an IP address is specified, diff --git a/lib/ansible/modules/cloud/google/gcp_compute_firewall.py b/lib/ansible/modules/cloud/google/gcp_compute_firewall.py index f622ce71ebb77c..09fcadb93fa4f7 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_firewall.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_firewall.py @@ -112,6 +112,15 @@ required: false version_added: 2.8 choices: ['INGRESS', 'EGRESS'] + disabled: + description: + - Denotes whether the firewall rule is disabled, i.e not applied to the network it + is associated with. When set to true, the firewall rule is not enforced and the + network behaves as if it did not exist. If this is unspecified, the firewall rule + will be enabled. + required: false + type: bool + version_added: 2.8 name: description: - Name of the resource. Provided by the client when the resource is created. The name @@ -290,6 +299,14 @@ traffic, it is NOT supported to specify sourceRanges OR sourceTags.' returned: success type: str + disabled: + description: + - Denotes whether the firewall rule is disabled, i.e not applied to the network it + is associated with. When set to true, the firewall rule is not enforced and the + network behaves as if it did not exist. If this is unspecified, the firewall rule + will be enabled. + returned: success + type: bool id: description: - The unique identifier for the resource. @@ -409,6 +426,7 @@ def main(): description=dict(type='str'), destination_ranges=dict(type='list', elements='str'), direction=dict(type='str', choices=['INGRESS', 'EGRESS']), + disabled=dict(type='bool'), name=dict(required=True, type='str'), network=dict(required=True, type='dict'), priority=dict(default=1000, type='int'), @@ -474,6 +492,7 @@ def resource_to_request(module): u'description': module.params.get('description'), u'destinationRanges': module.params.get('destination_ranges'), u'direction': module.params.get('direction'), + u'disabled': module.params.get('disabled'), u'name': module.params.get('name'), u'network': replace_resource_dict(module.params.get(u'network', {}), 'selfLink'), u'priority': module.params.get('priority'), @@ -553,6 +572,7 @@ def response_to_hash(module, response): u'description': response.get(u'description'), u'destinationRanges': response.get(u'destinationRanges'), u'direction': response.get(u'direction'), + u'disabled': response.get(u'disabled'), u'id': response.get(u'id'), u'name': module.params.get('name'), u'network': response.get(u'network'), diff --git a/lib/ansible/modules/cloud/google/gcp_compute_firewall_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_firewall_facts.py index 0914ba8c8c77e6..5fce2e9fbacc55 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_firewall_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_firewall_facts.py @@ -135,6 +135,14 @@ traffic, it is NOT supported to specify sourceRanges OR sourceTags.' returned: success type: str + disabled: + description: + - Denotes whether the firewall rule is disabled, i.e not applied to the network it + is associated with. When set to true, the firewall rule is not enforced and the + network behaves as if it did not exist. If this is unspecified, the firewall rule + will be enabled. + returned: success + type: bool id: description: - The unique identifier for the resource. diff --git a/lib/ansible/modules/cloud/google/gcp_compute_forwarding_rule.py b/lib/ansible/modules/cloud/google/gcp_compute_forwarding_rule.py index 336add18c78e2b..a712c5e709f6f0 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_forwarding_rule.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_forwarding_rule.py @@ -177,6 +177,14 @@ selfLink of your TargetPool.' required: false version_added: 2.7 + network_tier: + description: + - 'The networking tier used for configuring this address. This field can take the + following values: PREMIUM or STANDARD. If this field is not specified, it is assumed + to be PREMIUM.' + required: false + version_added: 2.8 + choices: ['PREMIUM', 'STANDARD'] region: description: - A reference to the region where the regional forwarding rule resides. @@ -357,6 +365,13 @@ updates. returned: success type: str + networkTier: + description: + - 'The networking tier used for configuring this address. This field can take the + following values: PREMIUM or STANDARD. If this field is not specified, it is assumed + to be PREMIUM.' + returned: success + type: str region: description: - A reference to the region where the regional forwarding rule resides. @@ -396,6 +411,7 @@ def main(): ports=dict(type='list', elements='str'), subnetwork=dict(type='dict'), target=dict(type='dict'), + network_tier=dict(type='str', choices=['PREMIUM', 'STANDARD']), region=dict(required=True, type='str') ) ) @@ -492,7 +508,8 @@ def resource_to_request(module): u'portRange': module.params.get('port_range'), u'ports': module.params.get('ports'), u'subnetwork': replace_resource_dict(module.params.get(u'subnetwork', {}), 'selfLink'), - u'target': replace_resource_dict(module.params.get(u'target', {}), 'selfLink') + u'target': replace_resource_dict(module.params.get(u'target', {}), 'selfLink'), + u'networkTier': module.params.get('network_tier') } return_vals = {} for k, v in request.items(): @@ -572,7 +589,8 @@ def response_to_hash(module, response): u'ports': response.get(u'ports'), u'subnetwork': response.get(u'subnetwork'), u'target': response.get(u'target'), - u'labelFingerprint': response.get(u'labelFingerprint') + u'labelFingerprint': response.get(u'labelFingerprint'), + u'networkTier': module.params.get('network_tier') } diff --git a/lib/ansible/modules/cloud/google/gcp_compute_forwarding_rule_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_forwarding_rule_facts.py index 109dbdcc0bf3e3..a56710298af767 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_forwarding_rule_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_forwarding_rule_facts.py @@ -205,6 +205,13 @@ updates. returned: success type: str + networkTier: + description: + - 'The networking tier used for configuring this address. This field can take the + following values: PREMIUM or STANDARD. If this field is not specified, it is assumed + to be PREMIUM.' + returned: success + type: str region: description: - A reference to the region where the regional forwarding rule resides. diff --git a/lib/ansible/modules/cloud/google/gcp_compute_global_address.py b/lib/ansible/modules/cloud/google/gcp_compute_global_address.py index 670d3a2de73882..f8cc7eaea96ab2 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_global_address.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_global_address.py @@ -67,6 +67,15 @@ The default value is IPV4. required: false choices: ['IPV4', 'IPV6'] + address_type: + description: + - The type of the address to reserve, default is EXTERNAL. + - "* EXTERNAL indicates public/external single IP address." + - "* INTERNAL indicates internal IP ranges belonging to some network." + required: false + default: EXTERNAL + version_added: 2.8 + choices: ['EXTERNAL', 'INTERNAL'] extends_documentation_fragment: gcp notes: - "API Reference: U(https://cloud.google.com/compute/docs/reference/latest/globalAddresses)" @@ -132,6 +141,13 @@ - A reference to the region where the regional address resides. returned: success type: str + addressType: + description: + - The type of the address to reserve, default is EXTERNAL. + - "* EXTERNAL indicates public/external single IP address." + - "* INTERNAL indicates internal IP ranges belonging to some network." + returned: success + type: str ''' ################################################################################ @@ -156,7 +172,8 @@ def main(): state=dict(default='present', choices=['present', 'absent'], type='str'), description=dict(type='str'), name=dict(required=True, type='str'), - ip_version=dict(type='str', choices=['IPV4', 'IPV6']) + ip_version=dict(type='str', choices=['IPV4', 'IPV6']), + address_type=dict(default='EXTERNAL', type='str', choices=['EXTERNAL', 'INTERNAL']) ) ) @@ -229,7 +246,8 @@ def resource_to_request(module): u'kind': 'compute#address', u'description': module.params.get('description'), u'name': module.params.get('name'), - u'ipVersion': module.params.get('ip_version') + u'ipVersion': module.params.get('ip_version'), + u'addressType': module.params.get('address_type') } return_vals = {} for k, v in request.items(): @@ -302,7 +320,8 @@ def response_to_hash(module, response): u'name': response.get(u'name'), u'labelFingerprint': response.get(u'labelFingerprint'), u'ipVersion': response.get(u'ipVersion'), - u'region': response.get(u'region') + u'region': response.get(u'region'), + u'addressType': response.get(u'addressType') } diff --git a/lib/ansible/modules/cloud/google/gcp_compute_global_address_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_global_address_facts.py index 26020122b32178..cd91bc0a272e9f 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_global_address_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_global_address_facts.py @@ -114,6 +114,13 @@ - A reference to the region where the regional address resides. returned: success type: str + addressType: + description: + - The type of the address to reserve, default is EXTERNAL. + - "* EXTERNAL indicates public/external single IP address." + - "* INTERNAL indicates internal IP ranges belonging to some network." + returned: success + type: str ''' ################################################################################ diff --git a/lib/ansible/modules/cloud/google/gcp_compute_region_disk.py b/lib/ansible/modules/cloud/google/gcp_compute_region_disk.py new file mode 100644 index 00000000000000..819da0ab38eab9 --- /dev/null +++ b/lib/ansible/modules/cloud/google/gcp_compute_region_disk.py @@ -0,0 +1,634 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# +# Copyright (C) 2017 Google +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) +# ---------------------------------------------------------------------------- +# +# *** AUTO GENERATED CODE *** AUTO GENERATED CODE *** +# +# ---------------------------------------------------------------------------- +# +# This file is automatically generated by Magic Modules and manual +# changes will be clobbered when the file is regenerated. +# +# Please read more about how to change this file at +# https://www.github.com/GoogleCloudPlatform/magic-modules +# +# ---------------------------------------------------------------------------- + +from __future__ import absolute_import, division, print_function +__metaclass__ = type + +################################################################################ +# Documentation +################################################################################ + +ANSIBLE_METADATA = {'metadata_version': '1.1', + 'status': ["preview"], + 'supported_by': 'community'} + +DOCUMENTATION = ''' +--- +module: gcp_compute_region_disk +description: + - Persistent disks are durable storage devices that function similarly to the physical + disks in a desktop or a server. Compute Engine manages the hardware behind these + devices to ensure data redundancy and optimize performance for you. Persistent disks + are available as either standard hard disk drives (HDD) or solid-state drives (SSD). + - Persistent disks are located independently from your virtual machine instances, + so you can detach or move persistent disks to keep your data even after you delete + your instances. Persistent disk performance scales automatically with size, so you + can resize your existing persistent disks or add more persistent disks to an instance + to meet your performance and storage space requirements. + - Add a persistent disk to your instance when you need reliable and affordable storage + with consistent performance characteristics. +short_description: Creates a GCP RegionDisk +version_added: 2.8 +author: Google Inc. (@googlecloudplatform) +requirements: + - python >= 2.6 + - requests >= 2.18.4 + - google-auth >= 1.3.0 +options: + state: + description: + - Whether the given object should exist in GCP + choices: ['present', 'absent'] + default: 'present' + description: + description: + - An optional description of this resource. Provide this property when you create + the resource. + required: false + labels: + description: + - Labels to apply to this disk. A list of key->value pairs. + required: false + licenses: + description: + - Any applicable publicly visible licenses. + required: false + name: + description: + - Name of the resource. Provided by the client when the resource is created. The name + must be 1-63 characters long, and comply with RFC1035. Specifically, the name must + be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` + which means the first character must be a lowercase letter, and all following characters + must be a dash, lowercase letter, or digit, except the last character, which cannot + be a dash. + required: true + size_gb: + description: + - Size of the persistent disk, specified in GB. You can specify this field when creating + a persistent disk using the sourceImage or sourceSnapshot parameter, or specify + it alone to create an empty persistent disk. + - If you specify this field along with sourceImage or sourceSnapshot, the value of + sizeGb must not be less than the size of the sourceImage or the size of the snapshot. + required: false + replica_zones: + description: + - URLs of the zones where the disk should be replicated to. + required: true + type: + description: + - URL of the disk type resource describing which disk type to use to create the disk. + Provide this when creating the disk. + required: false + region: + description: + - A reference to the region where the disk resides. + required: true + disk_encryption_key: + description: + - Encrypts the disk using a customer-supplied encryption key. + - After you encrypt a disk with a customer-supplied key, you must provide the same + key if you use the disk later (e.g. to create a disk snapshot or an image, or to + attach the disk to a virtual machine). + - Customer-supplied encryption keys do not protect access to metadata of the disk. + - If you do not provide an encryption key when creating the disk, then the disk will + be encrypted using an automatically generated key and you do not need to provide + a key to use the disk later. + required: false + suboptions: + raw_key: + description: + - Specifies a 256-bit customer-supplied encryption key, encoded in RFC 4648 base64 + to either encrypt or decrypt this resource. + required: false + sha256: + description: + - The RFC 4648 base64 encoded SHA-256 hash of the customer-supplied encryption key + that protects this resource. + required: false + source_snapshot: + description: + - 'The source snapshot used to create this disk. You can provide this as a partial or + full URL to the resource. For example, the following are valid values: * + `U(https://www.googleapis.com/compute/v1/projects/project/global/snapshots/snapshot`) + * `projects/project/global/snapshots/snapshot` * `global/snapshots/snapshot` .' + - 'This field represents a link to a Snapshot resource in GCP. It can be specified + in two ways. You can add `register: name-of-resource` to a gcp_compute_snapshot + task and then set this source_snapshot field to "{{ name-of-resource }}" Alternatively, + you can set this source_snapshot to a dictionary with the selfLink key where the + value is the selfLink of your Snapshot.' + required: false + source_snapshot_encryption_key: + description: + - The customer-supplied encryption key of the source snapshot. Required if the source + snapshot is protected by a customer-supplied encryption key. + required: false + suboptions: + raw_key: + description: + - Specifies a 256-bit customer-supplied encryption key, encoded in RFC 4648 base64 + to either encrypt or decrypt this resource. + required: false + sha256: + description: + - The RFC 4648 base64 encoded SHA-256 hash of the customer-supplied encryption key + that protects this resource. + required: false +extends_documentation_fragment: gcp +notes: + - "API Reference: U(https://cloud.google.com/compute/docs/reference/rest/beta/regionDisks)" + - "Adding or Resizing Regional Persistent Disks: U(https://cloud.google.com/compute/docs/disks/regional-persistent-disk)" +''' + +EXAMPLES = ''' +- name: create a region disk + gcp_compute_region_disk: + name: "test_object" + size_gb: 50 + disk_encryption_key: + raw_key: SGVsbG8gZnJvbSBHb29nbGUgQ2xvdWQgUGxhdGZvcm0= + region: us-central1 + replica_zones: + - us-central1-a + - us-central1-f + project: "test_project" + auth_kind: "serviceaccount" + service_account_file: "/tmp/auth.pem" + state: present +''' + +RETURN = ''' + labelFingerprint: + description: + - The fingerprint used for optimistic locking of this resource. Used internally during + updates. + returned: success + type: str + creationTimestamp: + description: + - Creation timestamp in RFC3339 text format. + returned: success + type: str + description: + description: + - An optional description of this resource. Provide this property when you create + the resource. + returned: success + type: str + id: + description: + - The unique identifier for the resource. + returned: success + type: int + lastAttachTimestamp: + description: + - Last attach timestamp in RFC3339 text format. + returned: success + type: str + lastDetachTimestamp: + description: + - Last dettach timestamp in RFC3339 text format. + returned: success + type: str + labels: + description: + - Labels to apply to this disk. A list of key->value pairs. + returned: success + type: dict + licenses: + description: + - Any applicable publicly visible licenses. + returned: success + type: list + name: + description: + - Name of the resource. Provided by the client when the resource is created. The name + must be 1-63 characters long, and comply with RFC1035. Specifically, the name must + be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` + which means the first character must be a lowercase letter, and all following characters + must be a dash, lowercase letter, or digit, except the last character, which cannot + be a dash. + returned: success + type: str + sizeGb: + description: + - Size of the persistent disk, specified in GB. You can specify this field when creating + a persistent disk using the sourceImage or sourceSnapshot parameter, or specify + it alone to create an empty persistent disk. + - If you specify this field along with sourceImage or sourceSnapshot, the value of + sizeGb must not be less than the size of the sourceImage or the size of the snapshot. + returned: success + type: int + users: + description: + - 'Links to the users of the disk (attached instances) in form: project/zones/zone/instances/instance + .' + returned: success + type: list + replicaZones: + description: + - URLs of the zones where the disk should be replicated to. + returned: success + type: list + type: + description: + - URL of the disk type resource describing which disk type to use to create the disk. + Provide this when creating the disk. + returned: success + type: str + region: + description: + - A reference to the region where the disk resides. + returned: success + type: str + diskEncryptionKey: + description: + - Encrypts the disk using a customer-supplied encryption key. + - After you encrypt a disk with a customer-supplied key, you must provide the same + key if you use the disk later (e.g. to create a disk snapshot or an image, or to + attach the disk to a virtual machine). + - Customer-supplied encryption keys do not protect access to metadata of the disk. + - If you do not provide an encryption key when creating the disk, then the disk will + be encrypted using an automatically generated key and you do not need to provide + a key to use the disk later. + returned: success + type: complex + contains: + rawKey: + description: + - Specifies a 256-bit customer-supplied encryption key, encoded in RFC 4648 base64 + to either encrypt or decrypt this resource. + returned: success + type: str + sha256: + description: + - The RFC 4648 base64 encoded SHA-256 hash of the customer-supplied encryption key + that protects this resource. + returned: success + type: str + sourceSnapshot: + description: + - 'The source snapshot used to create this disk. You can provide this as a partial or + full URL to the resource. For example, the following are valid values: * + `U(https://www.googleapis.com/compute/v1/projects/project/global/snapshots/snapshot`) + * `projects/project/global/snapshots/snapshot` * `global/snapshots/snapshot` .' + returned: success + type: dict + sourceSnapshotEncryptionKey: + description: + - The customer-supplied encryption key of the source snapshot. Required if the source + snapshot is protected by a customer-supplied encryption key. + returned: success + type: complex + contains: + rawKey: + description: + - Specifies a 256-bit customer-supplied encryption key, encoded in RFC 4648 base64 + to either encrypt or decrypt this resource. + returned: success + type: str + sha256: + description: + - The RFC 4648 base64 encoded SHA-256 hash of the customer-supplied encryption key + that protects this resource. + returned: success + type: str + sourceSnapshotId: + description: + - The unique ID of the snapshot used to create this disk. This value identifies the + exact snapshot that was used to create this persistent disk. For example, if you + created the persistent disk from a snapshot that was later deleted and recreated + under the same name, the source snapshot ID would identify the exact version of + the snapshot that was used. + returned: success + type: str +''' + +################################################################################ +# Imports +################################################################################ + +from ansible.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest, remove_nones_from_dict, replace_resource_dict +import json +import re +import time + +################################################################################ +# Main +################################################################################ + + +def main(): + """Main function""" + + module = GcpModule( + argument_spec=dict( + state=dict(default='present', choices=['present', 'absent'], type='str'), + description=dict(type='str'), + labels=dict(type='dict'), + licenses=dict(type='list', elements='str'), + name=dict(required=True, type='str'), + size_gb=dict(type='int'), + replica_zones=dict(required=True, type='list', elements='str'), + type=dict(type='str'), + region=dict(required=True, type='str'), + disk_encryption_key=dict(type='dict', options=dict( + raw_key=dict(type='str'), + sha256=dict(type='str') + )), + source_snapshot=dict(type='dict'), + source_snapshot_encryption_key=dict(type='dict', options=dict( + raw_key=dict(type='str'), + sha256=dict(type='str') + )) + ) + ) + + if not module.params['scopes']: + module.params['scopes'] = ['https://www.googleapis.com/auth/compute'] + + state = module.params['state'] + kind = 'compute#disk' + + fetch = fetch_resource(module, self_link(module), kind) + changed = False + + if fetch: + if state == 'present': + if is_different(module, fetch): + update(module, self_link(module), kind, fetch) + fetch = fetch_resource(module, self_link(module), kind) + changed = True + else: + delete(module, self_link(module), kind) + fetch = {} + changed = True + else: + if state == 'present': + fetch = create(module, collection(module), kind) + changed = True + else: + fetch = {} + + fetch.update({'changed': changed}) + + module.exit_json(**fetch) + + +def create(module, link, kind): + auth = GcpSession(module, 'compute') + return wait_for_operation(module, auth.post(link, resource_to_request(module))) + + +def update(module, link, kind, fetch): + update_fields(module, resource_to_request(module), + response_to_hash(module, fetch)) + return fetch_resource(module, self_link(module), kind) + + +def update_fields(module, request, response): + if response.get('labels') != request.get('labels'): + label_fingerprint_update(module, request, response) + if response.get('sizeGb') != request.get('sizeGb'): + size_gb_update(module, request, response) + + +def label_fingerprint_update(module, request, response): + auth = GcpSession(module, 'compute') + auth.post( + ''.join([ + "https://www.googleapis.com/compute/v1/", + "projects/{project}/regions/{region}/disks/{name}/setLabels" + ]).format(**module.params), + { + u'labelFingerprint': response.get('labelFingerprint'), + u'labels': module.params.get('labels') + } + ) + + +def size_gb_update(module, request, response): + auth = GcpSession(module, 'compute') + auth.post( + ''.join([ + "https://www.googleapis.com/compute/v1/", + "projects/{project}/regions/{region}/disks/{name}/resize" + ]).format(**module.params), + { + u'sizeGb': module.params.get('size_gb') + } + ) + + +def delete(module, link, kind): + auth = GcpSession(module, 'compute') + return wait_for_operation(module, auth.delete(link)) + + +def resource_to_request(module): + request = { + u'kind': 'compute#disk', + u'diskEncryptionKey': RegionDiskDiskEncryptionKey(module.params.get('disk_encryption_key', {}), module).to_request(), + u'sourceSnapshotEncryptionKey': RegionDiskSourceSnapshotEncryptionKey(module.params.get('source_snapshot_encryption_key', {}), module).to_request(), + u'description': module.params.get('description'), + u'labels': module.params.get('labels'), + u'licenses': module.params.get('licenses'), + u'name': module.params.get('name'), + u'sizeGb': module.params.get('size_gb'), + u'replicaZones': module.params.get('replica_zones'), + u'type': region_disk_type_selflink(module.params.get('type'), module.params) + } + return_vals = {} + for k, v in request.items(): + if v: + return_vals[k] = v + + return return_vals + + +def fetch_resource(module, link, kind, allow_not_found=True): + auth = GcpSession(module, 'compute') + return return_if_object(module, auth.get(link), kind, allow_not_found) + + +def self_link(module): + return "https://www.googleapis.com/compute/v1/projects/{project}/regions/{region}/disks/{name}".format(**module.params) + + +def collection(module): + return "https://www.googleapis.com/compute/v1/projects/{project}/regions/{region}/disks".format(**module.params) + + +def return_if_object(module, response, kind, allow_not_found=False): + # If not found, return nothing. + if allow_not_found and response.status_code == 404: + return None + + # If no content, return nothing. + if response.status_code == 204: + return None + + try: + module.raise_for_status(response) + result = response.json() + except getattr(json.decoder, 'JSONDecodeError', ValueError) as inst: + module.fail_json(msg="Invalid JSON response with error: %s" % inst) + + if navigate_hash(result, ['error', 'errors']): + module.fail_json(msg=navigate_hash(result, ['error', 'errors'])) + + return result + + +def is_different(module, response): + request = resource_to_request(module) + response = response_to_hash(module, response) + + # Remove all output-only from response. + response_vals = {} + for k, v in response.items(): + if k in request: + response_vals[k] = v + + request_vals = {} + for k, v in request.items(): + if k in response: + request_vals[k] = v + + return GcpRequest(request_vals) != GcpRequest(response_vals) + + +# Remove unnecessary properties from the response. +# This is for doing comparisons with Ansible's current parameters. +def response_to_hash(module, response): + return { + u'labelFingerprint': response.get(u'labelFingerprint'), + u'creationTimestamp': response.get(u'creationTimestamp'), + u'description': response.get(u'description'), + u'id': response.get(u'id'), + u'lastAttachTimestamp': response.get(u'lastAttachTimestamp'), + u'lastDetachTimestamp': response.get(u'lastDetachTimestamp'), + u'labels': response.get(u'labels'), + u'licenses': response.get(u'licenses'), + u'name': module.params.get('name'), + u'sizeGb': response.get(u'sizeGb'), + u'users': response.get(u'users'), + u'replicaZones': response.get(u'replicaZones'), + u'type': response.get(u'type') + } + + +def zone_selflink(name, params): + if name is None: + return + url = r"https://www.googleapis.com/compute/v1/projects/.*/zones/[a-z1-9\-]*" + if not re.match(url, name): + name = "https://www.googleapis.com/compute/v1/projects/{project}/zones/%s".format(**params) % name + return name + + +def region_disk_type_selflink(name, params): + if name is None: + return + url = r"https://www.googleapis.com/compute/v1/projects/.*/regions/{region}/diskTypes/[a-z1-9\-]*" + if not re.match(url, name): + name = "https://www.googleapis.com/compute/v1/projects/{project}/regions/{region}/diskTypes/%s".format(**params) % name + return name + + +def async_op_url(module, extra_data=None): + if extra_data is None: + extra_data = {} + url = "https://www.googleapis.com/compute/v1/projects/{project}/regions/{region}/operations/{op_id}" + combined = extra_data.copy() + combined.update(module.params) + return url.format(**combined) + + +def wait_for_operation(module, response): + op_result = return_if_object(module, response, 'compute#operation') + if op_result is None: + return {} + status = navigate_hash(op_result, ['status']) + wait_done = wait_for_completion(status, op_result, module) + return fetch_resource(module, navigate_hash(wait_done, ['targetLink']), 'compute#disk') + + +def wait_for_completion(status, op_result, module): + op_id = navigate_hash(op_result, ['name']) + op_uri = async_op_url(module, {'op_id': op_id}) + while status != 'DONE': + raise_if_errors(op_result, ['error', 'errors'], 'message') + time.sleep(1.0) + if status not in ['PENDING', 'RUNNING', 'DONE']: + module.fail_json(msg="Invalid result %s" % status) + op_result = fetch_resource(module, op_uri, 'compute#operation') + status = navigate_hash(op_result, ['status']) + return op_result + + +def raise_if_errors(response, err_path, module): + errors = navigate_hash(response, err_path) + if errors is not None: + module.fail_json(msg=errors) + + +class RegionDiskDiskEncryptionKey(object): + def __init__(self, request, module): + self.module = module + if request: + self.request = request + else: + self.request = {} + + def to_request(self): + return remove_nones_from_dict({ + u'rawKey': self.request.get('raw_key'), + u'sha256': self.request.get('sha256') + }) + + def from_response(self): + return remove_nones_from_dict({ + u'rawKey': self.request.get(u'rawKey'), + u'sha256': self.request.get(u'sha256') + }) + + +class RegionDiskSourceSnapshotEncryptionKey(object): + def __init__(self, request, module): + self.module = module + if request: + self.request = request + else: + self.request = {} + + def to_request(self): + return remove_nones_from_dict({ + u'rawKey': self.request.get('raw_key'), + u'sha256': self.request.get('sha256') + }) + + def from_response(self): + return remove_nones_from_dict({ + u'rawKey': self.request.get(u'rawKey'), + u'sha256': self.request.get(u'sha256') + }) + + +if __name__ == '__main__': + main() diff --git a/lib/ansible/modules/cloud/google/gcp_compute_region_disk_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_region_disk_facts.py new file mode 100644 index 00000000000000..99810136f6c186 --- /dev/null +++ b/lib/ansible/modules/cloud/google/gcp_compute_region_disk_facts.py @@ -0,0 +1,303 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# +# Copyright (C) 2017 Google +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) +# ---------------------------------------------------------------------------- +# +# *** AUTO GENERATED CODE *** AUTO GENERATED CODE *** +# +# ---------------------------------------------------------------------------- +# +# This file is automatically generated by Magic Modules and manual +# changes will be clobbered when the file is regenerated. +# +# Please read more about how to change this file at +# https://www.github.com/GoogleCloudPlatform/magic-modules +# +# ---------------------------------------------------------------------------- + +from __future__ import absolute_import, division, print_function +__metaclass__ = type + +################################################################################ +# Documentation +################################################################################ + +ANSIBLE_METADATA = {'metadata_version': '1.1', + 'status': ["preview"], + 'supported_by': 'community'} + +DOCUMENTATION = ''' +--- +module: gcp_compute_region_disk_facts +description: + - Gather facts for GCP RegionDisk +short_description: Gather facts for GCP RegionDisk +version_added: 2.8 +author: Google Inc. (@googlecloudplatform) +requirements: + - python >= 2.6 + - requests >= 2.18.4 + - google-auth >= 1.3.0 +options: + filters: + description: + A list of filter value pairs. Available filters are listed here + U(https://cloud.google.com/sdk/gcloud/reference/topic/filters). + Each additional filter in the list will act be added as an AND condition + (filter1 and filter2) + region: + description: + - A reference to the region where the disk resides. + required: true +extends_documentation_fragment: gcp +''' + +EXAMPLES = ''' +- name: a region disk facts + gcp_compute_region_disk_facts: + region: us-central1 + filters: + - name = test_object + project: test_project + auth_kind: serviceaccount + service_account_file: "/tmp/auth.pem" +''' + +RETURN = ''' +items: + description: List of items + returned: always + type: complex + contains: + labelFingerprint: + description: + - The fingerprint used for optimistic locking of this resource. Used internally during + updates. + returned: success + type: str + creationTimestamp: + description: + - Creation timestamp in RFC3339 text format. + returned: success + type: str + description: + description: + - An optional description of this resource. Provide this property when you create + the resource. + returned: success + type: str + id: + description: + - The unique identifier for the resource. + returned: success + type: int + lastAttachTimestamp: + description: + - Last attach timestamp in RFC3339 text format. + returned: success + type: str + lastDetachTimestamp: + description: + - Last dettach timestamp in RFC3339 text format. + returned: success + type: str + labels: + description: + - Labels to apply to this disk. A list of key->value pairs. + returned: success + type: dict + licenses: + description: + - Any applicable publicly visible licenses. + returned: success + type: list + name: + description: + - Name of the resource. Provided by the client when the resource is created. The name + must be 1-63 characters long, and comply with RFC1035. Specifically, the name must + be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` + which means the first character must be a lowercase letter, and all following characters + must be a dash, lowercase letter, or digit, except the last character, which cannot + be a dash. + returned: success + type: str + sizeGb: + description: + - Size of the persistent disk, specified in GB. You can specify this field when creating + a persistent disk using the sourceImage or sourceSnapshot parameter, or specify + it alone to create an empty persistent disk. + - If you specify this field along with sourceImage or sourceSnapshot, the value of + sizeGb must not be less than the size of the sourceImage or the size of the snapshot. + returned: success + type: int + users: + description: + - 'Links to the users of the disk (attached instances) in form: project/zones/zone/instances/instance + .' + returned: success + type: list + replicaZones: + description: + - URLs of the zones where the disk should be replicated to. + returned: success + type: list + type: + description: + - URL of the disk type resource describing which disk type to use to create the disk. + Provide this when creating the disk. + returned: success + type: str + region: + description: + - A reference to the region where the disk resides. + returned: success + type: str + diskEncryptionKey: + description: + - Encrypts the disk using a customer-supplied encryption key. + - After you encrypt a disk with a customer-supplied key, you must provide the same + key if you use the disk later (e.g. to create a disk snapshot or an image, or to + attach the disk to a virtual machine). + - Customer-supplied encryption keys do not protect access to metadata of the disk. + - If you do not provide an encryption key when creating the disk, then the disk will + be encrypted using an automatically generated key and you do not need to provide + a key to use the disk later. + returned: success + type: complex + contains: + rawKey: + description: + - Specifies a 256-bit customer-supplied encryption key, encoded in RFC 4648 base64 + to either encrypt or decrypt this resource. + returned: success + type: str + sha256: + description: + - The RFC 4648 base64 encoded SHA-256 hash of the customer-supplied encryption key + that protects this resource. + returned: success + type: str + sourceSnapshot: + description: + - 'The source snapshot used to create this disk. You can provide this as a partial + or full URL to the resource. For example, the following are valid values: * + `U(https://www.googleapis.com/compute/v1/projects/project/global/snapshots/snapshot`) + * `projects/project/global/snapshots/snapshot` * `global/snapshots/snapshot` .' + returned: success + type: dict + sourceSnapshotEncryptionKey: + description: + - The customer-supplied encryption key of the source snapshot. Required if the source + snapshot is protected by a customer-supplied encryption key. + returned: success + type: complex + contains: + rawKey: + description: + - Specifies a 256-bit customer-supplied encryption key, encoded in RFC 4648 base64 + to either encrypt or decrypt this resource. + returned: success + type: str + sha256: + description: + - The RFC 4648 base64 encoded SHA-256 hash of the customer-supplied encryption key + that protects this resource. + returned: success + type: str + sourceSnapshotId: + description: + - The unique ID of the snapshot used to create this disk. This value identifies the + exact snapshot that was used to create this persistent disk. For example, if you + created the persistent disk from a snapshot that was later deleted and recreated + under the same name, the source snapshot ID would identify the exact version of + the snapshot that was used. + returned: success + type: str +''' + +################################################################################ +# Imports +################################################################################ +from ansible.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest +import json + +################################################################################ +# Main +################################################################################ + + +def main(): + module = GcpModule( + argument_spec=dict( + filters=dict(type='list', elements='str'), + region=dict(required=True, type='str') + ) + ) + + if 'scopes' not in module.params: + module.params['scopes'] = ['https://www.googleapis.com/auth/compute'] + + items = fetch_list(module, collection(module), query_options(module.params['filters'])) + if items.get('items'): + items = items.get('items') + else: + items = [] + return_value = { + 'items': items + } + module.exit_json(**return_value) + + +def collection(module): + return "https://www.googleapis.com/compute/v1/projects/{project}/regions/{region}/disks".format(**module.params) + + +def fetch_list(module, link, query): + auth = GcpSession(module, 'compute') + response = auth.get(link, params={'filter': query}) + return return_if_object(module, response) + + +def query_options(filters): + if not filters: + return '' + + if len(filters) == 1: + return filters[0] + else: + queries = [] + for f in filters: + # For multiple queries, all queries should have () + if f[0] != '(' and f[-1] != ')': + queries.append("(%s)" % ''.join(f)) + else: + queries.append(f) + + return ' '.join(queries) + + +def return_if_object(module, response): + # If not found, return nothing. + if response.status_code == 404: + return None + + # If no content, return nothing. + if response.status_code == 204: + return None + + try: + module.raise_for_status(response) + result = response.json() + except getattr(json.decoder, 'JSONDecodeError', ValueError) as inst: + module.fail_json(msg="Invalid JSON response with error: %s" % inst) + + if navigate_hash(result, ['error', 'errors']): + module.fail_json(msg=navigate_hash(result, ['error', 'errors'])) + + return result + + +if __name__ == "__main__": + main() diff --git a/lib/ansible/modules/cloud/google/gcp_compute_subnetwork.py b/lib/ansible/modules/cloud/google/gcp_compute_subnetwork.py index 20a9b80a7343dc..9348fb629385fa 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_subnetwork.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_subnetwork.py @@ -93,6 +93,33 @@ set this network to a dictionary with the selfLink key where the value is the selfLink of your Network.' required: true + enable_flow_logs: + description: + - Whether to enable flow logging for this subnetwork. + required: false + type: bool + version_added: 2.8 + secondary_ip_ranges: + description: + - An array of configurations for secondary IP ranges for VM instances contained in + this subnetwork. The primary IP of such VM must belong to the primary ipCidrRange + of the subnetwork. The alias IPs may belong to either primary or secondary ranges. + required: false + version_added: 2.8 + suboptions: + range_name: + description: + - The name associated with this subnetwork secondary range, used when adding an alias + IP range to a VM instance. The name must be 1-63 characters long, and comply with + RFC1035. The name must be unique within the subnetwork. + required: true + ip_cidr_range: + description: + - The range of IP addresses belonging to this subnetwork secondary range. Provide + this property when you create the subnetwork. + - Ranges must be unique and non-overlapping with all primary and secondary IP ranges + within a network. Only IPv4 is supported. + required: true private_ip_google_access: description: - Whether the VMs in this subnet can access Google services without assigned external @@ -180,6 +207,40 @@ - Only networks that are in the distributed mode can have subnetworks. returned: success type: dict + enableFlowLogs: + description: + - Whether to enable flow logging for this subnetwork. + returned: success + type: bool + fingerprint: + description: + - Fingerprint of this resource. This field is used internally during updates of this + resource. + returned: success + type: str + secondaryIpRanges: + description: + - An array of configurations for secondary IP ranges for VM instances contained in + this subnetwork. The primary IP of such VM must belong to the primary ipCidrRange + of the subnetwork. The alias IPs may belong to either primary or secondary ranges. + returned: success + type: complex + contains: + rangeName: + description: + - The name associated with this subnetwork secondary range, used when adding an alias + IP range to a VM instance. The name must be 1-63 characters long, and comply with + RFC1035. The name must be unique within the subnetwork. + returned: success + type: str + ipCidrRange: + description: + - The range of IP addresses belonging to this subnetwork secondary range. Provide + this property when you create the subnetwork. + - Ranges must be unique and non-overlapping with all primary and secondary IP ranges + within a network. Only IPv4 is supported. + returned: success + type: str privateIpGoogleAccess: description: - Whether the VMs in this subnet can access Google services without assigned external @@ -197,7 +258,7 @@ # Imports ################################################################################ -from ansible.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest, replace_resource_dict +from ansible.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest, remove_nones_from_dict, replace_resource_dict import json import time @@ -216,6 +277,11 @@ def main(): ip_cidr_range=dict(required=True, type='str'), name=dict(required=True, type='str'), network=dict(required=True, type='dict'), + enable_flow_logs=dict(type='bool'), + secondary_ip_ranges=dict(type='list', elements='dict', options=dict( + range_name=dict(required=True, type='str'), + ip_cidr_range=dict(required=True, type='str') + )), private_ip_google_access=dict(type='bool'), region=dict(required=True, type='str') ) @@ -266,6 +332,8 @@ def update(module, link, kind, fetch): def update_fields(module, request, response): if response.get('ipCidrRange') != request.get('ipCidrRange'): ip_cidr_range_update(module, request, response) + if response.get('enableFlowLogs') != request.get('enableFlowLogs') or response.get('secondaryIpRanges') != request.get('secondaryIpRanges'): + enable_flow_logs_update(module, request, response) if response.get('privateIpGoogleAccess') != request.get('privateIpGoogleAccess'): private_ip_google_access_update(module, request, response) @@ -283,6 +351,21 @@ def ip_cidr_range_update(module, request, response): ) +def enable_flow_logs_update(module, request, response): + auth = GcpSession(module, 'compute') + auth.patch( + ''.join([ + "https://www.googleapis.com/compute/v1/", + "projects/{project}/regions/{region}/subnetworks/{name}" + ]).format(**module.params), + { + u'enableFlowLogs': module.params.get('enable_flow_logs'), + u'fingerprint': response.get('fingerprint'), + u'secondaryIpRanges': SubnetworkSecondaryIpRangesArray(module.params.get('secondary_ip_ranges', []), module).to_request() + } + ) + + def private_ip_google_access_update(module, request, response): auth = GcpSession(module, 'compute') auth.post( @@ -308,6 +391,8 @@ def resource_to_request(module): u'ipCidrRange': module.params.get('ip_cidr_range'), u'name': module.params.get('name'), u'network': replace_resource_dict(module.params.get(u'network', {}), 'selfLink'), + u'enableFlowLogs': module.params.get('enable_flow_logs'), + u'secondaryIpRanges': SubnetworkSecondaryIpRangesArray(module.params.get('secondary_ip_ranges', []), module).to_request(), u'privateIpGoogleAccess': module.params.get('private_ip_google_access'), u'region': module.params.get('region') } @@ -382,6 +467,9 @@ def response_to_hash(module, response): u'ipCidrRange': response.get(u'ipCidrRange'), u'name': response.get(u'name'), u'network': replace_resource_dict(module.params.get(u'network', {}), 'selfLink'), + u'enableFlowLogs': response.get(u'enableFlowLogs'), + u'fingerprint': response.get(u'fingerprint'), + u'secondaryIpRanges': SubnetworkSecondaryIpRangesArray(response.get(u'secondaryIpRanges', []), module).from_response(), u'privateIpGoogleAccess': response.get(u'privateIpGoogleAccess'), u'region': module.params.get('region') } @@ -424,5 +512,38 @@ def raise_if_errors(response, err_path, module): module.fail_json(msg=errors) +class SubnetworkSecondaryIpRangesArray(object): + def __init__(self, request, module): + self.module = module + if request: + self.request = request + else: + self.request = [] + + def to_request(self): + items = [] + for item in self.request: + items.append(self._request_for_item(item)) + return items + + def from_response(self): + items = [] + for item in self.request: + items.append(self._response_from_item(item)) + return items + + def _request_for_item(self, item): + return remove_nones_from_dict({ + u'rangeName': item.get('range_name'), + u'ipCidrRange': item.get('ip_cidr_range') + }) + + def _response_from_item(self, item): + return remove_nones_from_dict({ + u'rangeName': item.get(u'rangeName'), + u'ipCidrRange': item.get(u'ipCidrRange') + }) + + if __name__ == '__main__': main() diff --git a/lib/ansible/modules/cloud/google/gcp_compute_subnetwork_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_subnetwork_facts.py index f48a1191f85163..2952d3a1514e37 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_subnetwork_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_subnetwork_facts.py @@ -117,6 +117,40 @@ - Only networks that are in the distributed mode can have subnetworks. returned: success type: dict + enableFlowLogs: + description: + - Whether to enable flow logging for this subnetwork. + returned: success + type: bool + fingerprint: + description: + - Fingerprint of this resource. This field is used internally during updates of this + resource. + returned: success + type: str + secondaryIpRanges: + description: + - An array of configurations for secondary IP ranges for VM instances contained in + this subnetwork. The primary IP of such VM must belong to the primary ipCidrRange + of the subnetwork. The alias IPs may belong to either primary or secondary ranges. + returned: success + type: complex + contains: + rangeName: + description: + - The name associated with this subnetwork secondary range, used when adding an alias + IP range to a VM instance. The name must be 1-63 characters long, and comply with + RFC1035. The name must be unique within the subnetwork. + returned: success + type: str + ipCidrRange: + description: + - The range of IP addresses belonging to this subnetwork secondary range. Provide + this property when you create the subnetwork. + - Ranges must be unique and non-overlapping with all primary and secondary IP ranges + within a network. Only IPv4 is supported. + returned: success + type: str privateIpGoogleAccess: description: - Whether the VMs in this subnet can access Google services without assigned external diff --git a/test/integration/targets/gcp_compute_region_disk/aliases b/test/integration/targets/gcp_compute_region_disk/aliases new file mode 100644 index 00000000000000..9812f019ca4bae --- /dev/null +++ b/test/integration/targets/gcp_compute_region_disk/aliases @@ -0,0 +1,2 @@ +cloud/gcp +unsupported diff --git a/test/integration/targets/gcp_compute_region_disk/defaults/main.yml b/test/integration/targets/gcp_compute_region_disk/defaults/main.yml new file mode 100644 index 00000000000000..aa87a2a8e0e0e0 --- /dev/null +++ b/test/integration/targets/gcp_compute_region_disk/defaults/main.yml @@ -0,0 +1,3 @@ +--- +# defaults file +resource_name: '{{resource_prefix}}' diff --git a/test/integration/targets/gcp_compute_region_disk/meta/main.yml b/test/integration/targets/gcp_compute_region_disk/meta/main.yml new file mode 100644 index 00000000000000..e69de29bb2d1d6 diff --git a/test/integration/targets/gcp_compute_region_disk/tasks/main.yml b/test/integration/targets/gcp_compute_region_disk/tasks/main.yml new file mode 100644 index 00000000000000..9e850c3a717468 --- /dev/null +++ b/test/integration/targets/gcp_compute_region_disk/tasks/main.yml @@ -0,0 +1,143 @@ +--- +# ---------------------------------------------------------------------------- +# +# *** AUTO GENERATED CODE *** AUTO GENERATED CODE *** +# +# ---------------------------------------------------------------------------- +# +# This file is automatically generated by Magic Modules and manual +# changes will be clobbered when the file is regenerated. +# +# Please read more about how to change this file at +# https://www.github.com/GoogleCloudPlatform/magic-modules +# +# ---------------------------------------------------------------------------- +# Pre-test setup +- name: delete a region disk + gcp_compute_region_disk: + name: "{{ resource_name }}" + size_gb: 50 + disk_encryption_key: + raw_key: SGVsbG8gZnJvbSBHb29nbGUgQ2xvdWQgUGxhdGZvcm0= + region: us-central1 + replica_zones: + - us-central1-a + - us-central1-f + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent +#---------------------------------------------------------- +- name: create a region disk + gcp_compute_region_disk: + name: "{{ resource_name }}" + size_gb: 50 + disk_encryption_key: + raw_key: SGVsbG8gZnJvbSBHb29nbGUgQ2xvdWQgUGxhdGZvcm0= + region: us-central1 + replica_zones: + - us-central1-a + - us-central1-f + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present + register: result +- name: assert changed is true + assert: + that: + - result.changed == true + - "result.kind == 'compute#disk'" +- name: verify that region_disk was created + gcp_compute_region_disk_facts: + filters: + - name = {{ resource_name }} + region: us-central1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + scopes: + - https://www.googleapis.com/auth/compute + register: results +- name: verify that command succeeded + assert: + that: + - results['items'] | length == 1 +# ---------------------------------------------------------------------------- +- name: create a region disk that already exists + gcp_compute_region_disk: + name: "{{ resource_name }}" + size_gb: 50 + disk_encryption_key: + raw_key: SGVsbG8gZnJvbSBHb29nbGUgQ2xvdWQgUGxhdGZvcm0= + region: us-central1 + replica_zones: + - us-central1-a + - us-central1-f + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present + register: result +- name: assert changed is false + assert: + that: + - result.changed == false + - "result.kind == 'compute#disk'" +#---------------------------------------------------------- +- name: delete a region disk + gcp_compute_region_disk: + name: "{{ resource_name }}" + size_gb: 50 + disk_encryption_key: + raw_key: SGVsbG8gZnJvbSBHb29nbGUgQ2xvdWQgUGxhdGZvcm0= + region: us-central1 + replica_zones: + - us-central1-a + - us-central1-f + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: result +- name: assert changed is true + assert: + that: + - result.changed == true + - result.has_key('kind') == False +- name: verify that region_disk was deleted + gcp_compute_region_disk_facts: + filters: + - name = {{ resource_name }} + region: us-central1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + scopes: + - https://www.googleapis.com/auth/compute + register: results +- name: verify that command succeeded + assert: + that: + - results['items'] | length == 0 +# ---------------------------------------------------------------------------- +- name: delete a region disk that does not exist + gcp_compute_region_disk: + name: "{{ resource_name }}" + size_gb: 50 + disk_encryption_key: + raw_key: SGVsbG8gZnJvbSBHb29nbGUgQ2xvdWQgUGxhdGZvcm0= + region: us-central1 + replica_zones: + - us-central1-a + - us-central1-f + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: result +- name: assert changed is false + assert: + that: + - result.changed == false + - result.has_key('kind') == False From f8c46d6fa4e9388dd6be434f9c1d80086bd52941 Mon Sep 17 00:00:00 2001 From: Dana Hoffman Date: Tue, 9 Oct 2018 20:31:42 +0000 Subject: [PATCH 044/144] labelfingerprint is beta for resources where labels are beta --- .../google/gcp_compute_forwarding_rule.py | 20 ------------ .../gcp_compute_forwarding_rule_facts.py | 6 ---- .../google/gcp_compute_global_address.py | 32 ++----------------- .../gcp_compute_global_address_facts.py | 6 ---- 4 files changed, 3 insertions(+), 61 deletions(-) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_forwarding_rule.py b/lib/ansible/modules/cloud/google/gcp_compute_forwarding_rule.py index a712c5e709f6f0..507ce5182083f4 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_forwarding_rule.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_forwarding_rule.py @@ -359,12 +359,6 @@ - This field is not used for internal load balancing. returned: success type: dict - labelFingerprint: - description: - - The fingerprint used for optimistic locking of this resource. Used internally during - updates. - returned: success - type: str networkTier: description: - 'The networking tier used for configuring this address. This field can take the @@ -476,19 +470,6 @@ def target_update(module, request, response): ) -def label_fingerprint_update(module, request, response): - auth = GcpSession(module, 'compute') - auth.post( - ''.join([ - "https://www.googleapis.com/compute/v1/", - "projects/{project}/regions/{region}/forwardingRules/{name}/setLabels" - ]).format(**module.params), - { - u'labelFingerprint': response.get('labelFingerprint') - } - ) - - def delete(module, link, kind): auth = GcpSession(module, 'compute') return wait_for_operation(module, auth.delete(link)) @@ -589,7 +570,6 @@ def response_to_hash(module, response): u'ports': response.get(u'ports'), u'subnetwork': response.get(u'subnetwork'), u'target': response.get(u'target'), - u'labelFingerprint': response.get(u'labelFingerprint'), u'networkTier': module.params.get('network_tier') } diff --git a/lib/ansible/modules/cloud/google/gcp_compute_forwarding_rule_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_forwarding_rule_facts.py index a56710298af767..1844ef264980f9 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_forwarding_rule_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_forwarding_rule_facts.py @@ -199,12 +199,6 @@ - This field is not used for internal load balancing. returned: success type: dict - labelFingerprint: - description: - - The fingerprint used for optimistic locking of this resource. Used internally during - updates. - returned: success - type: str networkTier: description: - 'The networking tier used for configuring this address. This field can take the diff --git a/lib/ansible/modules/cloud/google/gcp_compute_global_address.py b/lib/ansible/modules/cloud/google/gcp_compute_global_address.py index f8cc7eaea96ab2..79ef0262a09dff 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_global_address.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_global_address.py @@ -124,12 +124,6 @@ be a dash. returned: success type: str - labelFingerprint: - description: - - The fingerprint used for optimistic locking of this resource. Used internally during - updates. - returned: success - type: str ipVersion: description: - The IP Version that will be used by this address. Valid options are IPV4 or IPV6. @@ -189,7 +183,7 @@ def main(): if fetch: if state == 'present': if is_different(module, fetch): - update(module, self_link(module), kind, fetch) + update(module, self_link(module), kind) fetch = fetch_resource(module, self_link(module), kind) changed = True else: @@ -213,27 +207,8 @@ def create(module, link, kind): return wait_for_operation(module, auth.post(link, resource_to_request(module))) -def update(module, link, kind, fetch): - update_fields(module, resource_to_request(module), - response_to_hash(module, fetch)) - return fetch_resource(module, self_link(module), kind) - - -def update_fields(module, request, response): - pass - - -def label_fingerprint_update(module, request, response): - auth = GcpSession(module, 'compute') - auth.post( - ''.join([ - "https://www.googleapis.com/compute/v1/", - "projects/{project}/global/addresses/{name}/setLabels" - ]).format(**module.params), - { - u'labelFingerprint': response.get('labelFingerprint') - } - ) +def update(module, link, kind): + module.fail_json(msg="GlobalAddress cannot be edited") def delete(module, link, kind): @@ -318,7 +293,6 @@ def response_to_hash(module, response): u'description': response.get(u'description'), u'id': response.get(u'id'), u'name': response.get(u'name'), - u'labelFingerprint': response.get(u'labelFingerprint'), u'ipVersion': response.get(u'ipVersion'), u'region': response.get(u'region'), u'addressType': response.get(u'addressType') diff --git a/lib/ansible/modules/cloud/google/gcp_compute_global_address_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_global_address_facts.py index cd91bc0a272e9f..2e09ef41c9fd61 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_global_address_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_global_address_facts.py @@ -97,12 +97,6 @@ be a dash. returned: success type: str - labelFingerprint: - description: - - The fingerprint used for optimistic locking of this resource. Used internally during - updates. - returned: success - type: str ipVersion: description: - The IP Version that will be used by this address. Valid options are IPV4 or IPV6. From 9d250b6fb08d79f5cace73cb5f16679b7e3e03a3 Mon Sep 17 00:00:00 2001 From: The Magician Date: Thu, 11 Oct 2018 10:03:25 -0700 Subject: [PATCH 045/144] Removing the <|extra|> marker because it's only used in DNS custom code (#103) /cc @rambleraptor --- .../modules/cloud/google/gcp_dns_resource_record_set.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/ansible/modules/cloud/google/gcp_dns_resource_record_set.py b/lib/ansible/modules/cloud/google/gcp_dns_resource_record_set.py index f5b1042feae3d8..2b0491534b515e 100644 --- a/lib/ansible/modules/cloud/google/gcp_dns_resource_record_set.py +++ b/lib/ansible/modules/cloud/google/gcp_dns_resource_record_set.py @@ -275,12 +275,12 @@ def self_link(module): return "https://www.googleapis.com/dns/v1/projects/{project}/managedZones/{managed_zone}/rrsets?name={name}&type={type}".format(**res) -def collection(module, extra_url=''): +def collection(module): res = { 'project': module.params['project'], 'managed_zone': replace_resource_dict(module.params['managed_zone'], 'name') } - return "https://www.googleapis.com/dns/v1/projects/{project}/managedZones/{managed_zone}/changes".format(**res) + extra_url + return "https://www.googleapis.com/dns/v1/projects/{project}/managedZones/{managed_zone}/changes".format(**res) def return_if_object(module, response, kind, allow_not_found=False): @@ -440,7 +440,7 @@ def wait_for_change_to_complete(change_id, module): def get_change_status(change_id, module): auth = GcpSession(module, 'dns') - link = collection(module, "/%s" % change_id) + link = collection(module) + "/%s" % change_id return return_if_change_object(module, auth.get(link))['status'] From 30caf7fa448b5e82e6aa6ac20de512ee9e094755 Mon Sep 17 00:00:00 2001 From: The Magician Date: Thu, 11 Oct 2018 11:08:04 -0700 Subject: [PATCH 046/144] Magic Modules changes. (#101) --- .../cloud/google/gcp_compute_instance.py | 25 ++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_instance.py b/lib/ansible/modules/cloud/google/gcp_compute_instance.py index 1c7935d7011989..4c52273d079ba2 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_instance.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_instance.py @@ -931,7 +931,7 @@ def main(): if fetch: if state == 'present': if is_different(module, fetch): - update(module, self_link(module), kind) + update(module, self_link(module), kind, fetch) fetch = fetch_resource(module, self_link(module), kind) changed = True else: @@ -955,9 +955,28 @@ def create(module, link, kind): return wait_for_operation(module, auth.post(link, resource_to_request(module))) -def update(module, link, kind): +def update(module, link, kind, fetch): + update_fields(module, resource_to_request(module), + response_to_hash(module, fetch)) + return fetch_resource(module, self_link(module), kind) + + +def update_fields(module, request, response): + if response.get('machineType') != request.get('machineType'): + machine_type_update(module, request, response) + + +def machine_type_update(module, request, response): auth = GcpSession(module, 'compute') - return wait_for_operation(module, auth.put(link, resource_to_request(module))) + auth.post( + ''.join([ + "https://www.googleapis.com/compute/v1/", + "projdcts/{project}/zones/{zone}/instances/{name}/setMachineType" + ]).format(**module.params), + { + u'machineType': machine_type_selflink(module.params.get('machine_type'), module.params) + } + ) def delete(module, link, kind): From 8da785e98e8a42f387c839ad4412b197c7f403c0 Mon Sep 17 00:00:00 2001 From: Nathan McKinley Date: Thu, 11 Oct 2018 22:52:11 +0000 Subject: [PATCH 047/144] WIP: Add interconnect attachments. --- .../gcp_compute_interconnect_attachment.py | 403 ++++++++++++++++++ ...p_compute_interconnect_attachment_facts.py | 234 ++++++++++ .../aliases | 2 + .../defaults/main.yml | 3 + .../meta/main.yml | 0 .../tasks/main.yml | 116 +++++ 6 files changed, 758 insertions(+) create mode 100644 lib/ansible/modules/cloud/google/gcp_compute_interconnect_attachment.py create mode 100644 lib/ansible/modules/cloud/google/gcp_compute_interconnect_attachment_facts.py create mode 100644 test/integration/targets/gcp_compute_interconnect_attachment/aliases create mode 100644 test/integration/targets/gcp_compute_interconnect_attachment/defaults/main.yml create mode 100644 test/integration/targets/gcp_compute_interconnect_attachment/meta/main.yml create mode 100644 test/integration/targets/gcp_compute_interconnect_attachment/tasks/main.yml diff --git a/lib/ansible/modules/cloud/google/gcp_compute_interconnect_attachment.py b/lib/ansible/modules/cloud/google/gcp_compute_interconnect_attachment.py new file mode 100644 index 00000000000000..eb9598d3706357 --- /dev/null +++ b/lib/ansible/modules/cloud/google/gcp_compute_interconnect_attachment.py @@ -0,0 +1,403 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# +# Copyright (C) 2017 Google +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) +# ---------------------------------------------------------------------------- +# +# *** AUTO GENERATED CODE *** AUTO GENERATED CODE *** +# +# ---------------------------------------------------------------------------- +# +# This file is automatically generated by Magic Modules and manual +# changes will be clobbered when the file is regenerated. +# +# Please read more about how to change this file at +# https://www.github.com/GoogleCloudPlatform/magic-modules +# +# ---------------------------------------------------------------------------- + +from __future__ import absolute_import, division, print_function +__metaclass__ = type + +################################################################################ +# Documentation +################################################################################ + +ANSIBLE_METADATA = {'metadata_version': '1.1', + 'status': ["preview"], + 'supported_by': 'community'} + +DOCUMENTATION = ''' +--- +module: gcp_compute_interconnect_attachment +description: + - Represents an InterconnectAttachment (VLAN attachment) resource. For more information, + see Creating VLAN Attachments. +short_description: Creates a GCP InterconnectAttachment +version_added: 2.8 +author: Google Inc. (@googlecloudplatform) +requirements: + - python >= 2.6 + - requests >= 2.18.4 + - google-auth >= 1.3.0 +options: + state: + description: + - Whether the given object should exist in GCP + choices: ['present', 'absent'] + default: 'present' + interconnect: + description: + - URL of the underlying Interconnect object that this attachment's traffic will traverse + through. + required: true + description: + description: + - An optional description of this resource. . + required: false + router: + description: + - URL of the cloud router to be used for dynamic routing. This router must be in the + same region as this InterconnectAttachment. The InterconnectAttachment will automatically + connect the Interconnect to the network & region within which the Cloud Router is + configured. + - 'This field represents a link to a Router resource in GCP. It can be specified in + two ways. You can add `register: name-of-resource` to a gcp_compute_router task + and then set this router field to "{{ name-of-resource }}" Alternatively, you can + set this router to a dictionary with the selfLink key where the value is the selfLink + of your Router.' + required: true + name: + description: + - Name of the resource. Provided by the client when the resource is created. The name + must be 1-63 characters long, and comply with RFC1035. Specifically, the name must + be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` + which means the first character must be a lowercase letter, and all following characters + must be a dash, lowercase letter, or digit, except the last character, which cannot + be a dash. + required: true + region: + description: + - Region where the regional interconnect attachment resides. + required: true +extends_documentation_fragment: gcp +''' + +EXAMPLES = ''' +- name: create a interconnect attachment + gcp_compute_interconnect_attachment: + name: "test_object" + region: us-central1 + project: "test_project" + auth_kind: "serviceaccount" + interconnect: https://googleapis.com/compute/v1/projects/test_project/global/interconnects/... + router: https://googleapis.com/compute/v1/projects/test_project/regions/us-central1/routers/... + service_account_file: "/tmp/auth.pem" + state: present + register: disk +''' + +RETURN = ''' + cloudRouterIpAddress: + description: + - IPv4 address + prefix length to be configured on Cloud Router Interface for this + interconnect attachment. + returned: success + type: str + customerRouterIpAddress: + description: + - IPv4 address + prefix length to be configured on the customer router subinterface + for this interconnect attachment. + returned: success + type: str + interconnect: + description: + - URL of the underlying Interconnect object that this attachment's traffic will traverse + through. + returned: success + type: str + description: + description: + - An optional description of this resource. . + returned: success + type: str + privateInterconnectInfo: + description: + - Information specific to an InterconnectAttachment. This property is populated if + the interconnect that this is attached to is of type DEDICATED. + returned: success + type: complex + contains: + tag8021q: + description: + - 802.1q encapsulation tag to be used for traffic between Google and the customer, + going to and from this network and region. + returned: success + type: int + googleReferenceId: + description: + - Google reference ID, to be used when raising support tickets with Google or otherwise + to debug backend connectivity issues. + returned: success + type: str + router: + description: + - URL of the cloud router to be used for dynamic routing. This router must be in the + same region as this InterconnectAttachment. The InterconnectAttachment will automatically + connect the Interconnect to the network & region within which the Cloud Router is + configured. + returned: success + type: dict + creationTimestamp: + description: + - Creation timestamp in RFC3339 text format. + returned: success + type: str + id: + description: + - The unique identifier for the resource. This identifier is defined by the server. + returned: success + type: str + name: + description: + - Name of the resource. Provided by the client when the resource is created. The name + must be 1-63 characters long, and comply with RFC1035. Specifically, the name must + be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` + which means the first character must be a lowercase letter, and all following characters + must be a dash, lowercase letter, or digit, except the last character, which cannot + be a dash. + returned: success + type: str + region: + description: + - Region where the regional interconnect attachment resides. + returned: success + type: str +''' + +################################################################################ +# Imports +################################################################################ + +from ansible.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest, remove_nones_from_dict, replace_resource_dict +import json +import re +import time + +################################################################################ +# Main +################################################################################ + + +def main(): + """Main function""" + + module = GcpModule( + argument_spec=dict( + state=dict(default='present', choices=['present', 'absent'], type='str'), + interconnect=dict(required=True, type='str'), + description=dict(type='str'), + router=dict(required=True, type='dict'), + name=dict(required=True, type='str'), + region=dict(required=True, type='str') + ) + ) + + if not module.params['scopes']: + module.params['scopes'] = ['https://www.googleapis.com/auth/compute'] + + state = module.params['state'] + kind = 'compute#interconnectAttachment' + + fetch = fetch_resource(module, self_link(module), kind) + changed = False + + if fetch: + if state == 'present': + if is_different(module, fetch): + update(module, self_link(module), kind) + fetch = fetch_resource(module, self_link(module), kind) + changed = True + else: + delete(module, self_link(module), kind) + fetch = {} + changed = True + else: + if state == 'present': + fetch = create(module, collection(module), kind) + changed = True + else: + fetch = {} + + fetch.update({'changed': changed}) + + module.exit_json(**fetch) + + +def create(module, link, kind): + auth = GcpSession(module, 'compute') + return wait_for_operation(module, auth.post(link, resource_to_request(module))) + + +def update(module, link, kind): + module.fail_json(msg="InterconnectAttachment cannot be edited") + + +def delete(module, link, kind): + auth = GcpSession(module, 'compute') + return wait_for_operation(module, auth.delete(link)) + + +def resource_to_request(module): + request = { + u'kind': 'compute#interconnectAttachment', + u'interconnect': module.params.get('interconnect'), + u'description': module.params.get('description'), + u'router': replace_resource_dict(module.params.get(u'router', {}), 'selfLink'), + u'name': module.params.get('name') + } + return_vals = {} + for k, v in request.items(): + if v: + return_vals[k] = v + + return return_vals + + +def fetch_resource(module, link, kind, allow_not_found=True): + auth = GcpSession(module, 'compute') + return return_if_object(module, auth.get(link), kind, allow_not_found) + + +def self_link(module): + return "https://www.googleapis.com/compute/v1/projects/{project}/regions/{region}/interconnectAttachments/{name}".format(**module.params) + + +def collection(module): + return "https://www.googleapis.com/compute/v1/projects/{project}/regions/{region}/interconnectAttachments".format(**module.params) + + +def return_if_object(module, response, kind, allow_not_found=False): + # If not found, return nothing. + if allow_not_found and response.status_code == 404: + return None + + # If no content, return nothing. + if response.status_code == 204: + return None + + try: + module.raise_for_status(response) + result = response.json() + except getattr(json.decoder, 'JSONDecodeError', ValueError) as inst: + module.fail_json(msg="Invalid JSON response with error: %s" % inst) + + if navigate_hash(result, ['error', 'errors']): + module.fail_json(msg=navigate_hash(result, ['error', 'errors'])) + + return result + + +def is_different(module, response): + request = resource_to_request(module) + response = response_to_hash(module, response) + + # Remove all output-only from response. + response_vals = {} + for k, v in response.items(): + if k in request: + response_vals[k] = v + + request_vals = {} + for k, v in request.items(): + if k in response: + request_vals[k] = v + + return GcpRequest(request_vals) != GcpRequest(response_vals) + + +# Remove unnecessary properties from the response. +# This is for doing comparisons with Ansible's current parameters. +def response_to_hash(module, response): + return { + u'cloudRouterIpAddress': response.get(u'cloudRouterIpAddress'), + u'customerRouterIpAddress': response.get(u'customerRouterIpAddress'), + u'interconnect': response.get(u'interconnect'), + u'description': response.get(u'description'), + u'privateInterconnectInfo': InterconnectAttachmentPrivateInterconnectInfo(response.get(u'privateInterconnectInfo', {}), module).from_response(), + u'googleReferenceId': response.get(u'googleReferenceId'), + u'router': response.get(u'router'), + u'creationTimestamp': response.get(u'creationTimestamp'), + u'id': response.get(u'id'), + u'name': response.get(u'name') + } + + +def region_selflink(name, params): + if name is None: + return + url = r"https://www.googleapis.com/compute/v1/projects/.*/regions/[a-z1-9\-]*" + if not re.match(url, name): + name = "https://www.googleapis.com/compute/v1/projects/{project}/regions/%s".format(**params) % name + return name + + +def async_op_url(module, extra_data=None): + if extra_data is None: + extra_data = {} + url = "https://www.googleapis.com/compute/v1/projects/{project}/regions/{region}/operations/{op_id}" + combined = extra_data.copy() + combined.update(module.params) + return url.format(**combined) + + +def wait_for_operation(module, response): + op_result = return_if_object(module, response, 'compute#operation') + if op_result is None: + return {} + status = navigate_hash(op_result, ['status']) + wait_done = wait_for_completion(status, op_result, module) + return fetch_resource(module, navigate_hash(wait_done, ['targetLink']), 'compute#interconnectAttachment') + + +def wait_for_completion(status, op_result, module): + op_id = navigate_hash(op_result, ['name']) + op_uri = async_op_url(module, {'op_id': op_id}) + while status != 'DONE': + raise_if_errors(op_result, ['error', 'errors'], 'message') + time.sleep(1.0) + if status not in ['PENDING', 'RUNNING', 'DONE']: + module.fail_json(msg="Invalid result %s" % status) + op_result = fetch_resource(module, op_uri, 'compute#operation') + status = navigate_hash(op_result, ['status']) + return op_result + + +def raise_if_errors(response, err_path, module): + errors = navigate_hash(response, err_path) + if errors is not None: + module.fail_json(msg=errors) + + +class InterconnectAttachmentPrivateInterconnectInfo(object): + def __init__(self, request, module): + self.module = module + if request: + self.request = request + else: + self.request = {} + + def to_request(self): + return remove_nones_from_dict({ + u'tag8021q': self.request.get('tag8021q') + }) + + def from_response(self): + return remove_nones_from_dict({ + u'tag8021q': self.request.get(u'tag8021q') + }) + + +if __name__ == '__main__': + main() diff --git a/lib/ansible/modules/cloud/google/gcp_compute_interconnect_attachment_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_interconnect_attachment_facts.py new file mode 100644 index 00000000000000..2472df5d00ed86 --- /dev/null +++ b/lib/ansible/modules/cloud/google/gcp_compute_interconnect_attachment_facts.py @@ -0,0 +1,234 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# +# Copyright (C) 2017 Google +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) +# ---------------------------------------------------------------------------- +# +# *** AUTO GENERATED CODE *** AUTO GENERATED CODE *** +# +# ---------------------------------------------------------------------------- +# +# This file is automatically generated by Magic Modules and manual +# changes will be clobbered when the file is regenerated. +# +# Please read more about how to change this file at +# https://www.github.com/GoogleCloudPlatform/magic-modules +# +# ---------------------------------------------------------------------------- + +from __future__ import absolute_import, division, print_function +__metaclass__ = type + +################################################################################ +# Documentation +################################################################################ + +ANSIBLE_METADATA = {'metadata_version': '1.1', + 'status': ["preview"], + 'supported_by': 'community'} + +DOCUMENTATION = ''' +--- +module: gcp_compute_interconnect_attachment_facts +description: + - Gather facts for GCP InterconnectAttachment +short_description: Gather facts for GCP InterconnectAttachment +version_added: 2.8 +author: Google Inc. (@googlecloudplatform) +requirements: + - python >= 2.6 + - requests >= 2.18.4 + - google-auth >= 1.3.0 +options: + filters: + description: + A list of filter value pairs. Available filters are listed here + U(https://cloud.google.com/sdk/gcloud/reference/topic/filters). + Each additional filter in the list will act be added as an AND condition + (filter1 and filter2) + region: + description: + - Region where the regional interconnect attachment resides. + required: true +extends_documentation_fragment: gcp +''' + +EXAMPLES = ''' +- name: a interconnect attachment facts + gcp_compute_interconnect_attachment_facts: + region: us-central1 + filters: + - name = test_object + project: test_project + auth_kind: serviceaccount + service_account_file: "/tmp/auth.pem" +''' + +RETURN = ''' +items: + description: List of items + returned: always + type: complex + contains: + cloudRouterIpAddress: + description: + - IPv4 address + prefix length to be configured on Cloud Router Interface for this + interconnect attachment. + returned: success + type: str + customerRouterIpAddress: + description: + - IPv4 address + prefix length to be configured on the customer router subinterface + for this interconnect attachment. + returned: success + type: str + interconnect: + description: + - URL of the underlying Interconnect object that this attachment's traffic will traverse + through. + returned: success + type: str + description: + description: + - An optional description of this resource. . + returned: success + type: str + privateInterconnectInfo: + description: + - Information specific to an InterconnectAttachment. This property is populated if + the interconnect that this is attached to is of type DEDICATED. + returned: success + type: complex + contains: + tag8021q: + description: + - 802.1q encapsulation tag to be used for traffic between Google and the customer, + going to and from this network and region. + returned: success + type: int + googleReferenceId: + description: + - Google reference ID, to be used when raising support tickets with Google or otherwise + to debug backend connectivity issues. + returned: success + type: str + router: + description: + - URL of the cloud router to be used for dynamic routing. This router must be in the + same region as this InterconnectAttachment. The InterconnectAttachment will automatically + connect the Interconnect to the network & region within which the Cloud Router is + configured. + returned: success + type: dict + creationTimestamp: + description: + - Creation timestamp in RFC3339 text format. + returned: success + type: str + id: + description: + - The unique identifier for the resource. This identifier is defined by the server. + returned: success + type: str + name: + description: + - Name of the resource. Provided by the client when the resource is created. The name + must be 1-63 characters long, and comply with RFC1035. Specifically, the name must + be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` + which means the first character must be a lowercase letter, and all following characters + must be a dash, lowercase letter, or digit, except the last character, which cannot + be a dash. + returned: success + type: str + region: + description: + - Region where the regional interconnect attachment resides. + returned: success + type: str +''' + +################################################################################ +# Imports +################################################################################ +from ansible.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest +import json + +################################################################################ +# Main +################################################################################ + + +def main(): + module = GcpModule( + argument_spec=dict( + filters=dict(type='list', elements='str'), + region=dict(required=True, type='str') + ) + ) + + if 'scopes' not in module.params: + module.params['scopes'] = ['https://www.googleapis.com/auth/compute'] + + items = fetch_list(module, collection(module), query_options(module.params['filters'])) + if items.get('items'): + items = items.get('items') + else: + items = [] + return_value = { + 'items': items + } + module.exit_json(**return_value) + + +def collection(module): + return "https://www.googleapis.com/compute/v1/projects/{project}/regions/{region}/interconnectAttachments".format(**module.params) + + +def fetch_list(module, link, query): + auth = GcpSession(module, 'compute') + response = auth.get(link, params={'filter': query}) + return return_if_object(module, response) + + +def query_options(filters): + if not filters: + return '' + + if len(filters) == 1: + return filters[0] + else: + queries = [] + for f in filters: + # For multiple queries, all queries should have () + if f[0] != '(' and f[-1] != ')': + queries.append("(%s)" % ''.join(f)) + else: + queries.append(f) + + return ' '.join(queries) + + +def return_if_object(module, response): + # If not found, return nothing. + if response.status_code == 404: + return None + + # If no content, return nothing. + if response.status_code == 204: + return None + + try: + module.raise_for_status(response) + result = response.json() + except getattr(json.decoder, 'JSONDecodeError', ValueError) as inst: + module.fail_json(msg="Invalid JSON response with error: %s" % inst) + + if navigate_hash(result, ['error', 'errors']): + module.fail_json(msg=navigate_hash(result, ['error', 'errors'])) + + return result + + +if __name__ == "__main__": + main() diff --git a/test/integration/targets/gcp_compute_interconnect_attachment/aliases b/test/integration/targets/gcp_compute_interconnect_attachment/aliases new file mode 100644 index 00000000000000..9812f019ca4bae --- /dev/null +++ b/test/integration/targets/gcp_compute_interconnect_attachment/aliases @@ -0,0 +1,2 @@ +cloud/gcp +unsupported diff --git a/test/integration/targets/gcp_compute_interconnect_attachment/defaults/main.yml b/test/integration/targets/gcp_compute_interconnect_attachment/defaults/main.yml new file mode 100644 index 00000000000000..aa87a2a8e0e0e0 --- /dev/null +++ b/test/integration/targets/gcp_compute_interconnect_attachment/defaults/main.yml @@ -0,0 +1,3 @@ +--- +# defaults file +resource_name: '{{resource_prefix}}' diff --git a/test/integration/targets/gcp_compute_interconnect_attachment/meta/main.yml b/test/integration/targets/gcp_compute_interconnect_attachment/meta/main.yml new file mode 100644 index 00000000000000..e69de29bb2d1d6 diff --git a/test/integration/targets/gcp_compute_interconnect_attachment/tasks/main.yml b/test/integration/targets/gcp_compute_interconnect_attachment/tasks/main.yml new file mode 100644 index 00000000000000..2ed187af54598e --- /dev/null +++ b/test/integration/targets/gcp_compute_interconnect_attachment/tasks/main.yml @@ -0,0 +1,116 @@ +--- +# ---------------------------------------------------------------------------- +# +# *** AUTO GENERATED CODE *** AUTO GENERATED CODE *** +# +# ---------------------------------------------------------------------------- +# +# This file is automatically generated by Magic Modules and manual +# changes will be clobbered when the file is regenerated. +# +# Please read more about how to change this file at +# https://www.github.com/GoogleCloudPlatform/magic-modules +# +# ---------------------------------------------------------------------------- +# Pre-test setup +- name: delete a interconnect attachment + gcp_compute_interconnect_attachment: + name: "{{ resource_name }}" + region: us-central1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + interconnect: https://googleapis.com/compute/v1/projects/{{ gcp_project }}/global/interconnects/... + router: https://googleapis.com/compute/v1/projects/{{ gcp_project }}/regions/us-central1/routers/... + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: disk +#---------------------------------------------------------- +- name: create a interconnect attachment + gcp_compute_interconnect_attachment: + name: "{{ resource_name }}" + region: us-central1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + interconnect: https://googleapis.com/compute/v1/projects/{{ gcp_project }}/global/interconnects/... + router: https://googleapis.com/compute/v1/projects/{{ gcp_project }}/regions/us-central1/routers/... + service_account_file: "{{ gcp_cred_file }}" + state: present + register: disk + register: result +- name: assert changed is true + assert: + that: + - result.changed == true + - "result.kind == 'compute#interconnectAttachment'" +- name: verify that interconnect_attachment was created + shell: | + gcloud compute interconnects attachments describe "{{ resource_name }}" --project="{{ gcp_project}}" --region="{{ gcp_region}}" + register: results +- name: verify that command succeeded + assert: + that: + - results.rc == 0 +# ---------------------------------------------------------------------------- +- name: create a interconnect attachment that already exists + gcp_compute_interconnect_attachment: + name: "{{ resource_name }}" + region: us-central1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + interconnect: https://googleapis.com/compute/v1/projects/{{ gcp_project }}/global/interconnects/... + router: https://googleapis.com/compute/v1/projects/{{ gcp_project }}/regions/us-central1/routers/... + service_account_file: "{{ gcp_cred_file }}" + state: present + register: disk + register: result +- name: assert changed is false + assert: + that: + - result.changed == false + - "result.kind == 'compute#interconnectAttachment'" +#---------------------------------------------------------- +- name: delete a interconnect attachment + gcp_compute_interconnect_attachment: + name: "{{ resource_name }}" + region: us-central1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + interconnect: https://googleapis.com/compute/v1/projects/{{ gcp_project }}/global/interconnects/... + router: https://googleapis.com/compute/v1/projects/{{ gcp_project }}/regions/us-central1/routers/... + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: disk + register: result +- name: assert changed is true + assert: + that: + - result.changed == true + - result.has_key('kind') == False +- name: verify that interconnect_attachment was deleted + shell: | + gcloud compute interconnects attachments describe "{{ resource_name }}" --project="{{ gcp_project}}" --region="{{ gcp_region}}" + register: results + failed_when: results.rc == 0 +- name: verify that command succeeded + assert: + that: + - results.rc == 1 + - "\"'projects/{{ gcp_project }}/global/images/{{ resource_name }}' was not found\" in results.stderr" +# ---------------------------------------------------------------------------- +- name: delete a interconnect attachment that does not exist + gcp_compute_interconnect_attachment: + name: "{{ resource_name }}" + region: us-central1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + interconnect: https://googleapis.com/compute/v1/projects/{{ gcp_project }}/global/interconnects/... + router: https://googleapis.com/compute/v1/projects/{{ gcp_project }}/regions/us-central1/routers/... + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: disk + register: result +- name: assert changed is false + assert: + that: + - result.changed == false + - result.has_key('kind') == False From d6c8fca8f3db791da322a5b4985bbbf9537b6766 Mon Sep 17 00:00:00 2001 From: Riley Karson Date: Fri, 12 Oct 2018 23:02:26 +0000 Subject: [PATCH 048/144] Minor docs changes for UrlMap --- .../modules/cloud/google/gcp_compute_url_map.py | 12 ++++++------ .../cloud/google/gcp_compute_url_map_facts.py | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_url_map.py b/lib/ansible/modules/cloud/google/gcp_compute_url_map.py index 60753392d9d438..6a3d8e5ae6b930 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_url_map.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_url_map.py @@ -68,7 +68,7 @@ suboptions: description: description: - - An optional description of this resource. Provide this property when you create + - An optional description of this HostRule. Provide this property when you create the resource. required: false hosts: @@ -124,7 +124,7 @@ - 'The list of path patterns to match. Each must start with / and the only place a * is allowed is at the end following a /. The string fed to the path matcher does not include any text after the first ? or #, and those chars are not allowed here.' - required: false + required: true service: description: - A reference to the BackendService resource if this rule is matched. @@ -136,7 +136,7 @@ required: true tests: description: - - The list of expected URL mappings. Request to update this UrlMap will succeed only + - The list of expected URL mappings. Requests to update this UrlMap will succeed only if all of the test cases pass. required: false suboptions: @@ -237,7 +237,7 @@ contains: description: description: - - An optional description of this resource. Provide this property when you create + - An optional description of this HostRule. Provide this property when you create the resource. returned: success type: str @@ -317,7 +317,7 @@ type: dict tests: description: - - The list of expected URL mappings. Request to update this UrlMap will succeed only + - The list of expected URL mappings. Requests to update this UrlMap will succeed only if all of the test cases pass. returned: success type: complex @@ -376,7 +376,7 @@ def main(): description=dict(type='str'), name=dict(required=True, type='str'), path_rules=dict(type='list', elements='dict', options=dict( - paths=dict(type='list', elements='str'), + paths=dict(required=True, type='list', elements='str'), service=dict(required=True, type='dict') )) )), diff --git a/lib/ansible/modules/cloud/google/gcp_compute_url_map_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_url_map_facts.py index 55d114e58cc8e9..b79a0502c1a1bc 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_url_map_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_url_map_facts.py @@ -90,7 +90,7 @@ contains: description: description: - - An optional description of this resource. Provide this property when you create + - An optional description of this HostRule. Provide this property when you create the resource. returned: success type: str @@ -170,7 +170,7 @@ type: dict tests: description: - - The list of expected URL mappings. Request to update this UrlMap will succeed only + - The list of expected URL mappings. Requests to update this UrlMap will succeed only if all of the test cases pass. returned: success type: complex From f83c565380f420564e797d8028fe493223b80f39 Mon Sep 17 00:00:00 2001 From: The Magician Date: Tue, 16 Oct 2018 14:26:12 -0700 Subject: [PATCH 049/144] The Last of the Facts Modules /cc @rambleraptor --- .../cloud/google/gcp_container_cluster.py | 2 +- .../google/gcp_container_cluster_facts.py | 419 ++++++++++++++++++ .../cloud/google/gcp_container_node_pool.py | 2 +- .../google/gcp_container_node_pool_facts.py | 328 ++++++++++++++ .../google/gcp_spanner_database_facts.py | 160 +++++++ .../google/gcp_spanner_instance_facts.py | 170 +++++++ .../cloud/google/gcp_sql_database_facts.py | 162 +++++++ .../cloud/google/gcp_sql_instance_facts.py | 382 ++++++++++++++++ .../cloud/google/gcp_sql_user_facts.py | 163 +++++++ .../gcp_container_cluster/tasks/main.yml | 34 +- .../gcp_container_node_pool/tasks/main.yml | 16 +- .../gcp_pubsub_subscription/tasks/main.yml | 2 +- .../targets/gcp_pubsub_topic/tasks/main.yml | 2 +- .../gcp_spanner_database/tasks/main.yml | 24 +- .../gcp_spanner_instance/tasks/main.yml | 22 +- .../targets/gcp_sql_database/tasks/main.yml | 24 +- .../targets/gcp_sql_instance/tasks/main.yml | 22 +- .../targets/gcp_sql_user/tasks/main.yml | 6 +- 18 files changed, 1876 insertions(+), 64 deletions(-) create mode 100644 lib/ansible/modules/cloud/google/gcp_container_cluster_facts.py create mode 100644 lib/ansible/modules/cloud/google/gcp_container_node_pool_facts.py create mode 100644 lib/ansible/modules/cloud/google/gcp_spanner_database_facts.py create mode 100644 lib/ansible/modules/cloud/google/gcp_spanner_instance_facts.py create mode 100644 lib/ansible/modules/cloud/google/gcp_sql_database_facts.py create mode 100644 lib/ansible/modules/cloud/google/gcp_sql_instance_facts.py create mode 100644 lib/ansible/modules/cloud/google/gcp_sql_user_facts.py diff --git a/lib/ansible/modules/cloud/google/gcp_container_cluster.py b/lib/ansible/modules/cloud/google/gcp_container_cluster.py index d0677315eb2ced..b0e642566b0cab 100644 --- a/lib/ansible/modules/cloud/google/gcp_container_cluster.py +++ b/lib/ansible/modules/cloud/google/gcp_container_cluster.py @@ -258,7 +258,7 @@ EXAMPLES = ''' - name: create a cluster gcp_container_cluster: - name: "test_object" + name: my-cluster initial_node_count: 2 master_auth: username: cluster_admin diff --git a/lib/ansible/modules/cloud/google/gcp_container_cluster_facts.py b/lib/ansible/modules/cloud/google/gcp_container_cluster_facts.py new file mode 100644 index 00000000000000..9fe28fab5cc968 --- /dev/null +++ b/lib/ansible/modules/cloud/google/gcp_container_cluster_facts.py @@ -0,0 +1,419 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# +# Copyright (C) 2017 Google +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) +# ---------------------------------------------------------------------------- +# +# *** AUTO GENERATED CODE *** AUTO GENERATED CODE *** +# +# ---------------------------------------------------------------------------- +# +# This file is automatically generated by Magic Modules and manual +# changes will be clobbered when the file is regenerated. +# +# Please read more about how to change this file at +# https://www.github.com/GoogleCloudPlatform/magic-modules +# +# ---------------------------------------------------------------------------- + +from __future__ import absolute_import, division, print_function +__metaclass__ = type + +################################################################################ +# Documentation +################################################################################ + +ANSIBLE_METADATA = {'metadata_version': '1.1', + 'status': ["preview"], + 'supported_by': 'community'} + +DOCUMENTATION = ''' +--- +module: gcp_container_cluster_facts +description: + - Gather facts for GCP Cluster +short_description: Gather facts for GCP Cluster +version_added: 2.8 +author: Google Inc. (@googlecloudplatform) +requirements: + - python >= 2.6 + - requests >= 2.18.4 + - google-auth >= 1.3.0 +options: + zone: + description: + - The zone where the cluster is deployed. + required: true +extends_documentation_fragment: gcp +''' + +EXAMPLES = ''' +- name: a cluster facts + gcp_container_cluster_facts: + zone: us-central1-a + project: test_project + auth_kind: serviceaccount + service_account_file: "/tmp/auth.pem" +''' + +RETURN = ''' +items: + description: List of items + returned: always + type: complex + contains: + name: + description: + - The name of this cluster. The name must be unique within this project and zone, + and can be up to 40 characters. Must be Lowercase letters, numbers, and hyphens + only. Must start with a letter. Must end with a number or a letter. + returned: success + type: str + description: + description: + - An optional description of this cluster. + returned: success + type: str + initialNodeCount: + description: + - The number of nodes to create in this cluster. You must ensure that your Compute + Engine resource quota is sufficient for this number of instances. You must also + have available firewall and routes quota. For requests, this field should only be + used in lieu of a "nodePool" object, since this configuration (along with the "nodeConfig") + will be used to create a "NodePool" object with an auto-generated name. Do not use + this and a nodePool at the same time. + returned: success + type: int + nodeConfig: + description: + - Parameters used in creating the cluster's nodes. + - For requests, this field should only be used in lieu of a "nodePool" object, since + this configuration (along with the "initialNodeCount") will be used to create a + "NodePool" object with an auto-generated name. Do not use this and a nodePool at + the same time. For responses, this field will be populated with the node configuration + of the first node pool. If unspecified, the defaults are used. + returned: success + type: complex + contains: + machineType: + description: + - The name of a Google Compute Engine machine type (e.g. + - n1-standard-1). If unspecified, the default machine type is n1-standard-1. + returned: success + type: str + diskSizeGb: + description: + - Size of the disk attached to each node, specified in GB. The smallest allowed disk + size is 10GB. If unspecified, the default disk size is 100GB. + returned: success + type: int + oauthScopes: + description: + - The set of Google API scopes to be made available on all of the node VMs under the + "default" service account. + - 'The following scopes are recommended, but not required, and by default are not + included: U(https://www.googleapis.com/auth/compute) is required for mounting persistent + storage on your nodes.' + - U(https://www.googleapis.com/auth/devstorage.read_only) is required for communicating + with gcr.io (the Google Container Registry). + - If unspecified, no scopes are added, unless Cloud Logging or Cloud Monitoring are + enabled, in which case their required scopes will be added. + returned: success + type: list + serviceAccount: + description: + - The Google Cloud Platform Service Account to be used by the node VMs. If no Service + Account is specified, the "default" service account is used. + returned: success + type: str + metadata: + description: + - The metadata key/value pairs assigned to instances in the cluster. + - 'Keys must conform to the regexp [a-zA-Z0-9-_]+ and be less than 128 bytes in length. + These are reflected as part of a URL in the metadata server. Additionally, to avoid + ambiguity, keys must not conflict with any other metadata keys for the project or + be one of the four reserved keys: "instance-template", "kube-env", "startup-script", + and "user-data" Values are free-form strings, and only have meaning as interpreted + by the image running in the instance. The only restriction placed on them is that + each value''s size must be less than or equal to 32 KB.' + - The total size of all keys and values must be less than 512 KB. + - 'An object containing a list of "key": value pairs.' + - 'Example: { "name": "wrench", "mass": "1.3kg", "count": "3" }.' + returned: success + type: dict + imageType: + description: + - The image type to use for this node. Note that for a given image type, the latest + version of it will be used. + returned: success + type: str + labels: + description: + - 'The map of Kubernetes labels (key/value pairs) to be applied to each node. + These will added in addition to any default label(s) that Kubernetes may apply + to the node. In case of conflict in label keys, the applied set may differ + depending on the Kubernetes version -- it''s best to assume the behavior is + undefined and conflicts should be avoided. For more information, including + usage and the valid values, see: + U(http://kubernetes.io/v1.1/docs/user-guide/labels.html) An object containing + a list of "key": value pairs.' + - 'Example: { "name": "wrench", "mass": "1.3kg", "count": "3" }.' + returned: success + type: dict + localSsdCount: + description: + - The number of local SSD disks to be attached to the node. + - 'The limit for this value is dependant upon the maximum number of disks available + on a machine per zone. See: U(https://cloud.google.com/compute/docs/disks/local-ssd#local_ssd_limits) for + more information.' + returned: success + type: int + tags: + description: + - The list of instance tags applied to all nodes. Tags are used to identify valid + sources or targets for network firewalls and are specified by the client during + cluster or node pool creation. Each tag within the list must comply with RFC1035. + returned: success + type: list + preemptible: + description: + - 'Whether the nodes are created as preemptible VM instances. See: U(https://cloud.google.com/compute/docs/instances/preemptible) + for more inforamtion about preemptible VM instances.' + returned: success + type: bool + masterAuth: + description: + - The authentication information for accessing the master endpoint. + returned: success + type: complex + contains: + username: + description: + - The username to use for HTTP basic authentication to the master endpoint. + returned: success + type: str + password: + description: + - The password to use for HTTP basic authentication to the master endpoint. Because + the master endpoint is open to the Internet, you should create a strong password. + returned: success + type: str + clusterCaCertificate: + description: + - Base64-encoded public certificate that is the root of trust for the cluster. + returned: success + type: str + clientCertificate: + description: + - Base64-encoded public certificate used by clients to authenticate to the cluster + endpoint. + returned: success + type: str + clientKey: + description: + - Base64-encoded private key used by clients to authenticate to the cluster endpoint. + returned: success + type: str + loggingService: + description: + - 'The logging service the cluster should use to write logs. Currently available options: logging.googleapis.com + - the Google Cloud Logging service.' + - none - no logs will be exported from the cluster. + - if left as an empty string,logging.googleapis.com will be used. + returned: success + type: str + monitoringService: + description: + - The monitoring service the cluster should use to write metrics. + - 'Currently available options: monitoring.googleapis.com - the Google Cloud Monitoring + service.' + - none - no metrics will be exported from the cluster. + - if left as an empty string, monitoring.googleapis.com will be used. + returned: success + type: str + network: + description: + - The name of the Google Compute Engine network to which the cluster is connected. + If left unspecified, the default network will be used. + - To ensure it exists and it is operations, configure the network using 'gcompute_network' + resource. + returned: success + type: str + clusterIpv4Cidr: + description: + - The IP address range of the container pods in this cluster, in CIDR notation (e.g. + 10.96.0.0/14). Leave blank to have one automatically chosen or specify a /14 block + in 10.0.0.0/8. + returned: success + type: str + addonsConfig: + description: + - Configurations for the various addons available to run in the cluster. + returned: success + type: complex + contains: + httpLoadBalancing: + description: + - Configuration for the HTTP (L7) load balancing controller addon, which makes it + easy to set up HTTP load balancers for services in a cluster. + returned: success + type: complex + contains: + disabled: + description: + - Whether the HTTP Load Balancing controller is enabled in the cluster. When enabled, + it runs a small pod in the cluster that manages the load balancers. + returned: success + type: bool + horizontalPodAutoscaling: + description: + - Configuration for the horizontal pod autoscaling feature, which increases or decreases + the number of replica pods a replication controller has based on the resource usage + of the existing pods. + returned: success + type: complex + contains: + disabled: + description: + - Whether the Horizontal Pod Autoscaling feature is enabled in the cluster. When enabled, + it ensures that a Heapster pod is running in the cluster, which is also used by + the Cloud Monitoring service. + returned: success + type: bool + subnetwork: + description: + - The name of the Google Compute Engine subnetwork to which the cluster is connected. + returned: success + type: str + location: + description: + - The list of Google Compute Engine locations in which the cluster's nodes should + be located. + returned: success + type: list + endpoint: + description: + - The IP address of this cluster's master endpoint. + - The endpoint can be accessed from the internet at https://username:password@endpoint/ See + the masterAuth property of this resource for username and password information. + returned: success + type: str + initialClusterVersion: + description: + - The software version of the master endpoint and kubelets used in the cluster when + it was first created. The version can be upgraded over time. + returned: success + type: str + currentMasterVersion: + description: + - The current software version of the master endpoint. + returned: success + type: str + currentNodeVersion: + description: + - The current version of the node software components. If they are currently at multiple + versions because they're in the process of being upgraded, this reflects the minimum + version of all nodes. + returned: success + type: str + createTime: + description: + - The time the cluster was created, in RFC3339 text format. + returned: success + type: str + nodeIpv4CidrSize: + description: + - The size of the address space on each node for hosting containers. + - This is provisioned from within the container_ipv4_cidr range. + returned: success + type: int + servicesIpv4Cidr: + description: + - The IP address range of the Kubernetes services in this cluster, in CIDR notation + (e.g. 1.2.3.4/29). Service addresses are typically put in the last /16 from the + container CIDR. + returned: success + type: str + currentNodeCount: + description: + - The number of nodes currently in the cluster. + returned: success + type: int + expireTime: + description: + - The time the cluster will be automatically deleted in RFC3339 text format. + returned: success + type: str + zone: + description: + - The zone where the cluster is deployed. + returned: success + type: str +''' + +################################################################################ +# Imports +################################################################################ +from ansible.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest +import json + +################################################################################ +# Main +################################################################################ + + +def main(): + module = GcpModule( + argument_spec=dict( + zone=dict(required=True, type='str') + ) + ) + + if 'scopes' not in module.params: + module.params['scopes'] = ['https://www.googleapis.com/auth/cloud-platform'] + + items = fetch_list(module, collection(module)) + if items.get('clusters'): + items = items.get('clusters') + else: + items = [] + return_value = { + 'items': items + } + module.exit_json(**return_value) + + +def collection(module): + return "https://container.googleapis.com/v1/projects/{project}/zones/{zone}/clusters".format(**module.params) + + +def fetch_list(module, link): + auth = GcpSession(module, 'container') + response = auth.get(link) + return return_if_object(module, response) + + +def return_if_object(module, response): + # If not found, return nothing. + if response.status_code == 404: + return None + + # If no content, return nothing. + if response.status_code == 204: + return None + + try: + module.raise_for_status(response) + result = response.json() + except getattr(json.decoder, 'JSONDecodeError', ValueError) as inst: + module.fail_json(msg="Invalid JSON response with error: %s" % inst) + + if navigate_hash(result, ['error', 'errors']): + module.fail_json(msg=navigate_hash(result, ['error', 'errors'])) + + return result + + +if __name__ == "__main__": + main() diff --git a/lib/ansible/modules/cloud/google/gcp_container_node_pool.py b/lib/ansible/modules/cloud/google/gcp_container_node_pool.py index 68b267a1330dd4..5ad1a86d93b662 100644 --- a/lib/ansible/modules/cloud/google/gcp_container_node_pool.py +++ b/lib/ansible/modules/cloud/google/gcp_container_node_pool.py @@ -225,7 +225,7 @@ - name: create a node pool gcp_container_node_pool: - name: "test_object" + name: my-pool initial_node_count: 4 cluster: "{{ cluster }}" zone: us-central1-a diff --git a/lib/ansible/modules/cloud/google/gcp_container_node_pool_facts.py b/lib/ansible/modules/cloud/google/gcp_container_node_pool_facts.py new file mode 100644 index 00000000000000..98b8c30599e6d3 --- /dev/null +++ b/lib/ansible/modules/cloud/google/gcp_container_node_pool_facts.py @@ -0,0 +1,328 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# +# Copyright (C) 2017 Google +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) +# ---------------------------------------------------------------------------- +# +# *** AUTO GENERATED CODE *** AUTO GENERATED CODE *** +# +# ---------------------------------------------------------------------------- +# +# This file is automatically generated by Magic Modules and manual +# changes will be clobbered when the file is regenerated. +# +# Please read more about how to change this file at +# https://www.github.com/GoogleCloudPlatform/magic-modules +# +# ---------------------------------------------------------------------------- + +from __future__ import absolute_import, division, print_function +__metaclass__ = type + +################################################################################ +# Documentation +################################################################################ + +ANSIBLE_METADATA = {'metadata_version': '1.1', + 'status': ["preview"], + 'supported_by': 'community'} + +DOCUMENTATION = ''' +--- +module: gcp_container_node_pool_facts +description: + - Gather facts for GCP NodePool +short_description: Gather facts for GCP NodePool +version_added: 2.8 +author: Google Inc. (@googlecloudplatform) +requirements: + - python >= 2.6 + - requests >= 2.18.4 + - google-auth >= 1.3.0 +options: + zone: + description: + - The zone where the node pool is deployed. + required: true + cluster: + description: + - The cluster this node pool belongs to. + - 'This field represents a link to a Cluster resource in GCP. It can be specified + in two ways. You can add `register: name-of-resource` to a gcp_container_cluster + task and then set this cluster field to "{{ name-of-resource }}" Alternatively, + you can set this cluster to a dictionary with the name key where the value is the + name of your Cluster.' + required: true +extends_documentation_fragment: gcp +''' + +EXAMPLES = ''' +- name: a node pool facts + gcp_container_node_pool_facts: + cluster: "{{ cluster }}" + zone: us-central1-a + project: test_project + auth_kind: serviceaccount + service_account_file: "/tmp/auth.pem" +''' + +RETURN = ''' +items: + description: List of items + returned: always + type: complex + contains: + name: + description: + - The name of the node pool. + returned: success + type: str + config: + description: + - The node configuration of the pool. + returned: success + type: complex + contains: + machineType: + description: + - The name of a Google Compute Engine machine type (e.g. + - n1-standard-1). If unspecified, the default machine type is n1-standard-1. + returned: success + type: str + diskSizeGb: + description: + - Size of the disk attached to each node, specified in GB. The smallest allowed disk + size is 10GB. If unspecified, the default disk size is 100GB. + returned: success + type: int + oauthScopes: + description: + - The set of Google API scopes to be made available on all of the node VMs under the + "default" service account. + - 'The following scopes are recommended, but not required, and by default are not + included: U(https://www.googleapis.com/auth/compute) is required for mounting persistent + storage on your nodes.' + - U(https://www.googleapis.com/auth/devstorage.read_only) is required for communicating + with gcr.io (the Google Container Registry). + - If unspecified, no scopes are added, unless Cloud Logging or Cloud Monitoring are + enabled, in which case their required scopes will be added. + returned: success + type: list + serviceAccount: + description: + - The Google Cloud Platform Service Account to be used by the node VMs. If no Service + Account is specified, the "default" service account is used. + returned: success + type: str + metadata: + description: + - The metadata key/value pairs assigned to instances in the cluster. + - 'Keys must conform to the regexp [a-zA-Z0-9-_]+ and be less than 128 bytes in length. + These are reflected as part of a URL in the metadata server. Additionally, to avoid + ambiguity, keys must not conflict with any other metadata keys for the project or + be one of the four reserved keys: "instance-template", "kube-env", "startup-script", + and "user-data" Values are free-form strings, and only have meaning as interpreted + by the image running in the instance. The only restriction placed on them is that + each value''s size must be less than or equal to 32 KB.' + - The total size of all keys and values must be less than 512 KB. + - 'An object containing a list of "key": value pairs.' + - 'Example: { "name": "wrench", "mass": "1.3kg", "count": "3" }.' + returned: success + type: dict + imageType: + description: + - The image type to use for this node. Note that for a given image type, the latest + version of it will be used. + returned: success + type: str + labels: + description: + - 'The map of Kubernetes labels (key/value pairs) to be applied to each node. + These will added in addition to any default label(s) that Kubernetes may apply + to the node. In case of conflict in label keys, the applied set may differ + depending on the Kubernetes version -- it''s best to assume the behavior is + undefined and conflicts should be avoided. For more information, including + usage and the valid values, see: + U(http://kubernetes.io/v1.1/docs/user-guide/labels.html) An object containing + a list of "key": value pairs.' + - 'Example: { "name": "wrench", "mass": "1.3kg", "count": "3" }.' + returned: success + type: dict + localSsdCount: + description: + - The number of local SSD disks to be attached to the node. + - 'The limit for this value is dependant upon the maximum number of disks available + on a machine per zone. See: U(https://cloud.google.com/compute/docs/disks/local-ssd#local_ssd_limits) for + more information.' + returned: success + type: int + tags: + description: + - The list of instance tags applied to all nodes. Tags are used to identify valid + sources or targets for network firewalls and are specified by the client during + cluster or node pool creation. Each tag within the list must comply with RFC1035. + returned: success + type: list + preemptible: + description: + - 'Whether the nodes are created as preemptible VM instances. See: U(https://cloud.google.com/compute/docs/instances/preemptible) + for more inforamtion about preemptible VM instances.' + returned: success + type: bool + initialNodeCount: + description: + - The initial node count for the pool. You must ensure that your Compute Engine resource + quota is sufficient for this number of instances. You must also have available firewall + and routes quota. + returned: success + type: int + version: + description: + - The version of the Kubernetes of this node. + returned: success + type: str + autoscaling: + description: + - Autoscaler configuration for this NodePool. Autoscaler is enabled only if a valid + configuration is present. + returned: success + type: complex + contains: + enabled: + description: + - Is autoscaling enabled for this node pool. + returned: success + type: bool + minNodeCount: + description: + - Minimum number of nodes in the NodePool. Must be >= 1 and <= maxNodeCount. + returned: success + type: int + maxNodeCount: + description: + - Maximum number of nodes in the NodePool. Must be >= minNodeCount. + - There has to enough quota to scale up the cluster. + returned: success + type: int + management: + description: + - Management configuration for this NodePool. + returned: success + type: complex + contains: + autoUpgrade: + description: + - A flag that specifies whether node auto-upgrade is enabled for the node pool. If + enabled, node auto-upgrade helps keep the nodes in your node pool up to date with + the latest release version of Kubernetes. + returned: success + type: bool + autoRepair: + description: + - A flag that specifies whether the node auto-repair is enabled for the node pool. + If enabled, the nodes in this node pool will be monitored and, if they fail health + checks too many times, an automatic repair action will be triggered. + returned: success + type: bool + upgradeOptions: + description: + - Specifies the Auto Upgrade knobs for the node pool. + returned: success + type: complex + contains: + autoUpgradeStartTime: + description: + - This field is set when upgrades are about to commence with the approximate start + time for the upgrades, in RFC3339 text format. + returned: success + type: str + description: + description: + - This field is set when upgrades are about to commence with the description of the + upgrade. + returned: success + type: str + cluster: + description: + - The cluster this node pool belongs to. + returned: success + type: dict + zone: + description: + - The zone where the node pool is deployed. + returned: success + type: str +''' + +################################################################################ +# Imports +################################################################################ +from ansible.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest, replace_resource_dict +import json + +################################################################################ +# Main +################################################################################ + + +def main(): + module = GcpModule( + argument_spec=dict( + zone=dict(required=True, type='str'), + cluster=dict(required=True, type='dict') + ) + ) + + if 'scopes' not in module.params: + module.params['scopes'] = ['https://www.googleapis.com/auth/cloud-platform'] + + items = fetch_list(module, collection(module)) + if items.get('nodePools'): + items = items.get('nodePools') + else: + items = [] + return_value = { + 'items': items + } + module.exit_json(**return_value) + + +def collection(module): + res = { + 'project': module.params['project'], + 'zone': module.params['zone'], + 'cluster': replace_resource_dict(module.params['cluster'], 'name') + } + return "https://container.googleapis.com/v1/projects/{project}/zones/{zone}/clusters/{cluster}/nodePools".format(**res) + + +def fetch_list(module, link): + auth = GcpSession(module, 'container') + response = auth.get(link) + return return_if_object(module, response) + + +def return_if_object(module, response): + # If not found, return nothing. + if response.status_code == 404: + return None + + # If no content, return nothing. + if response.status_code == 204: + return None + + try: + module.raise_for_status(response) + result = response.json() + except getattr(json.decoder, 'JSONDecodeError', ValueError) as inst: + module.fail_json(msg="Invalid JSON response with error: %s" % inst) + + if navigate_hash(result, ['error', 'errors']): + module.fail_json(msg=navigate_hash(result, ['error', 'errors'])) + + return result + + +if __name__ == "__main__": + main() diff --git a/lib/ansible/modules/cloud/google/gcp_spanner_database_facts.py b/lib/ansible/modules/cloud/google/gcp_spanner_database_facts.py new file mode 100644 index 00000000000000..bece9c797dc9cb --- /dev/null +++ b/lib/ansible/modules/cloud/google/gcp_spanner_database_facts.py @@ -0,0 +1,160 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# +# Copyright (C) 2017 Google +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) +# ---------------------------------------------------------------------------- +# +# *** AUTO GENERATED CODE *** AUTO GENERATED CODE *** +# +# ---------------------------------------------------------------------------- +# +# This file is automatically generated by Magic Modules and manual +# changes will be clobbered when the file is regenerated. +# +# Please read more about how to change this file at +# https://www.github.com/GoogleCloudPlatform/magic-modules +# +# ---------------------------------------------------------------------------- + +from __future__ import absolute_import, division, print_function +__metaclass__ = type + +################################################################################ +# Documentation +################################################################################ + +ANSIBLE_METADATA = {'metadata_version': '1.1', + 'status': ["preview"], + 'supported_by': 'community'} + +DOCUMENTATION = ''' +--- +module: gcp_spanner_database_facts +description: + - Gather facts for GCP Database +short_description: Gather facts for GCP Database +version_added: 2.8 +author: Google Inc. (@googlecloudplatform) +requirements: + - python >= 2.6 + - requests >= 2.18.4 + - google-auth >= 1.3.0 +options: + instance: + description: + - The instance to create the database on. + - 'This field represents a link to a Instance resource in GCP. It can be specified + in two ways. You can add `register: name-of-resource` to a gcp_spanner_instance + task and then set this instance field to "{{ name-of-resource }}" Alternatively, + you can set this instance to a dictionary with the name key where the value is the + name of your Instance.' + required: true +extends_documentation_fragment: gcp +''' + +EXAMPLES = ''' +- name: a database facts + gcp_spanner_database_facts: + instance: "{{ instance }}" + project: test_project + auth_kind: serviceaccount + service_account_file: "/tmp/auth.pem" +''' + +RETURN = ''' +items: + description: List of items + returned: always + type: complex + contains: + name: + description: + - A unique identifier for the database, which cannot be changed after the instance + is created. Values are of the form projects//instances/[a-z][-a-z0-9]*[a-z0-9]. + The final segment of the name must be between 6 and 30 characters in length. + returned: success + type: str + extraStatements: + description: + - 'An optional list of DDL statements to run inside the newly created database. Statements + can create tables, indexes, etc. These statements execute atomically with the creation + of the database: if there is an error in any statement, the database is not created.' + returned: success + type: list + instance: + description: + - The instance to create the database on. + returned: success + type: dict +''' + +################################################################################ +# Imports +################################################################################ +from ansible.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest, replace_resource_dict +import json + +################################################################################ +# Main +################################################################################ + + +def main(): + module = GcpModule( + argument_spec=dict( + instance=dict(required=True, type='dict') + ) + ) + + if 'scopes' not in module.params: + module.params['scopes'] = ['https://www.googleapis.com/auth/spanner.admin'] + + items = fetch_list(module, collection(module)) + if items.get('databases'): + items = items.get('databases') + else: + items = [] + return_value = { + 'items': items + } + module.exit_json(**return_value) + + +def collection(module): + res = { + 'project': module.params['project'], + 'instance': replace_resource_dict(module.params['instance'], 'name') + } + return "https://spanner.googleapis.com/v1/projects/{project}/instances/{instance}/databases".format(**res) + + +def fetch_list(module, link): + auth = GcpSession(module, 'spanner') + response = auth.get(link) + return return_if_object(module, response) + + +def return_if_object(module, response): + # If not found, return nothing. + if response.status_code == 404: + return None + + # If no content, return nothing. + if response.status_code == 204: + return None + + try: + module.raise_for_status(response) + result = response.json() + except getattr(json.decoder, 'JSONDecodeError', ValueError) as inst: + module.fail_json(msg="Invalid JSON response with error: %s" % inst) + + if navigate_hash(result, ['error', 'errors']): + module.fail_json(msg=navigate_hash(result, ['error', 'errors'])) + + return result + + +if __name__ == "__main__": + main() diff --git a/lib/ansible/modules/cloud/google/gcp_spanner_instance_facts.py b/lib/ansible/modules/cloud/google/gcp_spanner_instance_facts.py new file mode 100644 index 00000000000000..3e35b50351531b --- /dev/null +++ b/lib/ansible/modules/cloud/google/gcp_spanner_instance_facts.py @@ -0,0 +1,170 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# +# Copyright (C) 2017 Google +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) +# ---------------------------------------------------------------------------- +# +# *** AUTO GENERATED CODE *** AUTO GENERATED CODE *** +# +# ---------------------------------------------------------------------------- +# +# This file is automatically generated by Magic Modules and manual +# changes will be clobbered when the file is regenerated. +# +# Please read more about how to change this file at +# https://www.github.com/GoogleCloudPlatform/magic-modules +# +# ---------------------------------------------------------------------------- + +from __future__ import absolute_import, division, print_function +__metaclass__ = type + +################################################################################ +# Documentation +################################################################################ + +ANSIBLE_METADATA = {'metadata_version': '1.1', + 'status': ["preview"], + 'supported_by': 'community'} + +DOCUMENTATION = ''' +--- +module: gcp_spanner_instance_facts +description: + - Gather facts for GCP Instance +short_description: Gather facts for GCP Instance +version_added: 2.8 +author: Google Inc. (@googlecloudplatform) +requirements: + - python >= 2.6 + - requests >= 2.18.4 + - google-auth >= 1.3.0 +extends_documentation_fragment: gcp +''' + +EXAMPLES = ''' +- name: a instance facts + gcp_spanner_instance_facts: + project: test_project + auth_kind: serviceaccount + service_account_file: "/tmp/auth.pem" +''' + +RETURN = ''' +items: + description: List of items + returned: always + type: complex + contains: + name: + description: + - A unique identifier for the instance, which cannot be changed after the instance + is created. Values are of the form projects//instances/[a-z][-a-z0-9]*[a-z0-9]. + The final segment of the name must be between 6 and 30 characters in length. + returned: success + type: str + config: + description: + - A reference to the instance configuration. + returned: success + type: str + displayName: + description: + - The descriptive name for this instance as it appears in UIs. Must be unique per + project and between 4 and 30 characters in length. + returned: success + type: str + nodeCount: + description: + - The number of nodes allocated to this instance. + returned: success + type: int + labels: + description: + - Cloud Labels are a flexible and lightweight mechanism for organizing cloud resources + into groups that reflect a customer's organizational needs and deployment strategies. + Cloud Labels can be used to filter collections of resources. They can be used to + control how resource metrics are aggregated. And they can be used as arguments to + policy management rules (e.g. route, firewall, load balancing, etc.). + - 'Label keys must be between 1 and 63 characters long and must conform to the following + regular expression: `[a-z]([-a-z0-9]*[a-z0-9])?`.' + - Label values must be between 0 and 63 characters long and must conform to the regular + expression `([a-z]([-a-z0-9]*[a-z0-9])?)?`. + - No more than 64 labels can be associated with a given resource. + - See U(https://goo.gl/xmQnxf) for more information on and examples of labels. + - 'If you plan to use labels in your own code, please note that additional characters + may be allowed in the future. And so you are advised to use an internal label representation, + such as JSON, which doesn''t rely upon specific characters being disallowed. For + example, representing labels as the string: name + "_" + value would prove problematic + if we were to allow "_" in a future release.' + - 'An object containing a list of "key": value pairs.' + - 'Example: { "name": "wrench", "mass": "1.3kg", "count": "3" }.' + returned: success + type: dict +''' + +################################################################################ +# Imports +################################################################################ +from ansible.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest +import json + +################################################################################ +# Main +################################################################################ + + +def main(): + module = GcpModule( + argument_spec=dict( + ) + ) + + if 'scopes' not in module.params: + module.params['scopes'] = ['https://www.googleapis.com/auth/spanner.admin'] + + items = fetch_list(module, collection(module)) + if items.get('instances'): + items = items.get('instances') + else: + items = [] + return_value = { + 'items': items + } + module.exit_json(**return_value) + + +def collection(module): + return "https://spanner.googleapis.com/v1/projects/{project}/instances".format(**module.params) + + +def fetch_list(module, link): + auth = GcpSession(module, 'spanner') + response = auth.get(link) + return return_if_object(module, response) + + +def return_if_object(module, response): + # If not found, return nothing. + if response.status_code == 404: + return None + + # If no content, return nothing. + if response.status_code == 204: + return None + + try: + module.raise_for_status(response) + result = response.json() + except getattr(json.decoder, 'JSONDecodeError', ValueError) as inst: + module.fail_json(msg="Invalid JSON response with error: %s" % inst) + + if navigate_hash(result, ['error', 'errors']): + module.fail_json(msg=navigate_hash(result, ['error', 'errors'])) + + return result + + +if __name__ == "__main__": + main() diff --git a/lib/ansible/modules/cloud/google/gcp_sql_database_facts.py b/lib/ansible/modules/cloud/google/gcp_sql_database_facts.py new file mode 100644 index 00000000000000..a9603065e24448 --- /dev/null +++ b/lib/ansible/modules/cloud/google/gcp_sql_database_facts.py @@ -0,0 +1,162 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# +# Copyright (C) 2017 Google +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) +# ---------------------------------------------------------------------------- +# +# *** AUTO GENERATED CODE *** AUTO GENERATED CODE *** +# +# ---------------------------------------------------------------------------- +# +# This file is automatically generated by Magic Modules and manual +# changes will be clobbered when the file is regenerated. +# +# Please read more about how to change this file at +# https://www.github.com/GoogleCloudPlatform/magic-modules +# +# ---------------------------------------------------------------------------- + +from __future__ import absolute_import, division, print_function +__metaclass__ = type + +################################################################################ +# Documentation +################################################################################ + +ANSIBLE_METADATA = {'metadata_version': '1.1', + 'status': ["preview"], + 'supported_by': 'community'} + +DOCUMENTATION = ''' +--- +module: gcp_sql_database_facts +description: + - Gather facts for GCP Database +short_description: Gather facts for GCP Database +version_added: 2.8 +author: Google Inc. (@googlecloudplatform) +requirements: + - python >= 2.6 + - requests >= 2.18.4 + - google-auth >= 1.3.0 +options: + instance: + description: + - The name of the Cloud SQL instance. This does not include the project ID. + - 'This field represents a link to a Instance resource in GCP. It can be specified + in two ways. You can add `register: name-of-resource` to a gcp_sql_instance task + and then set this instance field to "{{ name-of-resource }}" Alternatively, you + can set this instance to a dictionary with the name key where the value is the name + of your Instance.' + required: true +extends_documentation_fragment: gcp +''' + +EXAMPLES = ''' +- name: a database facts + gcp_sql_database_facts: + instance: "{{ instance }}" + project: test_project + auth_kind: serviceaccount + service_account_file: "/tmp/auth.pem" +''' + +RETURN = ''' +items: + description: List of items + returned: always + type: complex + contains: + charset: + description: + - The MySQL charset value. + returned: success + type: str + collation: + description: + - The MySQL collation value. + returned: success + type: str + name: + description: + - The name of the database in the Cloud SQL instance. + - This does not include the project ID or instance name. + returned: success + type: str + instance: + description: + - The name of the Cloud SQL instance. This does not include the project ID. + returned: success + type: dict +''' + +################################################################################ +# Imports +################################################################################ +from ansible.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest, replace_resource_dict +import json + +################################################################################ +# Main +################################################################################ + + +def main(): + module = GcpModule( + argument_spec=dict( + instance=dict(required=True, type='dict') + ) + ) + + if 'scopes' not in module.params: + module.params['scopes'] = ['https://www.googleapis.com/auth/sqlservice.admin'] + + items = fetch_list(module, collection(module)) + if items.get('items'): + items = items.get('items') + else: + items = [] + return_value = { + 'items': items + } + module.exit_json(**return_value) + + +def collection(module): + res = { + 'project': module.params['project'], + 'instance': replace_resource_dict(module.params['instance'], 'name') + } + return "https://www.googleapis.com/sql/v1beta4/projects/{project}/instances/{instance}/databases".format(**res) + + +def fetch_list(module, link): + auth = GcpSession(module, 'sql') + response = auth.get(link) + return return_if_object(module, response) + + +def return_if_object(module, response): + # If not found, return nothing. + if response.status_code == 404: + return None + + # If no content, return nothing. + if response.status_code == 204: + return None + + try: + module.raise_for_status(response) + result = response.json() + except getattr(json.decoder, 'JSONDecodeError', ValueError) as inst: + module.fail_json(msg="Invalid JSON response with error: %s" % inst) + + if navigate_hash(result, ['error', 'errors']): + module.fail_json(msg=navigate_hash(result, ['error', 'errors'])) + + return result + + +if __name__ == "__main__": + main() diff --git a/lib/ansible/modules/cloud/google/gcp_sql_instance_facts.py b/lib/ansible/modules/cloud/google/gcp_sql_instance_facts.py new file mode 100644 index 00000000000000..1722b4276ad808 --- /dev/null +++ b/lib/ansible/modules/cloud/google/gcp_sql_instance_facts.py @@ -0,0 +1,382 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# +# Copyright (C) 2017 Google +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) +# ---------------------------------------------------------------------------- +# +# *** AUTO GENERATED CODE *** AUTO GENERATED CODE *** +# +# ---------------------------------------------------------------------------- +# +# This file is automatically generated by Magic Modules and manual +# changes will be clobbered when the file is regenerated. +# +# Please read more about how to change this file at +# https://www.github.com/GoogleCloudPlatform/magic-modules +# +# ---------------------------------------------------------------------------- + +from __future__ import absolute_import, division, print_function +__metaclass__ = type + +################################################################################ +# Documentation +################################################################################ + +ANSIBLE_METADATA = {'metadata_version': '1.1', + 'status': ["preview"], + 'supported_by': 'community'} + +DOCUMENTATION = ''' +--- +module: gcp_sql_instance_facts +description: + - Gather facts for GCP Instance +short_description: Gather facts for GCP Instance +version_added: 2.8 +author: Google Inc. (@googlecloudplatform) +requirements: + - python >= 2.6 + - requests >= 2.18.4 + - google-auth >= 1.3.0 +extends_documentation_fragment: gcp +''' + +EXAMPLES = ''' +- name: a instance facts + gcp_sql_instance_facts: + project: test_project + auth_kind: serviceaccount + service_account_file: "/tmp/auth.pem" +''' + +RETURN = ''' +items: + description: List of items + returned: always + type: complex + contains: + backendType: + description: + - "* FIRST_GEN: First Generation instance. MySQL only." + - "* SECOND_GEN: Second Generation instance or PostgreSQL instance." + - "* EXTERNAL: A database server that is not managed by Google." + returned: success + type: str + connectionName: + description: + - Connection name of the Cloud SQL instance used in connection strings. + returned: success + type: str + databaseVersion: + description: + - The database engine type and version. For First Generation instances, can be MYSQL_5_5, + or MYSQL_5_6. For Second Generation instances, can be MYSQL_5_6 or MYSQL_5_7. Defaults + to MYSQL_5_6. + - 'PostgreSQL instances: POSTGRES_9_6 The databaseVersion property can not be changed + after instance creation.' + returned: success + type: str + failoverReplica: + description: + - The name and status of the failover replica. This property is applicable only to + Second Generation instances. + returned: success + type: complex + contains: + available: + description: + - The availability status of the failover replica. A false status indicates that the + failover replica is out of sync. The master can only failover to the falover replica + when the status is true. + returned: success + type: bool + name: + description: + - The name of the failover replica. If specified at instance creation, a failover + replica is created for the instance. The name doesn't include the project ID. This + property is applicable only to Second Generation instances. + returned: success + type: str + instanceType: + description: + - The instance type. This can be one of the following. + - "* CLOUD_SQL_INSTANCE: A Cloud SQL instance that is not replicating from a master." + - "* ON_PREMISES_INSTANCE: An instance running on the customer's premises." + - "* READ_REPLICA_INSTANCE: A Cloud SQL instance configured as a read-replica." + returned: success + type: str + ipAddresses: + description: + - The assigned IP addresses for the instance. + returned: success + type: complex + contains: + ipAddress: + description: + - The IP address assigned. + returned: success + type: str + timeToRetire: + description: + - The due time for this IP to be retired in RFC 3339 format, for example 2012-11-15T16:19:00.094Z. + This field is only available when the IP is scheduled to be retired. + returned: success + type: str + type: + description: + - The type of this IP address. A PRIMARY address is an address that can accept incoming + connections. An OUTGOING address is the source address of connections originating + from the instance, if supported. + returned: success + type: str + ipv6Address: + description: + - The IPv6 address assigned to the instance. This property is applicable only to First + Generation instances. + returned: success + type: str + masterInstanceName: + description: + - The name of the instance which will act as master in the replication setup. + returned: success + type: str + maxDiskSize: + description: + - The maximum disk size of the instance in bytes. + returned: success + type: int + name: + description: + - Name of the Cloud SQL instance. This does not include the project ID. + returned: success + type: str + region: + description: + - The geographical region. Defaults to us-central or us-central1 depending on the + instance type (First Generation or Second Generation/PostgreSQL). + returned: success + type: str + replicaConfiguration: + description: + - Configuration specific to failover replicas and read replicas. + returned: success + type: complex + contains: + failoverTarget: + description: + - Specifies if the replica is the failover target. If the field is set to true the + replica will be designated as a failover replica. + - In case the master instance fails, the replica instance will be promoted as the + new master instance. + - Only one replica can be specified as failover target, and the replica has to be + in different zone with the master instance. + returned: success + type: bool + mysqlReplicaConfiguration: + description: + - MySQL specific configuration when replicating from a MySQL on-premises master. Replication + configuration information such as the username, password, certificates, and keys + are not stored in the instance metadata. The configuration information is used + only to set up the replication connection and is stored by MySQL in a file named + master.info in the data directory. + returned: success + type: complex + contains: + caCertificate: + description: + - PEM representation of the trusted CA's x509 certificate. + returned: success + type: str + clientCertificate: + description: + - PEM representation of the slave's x509 certificate . + returned: success + type: str + clientKey: + description: + - PEM representation of the slave's private key. The corresponsing public key is encoded + in the client's asf asd certificate. + returned: success + type: str + connectRetryInterval: + description: + - Seconds to wait between connect retries. MySQL's default is 60 seconds. + returned: success + type: int + dumpFilePath: + description: + - Path to a SQL dump file in Google Cloud Storage from which the slave instance is + to be created. The URI is in the form gs://bucketName/fileName. Compressed gzip + files (.gz) are also supported. Dumps should have the binlog co-ordinates from which + replication should begin. This can be accomplished by setting --master-data to 1 + when using mysqldump. + returned: success + type: str + masterHeartbeatPeriod: + description: + - Interval in milliseconds between replication heartbeats. + returned: success + type: int + password: + description: + - The password for the replication connection. + returned: success + type: str + sslCipher: + description: + - A list of permissible ciphers to use for SSL encryption. + returned: success + type: str + username: + description: + - The username for the replication connection. + returned: success + type: str + verifyServerCertificate: + description: + - Whether or not to check the master's Common Name value in the certificate that it + sends during the SSL handshake. + returned: success + type: bool + replicaNames: + description: + - The replicas of the instance. + returned: success + type: list + serviceAccountEmailAddress: + description: + - The service account email address assigned to the instance. This property is applicable + only to Second Generation instances. + returned: success + type: str + settings: + description: + - The user settings. + returned: success + type: complex + contains: + ipConfiguration: + description: + - The settings for IP Management. This allows to enable or disable the instance IP + and manage which external networks can connect to the instance. The IPv4 address + cannot be disabled for Second Generation instances. + returned: success + type: complex + contains: + ipv4Enabled: + description: + - Whether the instance should be assigned an IP address or not. + returned: success + type: bool + authorizedNetworks: + description: + - The list of external networks that are allowed to connect to the instance using + the IP. In CIDR notation, also known as 'slash' notation (e.g. 192.168.100.0/24). + returned: success + type: complex + contains: + expirationTime: + description: + - The time when this access control entry expires in RFC 3339 format, for example + 2012-11-15T16:19:00.094Z. + returned: success + type: str + name: + description: + - An optional label to identify this entry. + returned: success + type: str + value: + description: + - The whitelisted value for the access control list. For example, to grant access + to a client from an external IP (IPv4 or IPv6) address or subnet, use that address + or subnet here. + returned: success + type: str + requireSsl: + description: + - Whether the mysqld should default to 'REQUIRE X509' for users connecting over IP. + returned: success + type: bool + tier: + description: + - The tier or machine type for this instance, for example db-n1-standard-1. For MySQL + instances, this field determines whether the instance is Second Generation (recommended) + or First Generation. + returned: success + type: str + settingsVersion: + description: + - The version of instance settings. This is a required field for update method to + make sure concurrent updates are handled properly. During update, use the most + recent settingsVersion value for this instance and do not try to update this value. + returned: success + type: int +''' + +################################################################################ +# Imports +################################################################################ +from ansible.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest +import json + +################################################################################ +# Main +################################################################################ + + +def main(): + module = GcpModule( + argument_spec=dict( + ) + ) + + if 'scopes' not in module.params: + module.params['scopes'] = ['https://www.googleapis.com/auth/sqlservice.admin'] + + items = fetch_list(module, collection(module)) + if items.get('items'): + items = items.get('items') + else: + items = [] + return_value = { + 'items': items + } + module.exit_json(**return_value) + + +def collection(module): + return "https://www.googleapis.com/sql/v1beta4/projects/{project}/instances".format(**module.params) + + +def fetch_list(module, link): + auth = GcpSession(module, 'sql') + response = auth.get(link) + return return_if_object(module, response) + + +def return_if_object(module, response): + # If not found, return nothing. + if response.status_code == 404: + return None + + # If no content, return nothing. + if response.status_code == 204: + return None + + try: + module.raise_for_status(response) + result = response.json() + except getattr(json.decoder, 'JSONDecodeError', ValueError) as inst: + module.fail_json(msg="Invalid JSON response with error: %s" % inst) + + if navigate_hash(result, ['error', 'errors']): + module.fail_json(msg=navigate_hash(result, ['error', 'errors'])) + + return result + + +if __name__ == "__main__": + main() diff --git a/lib/ansible/modules/cloud/google/gcp_sql_user_facts.py b/lib/ansible/modules/cloud/google/gcp_sql_user_facts.py new file mode 100644 index 00000000000000..63f58621a27bd5 --- /dev/null +++ b/lib/ansible/modules/cloud/google/gcp_sql_user_facts.py @@ -0,0 +1,163 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# +# Copyright (C) 2017 Google +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) +# ---------------------------------------------------------------------------- +# +# *** AUTO GENERATED CODE *** AUTO GENERATED CODE *** +# +# ---------------------------------------------------------------------------- +# +# This file is automatically generated by Magic Modules and manual +# changes will be clobbered when the file is regenerated. +# +# Please read more about how to change this file at +# https://www.github.com/GoogleCloudPlatform/magic-modules +# +# ---------------------------------------------------------------------------- + +from __future__ import absolute_import, division, print_function +__metaclass__ = type + +################################################################################ +# Documentation +################################################################################ + +ANSIBLE_METADATA = {'metadata_version': '1.1', + 'status': ["preview"], + 'supported_by': 'community'} + +DOCUMENTATION = ''' +--- +module: gcp_sql_user_facts +description: + - Gather facts for GCP User +short_description: Gather facts for GCP User +version_added: 2.8 +author: Google Inc. (@googlecloudplatform) +requirements: + - python >= 2.6 + - requests >= 2.18.4 + - google-auth >= 1.3.0 +options: + instance: + description: + - The name of the Cloud SQL instance. This does not include the project ID. + - 'This field represents a link to a Instance resource in GCP. It can be specified + in two ways. You can add `register: name-of-resource` to a gcp_sql_instance task + and then set this instance field to "{{ name-of-resource }}" Alternatively, you + can set this instance to a dictionary with the name key where the value is the name + of your Instance.' + required: true +extends_documentation_fragment: gcp +''' + +EXAMPLES = ''' +- name: a user facts + gcp_sql_user_facts: + instance: "{{ instance }}" + project: test_project + auth_kind: serviceaccount + service_account_file: "/tmp/auth.pem" +''' + +RETURN = ''' +items: + description: List of items + returned: always + type: complex + contains: + host: + description: + - The host name from which the user can connect. For insert operations, host defaults + to an empty string. For update operations, host is specified as part of the request + URL. The host name cannot be updated after insertion. + returned: success + type: str + name: + description: + - The name of the user in the Cloud SQL instance. + returned: success + type: str + instance: + description: + - The name of the Cloud SQL instance. This does not include the project ID. + returned: success + type: dict + password: + description: + - The password for the user. + returned: success + type: str +''' + +################################################################################ +# Imports +################################################################################ +from ansible.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest, replace_resource_dict +import json + +################################################################################ +# Main +################################################################################ + + +def main(): + module = GcpModule( + argument_spec=dict( + instance=dict(required=True, type='dict') + ) + ) + + if 'scopes' not in module.params: + module.params['scopes'] = ['https://www.googleapis.com/auth/sqlservice.admin'] + + items = fetch_list(module, collection(module)) + if items.get('items'): + items = items.get('items') + else: + items = [] + return_value = { + 'items': items + } + module.exit_json(**return_value) + + +def collection(module): + res = { + 'project': module.params['project'], + 'instance': replace_resource_dict(module.params['instance'], 'name') + } + return "https://www.googleapis.com/sql/v1beta4/projects/{project}/instances/{instance}/users".format(**res) + + +def fetch_list(module, link): + auth = GcpSession(module, 'sql') + response = auth.get(link) + return return_if_object(module, response) + + +def return_if_object(module, response): + # If not found, return nothing. + if response.status_code == 404: + return None + + # If no content, return nothing. + if response.status_code == 204: + return None + + try: + module.raise_for_status(response) + result = response.json() + except getattr(json.decoder, 'JSONDecodeError', ValueError) as inst: + module.fail_json(msg="Invalid JSON response with error: %s" % inst) + + if navigate_hash(result, ['error', 'errors']): + module.fail_json(msg=navigate_hash(result, ['error', 'errors'])) + + return result + + +if __name__ == "__main__": + main() diff --git a/test/integration/targets/gcp_container_cluster/tasks/main.yml b/test/integration/targets/gcp_container_cluster/tasks/main.yml index 86e111d66ffa07..fa0e74690b11d2 100644 --- a/test/integration/targets/gcp_container_cluster/tasks/main.yml +++ b/test/integration/targets/gcp_container_cluster/tasks/main.yml @@ -15,7 +15,7 @@ # Pre-test setup - name: delete a cluster gcp_container_cluster: - name: "{{ resource_name }}" + name: my-cluster initial_node_count: 2 master_auth: username: cluster_admin @@ -31,7 +31,7 @@ #---------------------------------------------------------- - name: create a cluster gcp_container_cluster: - name: "{{ resource_name }}" + name: my-cluster initial_node_count: 2 master_auth: username: cluster_admin @@ -50,17 +50,22 @@ that: - result.changed == true - name: verify that cluster was created - shell: | - gcloud container clusters describe --project="{{ gcp_project}}" --zone=us-central1-a "{{ resource_name }}" + gcp_container_cluster_facts: + zone: us-central1-a + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + scopes: + - https://www.googleapis.com/auth/cloud-platform register: results - name: verify that command succeeded assert: that: - - results.rc == 0 + - results['items'] | length >= 1 # ---------------------------------------------------------------------------- - name: create a cluster that already exists gcp_container_cluster: - name: "{{ resource_name }}" + name: my-cluster initial_node_count: 2 master_auth: username: cluster_admin @@ -81,7 +86,7 @@ #---------------------------------------------------------- - name: delete a cluster gcp_container_cluster: - name: "{{ resource_name }}" + name: my-cluster initial_node_count: 2 master_auth: username: cluster_admin @@ -100,19 +105,22 @@ that: - result.changed == true - name: verify that cluster was deleted - shell: | - gcloud container clusters describe --project="{{ gcp_project}}" --zone=us-central1-a "{{ resource_name }}" + gcp_container_cluster_facts: + zone: us-central1-a + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + scopes: + - https://www.googleapis.com/auth/cloud-platform register: results - failed_when: results.rc == 0 - name: verify that command succeeded assert: that: - - results.rc == 1 - - "\"No cluster named '{{ resource_name }}' in {{ gcp_project }}.\" in results.stderr" + - results['items'] | length == 0 # ---------------------------------------------------------------------------- - name: delete a cluster that does not exist gcp_container_cluster: - name: "{{ resource_name }}" + name: my-cluster initial_node_count: 2 master_auth: username: cluster_admin diff --git a/test/integration/targets/gcp_container_node_pool/tasks/main.yml b/test/integration/targets/gcp_container_node_pool/tasks/main.yml index c3dfcbceff11a5..a151085d9f6a98 100644 --- a/test/integration/targets/gcp_container_node_pool/tasks/main.yml +++ b/test/integration/targets/gcp_container_node_pool/tasks/main.yml @@ -25,7 +25,7 @@ register: cluster - name: delete a node pool gcp_container_node_pool: - name: "{{ resource_name }}" + name: my-pool initial_node_count: 4 cluster: "{{ cluster }}" zone: us-central1-a @@ -36,7 +36,7 @@ #---------------------------------------------------------- - name: create a node pool gcp_container_node_pool: - name: "{{ resource_name }}" + name: my-pool initial_node_count: 4 cluster: "{{ cluster }}" zone: us-central1-a @@ -51,8 +51,6 @@ - result.changed == true - name: verify that node_pool was created gcp_container_node_pool_facts: - filters: - - name = {{ resource_name }} cluster: "{{ cluster }}" zone: us-central1-a project: "{{ gcp_project }}" @@ -64,11 +62,11 @@ - name: verify that command succeeded assert: that: - - results['items'] | length == 1 + - results['items'] | length >= 1 # ---------------------------------------------------------------------------- - name: create a node pool that already exists gcp_container_node_pool: - name: "{{ resource_name }}" + name: my-pool initial_node_count: 4 cluster: "{{ cluster }}" zone: us-central1-a @@ -84,7 +82,7 @@ #---------------------------------------------------------- - name: delete a node pool gcp_container_node_pool: - name: "{{ resource_name }}" + name: my-pool initial_node_count: 4 cluster: "{{ cluster }}" zone: us-central1-a @@ -99,8 +97,6 @@ - result.changed == true - name: verify that node_pool was deleted gcp_container_node_pool_facts: - filters: - - name = {{ resource_name }} cluster: "{{ cluster }}" zone: us-central1-a project: "{{ gcp_project }}" @@ -116,7 +112,7 @@ # ---------------------------------------------------------------------------- - name: delete a node pool that does not exist gcp_container_node_pool: - name: "{{ resource_name }}" + name: my-pool initial_node_count: 4 cluster: "{{ cluster }}" zone: us-central1-a diff --git a/test/integration/targets/gcp_pubsub_subscription/tasks/main.yml b/test/integration/targets/gcp_pubsub_subscription/tasks/main.yml index 6afc20203e7fac..4c7fb9024be380 100644 --- a/test/integration/targets/gcp_pubsub_subscription/tasks/main.yml +++ b/test/integration/targets/gcp_pubsub_subscription/tasks/main.yml @@ -60,7 +60,7 @@ - name: verify that command succeeded assert: that: - - results['items'] | length == 1 + - results['items'] | length >= 1 # ---------------------------------------------------------------------------- - name: create a subscription that already exists gcp_pubsub_subscription: diff --git a/test/integration/targets/gcp_pubsub_topic/tasks/main.yml b/test/integration/targets/gcp_pubsub_topic/tasks/main.yml index 8d1a0635c58173..32b4bd9229a650 100644 --- a/test/integration/targets/gcp_pubsub_topic/tasks/main.yml +++ b/test/integration/targets/gcp_pubsub_topic/tasks/main.yml @@ -44,7 +44,7 @@ - name: verify that command succeeded assert: that: - - results['items'] | length == 1 + - results['items'] | length >= 1 # ---------------------------------------------------------------------------- - name: create a topic that already exists gcp_pubsub_topic: diff --git a/test/integration/targets/gcp_spanner_database/tasks/main.yml b/test/integration/targets/gcp_spanner_database/tasks/main.yml index 269d2e5fd741ed..92b28b7cd4b074 100644 --- a/test/integration/targets/gcp_spanner_database/tasks/main.yml +++ b/test/integration/targets/gcp_spanner_database/tasks/main.yml @@ -49,13 +49,18 @@ that: - result.changed == true - name: verify that database was created - shell: | - gcloud spanner databases describe --project="{{ gcp_project }}" --instance="{{ instance.name }}" "webstore" + gcp_spanner_database_facts: + instance: "{{ instance }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + scopes: + - https://www.googleapis.com/auth/spanner.admin register: results - name: verify that command succeeded assert: that: - - results.rc == 0 + - results['items'] | length >= 1 # ---------------------------------------------------------------------------- - name: create a database that already exists gcp_spanner_database: @@ -85,15 +90,18 @@ that: - result.changed == true - name: verify that database was deleted - shell: | - gcloud spanner databases describe --project="{{ gcp_project }}" --instance="{{ instance.name }}" "webstore" + gcp_spanner_database_facts: + instance: "{{ instance }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + scopes: + - https://www.googleapis.com/auth/spanner.admin register: results - failed_when: results.rc == 0 - name: verify that command succeeded assert: that: - - results.rc == 1 - - "\"Database not found: projects/{{ gcp_project }}/instances/instance-database/databases/webstore\" in results.stderr" + - results['items'] | length == 0 # ---------------------------------------------------------------------------- - name: delete a database that does not exist gcp_spanner_database: diff --git a/test/integration/targets/gcp_spanner_instance/tasks/main.yml b/test/integration/targets/gcp_spanner_instance/tasks/main.yml index b79df29cc9d3d1..0724eff6197379 100644 --- a/test/integration/targets/gcp_spanner_instance/tasks/main.yml +++ b/test/integration/targets/gcp_spanner_instance/tasks/main.yml @@ -44,13 +44,17 @@ that: - result.changed == true - name: verify that instance was created - shell: | - gcloud spanner instances describe --project="{{ gcp_project }}" "{{ resource_name }}" + gcp_spanner_instance_facts: + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + scopes: + - https://www.googleapis.com/auth/spanner.admin register: results - name: verify that command succeeded assert: that: - - results.rc == 0 + - results['items'] | length >= 1 # ---------------------------------------------------------------------------- - name: create a instance that already exists gcp_spanner_instance: @@ -88,15 +92,17 @@ that: - result.changed == true - name: verify that instance was deleted - shell: | - gcloud spanner instances describe --project="{{ gcp_project }}" "{{ resource_name }}" + gcp_spanner_instance_facts: + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + scopes: + - https://www.googleapis.com/auth/spanner.admin register: results - failed_when: results.rc == 0 - name: verify that command succeeded assert: that: - - results.rc == 1 - - "\"Instance not found: projects/{{ gcp_project }}/instances/{{ resource_name }}\" in results.stderr" + - results['items'] | length == 0 # ---------------------------------------------------------------------------- - name: delete a instance that does not exist gcp_spanner_instance: diff --git a/test/integration/targets/gcp_sql_database/tasks/main.yml b/test/integration/targets/gcp_sql_database/tasks/main.yml index 81226327fdf966..b14a93af7f19c3 100644 --- a/test/integration/targets/gcp_sql_database/tasks/main.yml +++ b/test/integration/targets/gcp_sql_database/tasks/main.yml @@ -54,13 +54,18 @@ - result.changed == true - "result.kind == 'sql#database'" - name: verify that database was created - shell: | - gcloud sql databases describe --instance='instance-database' --project="{{ gcp_project}}" "{{ resource_name }}" + gcp_sql_database_facts: + instance: "{{ instance }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + scopes: + - https://www.googleapis.com/auth/sqlservice.admin register: results - name: verify that command succeeded assert: that: - - results.rc == 0 + - results['items'] | length >= 1 # ---------------------------------------------------------------------------- - name: create a database that already exists gcp_sql_database: @@ -94,15 +99,18 @@ - result.changed == true - result.has_key('kind') == False - name: verify that database was deleted - shell: | - gcloud sql databases describe --instance='instance-database' --project="{{ gcp_project}}" "{{ resource_name }}" + gcp_sql_database_facts: + instance: "{{ instance }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + scopes: + - https://www.googleapis.com/auth/sqlservice.admin register: results - failed_when: results.rc == 0 - name: verify that command succeeded assert: that: - - results.rc == 1 - - "\"(gcloud.sql.databases.describe) HTTPError 404: Not Found\" in results.stderr" + - results['items'] | length == 0 # ---------------------------------------------------------------------------- - name: delete a database that does not exist gcp_sql_database: diff --git a/test/integration/targets/gcp_sql_instance/tasks/main.yml b/test/integration/targets/gcp_sql_instance/tasks/main.yml index 5ef8f165acdf51..6fa18f2d0aa56b 100644 --- a/test/integration/targets/gcp_sql_instance/tasks/main.yml +++ b/test/integration/targets/gcp_sql_instance/tasks/main.yml @@ -49,13 +49,17 @@ - result.changed == true - "result.kind == 'sql#instance'" - name: verify that instance was created - shell: | - gcloud sql instances describe --project="{{ gcp_project}}" "{{ resource_name }}" + gcp_sql_instance_facts: + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + scopes: + - https://www.googleapis.com/auth/sqlservice.admin register: results - name: verify that command succeeded assert: that: - - results.rc == 0 + - results['items'] | length >= 1 # ---------------------------------------------------------------------------- - name: create a instance that already exists gcp_sql_instance: @@ -99,15 +103,17 @@ - result.changed == true - result.has_key('kind') == False - name: verify that instance was deleted - shell: | - gcloud sql instances describe --project="{{ gcp_project}}" "{{ resource_name }}" + gcp_sql_instance_facts: + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + scopes: + - https://www.googleapis.com/auth/sqlservice.admin register: results - failed_when: results.rc == 0 - name: verify that command succeeded assert: that: - - results.rc == 1 - - "\"Cloud SQL instance does not exist\" in results.stderr" + - results['items'] | length == 0 # ---------------------------------------------------------------------------- - name: delete a instance that does not exist gcp_sql_instance: diff --git a/test/integration/targets/gcp_sql_user/tasks/main.yml b/test/integration/targets/gcp_sql_user/tasks/main.yml index a481b394b7a0ae..3157df73f8e757 100644 --- a/test/integration/targets/gcp_sql_user/tasks/main.yml +++ b/test/integration/targets/gcp_sql_user/tasks/main.yml @@ -57,8 +57,6 @@ - "result.kind == 'sql#user'" - name: verify that user was created gcp_sql_user_facts: - filters: - - name = test-user instance: "{{ instance }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" @@ -69,7 +67,7 @@ - name: verify that command succeeded assert: that: - - results['items'] | length == 1 + - results['items'] | length >= 1 # ---------------------------------------------------------------------------- - name: create a user that already exists gcp_sql_user: @@ -106,8 +104,6 @@ - result.has_key('kind') == False - name: verify that user was deleted gcp_sql_user_facts: - filters: - - name = test-user instance: "{{ instance }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" From 6de55cbaaef806bda83f5475fa81f6525b5aa329 Mon Sep 17 00:00:00 2001 From: Riley Karson Date: Wed, 17 Oct 2018 22:26:12 +0000 Subject: [PATCH 050/144] Improve schema and docs for Google Cloud Storage ObjectAccessControl --- .../cloud/google/gcp_storage_bucket.py | 26 +++++++------------ 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/lib/ansible/modules/cloud/google/gcp_storage_bucket.py b/lib/ansible/modules/cloud/google/gcp_storage_bucket.py index 644f6a8d023a35..0d83987ba47d85 100644 --- a/lib/ansible/modules/cloud/google/gcp_storage_bucket.py +++ b/lib/ansible/modules/cloud/google/gcp_storage_bucket.py @@ -160,13 +160,10 @@ required: false entity: description: - - 'The entity holding the permission, in one of the following forms: user-userId - user-email group-groupId group-email domain-domain project-team-projectId allUsers - allAuthenticatedUsers Examples: The user liz@example.com would be - user-liz@example.com.' - - The group example@googlegroups.com would be group-example@googlegroups.com. - - To refer to all members of the Google Apps for Business domain example.com, the - entity would be domain-example.com. + - 'The entity holding the permission, in one of the following forms: * user-{{userId}} * + user-{{email}} (such as "user-liz@example.com") * group-{{groupId}} * group-{{email}} + (such as "group-example@googlegroups.com") * domain-{{domain}} (such as "domain-example.com") * + project-team-{{projectId}} * allUsers * allAuthenticatedUsers .' required: true entity_id: description: @@ -201,7 +198,7 @@ role: description: - The access permission for the entity. - required: false + required: true choices: ['OWNER', 'READER'] lifecycle: description: @@ -490,13 +487,10 @@ type: str entity: description: - - 'The entity holding the permission, in one of the following forms: user-userId - user-email group-groupId group-email domain-domain project-team-projectId allUsers - allAuthenticatedUsers Examples: The user liz@example.com would be - user-liz@example.com.' - - The group example@googlegroups.com would be group-example@googlegroups.com. - - To refer to all members of the Google Apps for Business domain example.com, the - entity would be domain-example.com. + - 'The entity holding the permission, in one of the following forms: * user-{{userId}} * + user-{{email}} (such as "user-liz@example.com") * group-{{groupId}} * group-{{email}} + (such as "group-example@googlegroups.com") * domain-{{domain}} (such as "domain-example.com") * + project-team-{{projectId}} * allUsers * allAuthenticatedUsers .' returned: success type: str entityId: @@ -792,7 +786,7 @@ def main(): project_number=dict(type='str'), team=dict(type='str', choices=['editors', 'owners', 'viewers']) )), - role=dict(type='str', choices=['OWNER', 'READER']) + role=dict(required=True, type='str', choices=['OWNER', 'READER']) )), lifecycle=dict(type='dict', options=dict( rule=dict(type='list', elements='dict', options=dict( From d7ae9f0c705fc34f8b74ca53db2e77a0637b3930 Mon Sep 17 00:00:00 2001 From: The Magician Date: Tue, 23 Oct 2018 11:40:07 -0700 Subject: [PATCH 051/144] Documentation Refactor --- .../cloud/google/gcp_compute_address.py | 274 ++-- .../cloud/google/gcp_compute_address_facts.py | 162 +- .../google/gcp_compute_backend_bucket.py | 148 +- .../gcp_compute_backend_bucket_facts.py | 99 +- .../google/gcp_compute_backend_service.py | 958 +++++------ .../gcp_compute_backend_service_facts.py | 542 +++---- .../modules/cloud/google/gcp_compute_disk.py | 628 ++++---- .../cloud/google/gcp_compute_disk_facts.py | 400 ++--- .../cloud/google/gcp_compute_firewall.py | 660 ++++---- .../google/gcp_compute_firewall_facts.py | 360 ++--- .../google/gcp_compute_forwarding_rule.py | 607 +++---- .../gcp_compute_forwarding_rule_facts.py | 321 ++-- .../google/gcp_compute_global_address.py | 184 +-- .../gcp_compute_global_address_facts.py | 126 +- .../gcp_compute_global_forwarding_rule.py | 543 ++++--- ...cp_compute_global_forwarding_rule_facts.py | 292 ++-- .../cloud/google/gcp_compute_health_check.py | 785 ++++----- .../google/gcp_compute_health_check_facts.py | 444 +++--- .../google/gcp_compute_http_health_check.py | 270 ++-- .../gcp_compute_http_health_check_facts.py | 166 +- .../google/gcp_compute_https_health_check.py | 265 +-- .../gcp_compute_https_health_check_facts.py | 166 +- .../modules/cloud/google/gcp_compute_image.py | 651 ++++---- .../cloud/google/gcp_compute_image_facts.py | 421 ++--- .../cloud/google/gcp_compute_instance.py | 1416 +++++++++-------- .../google/gcp_compute_instance_facts.py | 818 +++++----- .../google/gcp_compute_instance_group.py | 288 ++-- .../gcp_compute_instance_group_facts.py | 179 ++- .../gcp_compute_instance_group_manager.py | 424 ++--- ...cp_compute_instance_group_manager_facts.py | 326 ++-- .../google/gcp_compute_instance_template.py | 1414 ++++++++-------- .../gcp_compute_instance_template_facts.py | 782 ++++----- .../gcp_compute_interconnect_attachment.py | 238 +-- ...p_compute_interconnect_attachment_facts.py | 186 +-- .../cloud/google/gcp_compute_network.py | 265 +-- .../cloud/google/gcp_compute_network_facts.py | 164 +- .../cloud/google/gcp_compute_region_disk.py | 498 +++--- .../google/gcp_compute_region_disk_facts.py | 323 ++-- .../modules/cloud/google/gcp_compute_route.py | 326 ++-- .../cloud/google/gcp_compute_route_facts.py | 173 +- .../cloud/google/gcp_compute_router.py | 307 ++-- .../cloud/google/gcp_compute_router_facts.py | 197 +-- .../google/gcp_compute_ssl_certificate.py | 146 +- .../gcp_compute_ssl_certificate_facts.py | 101 +- .../cloud/google/gcp_compute_ssl_policy.py | 247 +-- .../google/gcp_compute_ssl_policy_facts.py | 176 +- .../cloud/google/gcp_compute_subnetwork.py | 364 ++--- .../google/gcp_compute_subnetwork_facts.py | 216 +-- .../google/gcp_compute_target_http_proxy.py | 129 +- .../gcp_compute_target_http_proxy_facts.py | 88 +- .../google/gcp_compute_target_https_proxy.py | 193 +-- .../gcp_compute_target_https_proxy_facts.py | 119 +- .../cloud/google/gcp_compute_target_pool.py | 347 ++-- .../google/gcp_compute_target_pool_facts.py | 203 ++- .../google/gcp_compute_target_ssl_proxy.py | 177 ++- .../gcp_compute_target_ssl_proxy_facts.py | 112 +- .../google/gcp_compute_target_tcp_proxy.py | 154 +- .../gcp_compute_target_tcp_proxy_facts.py | 99 +- .../google/gcp_compute_target_vpn_gateway.py | 164 +- .../gcp_compute_target_vpn_gateway_facts.py | 126 +- .../cloud/google/gcp_compute_url_map.py | 478 +++--- .../cloud/google/gcp_compute_url_map_facts.py | 282 ++-- .../cloud/google/gcp_compute_vpn_tunnel.py | 324 ++-- .../google/gcp_compute_vpn_tunnel_facts.py | 202 +-- .../cloud/google/gcp_container_cluster.py | 973 +++++------ .../google/gcp_container_cluster_facts.py | 603 +++---- .../cloud/google/gcp_container_node_pool.py | 681 ++++---- .../google/gcp_container_node_pool_facts.py | 402 ++--- .../cloud/google/gcp_dns_managed_zone.py | 142 +- .../google/gcp_dns_managed_zone_facts.py | 104 +- .../google/gcp_dns_resource_record_set.py | 146 +- .../gcp_dns_resource_record_set_facts.py | 88 +- .../cloud/google/gcp_pubsub_subscription.py | 186 +-- .../google/gcp_pubsub_subscription_facts.py | 102 +- .../modules/cloud/google/gcp_pubsub_topic.py | 38 +- .../cloud/google/gcp_pubsub_topic_facts.py | 27 +- .../cloud/google/gcp_spanner_database.py | 102 +- .../google/gcp_spanner_database_facts.py | 73 +- .../cloud/google/gcp_spanner_instance.py | 190 +-- .../google/gcp_spanner_instance_facts.py | 108 +- .../modules/cloud/google/gcp_sql_database.py | 106 +- .../cloud/google/gcp_sql_database_facts.py | 76 +- .../modules/cloud/google/gcp_sql_instance.py | 911 +++++------ .../cloud/google/gcp_sql_instance_facts.py | 535 ++++--- .../modules/cloud/google/gcp_sql_user.py | 110 +- .../cloud/google/gcp_sql_user_facts.py | 78 +- .../cloud/google/gcp_storage_bucket.py | 1326 +++++++-------- .../gcp_storage_bucket_access_control.py | 232 +-- 88 files changed, 15003 insertions(+), 14579 deletions(-) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_address.py b/lib/ansible/modules/cloud/google/gcp_compute_address.py index 7ac0cbec6944de..466adddfbcefb1 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_address.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_address.py @@ -32,85 +32,92 @@ --- module: gcp_compute_address description: - - Represents an Address resource. - - Each virtual machine instance has an ephemeral internal IP address and, optionally, - an external IP address. To communicate between instances on the same network, you - can use an instance's internal IP address. To communicate with the Internet and - instances outside of the same network, you must specify the instance's external - IP address. - - Internal IP addresses are ephemeral and only belong to an instance for the lifetime - of the instance; if the instance is deleted and recreated, the instance is assigned - a new internal IP address, either by Compute Engine or by you. External IP addresses - can be either ephemeral or static. +- Represents an Address resource. +- Each virtual machine instance has an ephemeral internal IP address and, optionally, + an external IP address. To communicate between instances on the same network, you + can use an instance's internal IP address. To communicate with the Internet and + instances outside of the same network, you must specify the instance's external + IP address. +- Internal IP addresses are ephemeral and only belong to an instance for the lifetime + of the instance; if the instance is deleted and recreated, the instance is assigned + a new internal IP address, either by Compute Engine or by you. External IP addresses + can be either ephemeral or static. short_description: Creates a GCP Address version_added: 2.6 author: Google Inc. (@googlecloudplatform) requirements: - - python >= 2.6 - - requests >= 2.18.4 - - google-auth >= 1.3.0 +- python >= 2.6 +- requests >= 2.18.4 +- google-auth >= 1.3.0 options: - state: - description: - - Whether the given object should exist in GCP - choices: ['present', 'absent'] - default: 'present' - address: - description: - - The static external IP address represented by this resource. Only IPv4 is supported. - An address may only be specified for INTERNAL address types. The IP address must - be inside the specified subnetwork, if any. - required: false - address_type: - description: - - The type of address to reserve, either INTERNAL or EXTERNAL. - - If unspecified, defaults to EXTERNAL. - required: false - default: EXTERNAL - version_added: 2.7 - choices: ['INTERNAL', 'EXTERNAL'] + state: description: - description: - - An optional description of this resource. - required: false - name: - description: - - Name of the resource. The name must be 1-63 characters long, and comply with RFC1035. - Specifically, the name must be 1-63 characters long and match the regular expression - `[a-z]([-a-z0-9]*[a-z0-9])?` which means the first character must be a lowercase - letter, and all following characters must be a dash, lowercase letter, or digit, - except the last character, which cannot be a dash. - required: true - network_tier: - description: - - 'The networking tier used for configuring this address. This field can take the - following values: PREMIUM or STANDARD. If this field is not specified, it is assumed - to be PREMIUM.' - required: false - version_added: 2.8 - choices: ['PREMIUM', 'STANDARD'] - subnetwork: - description: - - The URL of the subnetwork in which to reserve the address. If an IP address is specified, - it must be within the subnetwork's IP range. - - This field can only be used with INTERNAL type with GCE_ENDPOINT/DNS_RESOLVER purposes. - - 'This field represents a link to a Subnetwork resource in GCP. It can be specified - in two ways. You can add `register: name-of-resource` to a gcp_compute_subnetwork - task and then set this subnetwork field to "{{ name-of-resource }}" Alternatively, - you can set this subnetwork to a dictionary with the selfLink key where the value - is the selfLink of your Subnetwork.' - required: false - version_added: 2.7 - region: - description: - - URL of the region where the regional address resides. - - This field is not applicable to global addresses. - required: true + - Whether the given object should exist in GCP + choices: + - present + - absent + default: present + address: + description: + - The static external IP address represented by this resource. Only IPv4 is supported. + An address may only be specified for INTERNAL address types. The IP address + must be inside the specified subnetwork, if any. + required: false + address_type: + description: + - The type of address to reserve, either INTERNAL or EXTERNAL. + - If unspecified, defaults to EXTERNAL. + required: false + default: EXTERNAL + version_added: 2.7 + choices: + - INTERNAL + - EXTERNAL + description: + description: + - An optional description of this resource. + required: false + name: + description: + - Name of the resource. The name must be 1-63 characters long, and comply with + RFC1035. Specifically, the name must be 1-63 characters long and match the regular + expression `[a-z]([-a-z0-9]*[a-z0-9])?` which means the first character must + be a lowercase letter, and all following characters must be a dash, lowercase + letter, or digit, except the last character, which cannot be a dash. + required: true + network_tier: + description: + - 'The networking tier used for configuring this address. This field can take + the following values: PREMIUM or STANDARD. If this field is not specified, it + is assumed to be PREMIUM.' + required: false + version_added: 2.8 + choices: + - PREMIUM + - STANDARD + subnetwork: + description: + - The URL of the subnetwork in which to reserve the address. If an IP address + is specified, it must be within the subnetwork's IP range. + - This field can only be used with INTERNAL type with GCE_ENDPOINT/DNS_RESOLVER + purposes. + - 'This field represents a link to a Subnetwork resource in GCP. It can be specified + in two ways. You can add `register: name-of-resource` to a gcp_compute_subnetwork + task and then set this subnetwork field to "{{ name-of-resource }}" Alternatively, + you can set this subnetwork to a dictionary with the selfLink key where the + value is the selfLink of your Subnetwork' + required: false + version_added: 2.7 + region: + description: + - URL of the region where the regional address resides. + - This field is not applicable to global addresses. + required: true extends_documentation_fragment: gcp notes: - - "API Reference: U(https://cloud.google.com/compute/docs/reference/beta/addresses)" - - "Reserving a Static External IP Address: U(https://cloud.google.com/compute/docs/instances-and-network)" - - "Reserving a Static Internal IP Address: U(https://cloud.google.com/compute/docs/ip-addresses/reserve-static-internal-ip-address)" +- 'API Reference: U(https://cloud.google.com/compute/docs/reference/beta/addresses)' +- 'Reserving a Static External IP Address: U(https://cloud.google.com/compute/docs/instances-and-network)' +- 'Reserving a Static Internal IP Address: U(https://cloud.google.com/compute/docs/ip-addresses/reserve-static-internal-ip-address)' ''' EXAMPLES = ''' @@ -125,68 +132,69 @@ ''' RETURN = ''' - address: - description: - - The static external IP address represented by this resource. Only IPv4 is supported. - An address may only be specified for INTERNAL address types. The IP address must - be inside the specified subnetwork, if any. - returned: success - type: str - addressType: - description: - - The type of address to reserve, either INTERNAL or EXTERNAL. - - If unspecified, defaults to EXTERNAL. - returned: success - type: str - creationTimestamp: - description: - - Creation timestamp in RFC3339 text format. - returned: success - type: str - description: - description: - - An optional description of this resource. - returned: success - type: str - id: - description: - - The unique identifier for the resource. - returned: success - type: int - name: - description: - - Name of the resource. The name must be 1-63 characters long, and comply with RFC1035. - Specifically, the name must be 1-63 characters long and match the regular expression - `[a-z]([-a-z0-9]*[a-z0-9])?` which means the first character must be a lowercase - letter, and all following characters must be a dash, lowercase letter, or digit, - except the last character, which cannot be a dash. - returned: success - type: str - networkTier: - description: - - 'The networking tier used for configuring this address. This field can take the - following values: PREMIUM or STANDARD. If this field is not specified, it is assumed - to be PREMIUM.' - returned: success - type: str - subnetwork: - description: - - The URL of the subnetwork in which to reserve the address. If an IP address is specified, - it must be within the subnetwork's IP range. - - This field can only be used with INTERNAL type with GCE_ENDPOINT/DNS_RESOLVER purposes. - returned: success - type: dict - users: - description: - - The URLs of the resources that are using this address. - returned: success - type: list - region: - description: - - URL of the region where the regional address resides. - - This field is not applicable to global addresses. - returned: success - type: str +address: + description: + - The static external IP address represented by this resource. Only IPv4 is supported. + An address may only be specified for INTERNAL address types. The IP address must + be inside the specified subnetwork, if any. + returned: success + type: str +addressType: + description: + - The type of address to reserve, either INTERNAL or EXTERNAL. + - If unspecified, defaults to EXTERNAL. + returned: success + type: str +creationTimestamp: + description: + - Creation timestamp in RFC3339 text format. + returned: success + type: str +description: + description: + - An optional description of this resource. + returned: success + type: str +id: + description: + - The unique identifier for the resource. + returned: success + type: int +name: + description: + - Name of the resource. The name must be 1-63 characters long, and comply with RFC1035. + Specifically, the name must be 1-63 characters long and match the regular expression + `[a-z]([-a-z0-9]*[a-z0-9])?` which means the first character must be a lowercase + letter, and all following characters must be a dash, lowercase letter, or digit, + except the last character, which cannot be a dash. + returned: success + type: str +networkTier: + description: + - 'The networking tier used for configuring this address. This field can take the + following values: PREMIUM or STANDARD. If this field is not specified, it is assumed + to be PREMIUM.' + returned: success + type: str +subnetwork: + description: + - The URL of the subnetwork in which to reserve the address. If an IP address is + specified, it must be within the subnetwork's IP range. + - This field can only be used with INTERNAL type with GCE_ENDPOINT/DNS_RESOLVER + purposes. + returned: success + type: dict +users: + description: + - The URLs of the resources that are using this address. + returned: success + type: list +region: + description: + - URL of the region where the regional address resides. + - This field is not applicable to global addresses. + returned: success + type: str ''' ################################################################################ diff --git a/lib/ansible/modules/cloud/google/gcp_compute_address_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_address_facts.py index 4e6ed2792dfcf4..08d44dd12aa3b8 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_address_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_address_facts.py @@ -32,26 +32,25 @@ --- module: gcp_compute_address_facts description: - - Gather facts for GCP Address +- Gather facts for GCP Address short_description: Gather facts for GCP Address version_added: 2.7 author: Google Inc. (@googlecloudplatform) requirements: - - python >= 2.6 - - requests >= 2.18.4 - - google-auth >= 1.3.0 +- python >= 2.6 +- requests >= 2.18.4 +- google-auth >= 1.3.0 options: - filters: - description: - A list of filter value pairs. Available filters are listed here - U(https://cloud.google.com/sdk/gcloud/reference/topic/filters). - Each additional filter in the list will act be added as an AND condition - (filter1 and filter2) - region: - description: - - URL of the region where the regional address resides. - - This field is not applicable to global addresses. - required: true + filters: + description: + - A list of filter value pairs. Available filters are listed here U(U(https://cloud.google.com/sdk/gcloud/reference/topic/filters).) + - Each additional filter in the list will act be added as an AND condition (filter1 + and filter2) . + region: + description: + - URL of the region where the regional address resides. + - This field is not applicable to global addresses. + required: true extends_documentation_fragment: gcp ''' @@ -68,72 +67,73 @@ RETURN = ''' items: - description: List of items - returned: always - type: complex - contains: - address: - description: - - The static external IP address represented by this resource. Only IPv4 is supported. - An address may only be specified for INTERNAL address types. The IP address must - be inside the specified subnetwork, if any. - returned: success - type: str - addressType: - description: - - The type of address to reserve, either INTERNAL or EXTERNAL. - - If unspecified, defaults to EXTERNAL. - returned: success - type: str - creationTimestamp: - description: - - Creation timestamp in RFC3339 text format. - returned: success - type: str - description: - description: - - An optional description of this resource. - returned: success - type: str - id: - description: - - The unique identifier for the resource. - returned: success - type: int - name: - description: - - Name of the resource. The name must be 1-63 characters long, and comply with RFC1035. - Specifically, the name must be 1-63 characters long and match the regular expression - `[a-z]([-a-z0-9]*[a-z0-9])?` which means the first character must be a lowercase - letter, and all following characters must be a dash, lowercase letter, or digit, - except the last character, which cannot be a dash. - returned: success - type: str - networkTier: - description: - - 'The networking tier used for configuring this address. This field can take the - following values: PREMIUM or STANDARD. If this field is not specified, it is assumed - to be PREMIUM.' - returned: success - type: str - subnetwork: - description: - - The URL of the subnetwork in which to reserve the address. If an IP address is specified, - it must be within the subnetwork's IP range. - - This field can only be used with INTERNAL type with GCE_ENDPOINT/DNS_RESOLVER purposes. - returned: success - type: dict - users: - description: - - The URLs of the resources that are using this address. - returned: success - type: list - region: - description: - - URL of the region where the regional address resides. - - This field is not applicable to global addresses. - returned: success - type: str + description: List of items + returned: always + type: complex + contains: + address: + description: + - The static external IP address represented by this resource. Only IPv4 is + supported. An address may only be specified for INTERNAL address types. The + IP address must be inside the specified subnetwork, if any. + returned: success + type: str + addressType: + description: + - The type of address to reserve, either INTERNAL or EXTERNAL. + - If unspecified, defaults to EXTERNAL. + returned: success + type: str + creationTimestamp: + description: + - Creation timestamp in RFC3339 text format. + returned: success + type: str + description: + description: + - An optional description of this resource. + returned: success + type: str + id: + description: + - The unique identifier for the resource. + returned: success + type: int + name: + description: + - Name of the resource. The name must be 1-63 characters long, and comply with + RFC1035. Specifically, the name must be 1-63 characters long and match the + regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` which means the first character + must be a lowercase letter, and all following characters must be a dash, lowercase + letter, or digit, except the last character, which cannot be a dash. + returned: success + type: str + networkTier: + description: + - 'The networking tier used for configuring this address. This field can take + the following values: PREMIUM or STANDARD. If this field is not specified, + it is assumed to be PREMIUM.' + returned: success + type: str + subnetwork: + description: + - The URL of the subnetwork in which to reserve the address. If an IP address + is specified, it must be within the subnetwork's IP range. + - This field can only be used with INTERNAL type with GCE_ENDPOINT/DNS_RESOLVER + purposes. + returned: success + type: dict + users: + description: + - The URLs of the resources that are using this address. + returned: success + type: list + region: + description: + - URL of the region where the regional address resides. + - This field is not applicable to global addresses. + returned: success + type: str ''' ################################################################################ diff --git a/lib/ansible/modules/cloud/google/gcp_compute_backend_bucket.py b/lib/ansible/modules/cloud/google/gcp_compute_backend_bucket.py index 0ef41ad3c86294..f5f9255fe66217 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_backend_bucket.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_backend_bucket.py @@ -32,51 +32,53 @@ --- module: gcp_compute_backend_bucket description: - - Backend buckets allow you to use Google Cloud Storage buckets with HTTP(S) load - balancing. - - An HTTP(S) load balancer can direct traffic to specified URLs to a backend bucket - rather than a backend service. It can send requests for static content to a Cloud - Storage bucket and requests for dynamic content a virtual machine instance. +- Backend buckets allow you to use Google Cloud Storage buckets with HTTP(S) load + balancing. +- An HTTP(S) load balancer can direct traffic to specified URLs to a backend bucket + rather than a backend service. It can send requests for static content to a Cloud + Storage bucket and requests for dynamic content a virtual machine instance. short_description: Creates a GCP BackendBucket version_added: 2.6 author: Google Inc. (@googlecloudplatform) requirements: - - python >= 2.6 - - requests >= 2.18.4 - - google-auth >= 1.3.0 +- python >= 2.6 +- requests >= 2.18.4 +- google-auth >= 1.3.0 options: - state: - description: - - Whether the given object should exist in GCP - choices: ['present', 'absent'] - default: 'present' - bucket_name: - description: - - Cloud Storage bucket name. - required: true + state: description: - description: - - An optional textual description of the resource; provided by the client when the - resource is created. - required: false - enable_cdn: - description: - - If true, enable Cloud CDN for this BackendBucket. - required: false - type: bool - name: - description: - - Name of the resource. Provided by the client when the resource is created. The name - must be 1-63 characters long, and comply with RFC1035. Specifically, the name must - be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` - which means the first character must be a lowercase letter, and all following characters - must be a dash, lowercase letter, or digit, except the last character, which cannot - be a dash. - required: true + - Whether the given object should exist in GCP + choices: + - present + - absent + default: present + bucket_name: + description: + - Cloud Storage bucket name. + required: true + description: + description: + - An optional textual description of the resource; provided by the client when + the resource is created. + required: false + enable_cdn: + description: + - If true, enable Cloud CDN for this BackendBucket. + required: false + type: bool + name: + description: + - Name of the resource. Provided by the client when the resource is created. The + name must be 1-63 characters long, and comply with RFC1035. Specifically, the + name must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` + which means the first character must be a lowercase letter, and all following + characters must be a dash, lowercase letter, or digit, except the last character, + which cannot be a dash. + required: true extends_documentation_fragment: gcp notes: - - "API Reference: U(https://cloud.google.com/compute/docs/reference/latest/backendBuckets)" - - "Using a Cloud Storage bucket as a load balancer backend: U(https://cloud.google.com/compute/docs/load-balancing/http/backend-bucket)" +- 'API Reference: U(https://cloud.google.com/compute/docs/reference/latest/backendBuckets)' +- 'Using a Cloud Storage bucket as a load balancer backend: U(https://cloud.google.com/compute/docs/load-balancing/http/backend-bucket)' ''' EXAMPLES = ''' @@ -102,42 +104,42 @@ ''' RETURN = ''' - bucketName: - description: - - Cloud Storage bucket name. - returned: success - type: str - creationTimestamp: - description: - - Creation timestamp in RFC3339 text format. - returned: success - type: str - description: - description: - - An optional textual description of the resource; provided by the client when the - resource is created. - returned: success - type: str - enableCdn: - description: - - If true, enable Cloud CDN for this BackendBucket. - returned: success - type: bool - id: - description: - - Unique identifier for the resource. - returned: success - type: int - name: - description: - - Name of the resource. Provided by the client when the resource is created. The name - must be 1-63 characters long, and comply with RFC1035. Specifically, the name must - be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` - which means the first character must be a lowercase letter, and all following characters - must be a dash, lowercase letter, or digit, except the last character, which cannot - be a dash. - returned: success - type: str +bucketName: + description: + - Cloud Storage bucket name. + returned: success + type: str +creationTimestamp: + description: + - Creation timestamp in RFC3339 text format. + returned: success + type: str +description: + description: + - An optional textual description of the resource; provided by the client when the + resource is created. + returned: success + type: str +enableCdn: + description: + - If true, enable Cloud CDN for this BackendBucket. + returned: success + type: bool +id: + description: + - Unique identifier for the resource. + returned: success + type: int +name: + description: + - Name of the resource. Provided by the client when the resource is created. The + name must be 1-63 characters long, and comply with RFC1035. Specifically, the + name must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` + which means the first character must be a lowercase letter, and all following + characters must be a dash, lowercase letter, or digit, except the last character, + which cannot be a dash. + returned: success + type: str ''' ################################################################################ diff --git a/lib/ansible/modules/cloud/google/gcp_compute_backend_bucket_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_backend_bucket_facts.py index 29a7dea6039d82..df85a6d62aa3fd 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_backend_bucket_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_backend_bucket_facts.py @@ -32,21 +32,20 @@ --- module: gcp_compute_backend_bucket_facts description: - - Gather facts for GCP BackendBucket +- Gather facts for GCP BackendBucket short_description: Gather facts for GCP BackendBucket version_added: 2.7 author: Google Inc. (@googlecloudplatform) requirements: - - python >= 2.6 - - requests >= 2.18.4 - - google-auth >= 1.3.0 +- python >= 2.6 +- requests >= 2.18.4 +- google-auth >= 1.3.0 options: - filters: - description: - A list of filter value pairs. Available filters are listed here - U(https://cloud.google.com/sdk/gcloud/reference/topic/filters). - Each additional filter in the list will act be added as an AND condition - (filter1 and filter2) + filters: + description: + - A list of filter value pairs. Available filters are listed here U(U(https://cloud.google.com/sdk/gcloud/reference/topic/filters).) + - Each additional filter in the list will act be added as an AND condition (filter1 + and filter2) . extends_documentation_fragment: gcp ''' @@ -62,46 +61,46 @@ RETURN = ''' items: - description: List of items - returned: always - type: complex - contains: - bucketName: - description: - - Cloud Storage bucket name. - returned: success - type: str - creationTimestamp: - description: - - Creation timestamp in RFC3339 text format. - returned: success - type: str - description: - description: - - An optional textual description of the resource; provided by the client when the - resource is created. - returned: success - type: str - enableCdn: - description: - - If true, enable Cloud CDN for this BackendBucket. - returned: success - type: bool - id: - description: - - Unique identifier for the resource. - returned: success - type: int - name: - description: - - Name of the resource. Provided by the client when the resource is created. The name - must be 1-63 characters long, and comply with RFC1035. Specifically, the name must - be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` - which means the first character must be a lowercase letter, and all following characters - must be a dash, lowercase letter, or digit, except the last character, which cannot - be a dash. - returned: success - type: str + description: List of items + returned: always + type: complex + contains: + bucketName: + description: + - Cloud Storage bucket name. + returned: success + type: str + creationTimestamp: + description: + - Creation timestamp in RFC3339 text format. + returned: success + type: str + description: + description: + - An optional textual description of the resource; provided by the client when + the resource is created. + returned: success + type: str + enableCdn: + description: + - If true, enable Cloud CDN for this BackendBucket. + returned: success + type: bool + id: + description: + - Unique identifier for the resource. + returned: success + type: int + name: + description: + - Name of the resource. Provided by the client when the resource is created. + The name must be 1-63 characters long, and comply with RFC1035. Specifically, + the name must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` + which means the first character must be a lowercase letter, and all following + characters must be a dash, lowercase letter, or digit, except the last character, + which cannot be a dash. + returned: success + type: str ''' ################################################################################ diff --git a/lib/ansible/modules/cloud/google/gcp_compute_backend_service.py b/lib/ansible/modules/cloud/google/gcp_compute_backend_service.py index 56c77ac556885c..d7ad80de27f82d 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_backend_service.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_backend_service.py @@ -32,248 +32,271 @@ --- module: gcp_compute_backend_service description: - - Creates a BackendService resource in the specified project using the data included - in the request. +- Creates a BackendService resource in the specified project using the data included + in the request. short_description: Creates a GCP BackendService version_added: 2.6 author: Google Inc. (@googlecloudplatform) requirements: - - python >= 2.6 - - requests >= 2.18.4 - - google-auth >= 1.3.0 +- python >= 2.6 +- requests >= 2.18.4 +- google-auth >= 1.3.0 options: - state: - description: - - Whether the given object should exist in GCP - choices: ['present', 'absent'] - default: 'present' - affinity_cookie_ttl_sec: - description: - - Lifetime of cookies in seconds if session_affinity is GENERATED_COOKIE. If set to - 0, the cookie is non-persistent and lasts only until the end of the browser session - (or equivalent). The maximum allowed value for TTL is one day. - - When the load balancing scheme is INTERNAL, this field is not used. + state: + description: + - Whether the given object should exist in GCP + choices: + - present + - absent + default: present + affinity_cookie_ttl_sec: + description: + - Lifetime of cookies in seconds if session_affinity is GENERATED_COOKIE. If set + to 0, the cookie is non-persistent and lasts only until the end of the browser + session (or equivalent). The maximum allowed value for TTL is one day. + - When the load balancing scheme is INTERNAL, this field is not used. + required: false + backends: + description: + - The list of backends that serve this BackendService. + required: false + suboptions: + balancing_mode: + description: + - Specifies the balancing mode for this backend. + - For global HTTP(S) or TCP/SSL load balancing, the default is UTILIZATION. + Valid values are UTILIZATION, RATE (for HTTP(S)) and CONNECTION (for TCP/SSL). + - This cannot be used for internal load balancing. required: false - backends: - description: - - The list of backends that serve this BackendService. + choices: + - UTILIZATION + - RATE + - CONNECTION + capacity_scaler: + description: + - A multiplier applied to the group's maximum servicing capacity (based on + UTILIZATION, RATE or CONNECTION). + - Default value is 1, which means the group will serve up to 100% of its configured + capacity (depending on balancingMode). A setting of 0 means the group is + completely drained, offering 0% of its available Capacity. Valid range is + [0.0,1.0]. + - This cannot be used for internal load balancing. required: false - suboptions: - balancing_mode: - description: - - Specifies the balancing mode for this backend. - - For global HTTP(S) or TCP/SSL load balancing, the default is UTILIZATION. Valid - values are UTILIZATION, RATE (for HTTP(S)) and CONNECTION (for TCP/SSL). - - This cannot be used for internal load balancing. - required: false - choices: ['UTILIZATION', 'RATE', 'CONNECTION'] - capacity_scaler: - description: - - A multiplier applied to the group's maximum servicing capacity (based on UTILIZATION, - RATE or CONNECTION). - - Default value is 1, which means the group will serve up to 100% of its configured - capacity (depending on balancingMode). A setting of 0 means the group is completely - drained, offering 0% of its available Capacity. Valid range is [0.0,1.0]. - - This cannot be used for internal load balancing. - required: false - description: - description: - - An optional description of this resource. - - Provide this property when you create the resource. - required: false - group: - description: - - 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. - - 'This field represents a link to a InstanceGroup resource in GCP. It can be specified - in two ways. You can add `register: name-of-resource` to a gcp_compute_instance_group - task and then set this group field to "{{ name-of-resource }}" Alternatively, you - can set this group to a dictionary with the selfLink key where the value is the - selfLink of your InstanceGroup.' - required: false - max_connections: - description: - - The max number of simultaneous connections for the group. Can be used with either - CONNECTION or UTILIZATION balancing modes. - - For CONNECTION mode, either maxConnections or maxConnectionsPerInstance must be - set. - - This cannot be used for internal load balancing. - required: false - max_connections_per_instance: - description: - - The max number of simultaneous connections that a single backend instance can handle. - This is used to calculate the capacity of the group. Can be used in either CONNECTION - or UTILIZATION balancing modes. - - For CONNECTION mode, either maxConnections or maxConnectionsPerInstance must be - set. - - This cannot be used for internal load balancing. - required: false - max_rate: - description: - - The max requests per second (RPS) of the group. - - Can be used with either RATE or UTILIZATION balancing modes, but required if RATE - mode. For RATE mode, either maxRate or maxRatePerInstance must be set. - - This cannot be used for internal load balancing. - required: false - max_rate_per_instance: - description: - - The max requests per second (RPS) that a single backend instance can handle. This - is used to calculate the capacity of the group. Can be used in either balancing - mode. For RATE mode, either maxRate or maxRatePerInstance must be set. - - This cannot be used for internal load balancing. - required: false - max_utilization: - description: - - Used when balancingMode is UTILIZATION. This ratio defines the CPU utilization target - for the group. The default is 0.8. Valid range is [0.0, 1.0]. - - This cannot be used for internal load balancing. - required: false - cdn_policy: + description: description: - - Cloud CDN configuration for this BackendService. + - An optional description of this resource. + - Provide this property when you create the resource. required: false - suboptions: - cache_key_policy: - description: - - The CacheKeyPolicy for this CdnPolicy. - required: false - suboptions: - include_host: - description: - - If true requests to different hosts will be cached separately. - required: false - type: bool - include_protocol: - description: - - If true, http and https requests will be cached separately. - required: false - type: bool - include_query_string: - description: - - If true, include query string parameters in the cache key according to query_string_whitelist - and query_string_blacklist. If neither is set, the entire query string will be included. - - If false, the query string will be excluded from the cache key entirely. - required: false - type: bool - query_string_blacklist: - description: - - Names of query string parameters to exclude in cache keys. - - All other parameters will be included. Either specify query_string_whitelist or - query_string_blacklist, not both. - - "'&' and '=' will be percent encoded and not treated as delimiters." - required: false - query_string_whitelist: - description: - - Names of query string parameters to include in cache keys. - - All other parameters will be excluded. Either specify query_string_whitelist or - query_string_blacklist, not both. - - "'&' and '=' will be percent encoded and not treated as delimiters." - required: false - connection_draining: - description: - - Settings for connection draining. + group: + description: + - 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. + - 'This field represents a link to a InstanceGroup resource in GCP. It can + be specified in two ways. You can add `register: name-of-resource` to a + gcp_compute_instance_group task and then set this group field to "{{ name-of-resource + }}" Alternatively, you can set this group to a dictionary with the selfLink + key where the value is the selfLink of your InstanceGroup' required: false - suboptions: - draining_timeout_sec: - description: - - Time for which instance will be drained (not accept new connections, but still work - to finish started). - required: false - description: + max_connections: description: - - An optional description of this resource. + - The max number of simultaneous connections for the group. Can be used with + either CONNECTION or UTILIZATION balancing modes. + - For CONNECTION mode, either maxConnections or maxConnectionsPerInstance + must be set. + - This cannot be used for internal load balancing. required: false - enable_cdn: - description: - - If true, enable Cloud CDN for this BackendService. - - When the load balancing scheme is INTERNAL, this field is not used. + max_connections_per_instance: + description: + - The max number of simultaneous connections that a single backend instance + can handle. This is used to calculate the capacity of the group. Can be + used in either CONNECTION or UTILIZATION balancing modes. + - For CONNECTION mode, either maxConnections or maxConnectionsPerInstance + must be set. + - This cannot be used for internal load balancing. required: false - type: bool - health_checks: + max_rate: description: - - The list of URLs to the HttpHealthCheck or HttpsHealthCheck resource for health - checking this BackendService. Currently at most one health check can be specified, - and a health check is required. - - For internal load balancing, a URL to a HealthCheck resource must be specified instead. + - The max requests per second (RPS) of the group. + - Can be used with either RATE or UTILIZATION balancing modes, but required + if RATE mode. For RATE mode, either maxRate or maxRatePerInstance must be + set. + - This cannot be used for internal load balancing. required: false - iap: + max_rate_per_instance: description: - - Settings for enabling Cloud Identity Aware Proxy. + - The max requests per second (RPS) that a single backend instance can handle. + This is used to calculate the capacity of the group. Can be used in either + balancing mode. For RATE mode, either maxRate or maxRatePerInstance must + be set. + - This cannot be used for internal load balancing. required: false - version_added: 2.7 - suboptions: - enabled: - description: - - Enables IAP. - required: false - type: bool - oauth2_client_id: - description: - - OAuth2 Client ID for IAP. - required: false - oauth2_client_secret: - description: - - OAuth2 Client Secret for IAP. - required: false - oauth2_client_secret_sha256: - description: - - OAuth2 Client Secret SHA-256 for IAP. - required: false - load_balancing_scheme: + max_utilization: description: - - Indicates whether the backend service will be used with internal or external load - balancing. A backend service created for one type of load balancing cannot be used - with the other. + - Used when balancingMode is UTILIZATION. This ratio defines the CPU utilization + target for the group. The default is 0.8. Valid range is [0.0, 1.0]. + - This cannot be used for internal load balancing. required: false - version_added: 2.7 - choices: ['INTERNAL', 'EXTERNAL'] - name: + cdn_policy: + description: + - Cloud CDN configuration for this BackendService. + required: false + suboptions: + cache_key_policy: description: - - Name of the resource. Provided by the client when the resource is created. The name - must be 1-63 characters long, and comply with RFC1035. Specifically, the name must - be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` - which means the first character must be a lowercase letter, and all following characters - must be a dash, lowercase letter, or digit, except the last character, which cannot - be a dash. + - The CacheKeyPolicy for this CdnPolicy. required: false - port_name: + suboptions: + include_host: + description: + - If true requests to different hosts will be cached separately. + required: false + type: bool + include_protocol: + description: + - If true, http and https requests will be cached separately. + required: false + type: bool + include_query_string: + description: + - If true, include query string parameters in the cache key according + to query_string_whitelist and query_string_blacklist. If neither is + set, the entire query string will be included. + - If false, the query string will be excluded from the cache key entirely. + required: false + type: bool + query_string_blacklist: + description: + - Names of query string parameters to exclude in cache keys. + - All other parameters will be included. Either specify query_string_whitelist + or query_string_blacklist, not both. + - "'&' and '=' will be percent encoded and not treated as delimiters." + required: false + query_string_whitelist: + description: + - Names of query string parameters to include in cache keys. + - All other parameters will be excluded. Either specify query_string_whitelist + or query_string_blacklist, not both. + - "'&' and '=' will be percent encoded and not treated as delimiters." + required: false + connection_draining: + description: + - Settings for connection draining. + required: false + suboptions: + draining_timeout_sec: description: - - Name of backend port. The same name should appear in the instance groups referenced - by this service. Required when the load balancing scheme is EXTERNAL. - - When the load balancing scheme is INTERNAL, this field is not used. + - Time for which instance will be drained (not accept new connections, but + still work to finish started). required: false - protocol: + description: + description: + - An optional description of this resource. + required: false + enable_cdn: + description: + - If true, enable Cloud CDN for this BackendService. + - When the load balancing scheme is INTERNAL, this field is not used. + required: false + type: bool + health_checks: + description: + - The list of URLs to the HttpHealthCheck or HttpsHealthCheck resource for health + checking this BackendService. Currently at most one health check can be specified, + and a health check is required. + - For internal load balancing, a URL to a HealthCheck resource must be specified + instead. + required: false + iap: + description: + - Settings for enabling Cloud Identity Aware Proxy. + required: false + version_added: 2.7 + suboptions: + enabled: description: - - The protocol this BackendService uses to communicate with backends. - - Possible values are HTTP, HTTPS, TCP, and SSL. The default is HTTP. - - For internal load balancing, the possible values are TCP and UDP, and the default - is TCP. + - Enables IAP. required: false - choices: ['HTTP', 'HTTPS', 'TCP', 'SSL'] - region: + type: bool + oauth2_client_id: description: - - The region where the regional backend service resides. - - This field is not applicable to global backend services. + - OAuth2 Client ID for IAP. required: false - session_affinity: + oauth2_client_secret: description: - - Type of session affinity to use. The default is NONE. - - When the load balancing scheme is EXTERNAL, can be NONE, CLIENT_IP, or GENERATED_COOKIE. - - When the load balancing scheme is INTERNAL, can be NONE, CLIENT_IP, CLIENT_IP_PROTO, - or CLIENT_IP_PORT_PROTO. - - When the protocol is UDP, this field is not used. + - OAuth2 Client Secret for IAP. required: false - choices: ['NONE', 'CLIENT_IP', 'GENERATED_COOKIE', 'CLIENT_IP_PROTO', 'CLIENT_IP_PORT_PROTO'] - timeout_sec: + oauth2_client_secret_sha256: description: - - How many seconds to wait for the backend before considering it a failed request. - Default is 30 seconds. Valid range is [1, 86400]. + - OAuth2 Client Secret SHA-256 for IAP. required: false - aliases: [timeout_seconds] + load_balancing_scheme: + description: + - Indicates whether the backend service will be used with internal or external + load balancing. A backend service created for one type of load balancing cannot + be used with the other. + required: false + version_added: 2.7 + choices: + - INTERNAL + - EXTERNAL + name: + description: + - Name of the resource. Provided by the client when the resource is created. The + name must be 1-63 characters long, and comply with RFC1035. Specifically, the + name must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` + which means the first character must be a lowercase letter, and all following + characters must be a dash, lowercase letter, or digit, except the last character, + which cannot be a dash. + required: false + port_name: + description: + - Name of backend port. The same name should appear in the instance groups referenced + by this service. Required when the load balancing scheme is EXTERNAL. + - When the load balancing scheme is INTERNAL, this field is not used. + required: false + protocol: + description: + - The protocol this BackendService uses to communicate with backends. + - Possible values are HTTP, HTTPS, TCP, and SSL. The default is HTTP. + - For internal load balancing, the possible values are TCP and UDP, and the default + is TCP. + required: false + choices: + - HTTP + - HTTPS + - TCP + - SSL + region: + description: + - The region where the regional backend service resides. + - This field is not applicable to global backend services. + required: false + session_affinity: + description: + - Type of session affinity to use. The default is NONE. + - When the load balancing scheme is EXTERNAL, can be NONE, CLIENT_IP, or GENERATED_COOKIE. + - When the load balancing scheme is INTERNAL, can be NONE, CLIENT_IP, CLIENT_IP_PROTO, + or CLIENT_IP_PORT_PROTO. + - When the protocol is UDP, this field is not used. + required: false + choices: + - NONE + - CLIENT_IP + - GENERATED_COOKIE + - CLIENT_IP_PROTO + - CLIENT_IP_PORT_PROTO + timeout_sec: + description: + - How many seconds to wait for the backend before considering it a failed request. + Default is 30 seconds. Valid range is [1, 86400]. + required: false + aliases: + - timeout_seconds extends_documentation_fragment: gcp ''' @@ -316,261 +339,266 @@ ''' RETURN = ''' - affinityCookieTtlSec: - description: - - Lifetime of cookies in seconds if session_affinity is GENERATED_COOKIE. If set to - 0, the cookie is non-persistent and lasts only until the end of the browser session - (or equivalent). The maximum allowed value for TTL is one day. - - When the load balancing scheme is INTERNAL, this field is not used. - returned: success - type: int - backends: - description: - - The list of backends that serve this BackendService. - returned: success - type: complex - contains: - balancingMode: - description: - - Specifies the balancing mode for this backend. - - For global HTTP(S) or TCP/SSL load balancing, the default is UTILIZATION. Valid - values are UTILIZATION, RATE (for HTTP(S)) and CONNECTION (for TCP/SSL). - - This cannot be used for internal load balancing. - returned: success - type: str - capacityScaler: - description: - - A multiplier applied to the group's maximum servicing capacity (based on UTILIZATION, - RATE or CONNECTION). - - Default value is 1, which means the group will serve up to 100% of its configured - capacity (depending on balancingMode). A setting of 0 means the group is completely - drained, offering 0% of its available Capacity. Valid range is [0.0,1.0]. - - This cannot be used for internal load balancing. - returned: success - type: str - description: - description: - - An optional description of this resource. - - Provide this property when you create the resource. - returned: success - type: str - group: - description: - - 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 - type: dict - maxConnections: - description: - - The max number of simultaneous connections for the group. Can be used with either - CONNECTION or UTILIZATION balancing modes. - - For CONNECTION mode, either maxConnections or maxConnectionsPerInstance must be - set. - - This cannot be used for internal load balancing. - returned: success - type: int - maxConnectionsPerInstance: - description: - - The max number of simultaneous connections that a single backend instance can handle. - This is used to calculate the capacity of the group. Can be used in either CONNECTION - or UTILIZATION balancing modes. - - For CONNECTION mode, either maxConnections or maxConnectionsPerInstance must be - set. - - This cannot be used for internal load balancing. - returned: success - type: int - maxRate: - description: - - The max requests per second (RPS) of the group. - - Can be used with either RATE or UTILIZATION balancing modes, but required if RATE - mode. For RATE mode, either maxRate or maxRatePerInstance must be set. - - This cannot be used for internal load balancing. - returned: success - type: int - maxRatePerInstance: - description: - - The max requests per second (RPS) that a single backend instance can handle. This - is used to calculate the capacity of the group. Can be used in either balancing - mode. For RATE mode, either maxRate or maxRatePerInstance must be set. - - This cannot be used for internal load balancing. - returned: success - type: str - maxUtilization: - description: - - Used when balancingMode is UTILIZATION. This ratio defines the CPU utilization target - for the group. The default is 0.8. Valid range is [0.0, 1.0]. - - This cannot be used for internal load balancing. - returned: success - type: str - cdnPolicy: - description: - - Cloud CDN configuration for this BackendService. - returned: success - type: complex - contains: - cacheKeyPolicy: - description: - - The CacheKeyPolicy for this CdnPolicy. - returned: success - type: complex - contains: - includeHost: - description: - - If true requests to different hosts will be cached separately. - returned: success - type: bool - includeProtocol: - description: - - If true, http and https requests will be cached separately. - returned: success - type: bool - includeQueryString: - description: - - If true, include query string parameters in the cache key according to query_string_whitelist - and query_string_blacklist. If neither is set, the entire query string will be included. - - If false, the query string will be excluded from the cache key entirely. - returned: success - type: bool - queryStringBlacklist: - description: - - Names of query string parameters to exclude in cache keys. - - All other parameters will be included. Either specify query_string_whitelist or - query_string_blacklist, not both. - - "'&' and '=' will be percent encoded and not treated as delimiters." - returned: success - type: list - queryStringWhitelist: - description: - - Names of query string parameters to include in cache keys. - - All other parameters will be excluded. Either specify query_string_whitelist or - query_string_blacklist, not both. - - "'&' and '=' will be percent encoded and not treated as delimiters." - returned: success - type: list - connectionDraining: - description: - - Settings for connection draining. - returned: success - type: complex - contains: - drainingTimeoutSec: - description: - - Time for which instance will be drained (not accept new connections, but still work - to finish started). - returned: success - type: int - creationTimestamp: - description: - - Creation timestamp in RFC3339 text format. - returned: success - type: str +affinityCookieTtlSec: + description: + - Lifetime of cookies in seconds if session_affinity is GENERATED_COOKIE. If set + to 0, the cookie is non-persistent and lasts only until the end of the browser + session (or equivalent). The maximum allowed value for TTL is one day. + - When the load balancing scheme is INTERNAL, this field is not used. + returned: success + type: int +backends: + description: + - The list of backends that serve this BackendService. + returned: success + type: complex + contains: + balancingMode: + description: + - Specifies the balancing mode for this backend. + - For global HTTP(S) or TCP/SSL load balancing, the default is UTILIZATION. + Valid values are UTILIZATION, RATE (for HTTP(S)) and CONNECTION (for TCP/SSL). + - This cannot be used for internal load balancing. + returned: success + type: str + capacityScaler: + description: + - A multiplier applied to the group's maximum servicing capacity (based on UTILIZATION, + RATE or CONNECTION). + - Default value is 1, which means the group will serve up to 100% of its configured + capacity (depending on balancingMode). A setting of 0 means the group is completely + drained, offering 0% of its available Capacity. Valid range is [0.0,1.0]. + - This cannot be used for internal load balancing. + returned: success + type: str description: - description: - - An optional description of this resource. - returned: success - type: str - enableCDN: - description: - - If true, enable Cloud CDN for this BackendService. - - When the load balancing scheme is INTERNAL, this field is not used. - returned: success - type: bool - healthChecks: - description: - - The list of URLs to the HttpHealthCheck or HttpsHealthCheck resource for health - checking this BackendService. Currently at most one health check can be specified, - and a health check is required. - - For internal load balancing, a URL to a HealthCheck resource must be specified instead. - returned: success - type: list - id: - description: - - The unique identifier for the resource. - returned: success - type: int - iap: - description: - - Settings for enabling Cloud Identity Aware Proxy. - returned: success - type: complex - contains: - enabled: - description: - - Enables IAP. - returned: success - type: bool - oauth2ClientId: - description: - - OAuth2 Client ID for IAP. - returned: success - type: str - oauth2ClientSecret: - description: - - OAuth2 Client Secret for IAP. - returned: success - type: str - oauth2ClientSecretSha256: - description: - - OAuth2 Client Secret SHA-256 for IAP. - returned: success - type: str - loadBalancingScheme: - description: - - Indicates whether the backend service will be used with internal or external load - balancing. A backend service created for one type of load balancing cannot be used - with the other. - returned: success - type: str - name: - description: - - Name of the resource. Provided by the client when the resource is created. The name - must be 1-63 characters long, and comply with RFC1035. Specifically, the name must - be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` - which means the first character must be a lowercase letter, and all following characters - must be a dash, lowercase letter, or digit, except the last character, which cannot - be a dash. - returned: success - type: str - portName: - description: - - Name of backend port. The same name should appear in the instance groups referenced - by this service. Required when the load balancing scheme is EXTERNAL. - - When the load balancing scheme is INTERNAL, this field is not used. - returned: success - type: str - protocol: - description: - - The protocol this BackendService uses to communicate with backends. - - Possible values are HTTP, HTTPS, TCP, and SSL. The default is HTTP. - - For internal load balancing, the possible values are TCP and UDP, and the default - is TCP. - returned: success - type: str - region: - description: - - The region where the regional backend service resides. - - This field is not applicable to global backend services. - returned: success - type: str - sessionAffinity: - description: - - Type of session affinity to use. The default is NONE. - - When the load balancing scheme is EXTERNAL, can be NONE, CLIENT_IP, or GENERATED_COOKIE. - - When the load balancing scheme is INTERNAL, can be NONE, CLIENT_IP, CLIENT_IP_PROTO, - or CLIENT_IP_PORT_PROTO. - - When the protocol is UDP, this field is not used. - returned: success - type: str - timeoutSec: - description: - - How many seconds to wait for the backend before considering it a failed request. - Default is 30 seconds. Valid range is [1, 86400]. - returned: success - type: int + description: + - An optional description of this resource. + - Provide this property when you create the resource. + returned: success + type: str + group: + description: + - 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 + type: dict + maxConnections: + description: + - The max number of simultaneous connections for the group. Can be used with + either CONNECTION or UTILIZATION balancing modes. + - For CONNECTION mode, either maxConnections or maxConnectionsPerInstance must + be set. + - This cannot be used for internal load balancing. + returned: success + type: int + maxConnectionsPerInstance: + description: + - The max number of simultaneous connections that a single backend instance + can handle. This is used to calculate the capacity of the group. Can be used + in either CONNECTION or UTILIZATION balancing modes. + - For CONNECTION mode, either maxConnections or maxConnectionsPerInstance must + be set. + - This cannot be used for internal load balancing. + returned: success + type: int + maxRate: + description: + - The max requests per second (RPS) of the group. + - Can be used with either RATE or UTILIZATION balancing modes, but required + if RATE mode. For RATE mode, either maxRate or maxRatePerInstance must be + set. + - This cannot be used for internal load balancing. + returned: success + type: int + maxRatePerInstance: + description: + - The max requests per second (RPS) that a single backend instance can handle. + This is used to calculate the capacity of the group. Can be used in either + balancing mode. For RATE mode, either maxRate or maxRatePerInstance must be + set. + - This cannot be used for internal load balancing. + returned: success + type: str + maxUtilization: + description: + - Used when balancingMode is UTILIZATION. This ratio defines the CPU utilization + target for the group. The default is 0.8. Valid range is [0.0, 1.0]. + - This cannot be used for internal load balancing. + returned: success + type: str +cdnPolicy: + description: + - Cloud CDN configuration for this BackendService. + returned: success + type: complex + contains: + cacheKeyPolicy: + description: + - The CacheKeyPolicy for this CdnPolicy. + returned: success + type: complex + contains: + includeHost: + description: + - If true requests to different hosts will be cached separately. + returned: success + type: bool + includeProtocol: + description: + - If true, http and https requests will be cached separately. + returned: success + type: bool + includeQueryString: + description: + - If true, include query string parameters in the cache key according to + query_string_whitelist and query_string_blacklist. If neither is set, + the entire query string will be included. + - If false, the query string will be excluded from the cache key entirely. + returned: success + type: bool + queryStringBlacklist: + description: + - Names of query string parameters to exclude in cache keys. + - All other parameters will be included. Either specify query_string_whitelist + or query_string_blacklist, not both. + - "'&' and '=' will be percent encoded and not treated as delimiters." + returned: success + type: list + queryStringWhitelist: + description: + - Names of query string parameters to include in cache keys. + - All other parameters will be excluded. Either specify query_string_whitelist + or query_string_blacklist, not both. + - "'&' and '=' will be percent encoded and not treated as delimiters." + returned: success + type: list +connectionDraining: + description: + - Settings for connection draining. + returned: success + type: complex + contains: + drainingTimeoutSec: + description: + - Time for which instance will be drained (not accept new connections, but still + work to finish started). + returned: success + type: int +creationTimestamp: + description: + - Creation timestamp in RFC3339 text format. + returned: success + type: str +description: + description: + - An optional description of this resource. + returned: success + type: str +enableCDN: + description: + - If true, enable Cloud CDN for this BackendService. + - When the load balancing scheme is INTERNAL, this field is not used. + returned: success + type: bool +healthChecks: + description: + - The list of URLs to the HttpHealthCheck or HttpsHealthCheck resource for health + checking this BackendService. Currently at most one health check can be specified, + and a health check is required. + - For internal load balancing, a URL to a HealthCheck resource must be specified + instead. + returned: success + type: list +id: + description: + - The unique identifier for the resource. + returned: success + type: int +iap: + description: + - Settings for enabling Cloud Identity Aware Proxy. + returned: success + type: complex + contains: + enabled: + description: + - Enables IAP. + returned: success + type: bool + oauth2ClientId: + description: + - OAuth2 Client ID for IAP. + returned: success + type: str + oauth2ClientSecret: + description: + - OAuth2 Client Secret for IAP. + returned: success + type: str + oauth2ClientSecretSha256: + description: + - OAuth2 Client Secret SHA-256 for IAP. + returned: success + type: str +loadBalancingScheme: + description: + - Indicates whether the backend service will be used with internal or external load + balancing. A backend service created for one type of load balancing cannot be + used with the other. + returned: success + type: str +name: + description: + - Name of the resource. Provided by the client when the resource is created. The + name must be 1-63 characters long, and comply with RFC1035. Specifically, the + name must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` + which means the first character must be a lowercase letter, and all following + characters must be a dash, lowercase letter, or digit, except the last character, + which cannot be a dash. + returned: success + type: str +portName: + description: + - Name of backend port. The same name should appear in the instance groups referenced + by this service. Required when the load balancing scheme is EXTERNAL. + - When the load balancing scheme is INTERNAL, this field is not used. + returned: success + type: str +protocol: + description: + - The protocol this BackendService uses to communicate with backends. + - Possible values are HTTP, HTTPS, TCP, and SSL. The default is HTTP. + - For internal load balancing, the possible values are TCP and UDP, and the default + is TCP. + returned: success + type: str +region: + description: + - The region where the regional backend service resides. + - This field is not applicable to global backend services. + returned: success + type: str +sessionAffinity: + description: + - Type of session affinity to use. The default is NONE. + - When the load balancing scheme is EXTERNAL, can be NONE, CLIENT_IP, or GENERATED_COOKIE. + - When the load balancing scheme is INTERNAL, can be NONE, CLIENT_IP, CLIENT_IP_PROTO, + or CLIENT_IP_PORT_PROTO. + - When the protocol is UDP, this field is not used. + returned: success + type: str +timeoutSec: + description: + - How many seconds to wait for the backend before considering it a failed request. + Default is 30 seconds. Valid range is [1, 86400]. + returned: success + type: int ''' ################################################################################ diff --git a/lib/ansible/modules/cloud/google/gcp_compute_backend_service_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_backend_service_facts.py index c303c756866767..7fc7358d100a00 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_backend_service_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_backend_service_facts.py @@ -32,21 +32,20 @@ --- module: gcp_compute_backend_service_facts description: - - Gather facts for GCP BackendService +- Gather facts for GCP BackendService short_description: Gather facts for GCP BackendService version_added: 2.7 author: Google Inc. (@googlecloudplatform) requirements: - - python >= 2.6 - - requests >= 2.18.4 - - google-auth >= 1.3.0 +- python >= 2.6 +- requests >= 2.18.4 +- google-auth >= 1.3.0 options: - filters: - description: - A list of filter value pairs. Available filters are listed here - U(https://cloud.google.com/sdk/gcloud/reference/topic/filters). - Each additional filter in the list will act be added as an AND condition - (filter1 and filter2) + filters: + description: + - A list of filter value pairs. Available filters are listed here U(U(https://cloud.google.com/sdk/gcloud/reference/topic/filters).) + - Each additional filter in the list will act be added as an AND condition (filter1 + and filter2) . extends_documentation_fragment: gcp ''' @@ -62,265 +61,272 @@ RETURN = ''' items: - description: List of items - returned: always - type: complex - contains: - affinityCookieTtlSec: - description: - - Lifetime of cookies in seconds if session_affinity is GENERATED_COOKIE. If set to - 0, the cookie is non-persistent and lasts only until the end of the browser session - (or equivalent). The maximum allowed value for TTL is one day. - - When the load balancing scheme is INTERNAL, this field is not used. - returned: success - type: int - backends: - description: - - The list of backends that serve this BackendService. - returned: success - type: complex - contains: - balancingMode: - description: - - Specifies the balancing mode for this backend. - - For global HTTP(S) or TCP/SSL load balancing, the default is UTILIZATION. Valid - values are UTILIZATION, RATE (for HTTP(S)) and CONNECTION (for TCP/SSL). - - This cannot be used for internal load balancing. - returned: success - type: str - capacityScaler: - description: - - A multiplier applied to the group's maximum servicing capacity (based on UTILIZATION, - RATE or CONNECTION). - - Default value is 1, which means the group will serve up to 100% of its configured - capacity (depending on balancingMode). A setting of 0 means the group is completely - drained, offering 0% of its available Capacity. Valid range is [0.0,1.0]. - - This cannot be used for internal load balancing. - returned: success - type: str - description: - description: - - An optional description of this resource. - - Provide this property when you create the resource. - returned: success - type: str - group: - description: - - 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 - type: dict - maxConnections: - description: - - The max number of simultaneous connections for the group. Can be used with either - CONNECTION or UTILIZATION balancing modes. - - For CONNECTION mode, either maxConnections or maxConnectionsPerInstance must be - set. - - This cannot be used for internal load balancing. - returned: success - type: int - maxConnectionsPerInstance: - description: - - The max number of simultaneous connections that a single backend instance can handle. - This is used to calculate the capacity of the group. Can be used in either CONNECTION - or UTILIZATION balancing modes. - - For CONNECTION mode, either maxConnections or maxConnectionsPerInstance must be - set. - - This cannot be used for internal load balancing. - returned: success - type: int - maxRate: - description: - - The max requests per second (RPS) of the group. - - Can be used with either RATE or UTILIZATION balancing modes, but required if RATE - mode. For RATE mode, either maxRate or maxRatePerInstance must be set. - - This cannot be used for internal load balancing. - returned: success - type: int - maxRatePerInstance: - description: - - The max requests per second (RPS) that a single backend instance can handle. This - is used to calculate the capacity of the group. Can be used in either balancing - mode. For RATE mode, either maxRate or maxRatePerInstance must be set. - - This cannot be used for internal load balancing. - returned: success - type: str - maxUtilization: - description: - - Used when balancingMode is UTILIZATION. This ratio defines the CPU utilization target - for the group. The default is 0.8. Valid range is [0.0, 1.0]. - - This cannot be used for internal load balancing. - returned: success - type: str - cdnPolicy: - description: - - Cloud CDN configuration for this BackendService. - returned: success - type: complex - contains: - cacheKeyPolicy: - description: - - The CacheKeyPolicy for this CdnPolicy. - returned: success - type: complex - contains: - includeHost: - description: - - If true requests to different hosts will be cached separately. - returned: success - type: bool - includeProtocol: - description: - - If true, http and https requests will be cached separately. - returned: success - type: bool - includeQueryString: - description: - - If true, include query string parameters in the cache key according to query_string_whitelist - and query_string_blacklist. If neither is set, the entire query string will be included. - - If false, the query string will be excluded from the cache key entirely. - returned: success - type: bool - queryStringBlacklist: - description: - - Names of query string parameters to exclude in cache keys. - - All other parameters will be included. Either specify query_string_whitelist or - query_string_blacklist, not both. - - "'&' and '=' will be percent encoded and not treated as delimiters." - returned: success - type: list - queryStringWhitelist: - description: - - Names of query string parameters to include in cache keys. - - All other parameters will be excluded. Either specify query_string_whitelist or - query_string_blacklist, not both. - - "'&' and '=' will be percent encoded and not treated as delimiters." - returned: success - type: list - connectionDraining: - description: - - Settings for connection draining. - returned: success - type: complex - contains: - drainingTimeoutSec: - description: - - Time for which instance will be drained (not accept new connections, but still work - to finish started). - returned: success - type: int - creationTimestamp: - description: - - Creation timestamp in RFC3339 text format. - returned: success - type: str + description: List of items + returned: always + type: complex + contains: + affinityCookieTtlSec: + description: + - Lifetime of cookies in seconds if session_affinity is GENERATED_COOKIE. If + set to 0, the cookie is non-persistent and lasts only until the end of the + browser session (or equivalent). The maximum allowed value for TTL is one + day. + - When the load balancing scheme is INTERNAL, this field is not used. + returned: success + type: int + backends: + description: + - The list of backends that serve this BackendService. + returned: success + type: complex + contains: + balancingMode: + description: + - Specifies the balancing mode for this backend. + - For global HTTP(S) or TCP/SSL load balancing, the default is UTILIZATION. + Valid values are UTILIZATION, RATE (for HTTP(S)) and CONNECTION (for TCP/SSL). + - This cannot be used for internal load balancing. + returned: success + type: str + capacityScaler: + description: + - A multiplier applied to the group's maximum servicing capacity (based + on UTILIZATION, RATE or CONNECTION). + - Default value is 1, which means the group will serve up to 100% of its + configured capacity (depending on balancingMode). A setting of 0 means + the group is completely drained, offering 0% of its available Capacity. + Valid range is [0.0,1.0]. + - This cannot be used for internal load balancing. + returned: success + type: str description: - description: - - An optional description of this resource. - returned: success - type: str - enableCDN: - description: - - If true, enable Cloud CDN for this BackendService. - - When the load balancing scheme is INTERNAL, this field is not used. - returned: success - type: bool - healthChecks: - description: - - The list of URLs to the HttpHealthCheck or HttpsHealthCheck resource for health - checking this BackendService. Currently at most one health check can be specified, - and a health check is required. - - For internal load balancing, a URL to a HealthCheck resource must be specified instead. - returned: success - type: list - id: - description: - - The unique identifier for the resource. - returned: success - type: int - iap: - description: - - Settings for enabling Cloud Identity Aware Proxy. - returned: success - type: complex - contains: - enabled: - description: - - Enables IAP. - returned: success - type: bool - oauth2ClientId: - description: - - OAuth2 Client ID for IAP. - returned: success - type: str - oauth2ClientSecret: - description: - - OAuth2 Client Secret for IAP. - returned: success - type: str - oauth2ClientSecretSha256: - description: - - OAuth2 Client Secret SHA-256 for IAP. - returned: success - type: str - loadBalancingScheme: - description: - - Indicates whether the backend service will be used with internal or external load - balancing. A backend service created for one type of load balancing cannot be used - with the other. - returned: success - type: str - name: - description: - - Name of the resource. Provided by the client when the resource is created. The name - must be 1-63 characters long, and comply with RFC1035. Specifically, the name must - be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` - which means the first character must be a lowercase letter, and all following characters - must be a dash, lowercase letter, or digit, except the last character, which cannot - be a dash. - returned: success - type: str - portName: - description: - - Name of backend port. The same name should appear in the instance groups referenced - by this service. Required when the load balancing scheme is EXTERNAL. - - When the load balancing scheme is INTERNAL, this field is not used. - returned: success - type: str - protocol: - description: - - The protocol this BackendService uses to communicate with backends. - - Possible values are HTTP, HTTPS, TCP, and SSL. The default is HTTP. - - For internal load balancing, the possible values are TCP and UDP, and the default - is TCP. - returned: success - type: str - region: - description: - - The region where the regional backend service resides. - - This field is not applicable to global backend services. - returned: success - type: str - sessionAffinity: - description: - - Type of session affinity to use. The default is NONE. - - When the load balancing scheme is EXTERNAL, can be NONE, CLIENT_IP, or GENERATED_COOKIE. - - When the load balancing scheme is INTERNAL, can be NONE, CLIENT_IP, CLIENT_IP_PROTO, - or CLIENT_IP_PORT_PROTO. - - When the protocol is UDP, this field is not used. - returned: success - type: str - timeoutSec: - description: - - How many seconds to wait for the backend before considering it a failed request. - Default is 30 seconds. Valid range is [1, 86400]. - returned: success - type: int + description: + - An optional description of this resource. + - Provide this property when you create the resource. + returned: success + type: str + group: + description: + - 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 + type: dict + maxConnections: + description: + - The max number of simultaneous connections for the group. Can be used + with either CONNECTION or UTILIZATION balancing modes. + - For CONNECTION mode, either maxConnections or maxConnectionsPerInstance + must be set. + - This cannot be used for internal load balancing. + returned: success + type: int + maxConnectionsPerInstance: + description: + - The max number of simultaneous connections that a single backend instance + can handle. This is used to calculate the capacity of the group. Can be + used in either CONNECTION or UTILIZATION balancing modes. + - For CONNECTION mode, either maxConnections or maxConnectionsPerInstance + must be set. + - This cannot be used for internal load balancing. + returned: success + type: int + maxRate: + description: + - The max requests per second (RPS) of the group. + - Can be used with either RATE or UTILIZATION balancing modes, but required + if RATE mode. For RATE mode, either maxRate or maxRatePerInstance must + be set. + - This cannot be used for internal load balancing. + returned: success + type: int + maxRatePerInstance: + description: + - The max requests per second (RPS) that a single backend instance can handle. + This is used to calculate the capacity of the group. Can be used in either + balancing mode. For RATE mode, either maxRate or maxRatePerInstance must + be set. + - This cannot be used for internal load balancing. + returned: success + type: str + maxUtilization: + description: + - Used when balancingMode is UTILIZATION. This ratio defines the CPU utilization + target for the group. The default is 0.8. Valid range is [0.0, 1.0]. + - This cannot be used for internal load balancing. + returned: success + type: str + cdnPolicy: + description: + - Cloud CDN configuration for this BackendService. + returned: success + type: complex + contains: + cacheKeyPolicy: + description: + - The CacheKeyPolicy for this CdnPolicy. + returned: success + type: complex + contains: + includeHost: + description: + - If true requests to different hosts will be cached separately. + returned: success + type: bool + includeProtocol: + description: + - If true, http and https requests will be cached separately. + returned: success + type: bool + includeQueryString: + description: + - If true, include query string parameters in the cache key according + to query_string_whitelist and query_string_blacklist. If neither is + set, the entire query string will be included. + - If false, the query string will be excluded from the cache key entirely. + returned: success + type: bool + queryStringBlacklist: + description: + - Names of query string parameters to exclude in cache keys. + - All other parameters will be included. Either specify query_string_whitelist + or query_string_blacklist, not both. + - "'&' and '=' will be percent encoded and not treated as delimiters." + returned: success + type: list + queryStringWhitelist: + description: + - Names of query string parameters to include in cache keys. + - All other parameters will be excluded. Either specify query_string_whitelist + or query_string_blacklist, not both. + - "'&' and '=' will be percent encoded and not treated as delimiters." + returned: success + type: list + connectionDraining: + description: + - Settings for connection draining. + returned: success + type: complex + contains: + drainingTimeoutSec: + description: + - Time for which instance will be drained (not accept new connections, but + still work to finish started). + returned: success + type: int + creationTimestamp: + description: + - Creation timestamp in RFC3339 text format. + returned: success + type: str + description: + description: + - An optional description of this resource. + returned: success + type: str + enableCDN: + description: + - If true, enable Cloud CDN for this BackendService. + - When the load balancing scheme is INTERNAL, this field is not used. + returned: success + type: bool + healthChecks: + description: + - The list of URLs to the HttpHealthCheck or HttpsHealthCheck resource for health + checking this BackendService. Currently at most one health check can be specified, + and a health check is required. + - For internal load balancing, a URL to a HealthCheck resource must be specified + instead. + returned: success + type: list + id: + description: + - The unique identifier for the resource. + returned: success + type: int + iap: + description: + - Settings for enabling Cloud Identity Aware Proxy. + returned: success + type: complex + contains: + enabled: + description: + - Enables IAP. + returned: success + type: bool + oauth2ClientId: + description: + - OAuth2 Client ID for IAP. + returned: success + type: str + oauth2ClientSecret: + description: + - OAuth2 Client Secret for IAP. + returned: success + type: str + oauth2ClientSecretSha256: + description: + - OAuth2 Client Secret SHA-256 for IAP. + returned: success + type: str + loadBalancingScheme: + description: + - Indicates whether the backend service will be used with internal or external + load balancing. A backend service created for one type of load balancing cannot + be used with the other. + returned: success + type: str + name: + description: + - Name of the resource. Provided by the client when the resource is created. + The name must be 1-63 characters long, and comply with RFC1035. Specifically, + the name must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` + which means the first character must be a lowercase letter, and all following + characters must be a dash, lowercase letter, or digit, except the last character, + which cannot be a dash. + returned: success + type: str + portName: + description: + - Name of backend port. The same name should appear in the instance groups referenced + by this service. Required when the load balancing scheme is EXTERNAL. + - When the load balancing scheme is INTERNAL, this field is not used. + returned: success + type: str + protocol: + description: + - The protocol this BackendService uses to communicate with backends. + - Possible values are HTTP, HTTPS, TCP, and SSL. The default is HTTP. + - For internal load balancing, the possible values are TCP and UDP, and the + default is TCP. + returned: success + type: str + region: + description: + - The region where the regional backend service resides. + - This field is not applicable to global backend services. + returned: success + type: str + sessionAffinity: + description: + - Type of session affinity to use. The default is NONE. + - When the load balancing scheme is EXTERNAL, can be NONE, CLIENT_IP, or GENERATED_COOKIE. + - When the load balancing scheme is INTERNAL, can be NONE, CLIENT_IP, CLIENT_IP_PROTO, + or CLIENT_IP_PORT_PROTO. + - When the protocol is UDP, this field is not used. + returned: success + type: str + timeoutSec: + description: + - How many seconds to wait for the backend before considering it a failed request. + Default is 30 seconds. Valid range is [1, 86400]. + returned: success + type: int ''' ################################################################################ diff --git a/lib/ansible/modules/cloud/google/gcp_compute_disk.py b/lib/ansible/modules/cloud/google/gcp_compute_disk.py index ff840386d248aa..46913ae4c65e4f 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_disk.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_disk.py @@ -32,155 +32,156 @@ --- module: gcp_compute_disk description: - - Persistent disks are durable storage devices that function similarly to the physical - disks in a desktop or a server. Compute Engine manages the hardware behind these - devices to ensure data redundancy and optimize performance for you. Persistent disks - are available as either standard hard disk drives (HDD) or solid-state drives (SSD). - - Persistent disks are located independently from your virtual machine instances, - so you can detach or move persistent disks to keep your data even after you delete - your instances. Persistent disk performance scales automatically with size, so you - can resize your existing persistent disks or add more persistent disks to an instance - to meet your performance and storage space requirements. - - Add a persistent disk to your instance when you need reliable and affordable storage - with consistent performance characteristics. +- Persistent disks are durable storage devices that function similarly to the physical + disks in a desktop or a server. Compute Engine manages the hardware behind these + devices to ensure data redundancy and optimize performance for you. Persistent disks + are available as either standard hard disk drives (HDD) or solid-state drives (SSD). +- Persistent disks are located independently from your virtual machine instances, + so you can detach or move persistent disks to keep your data even after you delete + your instances. Persistent disk performance scales automatically with size, so you + can resize your existing persistent disks or add more persistent disks to an instance + to meet your performance and storage space requirements. +- Add a persistent disk to your instance when you need reliable and affordable storage + with consistent performance characteristics. short_description: Creates a GCP Disk version_added: 2.6 author: Google Inc. (@googlecloudplatform) requirements: - - python >= 2.6 - - requests >= 2.18.4 - - google-auth >= 1.3.0 +- python >= 2.6 +- requests >= 2.18.4 +- google-auth >= 1.3.0 options: - state: - description: - - Whether the given object should exist in GCP - choices: ['present', 'absent'] - default: 'present' + state: description: - description: - - An optional description of this resource. Provide this property when you create - the resource. - required: false - labels: - description: - - Labels to apply to this disk. A list of key->value pairs. - required: false - version_added: 2.7 - licenses: - description: - - Any applicable publicly visible licenses. - required: false - name: - description: - - Name of the resource. Provided by the client when the resource is created. The name - must be 1-63 characters long, and comply with RFC1035. Specifically, the name must - be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` - which means the first character must be a lowercase letter, and all following characters - must be a dash, lowercase letter, or digit, except the last character, which cannot - be a dash. - required: true - size_gb: - description: - - Size of the persistent disk, specified in GB. You can specify this field when creating - a persistent disk using the sourceImage or sourceSnapshot parameter, or specify - it alone to create an empty persistent disk. - - If you specify this field along with sourceImage or sourceSnapshot, the value of - sizeGb must not be less than the size of the sourceImage or the size of the snapshot. - required: false - type: - description: - - URL of the disk type resource describing which disk type to use to create the disk. - Provide this when creating the disk. + - Whether the given object should exist in GCP + choices: + - present + - absent + default: present + description: + description: + - An optional description of this resource. Provide this property when you create + the resource. + required: false + labels: + description: + - Labels to apply to this disk. A list of key->value pairs. + required: false + version_added: 2.7 + licenses: + description: + - Any applicable publicly visible licenses. + required: false + name: + description: + - Name of the resource. Provided by the client when the resource is created. The + name must be 1-63 characters long, and comply with RFC1035. Specifically, the + name must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` + which means the first character must be a lowercase letter, and all following + characters must be a dash, lowercase letter, or digit, except the last character, + which cannot be a dash. + required: true + size_gb: + description: + - Size of the persistent disk, specified in GB. You can specify this field when + creating a persistent disk using the sourceImage or sourceSnapshot parameter, + or specify it alone to create an empty persistent disk. + - If you specify this field along with sourceImage or sourceSnapshot, the value + of sizeGb must not be less than the size of the sourceImage or the size of the + snapshot. + required: false + type: + description: + - URL of the disk type resource describing which disk type to use to create the + disk. Provide this when creating the disk. + required: false + version_added: 2.7 + source_image: + description: + - The source image used to create this disk. If the source image is deleted, this + field will not be set. + - 'To create a disk with one of the public operating system images, specify the + image by its family name. For example, specify family/debian-8 to use the latest + Debian 8 image: projects/debian-cloud/global/images/family/debian-8 Alternatively, + use a specific version of a public operating system image: projects/debian-cloud/global/images/debian-8-jessie-vYYYYMMDD + To create a disk with a private image that you created, specify the image name + in the following format: global/images/my-private-image You can also specify + a private image by its image family, which returns the latest version of the + image in that family. Replace the image name with family/family-name: global/images/family/my-private-family + .' + required: false + zone: + description: + - A reference to the zone where the disk resides. + required: true + source_image_encryption_key: + description: + - The customer-supplied encryption key of the source image. Required if the source + image is protected by a customer-supplied encryption key. + required: false + suboptions: + raw_key: + description: + - Specifies a 256-bit customer-supplied encryption key, encoded in RFC 4648 + base64 to either encrypt or decrypt this resource. required: false - version_added: 2.7 - source_image: + sha256: description: - - The source image used to create this disk. If the source image is deleted, this - field will not be set. - - 'To create a disk with one of the public operating system images, specify the image - by its family name. For example, specify family/debian-8 to use the latest Debian - 8 image: projects/debian-cloud/global/images/family/debian-8 Alternatively, use - a specific version of a public operating system image: projects/debian-cloud/global/images/debian-8-jessie-vYYYYMMDD To - create a disk with a private image that you created, specify the image name in the - following format: global/images/my-private-image You can also specify a private - image by its image family, which returns the latest version of the image in that - family. Replace the image name with family/family-name: global/images/family/my-private-family - .' + - The RFC 4648 base64 encoded SHA-256 hash of the customer-supplied encryption + key that protects this resource. required: false - zone: - description: - - A reference to the zone where the disk resides. - required: true - source_image_encryption_key: - description: - - The customer-supplied encryption key of the source image. Required if the source - image is protected by a customer-supplied encryption key. + disk_encryption_key: + description: + - Encrypts the disk using a customer-supplied encryption key. + - After you encrypt a disk with a customer-supplied key, you must provide the + same key if you use the disk later (e.g. to create a disk snapshot or an image, + or to attach the disk to a virtual machine). + - Customer-supplied encryption keys do not protect access to metadata of the disk. + - If you do not provide an encryption key when creating the disk, then the disk + will be encrypted using an automatically generated key and you do not need to + provide a key to use the disk later. + required: false + suboptions: + raw_key: + description: + - Specifies a 256-bit customer-supplied encryption key, encoded in RFC 4648 + base64 to either encrypt or decrypt this resource. required: false - suboptions: - raw_key: - description: - - Specifies a 256-bit customer-supplied encryption key, encoded in RFC 4648 base64 - to either encrypt or decrypt this resource. - required: false - sha256: - description: - - The RFC 4648 base64 encoded SHA-256 hash of the customer-supplied encryption key - that protects this resource. - required: false - disk_encryption_key: + sha256: description: - - Encrypts the disk using a customer-supplied encryption key. - - After you encrypt a disk with a customer-supplied key, you must provide the same - key if you use the disk later (e.g. to create a disk snapshot or an image, or to - attach the disk to a virtual machine). - - Customer-supplied encryption keys do not protect access to metadata of the disk. - - If you do not provide an encryption key when creating the disk, then the disk will - be encrypted using an automatically generated key and you do not need to provide - a key to use the disk later. + - The RFC 4648 base64 encoded SHA-256 hash of the customer-supplied encryption + key that protects this resource. required: false - suboptions: - raw_key: - description: - - Specifies a 256-bit customer-supplied encryption key, encoded in RFC 4648 base64 - to either encrypt or decrypt this resource. - required: false - sha256: - description: - - The RFC 4648 base64 encoded SHA-256 hash of the customer-supplied encryption key - that protects this resource. - required: false - source_snapshot: - description: - - 'The source snapshot used to create this disk. You can provide this as a partial or - full URL to the resource. For example, the following are valid values: * - `U(https://www.googleapis.com/compute/v1/projects/project/global/snapshots/snapshot`) - * `projects/project/global/snapshots/snapshot` * `global/snapshots/snapshot` .' - - 'This field represents a link to a Snapshot resource in GCP. It can be specified - in two ways. You can add `register: name-of-resource` to a gcp_compute_snapshot - task and then set this source_snapshot field to "{{ name-of-resource }}" Alternatively, - you can set this source_snapshot to a dictionary with the selfLink key where the - value is the selfLink of your Snapshot.' + source_snapshot: + description: + - The source snapshot used to create this disk. You can provide this as a partial + or full URL to the resource. + - 'This field represents a link to a Snapshot resource in GCP. It can be specified + in two ways. You can add `register: name-of-resource` to a gcp_compute_snapshot + task and then set this source_snapshot field to "{{ name-of-resource }}" Alternatively, + you can set this source_snapshot to a dictionary with the selfLink key where + the value is the selfLink of your Snapshot' + required: false + source_snapshot_encryption_key: + description: + - The customer-supplied encryption key of the source snapshot. Required if the + source snapshot is protected by a customer-supplied encryption key. + required: false + suboptions: + raw_key: + description: + - Specifies a 256-bit customer-supplied encryption key, encoded in RFC 4648 + base64 to either encrypt or decrypt this resource. required: false - source_snapshot_encryption_key: + sha256: description: - - The customer-supplied encryption key of the source snapshot. Required if the source - snapshot is protected by a customer-supplied encryption key. + - The RFC 4648 base64 encoded SHA-256 hash of the customer-supplied encryption + key that protects this resource. required: false - suboptions: - raw_key: - description: - - Specifies a 256-bit customer-supplied encryption key, encoded in RFC 4648 base64 - to either encrypt or decrypt this resource. - required: false - sha256: - description: - - The RFC 4648 base64 encoded SHA-256 hash of the customer-supplied encryption key - that protects this resource. - required: false extends_documentation_fragment: gcp notes: - - "API Reference: U(https://cloud.google.com/compute/docs/reference/latest/disks)" - - "Adding a persistent disk: U(https://cloud.google.com/compute/docs/disks/add-persistent-disk)" +- 'API Reference: U(https://cloud.google.com/compute/docs/reference/latest/disks)' +- 'Adding a persistent disk: U(https://cloud.google.com/compute/docs/disks/add-persistent-disk)' ''' EXAMPLES = ''' @@ -198,188 +199,187 @@ ''' RETURN = ''' - labelFingerprint: - description: - - The fingerprint used for optimistic locking of this resource. Used internally during - updates. - returned: success - type: str - creationTimestamp: - description: - - Creation timestamp in RFC3339 text format. - returned: success - type: str - description: - description: - - An optional description of this resource. Provide this property when you create - the resource. - returned: success - type: str - id: - description: - - The unique identifier for the resource. - returned: success - type: int - lastAttachTimestamp: - description: - - Last attach timestamp in RFC3339 text format. - returned: success - type: str - lastDetachTimestamp: - description: - - Last dettach timestamp in RFC3339 text format. - returned: success - type: str - labels: - description: - - Labels to apply to this disk. A list of key->value pairs. - returned: success - type: dict - licenses: - description: - - Any applicable publicly visible licenses. - returned: success - type: list - name: - description: - - Name of the resource. Provided by the client when the resource is created. The name - must be 1-63 characters long, and comply with RFC1035. Specifically, the name must - be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` - which means the first character must be a lowercase letter, and all following characters - must be a dash, lowercase letter, or digit, except the last character, which cannot - be a dash. - returned: success - type: str - sizeGb: - description: - - Size of the persistent disk, specified in GB. You can specify this field when creating - a persistent disk using the sourceImage or sourceSnapshot parameter, or specify - it alone to create an empty persistent disk. - - If you specify this field along with sourceImage or sourceSnapshot, the value of - sizeGb must not be less than the size of the sourceImage or the size of the snapshot. - returned: success - type: int - users: - description: - - 'Links to the users of the disk (attached instances) in form: project/zones/zone/instances/instance - .' - returned: success - type: list - type: - description: - - URL of the disk type resource describing which disk type to use to create the disk. - Provide this when creating the disk. - returned: success - type: str - sourceImage: - description: - - The source image used to create this disk. If the source image is deleted, this - field will not be set. - - 'To create a disk with one of the public operating system images, specify the image - by its family name. For example, specify family/debian-8 to use the latest Debian - 8 image: projects/debian-cloud/global/images/family/debian-8 Alternatively, use - a specific version of a public operating system image: projects/debian-cloud/global/images/debian-8-jessie-vYYYYMMDD To - create a disk with a private image that you created, specify the image name in the - following format: global/images/my-private-image You can also specify a private - image by its image family, which returns the latest version of the image in that - family. Replace the image name with family/family-name: global/images/family/my-private-family - .' - returned: success - type: str - zone: - description: - - A reference to the zone where the disk resides. - returned: success - type: str - sourceImageEncryptionKey: - description: - - The customer-supplied encryption key of the source image. Required if the source - image is protected by a customer-supplied encryption key. - returned: success - type: complex - contains: - rawKey: - description: - - Specifies a 256-bit customer-supplied encryption key, encoded in RFC 4648 base64 - to either encrypt or decrypt this resource. - returned: success - type: str - sha256: - description: - - The RFC 4648 base64 encoded SHA-256 hash of the customer-supplied encryption key - that protects this resource. - returned: success - type: str - sourceImageId: - description: - - The ID value of the image used to create this disk. This value identifies the exact - image that was used to create this persistent disk. For example, if you created - the persistent disk from an image that was later deleted and recreated under the - same name, the source image ID would identify the exact version of the image that - was used. - returned: success - type: str - diskEncryptionKey: - description: - - Encrypts the disk using a customer-supplied encryption key. - - After you encrypt a disk with a customer-supplied key, you must provide the same - key if you use the disk later (e.g. to create a disk snapshot or an image, or to - attach the disk to a virtual machine). - - Customer-supplied encryption keys do not protect access to metadata of the disk. - - If you do not provide an encryption key when creating the disk, then the disk will - be encrypted using an automatically generated key and you do not need to provide - a key to use the disk later. - returned: success - type: complex - contains: - rawKey: - description: - - Specifies a 256-bit customer-supplied encryption key, encoded in RFC 4648 base64 - to either encrypt or decrypt this resource. - returned: success - type: str - sha256: - description: - - The RFC 4648 base64 encoded SHA-256 hash of the customer-supplied encryption key - that protects this resource. - returned: success - type: str - sourceSnapshot: - description: - - 'The source snapshot used to create this disk. You can provide this as a partial or - full URL to the resource. For example, the following are valid values: * - `U(https://www.googleapis.com/compute/v1/projects/project/global/snapshots/snapshot`) - * `projects/project/global/snapshots/snapshot` * `global/snapshots/snapshot` .' - returned: success - type: dict - sourceSnapshotEncryptionKey: - description: - - The customer-supplied encryption key of the source snapshot. Required if the source - snapshot is protected by a customer-supplied encryption key. - returned: success - type: complex - contains: - rawKey: - description: - - Specifies a 256-bit customer-supplied encryption key, encoded in RFC 4648 base64 - to either encrypt or decrypt this resource. - returned: success - type: str - sha256: - description: - - The RFC 4648 base64 encoded SHA-256 hash of the customer-supplied encryption key - that protects this resource. - returned: success - type: str - sourceSnapshotId: - description: - - The unique ID of the snapshot used to create this disk. This value identifies the - exact snapshot that was used to create this persistent disk. For example, if you - created the persistent disk from a snapshot that was later deleted and recreated - under the same name, the source snapshot ID would identify the exact version of - the snapshot that was used. - returned: success - type: str +labelFingerprint: + description: + - The fingerprint used for optimistic locking of this resource. Used internally + during updates. + returned: success + type: str +creationTimestamp: + description: + - Creation timestamp in RFC3339 text format. + returned: success + type: str +description: + description: + - An optional description of this resource. Provide this property when you create + the resource. + returned: success + type: str +id: + description: + - The unique identifier for the resource. + returned: success + type: int +lastAttachTimestamp: + description: + - Last attach timestamp in RFC3339 text format. + returned: success + type: str +lastDetachTimestamp: + description: + - Last dettach timestamp in RFC3339 text format. + returned: success + type: str +labels: + description: + - Labels to apply to this disk. A list of key->value pairs. + returned: success + type: dict +licenses: + description: + - Any applicable publicly visible licenses. + returned: success + type: list +name: + description: + - Name of the resource. Provided by the client when the resource is created. The + name must be 1-63 characters long, and comply with RFC1035. Specifically, the + name must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` + which means the first character must be a lowercase letter, and all following + characters must be a dash, lowercase letter, or digit, except the last character, + which cannot be a dash. + returned: success + type: str +sizeGb: + description: + - Size of the persistent disk, specified in GB. You can specify this field when + creating a persistent disk using the sourceImage or sourceSnapshot parameter, + or specify it alone to create an empty persistent disk. + - If you specify this field along with sourceImage or sourceSnapshot, the value + of sizeGb must not be less than the size of the sourceImage or the size of the + snapshot. + returned: success + type: int +users: + description: + - 'Links to the users of the disk (attached instances) in form: project/zones/zone/instances/instance + .' + returned: success + type: list +type: + description: + - URL of the disk type resource describing which disk type to use to create the + disk. Provide this when creating the disk. + returned: success + type: str +sourceImage: + description: + - The source image used to create this disk. If the source image is deleted, this + field will not be set. + - 'To create a disk with one of the public operating system images, specify the + image by its family name. For example, specify family/debian-8 to use the latest + Debian 8 image: projects/debian-cloud/global/images/family/debian-8 Alternatively, + use a specific version of a public operating system image: projects/debian-cloud/global/images/debian-8-jessie-vYYYYMMDD + To create a disk with a private image that you created, specify the image name + in the following format: global/images/my-private-image You can also specify a + private image by its image family, which returns the latest version of the image + in that family. Replace the image name with family/family-name: global/images/family/my-private-family + .' + returned: success + type: str +zone: + description: + - A reference to the zone where the disk resides. + returned: success + type: str +sourceImageEncryptionKey: + description: + - The customer-supplied encryption key of the source image. Required if the source + image is protected by a customer-supplied encryption key. + returned: success + type: complex + contains: + rawKey: + description: + - Specifies a 256-bit customer-supplied encryption key, encoded in RFC 4648 + base64 to either encrypt or decrypt this resource. + returned: success + type: str + sha256: + description: + - The RFC 4648 base64 encoded SHA-256 hash of the customer-supplied encryption + key that protects this resource. + returned: success + type: str +sourceImageId: + description: + - The ID value of the image used to create this disk. This value identifies the + exact image that was used to create this persistent disk. For example, if you + created the persistent disk from an image that was later deleted and recreated + under the same name, the source image ID would identify the exact version of the + image that was used. + returned: success + type: str +diskEncryptionKey: + description: + - Encrypts the disk using a customer-supplied encryption key. + - After you encrypt a disk with a customer-supplied key, you must provide the same + key if you use the disk later (e.g. to create a disk snapshot or an image, or + to attach the disk to a virtual machine). + - Customer-supplied encryption keys do not protect access to metadata of the disk. + - If you do not provide an encryption key when creating the disk, then the disk + will be encrypted using an automatically generated key and you do not need to + provide a key to use the disk later. + returned: success + type: complex + contains: + rawKey: + description: + - Specifies a 256-bit customer-supplied encryption key, encoded in RFC 4648 + base64 to either encrypt or decrypt this resource. + returned: success + type: str + sha256: + description: + - The RFC 4648 base64 encoded SHA-256 hash of the customer-supplied encryption + key that protects this resource. + returned: success + type: str +sourceSnapshot: + description: + - The source snapshot used to create this disk. You can provide this as a partial + or full URL to the resource. + returned: success + type: dict +sourceSnapshotEncryptionKey: + description: + - The customer-supplied encryption key of the source snapshot. Required if the source + snapshot is protected by a customer-supplied encryption key. + returned: success + type: complex + contains: + rawKey: + description: + - Specifies a 256-bit customer-supplied encryption key, encoded in RFC 4648 + base64 to either encrypt or decrypt this resource. + returned: success + type: str + sha256: + description: + - The RFC 4648 base64 encoded SHA-256 hash of the customer-supplied encryption + key that protects this resource. + returned: success + type: str +sourceSnapshotId: + description: + - The unique ID of the snapshot used to create this disk. This value identifies + the exact snapshot that was used to create this persistent disk. For example, + if you created the persistent disk from a snapshot that was later deleted and + recreated under the same name, the source snapshot ID would identify the exact + version of the snapshot that was used. + returned: success + type: str ''' ################################################################################ diff --git a/lib/ansible/modules/cloud/google/gcp_compute_disk_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_disk_facts.py index 5c7795d013a52a..c65e9d883d10ea 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_disk_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_disk_facts.py @@ -32,25 +32,24 @@ --- module: gcp_compute_disk_facts description: - - Gather facts for GCP Disk +- Gather facts for GCP Disk short_description: Gather facts for GCP Disk version_added: 2.7 author: Google Inc. (@googlecloudplatform) requirements: - - python >= 2.6 - - requests >= 2.18.4 - - google-auth >= 1.3.0 +- python >= 2.6 +- requests >= 2.18.4 +- google-auth >= 1.3.0 options: - filters: - description: - A list of filter value pairs. Available filters are listed here - U(https://cloud.google.com/sdk/gcloud/reference/topic/filters). - Each additional filter in the list will act be added as an AND condition - (filter1 and filter2) - zone: - description: - - A reference to the zone where the disk resides. - required: true + filters: + description: + - A list of filter value pairs. Available filters are listed here U(U(https://cloud.google.com/sdk/gcloud/reference/topic/filters).) + - Each additional filter in the list will act be added as an AND condition (filter1 + and filter2) . + zone: + description: + - A reference to the zone where the disk resides. + required: true extends_documentation_fragment: gcp ''' @@ -67,192 +66,193 @@ RETURN = ''' items: - description: List of items - returned: always - type: complex - contains: - labelFingerprint: - description: - - The fingerprint used for optimistic locking of this resource. Used internally during - updates. - returned: success - type: str - creationTimestamp: - description: - - Creation timestamp in RFC3339 text format. - returned: success - type: str - description: - description: - - An optional description of this resource. Provide this property when you create - the resource. - returned: success - type: str - id: - description: - - The unique identifier for the resource. - returned: success - type: int - lastAttachTimestamp: - description: - - Last attach timestamp in RFC3339 text format. - returned: success - type: str - lastDetachTimestamp: - description: - - Last dettach timestamp in RFC3339 text format. - returned: success - type: str - labels: - description: - - Labels to apply to this disk. A list of key->value pairs. - returned: success - type: dict - licenses: - description: - - Any applicable publicly visible licenses. - returned: success - type: list - name: - description: - - Name of the resource. Provided by the client when the resource is created. The name - must be 1-63 characters long, and comply with RFC1035. Specifically, the name must - be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` - which means the first character must be a lowercase letter, and all following characters - must be a dash, lowercase letter, or digit, except the last character, which cannot - be a dash. - returned: success - type: str - sizeGb: - description: - - Size of the persistent disk, specified in GB. You can specify this field when creating - a persistent disk using the sourceImage or sourceSnapshot parameter, or specify - it alone to create an empty persistent disk. - - If you specify this field along with sourceImage or sourceSnapshot, the value of - sizeGb must not be less than the size of the sourceImage or the size of the snapshot. - returned: success - type: int - users: - description: - - 'Links to the users of the disk (attached instances) in form: project/zones/zone/instances/instance - .' - returned: success - type: list - type: - description: - - URL of the disk type resource describing which disk type to use to create the disk. - Provide this when creating the disk. - returned: success - type: str - sourceImage: - description: - - The source image used to create this disk. If the source image is deleted, this - field will not be set. - - 'To create a disk with one of the public operating system images, specify the image - by its family name. For example, specify family/debian-8 to use the latest Debian - 8 image: projects/debian-cloud/global/images/family/debian-8 Alternatively, use - a specific version of a public operating system image: projects/debian-cloud/global/images/debian-8-jessie-vYYYYMMDD To - create a disk with a private image that you created, specify the image name in the - following format: global/images/my-private-image You can also specify a private - image by its image family, which returns the latest version of the image in that - family. Replace the image name with family/family-name: global/images/family/my-private-family - .' - returned: success - type: str - zone: - description: - - A reference to the zone where the disk resides. - returned: success - type: str - sourceImageEncryptionKey: - description: - - The customer-supplied encryption key of the source image. Required if the source - image is protected by a customer-supplied encryption key. - returned: success - type: complex - contains: - rawKey: - description: - - Specifies a 256-bit customer-supplied encryption key, encoded in RFC 4648 base64 - to either encrypt or decrypt this resource. - returned: success - type: str - sha256: - description: - - The RFC 4648 base64 encoded SHA-256 hash of the customer-supplied encryption key - that protects this resource. - returned: success - type: str - sourceImageId: - description: - - The ID value of the image used to create this disk. This value identifies the exact - image that was used to create this persistent disk. For example, if you created - the persistent disk from an image that was later deleted and recreated under the - same name, the source image ID would identify the exact version of the image that - was used. - returned: success - type: str - diskEncryptionKey: - description: - - Encrypts the disk using a customer-supplied encryption key. - - After you encrypt a disk with a customer-supplied key, you must provide the same - key if you use the disk later (e.g. to create a disk snapshot or an image, or to - attach the disk to a virtual machine). - - Customer-supplied encryption keys do not protect access to metadata of the disk. - - If you do not provide an encryption key when creating the disk, then the disk will - be encrypted using an automatically generated key and you do not need to provide - a key to use the disk later. - returned: success - type: complex - contains: - rawKey: - description: - - Specifies a 256-bit customer-supplied encryption key, encoded in RFC 4648 base64 - to either encrypt or decrypt this resource. - returned: success - type: str - sha256: - description: - - The RFC 4648 base64 encoded SHA-256 hash of the customer-supplied encryption key - that protects this resource. - returned: success - type: str - sourceSnapshot: - description: - - 'The source snapshot used to create this disk. You can provide this as a partial - or full URL to the resource. For example, the following are valid values: * - `U(https://www.googleapis.com/compute/v1/projects/project/global/snapshots/snapshot`) - * `projects/project/global/snapshots/snapshot` * `global/snapshots/snapshot` .' - returned: success - type: dict - sourceSnapshotEncryptionKey: - description: - - The customer-supplied encryption key of the source snapshot. Required if the source - snapshot is protected by a customer-supplied encryption key. - returned: success - type: complex - contains: - rawKey: - description: - - Specifies a 256-bit customer-supplied encryption key, encoded in RFC 4648 base64 - to either encrypt or decrypt this resource. - returned: success - type: str - sha256: - description: - - The RFC 4648 base64 encoded SHA-256 hash of the customer-supplied encryption key - that protects this resource. - returned: success - type: str - sourceSnapshotId: - description: - - The unique ID of the snapshot used to create this disk. This value identifies the - exact snapshot that was used to create this persistent disk. For example, if you - created the persistent disk from a snapshot that was later deleted and recreated - under the same name, the source snapshot ID would identify the exact version of - the snapshot that was used. - returned: success - type: str + description: List of items + returned: always + type: complex + contains: + labelFingerprint: + description: + - The fingerprint used for optimistic locking of this resource. Used internally + during updates. + returned: success + type: str + creationTimestamp: + description: + - Creation timestamp in RFC3339 text format. + returned: success + type: str + description: + description: + - An optional description of this resource. Provide this property when you create + the resource. + returned: success + type: str + id: + description: + - The unique identifier for the resource. + returned: success + type: int + lastAttachTimestamp: + description: + - Last attach timestamp in RFC3339 text format. + returned: success + type: str + lastDetachTimestamp: + description: + - Last dettach timestamp in RFC3339 text format. + returned: success + type: str + labels: + description: + - Labels to apply to this disk. A list of key->value pairs. + returned: success + type: dict + licenses: + description: + - Any applicable publicly visible licenses. + returned: success + type: list + name: + description: + - Name of the resource. Provided by the client when the resource is created. + The name must be 1-63 characters long, and comply with RFC1035. Specifically, + the name must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` + which means the first character must be a lowercase letter, and all following + characters must be a dash, lowercase letter, or digit, except the last character, + which cannot be a dash. + returned: success + type: str + sizeGb: + description: + - Size of the persistent disk, specified in GB. You can specify this field when + creating a persistent disk using the sourceImage or sourceSnapshot parameter, + or specify it alone to create an empty persistent disk. + - If you specify this field along with sourceImage or sourceSnapshot, the value + of sizeGb must not be less than the size of the sourceImage or the size of + the snapshot. + returned: success + type: int + users: + description: + - 'Links to the users of the disk (attached instances) in form: project/zones/zone/instances/instance + .' + returned: success + type: list + type: + description: + - URL of the disk type resource describing which disk type to use to create + the disk. Provide this when creating the disk. + returned: success + type: str + sourceImage: + description: + - The source image used to create this disk. If the source image is deleted, + this field will not be set. + - 'To create a disk with one of the public operating system images, specify + the image by its family name. For example, specify family/debian-8 to use + the latest Debian 8 image: projects/debian-cloud/global/images/family/debian-8 + Alternatively, use a specific version of a public operating system image: + projects/debian-cloud/global/images/debian-8-jessie-vYYYYMMDD To create a + disk with a private image that you created, specify the image name in the + following format: global/images/my-private-image You can also specify a private + image by its image family, which returns the latest version of the image in + that family. Replace the image name with family/family-name: global/images/family/my-private-family + .' + returned: success + type: str + zone: + description: + - A reference to the zone where the disk resides. + returned: success + type: str + sourceImageEncryptionKey: + description: + - The customer-supplied encryption key of the source image. Required if the + source image is protected by a customer-supplied encryption key. + returned: success + type: complex + contains: + rawKey: + description: + - Specifies a 256-bit customer-supplied encryption key, encoded in RFC 4648 + base64 to either encrypt or decrypt this resource. + returned: success + type: str + sha256: + description: + - The RFC 4648 base64 encoded SHA-256 hash of the customer-supplied encryption + key that protects this resource. + returned: success + type: str + sourceImageId: + description: + - The ID value of the image used to create this disk. This value identifies + the exact image that was used to create this persistent disk. For example, + if you created the persistent disk from an image that was later deleted and + recreated under the same name, the source image ID would identify the exact + version of the image that was used. + returned: success + type: str + diskEncryptionKey: + description: + - Encrypts the disk using a customer-supplied encryption key. + - After you encrypt a disk with a customer-supplied key, you must provide the + same key if you use the disk later (e.g. to create a disk snapshot or an image, + or to attach the disk to a virtual machine). + - Customer-supplied encryption keys do not protect access to metadata of the + disk. + - If you do not provide an encryption key when creating the disk, then the disk + will be encrypted using an automatically generated key and you do not need + to provide a key to use the disk later. + returned: success + type: complex + contains: + rawKey: + description: + - Specifies a 256-bit customer-supplied encryption key, encoded in RFC 4648 + base64 to either encrypt or decrypt this resource. + returned: success + type: str + sha256: + description: + - The RFC 4648 base64 encoded SHA-256 hash of the customer-supplied encryption + key that protects this resource. + returned: success + type: str + sourceSnapshot: + description: + - The source snapshot used to create this disk. You can provide this as a partial + or full URL to the resource. + returned: success + type: dict + sourceSnapshotEncryptionKey: + description: + - The customer-supplied encryption key of the source snapshot. Required if the + source snapshot is protected by a customer-supplied encryption key. + returned: success + type: complex + contains: + rawKey: + description: + - Specifies a 256-bit customer-supplied encryption key, encoded in RFC 4648 + base64 to either encrypt or decrypt this resource. + returned: success + type: str + sha256: + description: + - The RFC 4648 base64 encoded SHA-256 hash of the customer-supplied encryption + key that protects this resource. + returned: success + type: str + sourceSnapshotId: + description: + - The unique ID of the snapshot used to create this disk. This value identifies + the exact snapshot that was used to create this persistent disk. For example, + if you created the persistent disk from a snapshot that was later deleted + and recreated under the same name, the source snapshot ID would identify the + exact version of the snapshot that was used. + returned: success + type: str ''' ################################################################################ diff --git a/lib/ansible/modules/cloud/google/gcp_compute_firewall.py b/lib/ansible/modules/cloud/google/gcp_compute_firewall.py index 09fcadb93fa4f7..a1c5bac9110558 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_firewall.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_firewall.py @@ -32,182 +32,190 @@ --- module: gcp_compute_firewall description: - - Each network has its own firewall controlling access to and from the instances. - - All traffic to instances, even from other instances, is blocked by the firewall - unless firewall rules are created to allow it. - - The default network has automatically created firewall rules that are shown in default - firewall rules. No manually created network has automatically created firewall rules - except for a default "allow" rule for outgoing traffic and a default "deny" for - incoming traffic. For all networks except the default network, you must create any - firewall rules you need. +- Each network has its own firewall controlling access to and from the instances. +- All traffic to instances, even from other instances, is blocked by the firewall + unless firewall rules are created to allow it. +- The default network has automatically created firewall rules that are shown in default + firewall rules. No manually created network has automatically created firewall rules + except for a default "allow" rule for outgoing traffic and a default "deny" for + incoming traffic. For all networks except the default network, you must create any + firewall rules you need. short_description: Creates a GCP Firewall version_added: 2.6 author: Google Inc. (@googlecloudplatform) requirements: - - python >= 2.6 - - requests >= 2.18.4 - - google-auth >= 1.3.0 +- python >= 2.6 +- requests >= 2.18.4 +- google-auth >= 1.3.0 options: - state: - description: - - Whether the given object should exist in GCP - choices: ['present', 'absent'] - default: 'present' - allowed: - description: - - The list of ALLOW rules specified by this firewall. Each rule specifies a protocol - and port-range tuple that describes a permitted connection. - required: false - suboptions: - ip_protocol: - description: - - The IP protocol to which this rule applies. The protocol type is required when creating - a firewall rule. This value can either be one of the following well known protocol - strings (tcp, udp, icmp, esp, ah, sctp), or the IP protocol number. - required: true - ports: - description: - - An optional list of ports to which this rule applies. This field is only applicable - for UDP or TCP protocol. Each entry must be either an integer or a range. If not - specified, this rule applies to connections through any port. - - 'Example inputs include: ["22"], ["80","443"], and ["12345-12349"].' - required: false - denied: - description: - - The list of DENY rules specified by this firewall. Each rule specifies a protocol - and port-range tuple that describes a denied connection. - required: false - version_added: 2.8 - suboptions: - ip_protocol: - description: - - The IP protocol to which this rule applies. The protocol type is required when creating - a firewall rule. This value can either be one of the following well known protocol - strings (tcp, udp, icmp, esp, ah, sctp), or the IP protocol number. - required: true - ports: - description: - - An optional list of ports to which this rule applies. This field is only applicable - for UDP or TCP protocol. Each entry must be either an integer or a range. If not - specified, this rule applies to connections through any port. - - 'Example inputs include: ["22"], ["80","443"], and ["12345-12349"].' - required: false + state: description: + - Whether the given object should exist in GCP + choices: + - present + - absent + default: present + allowed: + description: + - The list of ALLOW rules specified by this firewall. Each rule specifies a protocol + and port-range tuple that describes a permitted connection. + required: false + suboptions: + ip_protocol: description: - - An optional description of this resource. Provide this property when you create - the resource. - required: false - destination_ranges: - description: - - If destination ranges are specified, the firewall will apply only to traffic that - has destination IP address in these ranges. These ranges must be expressed in CIDR - format. Only IPv4 is supported. - required: false - version_added: 2.8 - direction: - description: - - 'Direction of traffic to which this firewall applies; default is INGRESS. Note: - For INGRESS traffic, it is NOT supported to specify destinationRanges; For EGRESS - traffic, it is NOT supported to specify sourceRanges OR sourceTags.' - required: false - version_added: 2.8 - choices: ['INGRESS', 'EGRESS'] - disabled: - description: - - Denotes whether the firewall rule is disabled, i.e not applied to the network it - is associated with. When set to true, the firewall rule is not enforced and the - network behaves as if it did not exist. If this is unspecified, the firewall rule - will be enabled. - required: false - type: bool - version_added: 2.8 - name: - description: - - Name of the resource. Provided by the client when the resource is created. The name - must be 1-63 characters long, and comply with RFC1035. Specifically, the name must - be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` - which means the first character must be a lowercase letter, and all following characters - must be a dash, lowercase letter, or digit, except the last character, which cannot - be a dash. - required: true - network: - description: - - 'URL of the network resource for this firewall rule. If not specified when creating - a firewall rule, the default network is used: global/networks/default If you choose to - specify this property, you can specify the network as a full or partial URL. For - example, the following are all valid URLs: - U(https://www.googleapis.com/compute/v1/projects/myproject/global/) - networks/my-network projects/myproject/global/networks/my-network - global/networks/default .' - - 'This field represents a link to a Network resource in GCP. It can be specified - in two ways. You can add `register: name-of-resource` to a gcp_compute_network task - and then set this network field to "{{ name-of-resource }}" Alternatively, you can - set this network to a dictionary with the selfLink key where the value is the selfLink - of your Network.' + - The IP protocol to which this rule applies. The protocol type is required + when creating a firewall rule. This value can either be one of the following + well known protocol strings (tcp, udp, icmp, esp, ah, sctp), or the IP protocol + number. required: true - priority: - description: - - Priority for this rule. This is an integer between 0 and 65535, both inclusive. - When not specified, the value assumed is 1000. Relative priorities determine precedence - of conflicting rules. Lower value of priority implies higher precedence (eg, a rule - with priority 0 has higher precedence than a rule with priority 1). DENY rules take - precedence over ALLOW rules having equal priority. - required: false - default: 1000 - version_added: 2.8 - source_ranges: - description: - - If source ranges are specified, the firewall will apply only to traffic that has - source IP address in these ranges. These ranges must be expressed in CIDR format. - One or both of sourceRanges and sourceTags may be set. If both properties are set, - the firewall will apply to traffic that has source IP address within sourceRanges - OR the source IP that belongs to a tag listed in the sourceTags property. The connection - does not need to match both properties for the firewall to apply. Only IPv4 is supported. - required: false - source_service_accounts: - description: - - If source service accounts are specified, the firewall will apply only to traffic - originating from an instance with a service account in this list. Source service - accounts cannot be used to control traffic to an instance's external IP address - because service accounts are associated with an instance, not an IP address. sourceRanges - can be set at the same time as sourceServiceAccounts. If both are set, the firewall - will apply to traffic that has source IP address within sourceRanges OR the source - IP belongs to an instance with service account listed in sourceServiceAccount. The - connection does not need to match both properties for the firewall to apply. sourceServiceAccounts - cannot be used at the same time as sourceTags or targetTags. - required: false - version_added: 2.8 - source_tags: + ports: description: - - If source tags are specified, the firewall will apply only to traffic with source - IP that belongs to a tag listed in source tags. Source tags cannot be used to control - traffic to an instance's external IP address. Because tags are associated with an - instance, not an IP address. One or both of sourceRanges and sourceTags may be set. - If both properties are set, the firewall will apply to traffic that has source IP - address within sourceRanges OR the source IP that belongs to a tag listed in the - sourceTags property. The connection does not need to match both properties for the - firewall to apply. + - An optional list of ports to which this rule applies. This field is only + applicable for UDP or TCP protocol. Each entry must be either an integer + or a range. If not specified, this rule applies to connections through any + port. + - 'Example inputs include: ["22"], ["80","443"], and ["12345-12349"].' required: false - target_service_accounts: + denied: + description: + - The list of DENY rules specified by this firewall. Each rule specifies a protocol + and port-range tuple that describes a denied connection. + required: false + version_added: 2.8 + suboptions: + ip_protocol: description: - - A list of service accounts indicating sets of instances located in the network that - may make network connections as specified in allowed[]. - - targetServiceAccounts cannot be used at the same time as targetTags or sourceTags. - If neither targetServiceAccounts nor targetTags are specified, the firewall rule - applies to all instances on the specified network. - required: false - version_added: 2.8 - target_tags: + - The IP protocol to which this rule applies. The protocol type is required + when creating a firewall rule. This value can either be one of the following + well known protocol strings (tcp, udp, icmp, esp, ah, sctp), or the IP protocol + number. + required: true + ports: description: - - A list of instance tags indicating sets of instances located in the network that - may make network connections as specified in allowed[]. - - If no targetTags are specified, the firewall rule applies to all instances on the - specified network. + - An optional list of ports to which this rule applies. This field is only + applicable for UDP or TCP protocol. Each entry must be either an integer + or a range. If not specified, this rule applies to connections through any + port. + - 'Example inputs include: ["22"], ["80","443"], and ["12345-12349"].' required: false + description: + description: + - An optional description of this resource. Provide this property when you create + the resource. + required: false + destination_ranges: + description: + - If destination ranges are specified, the firewall will apply only to traffic + that has destination IP address in these ranges. These ranges must be expressed + in CIDR format. Only IPv4 is supported. + required: false + version_added: 2.8 + direction: + description: + - 'Direction of traffic to which this firewall applies; default is INGRESS. Note: + For INGRESS traffic, it is NOT supported to specify destinationRanges; For EGRESS + traffic, it is NOT supported to specify sourceRanges OR sourceTags.' + required: false + version_added: 2.8 + choices: + - INGRESS + - EGRESS + disabled: + description: + - Denotes whether the firewall rule is disabled, i.e not applied to the network + it is associated with. When set to true, the firewall rule is not enforced and + the network behaves as if it did not exist. If this is unspecified, the firewall + rule will be enabled. + required: false + type: bool + version_added: 2.8 + name: + description: + - Name of the resource. Provided by the client when the resource is created. The + name must be 1-63 characters long, and comply with RFC1035. Specifically, the + name must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` + which means the first character must be a lowercase letter, and all following + characters must be a dash, lowercase letter, or digit, except the last character, + which cannot be a dash. + required: true + network: + description: + - 'URL of the network resource for this firewall rule. If not specified when creating + a firewall rule, the default network is used: global/networks/default If you + choose to specify this property, you can specify the network as a full or partial + URL. For example, the following are all valid URLs: U(https://www.googleapis.com/compute/v1/projects/myproject/global/) + networks/my-network projects/myproject/global/networks/my-network global/networks/default + .' + - 'This field represents a link to a Network resource in GCP. It can be specified + in two ways. You can add `register: name-of-resource` to a gcp_compute_network + task and then set this network field to "{{ name-of-resource }}" Alternatively, + you can set this network to a dictionary with the selfLink key where the value + is the selfLink of your Network' + required: true + priority: + description: + - Priority for this rule. This is an integer between 0 and 65535, both inclusive. + When not specified, the value assumed is 1000. Relative priorities determine + precedence of conflicting rules. Lower value of priority implies higher precedence + (eg, a rule with priority 0 has higher precedence than a rule with priority + 1). DENY rules take precedence over ALLOW rules having equal priority. + required: false + default: '1000' + version_added: 2.8 + source_ranges: + description: + - If source ranges are specified, the firewall will apply only to traffic that + has source IP address in these ranges. These ranges must be expressed in CIDR + format. One or both of sourceRanges and sourceTags may be set. If both properties + are set, the firewall will apply to traffic that has source IP address within + sourceRanges OR the source IP that belongs to a tag listed in the sourceTags + property. The connection does not need to match both properties for the firewall + to apply. Only IPv4 is supported. + required: false + source_service_accounts: + description: + - If source service accounts are specified, the firewall will apply only to traffic + originating from an instance with a service account in this list. Source service + accounts cannot be used to control traffic to an instance's external IP address + because service accounts are associated with an instance, not an IP address. + sourceRanges can be set at the same time as sourceServiceAccounts. If both are + set, the firewall will apply to traffic that has source IP address within sourceRanges + OR the source IP belongs to an instance with service account listed in sourceServiceAccount. + The connection does not need to match both properties for the firewall to apply. + sourceServiceAccounts cannot be used at the same time as sourceTags or targetTags. + required: false + version_added: 2.8 + source_tags: + description: + - If source tags are specified, the firewall will apply only to traffic with source + IP that belongs to a tag listed in source tags. Source tags cannot be used to + control traffic to an instance's external IP address. Because tags are associated + with an instance, not an IP address. One or both of sourceRanges and sourceTags + may be set. If both properties are set, the firewall will apply to traffic that + has source IP address within sourceRanges OR the source IP that belongs to a + tag listed in the sourceTags property. The connection does not need to match + both properties for the firewall to apply. + required: false + target_service_accounts: + description: + - A list of service accounts indicating sets of instances located in the network + that may make network connections as specified in allowed[]. + - targetServiceAccounts cannot be used at the same time as targetTags or sourceTags. + If neither targetServiceAccounts nor targetTags are specified, the firewall + rule applies to all instances on the specified network. + required: false + version_added: 2.8 + target_tags: + description: + - A list of instance tags indicating sets of instances located in the network + that may make network connections as specified in allowed[]. + - If no targetTags are specified, the firewall rule applies to all instances on + the specified network. + required: false extends_documentation_fragment: gcp notes: - - "API Reference: U(https://cloud.google.com/compute/docs/reference/latest/firewalls)" - - "Official Documentation: U(https://cloud.google.com/vpc/docs/firewalls)" +- 'API Reference: U(https://cloud.google.com/compute/docs/reference/latest/firewalls)' +- 'Official Documentation: U(https://cloud.google.com/vpc/docs/firewalls)' ''' EXAMPLES = ''' @@ -230,170 +238,172 @@ ''' RETURN = ''' - allowed: - description: - - The list of ALLOW rules specified by this firewall. Each rule specifies a protocol - and port-range tuple that describes a permitted connection. - returned: success - type: complex - contains: - ip_protocol: - description: - - The IP protocol to which this rule applies. The protocol type is required when creating - a firewall rule. This value can either be one of the following well known protocol - strings (tcp, udp, icmp, esp, ah, sctp), or the IP protocol number. - returned: success - type: str - ports: - description: - - An optional list of ports to which this rule applies. This field is only applicable - for UDP or TCP protocol. Each entry must be either an integer or a range. If not - specified, this rule applies to connections through any port. - - 'Example inputs include: ["22"], ["80","443"], and ["12345-12349"].' - returned: success - type: list - creationTimestamp: - description: - - Creation timestamp in RFC3339 text format. - returned: success - type: str - denied: - description: - - The list of DENY rules specified by this firewall. Each rule specifies a protocol - and port-range tuple that describes a denied connection. - returned: success - type: complex - contains: - ip_protocol: - description: - - The IP protocol to which this rule applies. The protocol type is required when creating - a firewall rule. This value can either be one of the following well known protocol - strings (tcp, udp, icmp, esp, ah, sctp), or the IP protocol number. - returned: success - type: str - ports: - description: - - An optional list of ports to which this rule applies. This field is only applicable - for UDP or TCP protocol. Each entry must be either an integer or a range. If not - specified, this rule applies to connections through any port. - - 'Example inputs include: ["22"], ["80","443"], and ["12345-12349"].' - returned: success - type: list - description: - description: - - An optional description of this resource. Provide this property when you create - the resource. - returned: success - type: str - destinationRanges: - description: - - If destination ranges are specified, the firewall will apply only to traffic that - has destination IP address in these ranges. These ranges must be expressed in CIDR - format. Only IPv4 is supported. - returned: success - type: list - direction: - description: - - 'Direction of traffic to which this firewall applies; default is INGRESS. Note: - For INGRESS traffic, it is NOT supported to specify destinationRanges; For EGRESS - traffic, it is NOT supported to specify sourceRanges OR sourceTags.' - returned: success - type: str - disabled: - description: - - Denotes whether the firewall rule is disabled, i.e not applied to the network it - is associated with. When set to true, the firewall rule is not enforced and the - network behaves as if it did not exist. If this is unspecified, the firewall rule - will be enabled. - returned: success - type: bool - id: - description: - - The unique identifier for the resource. - returned: success - type: int - name: - description: - - Name of the resource. Provided by the client when the resource is created. The name - must be 1-63 characters long, and comply with RFC1035. Specifically, the name must - be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` - which means the first character must be a lowercase letter, and all following characters - must be a dash, lowercase letter, or digit, except the last character, which cannot - be a dash. - returned: success - type: str - network: - description: - - 'URL of the network resource for this firewall rule. If not specified when creating - a firewall rule, the default network is used: global/networks/default If you choose to - specify this property, you can specify the network as a full or partial URL. For - example, the following are all valid URLs: - U(https://www.googleapis.com/compute/v1/projects/myproject/global/) - networks/my-network projects/myproject/global/networks/my-network - global/networks/default .' - returned: success - type: dict - priority: - description: - - Priority for this rule. This is an integer between 0 and 65535, both inclusive. - When not specified, the value assumed is 1000. Relative priorities determine precedence - of conflicting rules. Lower value of priority implies higher precedence (eg, a rule - with priority 0 has higher precedence than a rule with priority 1). DENY rules take - precedence over ALLOW rules having equal priority. - returned: success - type: int - sourceRanges: - description: - - If source ranges are specified, the firewall will apply only to traffic that has - source IP address in these ranges. These ranges must be expressed in CIDR format. - One or both of sourceRanges and sourceTags may be set. If both properties are set, - the firewall will apply to traffic that has source IP address within sourceRanges - OR the source IP that belongs to a tag listed in the sourceTags property. The connection - does not need to match both properties for the firewall to apply. Only IPv4 is supported. - returned: success - type: list - sourceServiceAccounts: - description: - - If source service accounts are specified, the firewall will apply only to traffic - originating from an instance with a service account in this list. Source service - accounts cannot be used to control traffic to an instance's external IP address - because service accounts are associated with an instance, not an IP address. sourceRanges - can be set at the same time as sourceServiceAccounts. If both are set, the firewall - will apply to traffic that has source IP address within sourceRanges OR the source - IP belongs to an instance with service account listed in sourceServiceAccount. The - connection does not need to match both properties for the firewall to apply. sourceServiceAccounts - cannot be used at the same time as sourceTags or targetTags. - returned: success - type: list - sourceTags: - description: - - If source tags are specified, the firewall will apply only to traffic with source - IP that belongs to a tag listed in source tags. Source tags cannot be used to control - traffic to an instance's external IP address. Because tags are associated with an - instance, not an IP address. One or both of sourceRanges and sourceTags may be set. - If both properties are set, the firewall will apply to traffic that has source IP - address within sourceRanges OR the source IP that belongs to a tag listed in the - sourceTags property. The connection does not need to match both properties for the - firewall to apply. - returned: success - type: list - targetServiceAccounts: - description: - - A list of service accounts indicating sets of instances located in the network that - may make network connections as specified in allowed[]. - - targetServiceAccounts cannot be used at the same time as targetTags or sourceTags. - If neither targetServiceAccounts nor targetTags are specified, the firewall rule - applies to all instances on the specified network. - returned: success - type: list - targetTags: - description: - - A list of instance tags indicating sets of instances located in the network that - may make network connections as specified in allowed[]. - - If no targetTags are specified, the firewall rule applies to all instances on the - specified network. - returned: success - type: list +allowed: + description: + - The list of ALLOW rules specified by this firewall. Each rule specifies a protocol + and port-range tuple that describes a permitted connection. + returned: success + type: complex + contains: + ip_protocol: + description: + - The IP protocol to which this rule applies. The protocol type is required + when creating a firewall rule. This value can either be one of the following + well known protocol strings (tcp, udp, icmp, esp, ah, sctp), or the IP protocol + number. + returned: success + type: str + ports: + description: + - An optional list of ports to which this rule applies. This field is only applicable + for UDP or TCP protocol. Each entry must be either an integer or a range. + If not specified, this rule applies to connections through any port. + - 'Example inputs include: ["22"], ["80","443"], and ["12345-12349"].' + returned: success + type: list +creationTimestamp: + description: + - Creation timestamp in RFC3339 text format. + returned: success + type: str +denied: + description: + - The list of DENY rules specified by this firewall. Each rule specifies a protocol + and port-range tuple that describes a denied connection. + returned: success + type: complex + contains: + ip_protocol: + description: + - The IP protocol to which this rule applies. The protocol type is required + when creating a firewall rule. This value can either be one of the following + well known protocol strings (tcp, udp, icmp, esp, ah, sctp), or the IP protocol + number. + returned: success + type: str + ports: + description: + - An optional list of ports to which this rule applies. This field is only applicable + for UDP or TCP protocol. Each entry must be either an integer or a range. + If not specified, this rule applies to connections through any port. + - 'Example inputs include: ["22"], ["80","443"], and ["12345-12349"].' + returned: success + type: list +description: + description: + - An optional description of this resource. Provide this property when you create + the resource. + returned: success + type: str +destinationRanges: + description: + - If destination ranges are specified, the firewall will apply only to traffic that + has destination IP address in these ranges. These ranges must be expressed in + CIDR format. Only IPv4 is supported. + returned: success + type: list +direction: + description: + - 'Direction of traffic to which this firewall applies; default is INGRESS. Note: + For INGRESS traffic, it is NOT supported to specify destinationRanges; For EGRESS + traffic, it is NOT supported to specify sourceRanges OR sourceTags.' + returned: success + type: str +disabled: + description: + - Denotes whether the firewall rule is disabled, i.e not applied to the network + it is associated with. When set to true, the firewall rule is not enforced and + the network behaves as if it did not exist. If this is unspecified, the firewall + rule will be enabled. + returned: success + type: bool +id: + description: + - The unique identifier for the resource. + returned: success + type: int +name: + description: + - Name of the resource. Provided by the client when the resource is created. The + name must be 1-63 characters long, and comply with RFC1035. Specifically, the + name must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` + which means the first character must be a lowercase letter, and all following + characters must be a dash, lowercase letter, or digit, except the last character, + which cannot be a dash. + returned: success + type: str +network: + description: + - 'URL of the network resource for this firewall rule. If not specified when creating + a firewall rule, the default network is used: global/networks/default If you choose + to specify this property, you can specify the network as a full or partial URL. + For example, the following are all valid URLs: U(https://www.googleapis.com/compute/v1/projects/myproject/global/) + networks/my-network projects/myproject/global/networks/my-network global/networks/default + .' + returned: success + type: dict +priority: + description: + - Priority for this rule. This is an integer between 0 and 65535, both inclusive. + When not specified, the value assumed is 1000. Relative priorities determine precedence + of conflicting rules. Lower value of priority implies higher precedence (eg, a + rule with priority 0 has higher precedence than a rule with priority 1). DENY + rules take precedence over ALLOW rules having equal priority. + returned: success + type: int +sourceRanges: + description: + - If source ranges are specified, the firewall will apply only to traffic that has + source IP address in these ranges. These ranges must be expressed in CIDR format. + One or both of sourceRanges and sourceTags may be set. If both properties are + set, the firewall will apply to traffic that has source IP address within sourceRanges + OR the source IP that belongs to a tag listed in the sourceTags property. The + connection does not need to match both properties for the firewall to apply. Only + IPv4 is supported. + returned: success + type: list +sourceServiceAccounts: + description: + - If source service accounts are specified, the firewall will apply only to traffic + originating from an instance with a service account in this list. Source service + accounts cannot be used to control traffic to an instance's external IP address + because service accounts are associated with an instance, not an IP address. sourceRanges + can be set at the same time as sourceServiceAccounts. If both are set, the firewall + will apply to traffic that has source IP address within sourceRanges OR the source + IP belongs to an instance with service account listed in sourceServiceAccount. + The connection does not need to match both properties for the firewall to apply. + sourceServiceAccounts cannot be used at the same time as sourceTags or targetTags. + returned: success + type: list +sourceTags: + description: + - If source tags are specified, the firewall will apply only to traffic with source + IP that belongs to a tag listed in source tags. Source tags cannot be used to + control traffic to an instance's external IP address. Because tags are associated + with an instance, not an IP address. One or both of sourceRanges and sourceTags + may be set. If both properties are set, the firewall will apply to traffic that + has source IP address within sourceRanges OR the source IP that belongs to a tag + listed in the sourceTags property. The connection does not need to match both + properties for the firewall to apply. + returned: success + type: list +targetServiceAccounts: + description: + - A list of service accounts indicating sets of instances located in the network + that may make network connections as specified in allowed[]. + - targetServiceAccounts cannot be used at the same time as targetTags or sourceTags. + If neither targetServiceAccounts nor targetTags are specified, the firewall rule + applies to all instances on the specified network. + returned: success + type: list +targetTags: + description: + - A list of instance tags indicating sets of instances located in the network that + may make network connections as specified in allowed[]. + - If no targetTags are specified, the firewall rule applies to all instances on + the specified network. + returned: success + type: list ''' ################################################################################ diff --git a/lib/ansible/modules/cloud/google/gcp_compute_firewall_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_firewall_facts.py index 5fce2e9fbacc55..288b6e640fe634 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_firewall_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_firewall_facts.py @@ -32,21 +32,20 @@ --- module: gcp_compute_firewall_facts description: - - Gather facts for GCP Firewall +- Gather facts for GCP Firewall short_description: Gather facts for GCP Firewall version_added: 2.7 author: Google Inc. (@googlecloudplatform) requirements: - - python >= 2.6 - - requests >= 2.18.4 - - google-auth >= 1.3.0 +- python >= 2.6 +- requests >= 2.18.4 +- google-auth >= 1.3.0 options: - filters: - description: - A list of filter value pairs. Available filters are listed here - U(https://cloud.google.com/sdk/gcloud/reference/topic/filters). - Each additional filter in the list will act be added as an AND condition - (filter1 and filter2) + filters: + description: + - A list of filter value pairs. Available filters are listed here U(U(https://cloud.google.com/sdk/gcloud/reference/topic/filters).) + - Each additional filter in the list will act be added as an AND condition (filter1 + and filter2) . extends_documentation_fragment: gcp ''' @@ -62,174 +61,179 @@ RETURN = ''' items: - description: List of items - returned: always - type: complex - contains: - allowed: - description: - - The list of ALLOW rules specified by this firewall. Each rule specifies a protocol - and port-range tuple that describes a permitted connection. - returned: success - type: complex - contains: - ip_protocol: - description: - - The IP protocol to which this rule applies. The protocol type is required when creating - a firewall rule. This value can either be one of the following well known protocol - strings (tcp, udp, icmp, esp, ah, sctp), or the IP protocol number. - returned: success - type: str - ports: - description: - - An optional list of ports to which this rule applies. This field is only applicable - for UDP or TCP protocol. Each entry must be either an integer or a range. If not - specified, this rule applies to connections through any port. - - 'Example inputs include: ["22"], ["80","443"], and ["12345-12349"].' - returned: success - type: list - creationTimestamp: - description: - - Creation timestamp in RFC3339 text format. - returned: success - type: str - denied: - description: - - The list of DENY rules specified by this firewall. Each rule specifies a protocol - and port-range tuple that describes a denied connection. - returned: success - type: complex - contains: - ip_protocol: - description: - - The IP protocol to which this rule applies. The protocol type is required when creating - a firewall rule. This value can either be one of the following well known protocol - strings (tcp, udp, icmp, esp, ah, sctp), or the IP protocol number. - returned: success - type: str - ports: - description: - - An optional list of ports to which this rule applies. This field is only applicable - for UDP or TCP protocol. Each entry must be either an integer or a range. If not - specified, this rule applies to connections through any port. - - 'Example inputs include: ["22"], ["80","443"], and ["12345-12349"].' - returned: success - type: list - description: - description: - - An optional description of this resource. Provide this property when you create - the resource. - returned: success - type: str - destinationRanges: - description: - - If destination ranges are specified, the firewall will apply only to traffic that - has destination IP address in these ranges. These ranges must be expressed in CIDR - format. Only IPv4 is supported. - returned: success - type: list - direction: - description: - - 'Direction of traffic to which this firewall applies; default is INGRESS. Note: - For INGRESS traffic, it is NOT supported to specify destinationRanges; For EGRESS - traffic, it is NOT supported to specify sourceRanges OR sourceTags.' - returned: success - type: str - disabled: - description: - - Denotes whether the firewall rule is disabled, i.e not applied to the network it - is associated with. When set to true, the firewall rule is not enforced and the - network behaves as if it did not exist. If this is unspecified, the firewall rule - will be enabled. - returned: success - type: bool - id: - description: - - The unique identifier for the resource. - returned: success - type: int - name: - description: - - Name of the resource. Provided by the client when the resource is created. The name - must be 1-63 characters long, and comply with RFC1035. Specifically, the name must - be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` - which means the first character must be a lowercase letter, and all following characters - must be a dash, lowercase letter, or digit, except the last character, which cannot - be a dash. - returned: success - type: str - network: - description: - - 'URL of the network resource for this firewall rule. If not specified when - creating a firewall rule, the default network is used: global/networks/default If - you choose to specify this property, you can specify the network as a full or - partial URL. For example, the following are all valid URLs: - U(https://www.googleapis.com/compute/v1/projects/myproject/global/) - networks/my-network projects/myproject/global/networks/my-network - global/networks/default .' - returned: success - type: dict - priority: - description: - - Priority for this rule. This is an integer between 0 and 65535, both inclusive. - When not specified, the value assumed is 1000. Relative priorities determine precedence - of conflicting rules. Lower value of priority implies higher precedence (eg, a rule - with priority 0 has higher precedence than a rule with priority 1). DENY rules take - precedence over ALLOW rules having equal priority. - returned: success - type: int - sourceRanges: - description: - - If source ranges are specified, the firewall will apply only to traffic that has - source IP address in these ranges. These ranges must be expressed in CIDR format. - One or both of sourceRanges and sourceTags may be set. If both properties are set, - the firewall will apply to traffic that has source IP address within sourceRanges - OR the source IP that belongs to a tag listed in the sourceTags property. The connection - does not need to match both properties for the firewall to apply. Only IPv4 is supported. - returned: success - type: list - sourceServiceAccounts: - description: - - If source service accounts are specified, the firewall will apply only to traffic - originating from an instance with a service account in this list. Source service - accounts cannot be used to control traffic to an instance's external IP address - because service accounts are associated with an instance, not an IP address. sourceRanges - can be set at the same time as sourceServiceAccounts. If both are set, the firewall - will apply to traffic that has source IP address within sourceRanges OR the source - IP belongs to an instance with service account listed in sourceServiceAccount. The - connection does not need to match both properties for the firewall to apply. sourceServiceAccounts - cannot be used at the same time as sourceTags or targetTags. - returned: success - type: list - sourceTags: - description: - - If source tags are specified, the firewall will apply only to traffic with source - IP that belongs to a tag listed in source tags. Source tags cannot be used to control - traffic to an instance's external IP address. Because tags are associated with an - instance, not an IP address. One or both of sourceRanges and sourceTags may be set. - If both properties are set, the firewall will apply to traffic that has source IP - address within sourceRanges OR the source IP that belongs to a tag listed in the - sourceTags property. The connection does not need to match both properties for the - firewall to apply. - returned: success - type: list - targetServiceAccounts: - description: - - A list of service accounts indicating sets of instances located in the network that - may make network connections as specified in allowed[]. - - targetServiceAccounts cannot be used at the same time as targetTags or sourceTags. - If neither targetServiceAccounts nor targetTags are specified, the firewall rule - applies to all instances on the specified network. - returned: success - type: list - targetTags: - description: - - A list of instance tags indicating sets of instances located in the network that - may make network connections as specified in allowed[]. - - If no targetTags are specified, the firewall rule applies to all instances on the - specified network. - returned: success - type: list + description: List of items + returned: always + type: complex + contains: + allowed: + description: + - The list of ALLOW rules specified by this firewall. Each rule specifies a + protocol and port-range tuple that describes a permitted connection. + returned: success + type: complex + contains: + ip_protocol: + description: + - The IP protocol to which this rule applies. The protocol type is required + when creating a firewall rule. This value can either be one of the following + well known protocol strings (tcp, udp, icmp, esp, ah, sctp), or the IP + protocol number. + returned: success + type: str + ports: + description: + - An optional list of ports to which this rule applies. This field is only + applicable for UDP or TCP protocol. Each entry must be either an integer + or a range. If not specified, this rule applies to connections through + any port. + - 'Example inputs include: ["22"], ["80","443"], and ["12345-12349"].' + returned: success + type: list + creationTimestamp: + description: + - Creation timestamp in RFC3339 text format. + returned: success + type: str + denied: + description: + - The list of DENY rules specified by this firewall. Each rule specifies a protocol + and port-range tuple that describes a denied connection. + returned: success + type: complex + contains: + ip_protocol: + description: + - The IP protocol to which this rule applies. The protocol type is required + when creating a firewall rule. This value can either be one of the following + well known protocol strings (tcp, udp, icmp, esp, ah, sctp), or the IP + protocol number. + returned: success + type: str + ports: + description: + - An optional list of ports to which this rule applies. This field is only + applicable for UDP or TCP protocol. Each entry must be either an integer + or a range. If not specified, this rule applies to connections through + any port. + - 'Example inputs include: ["22"], ["80","443"], and ["12345-12349"].' + returned: success + type: list + description: + description: + - An optional description of this resource. Provide this property when you create + the resource. + returned: success + type: str + destinationRanges: + description: + - If destination ranges are specified, the firewall will apply only to traffic + that has destination IP address in these ranges. These ranges must be expressed + in CIDR format. Only IPv4 is supported. + returned: success + type: list + direction: + description: + - 'Direction of traffic to which this firewall applies; default is INGRESS. + Note: For INGRESS traffic, it is NOT supported to specify destinationRanges; + For EGRESS traffic, it is NOT supported to specify sourceRanges OR sourceTags.' + returned: success + type: str + disabled: + description: + - Denotes whether the firewall rule is disabled, i.e not applied to the network + it is associated with. When set to true, the firewall rule is not enforced + and the network behaves as if it did not exist. If this is unspecified, the + firewall rule will be enabled. + returned: success + type: bool + id: + description: + - The unique identifier for the resource. + returned: success + type: int + name: + description: + - Name of the resource. Provided by the client when the resource is created. + The name must be 1-63 characters long, and comply with RFC1035. Specifically, + the name must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` + which means the first character must be a lowercase letter, and all following + characters must be a dash, lowercase letter, or digit, except the last character, + which cannot be a dash. + returned: success + type: str + network: + description: + - 'URL of the network resource for this firewall rule. If not specified when + creating a firewall rule, the default network is used: global/networks/default + If you choose to specify this property, you can specify the network as a full + or partial URL. For example, the following are all valid URLs: U(https://www.googleapis.com/compute/v1/projects/myproject/global/) + networks/my-network projects/myproject/global/networks/my-network global/networks/default + .' + returned: success + type: dict + priority: + description: + - Priority for this rule. This is an integer between 0 and 65535, both inclusive. + When not specified, the value assumed is 1000. Relative priorities determine + precedence of conflicting rules. Lower value of priority implies higher precedence + (eg, a rule with priority 0 has higher precedence than a rule with priority + 1). DENY rules take precedence over ALLOW rules having equal priority. + returned: success + type: int + sourceRanges: + description: + - If source ranges are specified, the firewall will apply only to traffic that + has source IP address in these ranges. These ranges must be expressed in CIDR + format. One or both of sourceRanges and sourceTags may be set. If both properties + are set, the firewall will apply to traffic that has source IP address within + sourceRanges OR the source IP that belongs to a tag listed in the sourceTags + property. The connection does not need to match both properties for the firewall + to apply. Only IPv4 is supported. + returned: success + type: list + sourceServiceAccounts: + description: + - If source service accounts are specified, the firewall will apply only to + traffic originating from an instance with a service account in this list. + Source service accounts cannot be used to control traffic to an instance's + external IP address because service accounts are associated with an instance, + not an IP address. sourceRanges can be set at the same time as sourceServiceAccounts. + If both are set, the firewall will apply to traffic that has source IP address + within sourceRanges OR the source IP belongs to an instance with service account + listed in sourceServiceAccount. The connection does not need to match both + properties for the firewall to apply. sourceServiceAccounts cannot be used + at the same time as sourceTags or targetTags. + returned: success + type: list + sourceTags: + description: + - If source tags are specified, the firewall will apply only to traffic with + source IP that belongs to a tag listed in source tags. Source tags cannot + be used to control traffic to an instance's external IP address. Because tags + are associated with an instance, not an IP address. One or both of sourceRanges + and sourceTags may be set. If both properties are set, the firewall will apply + to traffic that has source IP address within sourceRanges OR the source IP + that belongs to a tag listed in the sourceTags property. The connection does + not need to match both properties for the firewall to apply. + returned: success + type: list + targetServiceAccounts: + description: + - A list of service accounts indicating sets of instances located in the network + that may make network connections as specified in allowed[]. + - targetServiceAccounts cannot be used at the same time as targetTags or sourceTags. + If neither targetServiceAccounts nor targetTags are specified, the firewall + rule applies to all instances on the specified network. + returned: success + type: list + targetTags: + description: + - A list of instance tags indicating sets of instances located in the network + that may make network connections as specified in allowed[]. + - If no targetTags are specified, the firewall rule applies to all instances + on the specified network. + returned: success + type: list ''' ################################################################################ diff --git a/lib/ansible/modules/cloud/google/gcp_compute_forwarding_rule.py b/lib/ansible/modules/cloud/google/gcp_compute_forwarding_rule.py index 507ce5182083f4..60d4d81566d626 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_forwarding_rule.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_forwarding_rule.py @@ -32,168 +32,185 @@ --- module: gcp_compute_forwarding_rule description: - - A ForwardingRule resource. A ForwardingRule resource specifies which pool of target - virtual machines to forward a packet to if it matches the given [IPAddress, IPProtocol, - portRange] tuple. +- A ForwardingRule resource. A ForwardingRule resource specifies which pool of target + virtual machines to forward a packet to if it matches the given [IPAddress, IPProtocol, + portRange] tuple. short_description: Creates a GCP ForwardingRule version_added: 2.6 author: Google Inc. (@googlecloudplatform) requirements: - - python >= 2.6 - - requests >= 2.18.4 - - google-auth >= 1.3.0 +- python >= 2.6 +- requests >= 2.18.4 +- google-auth >= 1.3.0 options: - state: - description: - - Whether the given object should exist in GCP - choices: ['present', 'absent'] - default: 'present' + state: description: - description: - - An optional description of this resource. Provide this property when you create - the resource. - required: false - ip_address: - description: - - The IP address that this forwarding rule is serving on behalf of. - - Addresses are restricted based on the forwarding rule's load balancing scheme (EXTERNAL - or INTERNAL) and scope (global or regional). - - When the load balancing scheme is EXTERNAL, for global forwarding rules, the address - must be a global IP, and for regional forwarding rules, the address must live in - the same region as the forwarding rule. If this field is empty, an ephemeral IPv4 - address from the same scope (global or regional) will be assigned. A regional forwarding - rule supports IPv4 only. A global forwarding rule supports either IPv4 or IPv6. - - When the load balancing scheme is INTERNAL, this can only be an RFC 1918 IP address - belonging to the network/subnet configured for the forwarding rule. By default, - if this field is empty, an ephemeral internal IP address will be automatically allocated - from the IP range of the subnet or network configured for this forwarding rule. - - 'An address can be specified either by a literal IP address or a URL reference to - an existing Address resource. The following examples are all valid: * 100.1.2.3 - * U(https://www.googleapis.com/compute/v1/projects/project/regions/region/addresses/address) - * projects/project/regions/region/addresses/address * regions/region/addresses/address - * global/addresses/address * address .' - required: false - ip_protocol: - description: - - The IP protocol to which this rule applies. Valid options are TCP, UDP, ESP, AH, - SCTP or ICMP. - - When the load balancing scheme is INTERNAL, only TCP and UDP are valid. - required: false - choices: ['TCP', 'UDP', 'ESP', 'AH', 'SCTP', 'ICMP'] - backend_service: - description: - - A reference to a BackendService to receive the matched traffic. - - This is used for internal load balancing. - - "(not used for external load balancing) ." - - 'This field represents a link to a BackendService resource in GCP. It can be specified - in two ways. You can add `register: name-of-resource` to a gcp_compute_backend_service - task and then set this backend_service field to "{{ name-of-resource }}" Alternatively, - you can set this backend_service to a dictionary with the selfLink key where the - value is the selfLink of your BackendService.' - required: false - ip_version: - description: - - The IP Version that will be used by this forwarding rule. Valid options are IPV4 - or IPV6. This can only be specified for a global forwarding rule. - required: false - choices: ['IPV4', 'IPV6'] - load_balancing_scheme: - description: - - 'This signifies what the ForwardingRule will be used for and can only take the following - values: INTERNAL, EXTERNAL The value of INTERNAL means that this will be used for - Internal Network Load Balancing (TCP, UDP). The value of EXTERNAL means that this - will be used for External Load Balancing (HTTP(S) LB, External TCP/UDP LB, SSL Proxy) - .' - required: false - choices: ['INTERNAL', 'EXTERNAL'] - name: - description: - - Name of the resource; provided by the client when the resource is created. The name - must be 1-63 characters long, and comply with RFC1035. Specifically, the name must - be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` - which means the first character must be a lowercase letter, and all following characters - must be a dash, lowercase letter, or digit, except the last character, which cannot - be a dash. - required: true - network: - description: - - For internal load balancing, this field identifies the network that the load balanced - IP should belong to for this Forwarding Rule. If this field is not specified, the - default network will be used. - - This field is not used for external load balancing. - - 'This field represents a link to a Network resource in GCP. It can be specified - in two ways. You can add `register: name-of-resource` to a gcp_compute_network task - and then set this network field to "{{ name-of-resource }}" Alternatively, you can - set this network to a dictionary with the selfLink key where the value is the selfLink - of your Network.' - required: false - port_range: - description: - - This field is used along with the target field for TargetHttpProxy, TargetHttpsProxy, - TargetSslProxy, TargetTcpProxy, TargetVpnGateway, TargetPool, TargetInstance. - - Applicable only when IPProtocol is TCP, UDP, or SCTP, only packets addressed to - ports in the specified range will be forwarded to target. - - Forwarding rules with the same [IPAddress, IPProtocol] pair must have disjoint port - ranges. - - 'Some types of forwarding target have constraints on the acceptable ports: * TargetHttpProxy: - 80, 8080 * TargetHttpsProxy: 443 * TargetTcpProxy: 25, 43, 110, 143, 195, 443, 465, - 587, 700, 993, 995, 1883, 5222 * TargetSslProxy: 25, 43, 110, - 143, 195, 443, 465, 587, 700, 993, 995, 1883, 5222 * TargetVpnGateway: - 500, 4500 .' - required: false - ports: - description: - - This field is used along with the backend_service field for internal load balancing. - - When the load balancing scheme is INTERNAL, a single port or a comma separated list - of ports can be configured. Only packets addressed to these ports will be forwarded - to the backends configured with this forwarding rule. - - You may specify a maximum of up to 5 ports. - required: false - subnetwork: - description: - - A reference to a subnetwork. - - For internal load balancing, this field identifies the subnetwork that the load - balanced IP should belong to for this Forwarding Rule. - - If the network specified is in auto subnet mode, this field is optional. However, - if the network is in custom subnet mode, a subnetwork must be specified. - - This field is not used for external load balancing. - - 'This field represents a link to a Subnetwork resource in GCP. It can be specified - in two ways. You can add `register: name-of-resource` to a gcp_compute_subnetwork - task and then set this subnetwork field to "{{ name-of-resource }}" Alternatively, - you can set this subnetwork to a dictionary with the selfLink key where the value - is the selfLink of your Subnetwork.' - required: false - target: - description: - - A reference to a TargetPool resource to receive the matched traffic. - - For regional forwarding rules, this target must live in the same region as the forwarding - rule. For global forwarding rules, this target must be a global load balancing resource. - The forwarded traffic must be of a type appropriate to the target object. - - This field is not used for internal load balancing. - - 'This field represents a link to a TargetPool resource in GCP. It can be specified - in two ways. You can add `register: name-of-resource` to a gcp_compute_target_pool - task and then set this target field to "{{ name-of-resource }}" Alternatively, you - can set this target to a dictionary with the selfLink key where the value is the - selfLink of your TargetPool.' - required: false - version_added: 2.7 - network_tier: - description: - - 'The networking tier used for configuring this address. This field can take the - following values: PREMIUM or STANDARD. If this field is not specified, it is assumed - to be PREMIUM.' - required: false - version_added: 2.8 - choices: ['PREMIUM', 'STANDARD'] - region: - description: - - A reference to the region where the regional forwarding rule resides. - - This field is not applicable to global forwarding rules. - required: true + - Whether the given object should exist in GCP + choices: + - present + - absent + default: present + description: + description: + - An optional description of this resource. Provide this property when you create + the resource. + required: false + ip_address: + description: + - The IP address that this forwarding rule is serving on behalf of. + - Addresses are restricted based on the forwarding rule's load balancing scheme + (EXTERNAL or INTERNAL) and scope (global or regional). + - When the load balancing scheme is EXTERNAL, for global forwarding rules, the + address must be a global IP, and for regional forwarding rules, the address + must live in the same region as the forwarding rule. If this field is empty, + an ephemeral IPv4 address from the same scope (global or regional) will be assigned. + A regional forwarding rule supports IPv4 only. A global forwarding rule supports + either IPv4 or IPv6. + - When the load balancing scheme is INTERNAL, this can only be an RFC 1918 IP + address belonging to the network/subnet configured for the forwarding rule. + By default, if this field is empty, an ephemeral internal IP address will be + automatically allocated from the IP range of the subnet or network configured + for this forwarding rule. + - 'An address can be specified either by a literal IP address or a URL reference + to an existing Address resource. The following examples are all valid: * 100.1.2.3 + * U(https://www.googleapis.com/compute/v1/projects/project/regions/region/addresses/address) + * projects/project/regions/region/addresses/address * regions/region/addresses/address + * global/addresses/address * address .' + required: false + ip_protocol: + description: + - The IP protocol to which this rule applies. Valid options are TCP, UDP, ESP, + AH, SCTP or ICMP. + - When the load balancing scheme is INTERNAL, only TCP and UDP are valid. + required: false + choices: + - TCP + - UDP + - ESP + - AH + - SCTP + - ICMP + backend_service: + description: + - A reference to a BackendService to receive the matched traffic. + - This is used for internal load balancing. + - "(not used for external load balancing) ." + - 'This field represents a link to a BackendService resource in GCP. It can be + specified in two ways. You can add `register: name-of-resource` to a gcp_compute_backend_service + task and then set this backend_service field to "{{ name-of-resource }}" Alternatively, + you can set this backend_service to a dictionary with the selfLink key where + the value is the selfLink of your BackendService' + required: false + ip_version: + description: + - The IP Version that will be used by this forwarding rule. Valid options are + IPV4 or IPV6. This can only be specified for a global forwarding rule. + required: false + choices: + - IPV4 + - IPV6 + load_balancing_scheme: + description: + - 'This signifies what the ForwardingRule will be used for and can only take the + following values: INTERNAL, EXTERNAL The value of INTERNAL means that this will + be used for Internal Network Load Balancing (TCP, UDP). The value of EXTERNAL + means that this will be used for External Load Balancing (HTTP(S) LB, External + TCP/UDP LB, SSL Proxy) .' + required: false + choices: + - INTERNAL + - EXTERNAL + name: + description: + - Name of the resource; provided by the client when the resource is created. The + name must be 1-63 characters long, and comply with RFC1035. Specifically, the + name must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` + which means the first character must be a lowercase letter, and all following + characters must be a dash, lowercase letter, or digit, except the last character, + which cannot be a dash. + required: true + network: + description: + - For internal load balancing, this field identifies the network that the load + balanced IP should belong to for this Forwarding Rule. If this field is not + specified, the default network will be used. + - This field is not used for external load balancing. + - 'This field represents a link to a Network resource in GCP. It can be specified + in two ways. You can add `register: name-of-resource` to a gcp_compute_network + task and then set this network field to "{{ name-of-resource }}" Alternatively, + you can set this network to a dictionary with the selfLink key where the value + is the selfLink of your Network' + required: false + port_range: + description: + - This field is used along with the target field for TargetHttpProxy, TargetHttpsProxy, + TargetSslProxy, TargetTcpProxy, TargetVpnGateway, TargetPool, TargetInstance. + - Applicable only when IPProtocol is TCP, UDP, or SCTP, only packets addressed + to ports in the specified range will be forwarded to target. + - Forwarding rules with the same [IPAddress, IPProtocol] pair must have disjoint + port ranges. + - 'Some types of forwarding target have constraints on the acceptable ports: * + TargetHttpProxy: 80, 8080 * TargetHttpsProxy: 443 * TargetTcpProxy: 25, 43, + 110, 143, 195, 443, 465, 587, 700, 993, 995, 1883, 5222 * TargetSslProxy: 25, + 43, 110, 143, 195, 443, 465, 587, 700, 993, 995, 1883, 5222 * TargetVpnGateway: + 500, 4500 .' + required: false + ports: + description: + - This field is used along with the backend_service field for internal load balancing. + - When the load balancing scheme is INTERNAL, a single port or a comma separated + list of ports can be configured. Only packets addressed to these ports will + be forwarded to the backends configured with this forwarding rule. + - You may specify a maximum of up to 5 ports. + required: false + subnetwork: + description: + - A reference to a subnetwork. + - For internal load balancing, this field identifies the subnetwork that the load + balanced IP should belong to for this Forwarding Rule. + - If the network specified is in auto subnet mode, this field is optional. However, + if the network is in custom subnet mode, a subnetwork must be specified. + - This field is not used for external load balancing. + - 'This field represents a link to a Subnetwork resource in GCP. It can be specified + in two ways. You can add `register: name-of-resource` to a gcp_compute_subnetwork + task and then set this subnetwork field to "{{ name-of-resource }}" Alternatively, + you can set this subnetwork to a dictionary with the selfLink key where the + value is the selfLink of your Subnetwork' + required: false + target: + description: + - A reference to a TargetPool resource to receive the matched traffic. + - For regional forwarding rules, this target must live in the same region as the + forwarding rule. For global forwarding rules, this target must be a global load + balancing resource. The forwarded traffic must be of a type appropriate to the + target object. + - This field is not used for internal load balancing. + - 'This field represents a link to a TargetPool resource in GCP. It can be specified + in two ways. You can add `register: name-of-resource` to a gcp_compute_target_pool + task and then set this target field to "{{ name-of-resource }}" Alternatively, + you can set this target to a dictionary with the selfLink key where the value + is the selfLink of your TargetPool' + required: false + version_added: 2.7 + network_tier: + description: + - 'The networking tier used for configuring this address. This field can take + the following values: PREMIUM or STANDARD. If this field is not specified, it + is assumed to be PREMIUM.' + required: false + version_added: 2.8 + choices: + - PREMIUM + - STANDARD + region: + description: + - A reference to the region where the regional forwarding rule resides. + - This field is not applicable to global forwarding rules. + required: true extends_documentation_fragment: gcp notes: - - "API Reference: U(https://cloud.google.com/compute/docs/reference/latest/forwardingRule)" - - "Official Documentation: U(https://cloud.google.com/compute/docs/load-balancing/network/forwarding-rules)" +- 'API Reference: U(https://cloud.google.com/compute/docs/reference/latest/forwardingRule)' +- 'Official Documentation: U(https://cloud.google.com/compute/docs/load-balancing/network/forwarding-rules)' ''' EXAMPLES = ''' @@ -232,146 +249,148 @@ ''' RETURN = ''' - creationTimestamp: - description: - - Creation timestamp in RFC3339 text format. - returned: success - type: str - description: - description: - - An optional description of this resource. Provide this property when you create - the resource. - returned: success - type: str - id: - description: - - The unique identifier for the resource. - returned: success - type: int - IPAddress: - description: - - The IP address that this forwarding rule is serving on behalf of. - - Addresses are restricted based on the forwarding rule's load balancing scheme (EXTERNAL - or INTERNAL) and scope (global or regional). - - When the load balancing scheme is EXTERNAL, for global forwarding rules, the address - must be a global IP, and for regional forwarding rules, the address must live in - the same region as the forwarding rule. If this field is empty, an ephemeral IPv4 - address from the same scope (global or regional) will be assigned. A regional forwarding - rule supports IPv4 only. A global forwarding rule supports either IPv4 or IPv6. - - When the load balancing scheme is INTERNAL, this can only be an RFC 1918 IP address - belonging to the network/subnet configured for the forwarding rule. By default, - if this field is empty, an ephemeral internal IP address will be automatically allocated - from the IP range of the subnet or network configured for this forwarding rule. - - 'An address can be specified either by a literal IP address or a URL reference to - an existing Address resource. The following examples are all valid: * 100.1.2.3 - * U(https://www.googleapis.com/compute/v1/projects/project/regions/region/addresses/address) - * projects/project/regions/region/addresses/address * regions/region/addresses/address - * global/addresses/address * address .' - returned: success - type: str - IPProtocol: - description: - - The IP protocol to which this rule applies. Valid options are TCP, UDP, ESP, AH, - SCTP or ICMP. - - When the load balancing scheme is INTERNAL, only TCP and UDP are valid. - returned: success - type: str - backendService: - description: - - A reference to a BackendService to receive the matched traffic. - - This is used for internal load balancing. - - "(not used for external load balancing) ." - returned: success - type: dict - ipVersion: - description: - - The IP Version that will be used by this forwarding rule. Valid options are IPV4 - or IPV6. This can only be specified for a global forwarding rule. - returned: success - type: str - loadBalancingScheme: - description: - - 'This signifies what the ForwardingRule will be used for and can only take the following - values: INTERNAL, EXTERNAL The value of INTERNAL means that this will be used for - Internal Network Load Balancing (TCP, UDP). The value of EXTERNAL means that this - will be used for External Load Balancing (HTTP(S) LB, External TCP/UDP LB, SSL Proxy) - .' - returned: success - type: str - name: - description: - - Name of the resource; provided by the client when the resource is created. The name - must be 1-63 characters long, and comply with RFC1035. Specifically, the name must - be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` - which means the first character must be a lowercase letter, and all following characters - must be a dash, lowercase letter, or digit, except the last character, which cannot - be a dash. - returned: success - type: str - network: - description: - - For internal load balancing, this field identifies the network that the load balanced - IP should belong to for this Forwarding Rule. If this field is not specified, the - default network will be used. - - This field is not used for external load balancing. - returned: success - type: dict - portRange: - description: - - This field is used along with the target field for TargetHttpProxy, TargetHttpsProxy, - TargetSslProxy, TargetTcpProxy, TargetVpnGateway, TargetPool, TargetInstance. - - Applicable only when IPProtocol is TCP, UDP, or SCTP, only packets addressed to - ports in the specified range will be forwarded to target. - - Forwarding rules with the same [IPAddress, IPProtocol] pair must have disjoint port - ranges. - - 'Some types of forwarding target have constraints on the acceptable ports: * TargetHttpProxy: - 80, 8080 * TargetHttpsProxy: 443 * TargetTcpProxy: 25, 43, 110, 143, 195, 443, 465, - 587, 700, 993, 995, 1883, 5222 * TargetSslProxy: 25, 43, 110, - 143, 195, 443, 465, 587, 700, 993, 995, 1883, 5222 * TargetVpnGateway: - 500, 4500 .' - returned: success - type: str - ports: - description: - - This field is used along with the backend_service field for internal load balancing. - - When the load balancing scheme is INTERNAL, a single port or a comma separated list - of ports can be configured. Only packets addressed to these ports will be forwarded - to the backends configured with this forwarding rule. - - You may specify a maximum of up to 5 ports. - returned: success - type: list - subnetwork: - description: - - A reference to a subnetwork. - - For internal load balancing, this field identifies the subnetwork that the load - balanced IP should belong to for this Forwarding Rule. - - If the network specified is in auto subnet mode, this field is optional. However, - if the network is in custom subnet mode, a subnetwork must be specified. - - This field is not used for external load balancing. - returned: success - type: dict - target: - description: - - A reference to a TargetPool resource to receive the matched traffic. - - For regional forwarding rules, this target must live in the same region as the forwarding - rule. For global forwarding rules, this target must be a global load balancing resource. - The forwarded traffic must be of a type appropriate to the target object. - - This field is not used for internal load balancing. - returned: success - type: dict - networkTier: - description: - - 'The networking tier used for configuring this address. This field can take the - following values: PREMIUM or STANDARD. If this field is not specified, it is assumed - to be PREMIUM.' - returned: success - type: str - region: - description: - - A reference to the region where the regional forwarding rule resides. - - This field is not applicable to global forwarding rules. - returned: success - type: str +creationTimestamp: + description: + - Creation timestamp in RFC3339 text format. + returned: success + type: str +description: + description: + - An optional description of this resource. Provide this property when you create + the resource. + returned: success + type: str +id: + description: + - The unique identifier for the resource. + returned: success + type: int +IPAddress: + description: + - The IP address that this forwarding rule is serving on behalf of. + - Addresses are restricted based on the forwarding rule's load balancing scheme + (EXTERNAL or INTERNAL) and scope (global or regional). + - When the load balancing scheme is EXTERNAL, for global forwarding rules, the address + must be a global IP, and for regional forwarding rules, the address must live + in the same region as the forwarding rule. If this field is empty, an ephemeral + IPv4 address from the same scope (global or regional) will be assigned. A regional + forwarding rule supports IPv4 only. A global forwarding rule supports either IPv4 + or IPv6. + - When the load balancing scheme is INTERNAL, this can only be an RFC 1918 IP address + belonging to the network/subnet configured for the forwarding rule. By default, + if this field is empty, an ephemeral internal IP address will be automatically + allocated from the IP range of the subnet or network configured for this forwarding + rule. + - 'An address can be specified either by a literal IP address or a URL reference + to an existing Address resource. The following examples are all valid: * 100.1.2.3 + * U(https://www.googleapis.com/compute/v1/projects/project/regions/region/addresses/address) + * projects/project/regions/region/addresses/address * regions/region/addresses/address + * global/addresses/address * address .' + returned: success + type: str +IPProtocol: + description: + - The IP protocol to which this rule applies. Valid options are TCP, UDP, ESP, AH, + SCTP or ICMP. + - When the load balancing scheme is INTERNAL, only TCP and UDP are valid. + returned: success + type: str +backendService: + description: + - A reference to a BackendService to receive the matched traffic. + - This is used for internal load balancing. + - "(not used for external load balancing) ." + returned: success + type: dict +ipVersion: + description: + - The IP Version that will be used by this forwarding rule. Valid options are IPV4 + or IPV6. This can only be specified for a global forwarding rule. + returned: success + type: str +loadBalancingScheme: + description: + - 'This signifies what the ForwardingRule will be used for and can only take the + following values: INTERNAL, EXTERNAL The value of INTERNAL means that this will + be used for Internal Network Load Balancing (TCP, UDP). The value of EXTERNAL + means that this will be used for External Load Balancing (HTTP(S) LB, External + TCP/UDP LB, SSL Proxy) .' + returned: success + type: str +name: + description: + - Name of the resource; provided by the client when the resource is created. The + name must be 1-63 characters long, and comply with RFC1035. Specifically, the + name must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` + which means the first character must be a lowercase letter, and all following + characters must be a dash, lowercase letter, or digit, except the last character, + which cannot be a dash. + returned: success + type: str +network: + description: + - For internal load balancing, this field identifies the network that the load balanced + IP should belong to for this Forwarding Rule. If this field is not specified, + the default network will be used. + - This field is not used for external load balancing. + returned: success + type: dict +portRange: + description: + - This field is used along with the target field for TargetHttpProxy, TargetHttpsProxy, + TargetSslProxy, TargetTcpProxy, TargetVpnGateway, TargetPool, TargetInstance. + - Applicable only when IPProtocol is TCP, UDP, or SCTP, only packets addressed to + ports in the specified range will be forwarded to target. + - Forwarding rules with the same [IPAddress, IPProtocol] pair must have disjoint + port ranges. + - 'Some types of forwarding target have constraints on the acceptable ports: * TargetHttpProxy: + 80, 8080 * TargetHttpsProxy: 443 * TargetTcpProxy: 25, 43, 110, 143, 195, 443, + 465, 587, 700, 993, 995, 1883, 5222 * TargetSslProxy: 25, 43, 110, 143, 195, 443, + 465, 587, 700, 993, 995, 1883, 5222 * TargetVpnGateway: 500, 4500 .' + returned: success + type: str +ports: + description: + - This field is used along with the backend_service field for internal load balancing. + - When the load balancing scheme is INTERNAL, a single port or a comma separated + list of ports can be configured. Only packets addressed to these ports will be + forwarded to the backends configured with this forwarding rule. + - You may specify a maximum of up to 5 ports. + returned: success + type: list +subnetwork: + description: + - A reference to a subnetwork. + - For internal load balancing, this field identifies the subnetwork that the load + balanced IP should belong to for this Forwarding Rule. + - If the network specified is in auto subnet mode, this field is optional. However, + if the network is in custom subnet mode, a subnetwork must be specified. + - This field is not used for external load balancing. + returned: success + type: dict +target: + description: + - A reference to a TargetPool resource to receive the matched traffic. + - For regional forwarding rules, this target must live in the same region as the + forwarding rule. For global forwarding rules, this target must be a global load + balancing resource. The forwarded traffic must be of a type appropriate to the + target object. + - This field is not used for internal load balancing. + returned: success + type: dict +networkTier: + description: + - 'The networking tier used for configuring this address. This field can take the + following values: PREMIUM or STANDARD. If this field is not specified, it is assumed + to be PREMIUM.' + returned: success + type: str +region: + description: + - A reference to the region where the regional forwarding rule resides. + - This field is not applicable to global forwarding rules. + returned: success + type: str ''' ################################################################################ diff --git a/lib/ansible/modules/cloud/google/gcp_compute_forwarding_rule_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_forwarding_rule_facts.py index 1844ef264980f9..d1f58bc45f678d 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_forwarding_rule_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_forwarding_rule_facts.py @@ -32,26 +32,25 @@ --- module: gcp_compute_forwarding_rule_facts description: - - Gather facts for GCP ForwardingRule +- Gather facts for GCP ForwardingRule short_description: Gather facts for GCP ForwardingRule version_added: 2.7 author: Google Inc. (@googlecloudplatform) requirements: - - python >= 2.6 - - requests >= 2.18.4 - - google-auth >= 1.3.0 +- python >= 2.6 +- requests >= 2.18.4 +- google-auth >= 1.3.0 options: - filters: - description: - A list of filter value pairs. Available filters are listed here - U(https://cloud.google.com/sdk/gcloud/reference/topic/filters). - Each additional filter in the list will act be added as an AND condition - (filter1 and filter2) - region: - description: - - A reference to the region where the regional forwarding rule resides. - - This field is not applicable to global forwarding rules. - required: true + filters: + description: + - A list of filter value pairs. Available filters are listed here U(U(https://cloud.google.com/sdk/gcloud/reference/topic/filters).) + - Each additional filter in the list will act be added as an AND condition (filter1 + and filter2) . + region: + description: + - A reference to the region where the regional forwarding rule resides. + - This field is not applicable to global forwarding rules. + required: true extends_documentation_fragment: gcp ''' @@ -68,150 +67,154 @@ RETURN = ''' items: - description: List of items - returned: always - type: complex - contains: - creationTimestamp: - description: - - Creation timestamp in RFC3339 text format. - returned: success - type: str - description: - description: - - An optional description of this resource. Provide this property when you create - the resource. - returned: success - type: str - id: - description: - - The unique identifier for the resource. - returned: success - type: int - IPAddress: - description: - - The IP address that this forwarding rule is serving on behalf of. - - Addresses are restricted based on the forwarding rule's load balancing scheme (EXTERNAL - or INTERNAL) and scope (global or regional). - - When the load balancing scheme is EXTERNAL, for global forwarding rules, the address - must be a global IP, and for regional forwarding rules, the address must live in - the same region as the forwarding rule. If this field is empty, an ephemeral IPv4 - address from the same scope (global or regional) will be assigned. A regional forwarding - rule supports IPv4 only. A global forwarding rule supports either IPv4 or IPv6. - - When the load balancing scheme is INTERNAL, this can only be an RFC 1918 IP address - belonging to the network/subnet configured for the forwarding rule. By default, - if this field is empty, an ephemeral internal IP address will be automatically allocated - from the IP range of the subnet or network configured for this forwarding rule. - - 'An address can be specified either by a literal IP address or a URL reference to - an existing Address resource. The following examples are all valid: * 100.1.2.3 - * U(https://www.googleapis.com/compute/v1/projects/project/regions/region/addresses/address) - * projects/project/regions/region/addresses/address * regions/region/addresses/address - * global/addresses/address * address .' - returned: success - type: str - IPProtocol: - description: - - The IP protocol to which this rule applies. Valid options are TCP, UDP, ESP, AH, - SCTP or ICMP. - - When the load balancing scheme is INTERNAL, only TCP and UDP are valid. - returned: success - type: str - backendService: - description: - - A reference to a BackendService to receive the matched traffic. - - This is used for internal load balancing. - - "(not used for external load balancing) ." - returned: success - type: dict - ipVersion: - description: - - The IP Version that will be used by this forwarding rule. Valid options are IPV4 - or IPV6. This can only be specified for a global forwarding rule. - returned: success - type: str - loadBalancingScheme: - description: - - 'This signifies what the ForwardingRule will be used for and can only take the following - values: INTERNAL, EXTERNAL The value of INTERNAL means that this will be used for - Internal Network Load Balancing (TCP, UDP). The value of EXTERNAL means that this - will be used for External Load Balancing (HTTP(S) LB, External TCP/UDP LB, SSL Proxy) - .' - returned: success - type: str - name: - description: - - Name of the resource; provided by the client when the resource is created. The name - must be 1-63 characters long, and comply with RFC1035. Specifically, the name must - be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` - which means the first character must be a lowercase letter, and all following characters - must be a dash, lowercase letter, or digit, except the last character, which cannot - be a dash. - returned: success - type: str - network: - description: - - For internal load balancing, this field identifies the network that the load balanced - IP should belong to for this Forwarding Rule. If this field is not specified, the - default network will be used. - - This field is not used for external load balancing. - returned: success - type: dict - portRange: - description: - - This field is used along with the target field for TargetHttpProxy, TargetHttpsProxy, - TargetSslProxy, TargetTcpProxy, TargetVpnGateway, TargetPool, TargetInstance. - - Applicable only when IPProtocol is TCP, UDP, or SCTP, only packets addressed to - ports in the specified range will be forwarded to target. - - Forwarding rules with the same [IPAddress, IPProtocol] pair must have disjoint port - ranges. - - 'Some types of forwarding target have constraints on the acceptable ports: * TargetHttpProxy: - 80, 8080 * TargetHttpsProxy: 443 * TargetTcpProxy: 25, 43, 110, 143, 195, 443, 465, - 587, 700, 993, 995, 1883, 5222 * TargetSslProxy: 25, 43, 110, - 143, 195, 443, 465, 587, 700, 993, 995, 1883, 5222 * TargetVpnGateway: - 500, 4500 .' - returned: success - type: str - ports: - description: - - This field is used along with the backend_service field for internal load balancing. - - When the load balancing scheme is INTERNAL, a single port or a comma separated list - of ports can be configured. Only packets addressed to these ports will be forwarded - to the backends configured with this forwarding rule. - - You may specify a maximum of up to 5 ports. - returned: success - type: list - subnetwork: - description: - - A reference to a subnetwork. - - For internal load balancing, this field identifies the subnetwork that the load - balanced IP should belong to for this Forwarding Rule. - - If the network specified is in auto subnet mode, this field is optional. However, - if the network is in custom subnet mode, a subnetwork must be specified. - - This field is not used for external load balancing. - returned: success - type: dict - target: - description: - - A reference to a TargetPool resource to receive the matched traffic. - - For regional forwarding rules, this target must live in the same region as the forwarding - rule. For global forwarding rules, this target must be a global load balancing resource. - The forwarded traffic must be of a type appropriate to the target object. - - This field is not used for internal load balancing. - returned: success - type: dict - networkTier: - description: - - 'The networking tier used for configuring this address. This field can take the - following values: PREMIUM or STANDARD. If this field is not specified, it is assumed - to be PREMIUM.' - returned: success - type: str - region: - description: - - A reference to the region where the regional forwarding rule resides. - - This field is not applicable to global forwarding rules. - returned: success - type: str + description: List of items + returned: always + type: complex + contains: + creationTimestamp: + description: + - Creation timestamp in RFC3339 text format. + returned: success + type: str + description: + description: + - An optional description of this resource. Provide this property when you create + the resource. + returned: success + type: str + id: + description: + - The unique identifier for the resource. + returned: success + type: int + IPAddress: + description: + - The IP address that this forwarding rule is serving on behalf of. + - Addresses are restricted based on the forwarding rule's load balancing scheme + (EXTERNAL or INTERNAL) and scope (global or regional). + - When the load balancing scheme is EXTERNAL, for global forwarding rules, the + address must be a global IP, and for regional forwarding rules, the address + must live in the same region as the forwarding rule. If this field is empty, + an ephemeral IPv4 address from the same scope (global or regional) will be + assigned. A regional forwarding rule supports IPv4 only. A global forwarding + rule supports either IPv4 or IPv6. + - When the load balancing scheme is INTERNAL, this can only be an RFC 1918 IP + address belonging to the network/subnet configured for the forwarding rule. + By default, if this field is empty, an ephemeral internal IP address will + be automatically allocated from the IP range of the subnet or network configured + for this forwarding rule. + - 'An address can be specified either by a literal IP address or a URL reference + to an existing Address resource. The following examples are all valid: * 100.1.2.3 + * U(https://www.googleapis.com/compute/v1/projects/project/regions/region/addresses/address) + * projects/project/regions/region/addresses/address * regions/region/addresses/address + * global/addresses/address * address .' + returned: success + type: str + IPProtocol: + description: + - The IP protocol to which this rule applies. Valid options are TCP, UDP, ESP, + AH, SCTP or ICMP. + - When the load balancing scheme is INTERNAL, only TCP and UDP are valid. + returned: success + type: str + backendService: + description: + - A reference to a BackendService to receive the matched traffic. + - This is used for internal load balancing. + - "(not used for external load balancing) ." + returned: success + type: dict + ipVersion: + description: + - The IP Version that will be used by this forwarding rule. Valid options are + IPV4 or IPV6. This can only be specified for a global forwarding rule. + returned: success + type: str + loadBalancingScheme: + description: + - 'This signifies what the ForwardingRule will be used for and can only take + the following values: INTERNAL, EXTERNAL The value of INTERNAL means that + this will be used for Internal Network Load Balancing (TCP, UDP). The value + of EXTERNAL means that this will be used for External Load Balancing (HTTP(S) + LB, External TCP/UDP LB, SSL Proxy) .' + returned: success + type: str + name: + description: + - Name of the resource; provided by the client when the resource is created. + The name must be 1-63 characters long, and comply with RFC1035. Specifically, + the name must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` + which means the first character must be a lowercase letter, and all following + characters must be a dash, lowercase letter, or digit, except the last character, + which cannot be a dash. + returned: success + type: str + network: + description: + - For internal load balancing, this field identifies the network that the load + balanced IP should belong to for this Forwarding Rule. If this field is not + specified, the default network will be used. + - This field is not used for external load balancing. + returned: success + type: dict + portRange: + description: + - This field is used along with the target field for TargetHttpProxy, TargetHttpsProxy, + TargetSslProxy, TargetTcpProxy, TargetVpnGateway, TargetPool, TargetInstance. + - Applicable only when IPProtocol is TCP, UDP, or SCTP, only packets addressed + to ports in the specified range will be forwarded to target. + - Forwarding rules with the same [IPAddress, IPProtocol] pair must have disjoint + port ranges. + - 'Some types of forwarding target have constraints on the acceptable ports: + * TargetHttpProxy: 80, 8080 * TargetHttpsProxy: 443 * TargetTcpProxy: 25, + 43, 110, 143, 195, 443, 465, 587, 700, 993, 995, 1883, 5222 * TargetSslProxy: + 25, 43, 110, 143, 195, 443, 465, 587, 700, 993, 995, 1883, 5222 * TargetVpnGateway: + 500, 4500 .' + returned: success + type: str + ports: + description: + - This field is used along with the backend_service field for internal load + balancing. + - When the load balancing scheme is INTERNAL, a single port or a comma separated + list of ports can be configured. Only packets addressed to these ports will + be forwarded to the backends configured with this forwarding rule. + - You may specify a maximum of up to 5 ports. + returned: success + type: list + subnetwork: + description: + - A reference to a subnetwork. + - For internal load balancing, this field identifies the subnetwork that the + load balanced IP should belong to for this Forwarding Rule. + - If the network specified is in auto subnet mode, this field is optional. However, + if the network is in custom subnet mode, a subnetwork must be specified. + - This field is not used for external load balancing. + returned: success + type: dict + target: + description: + - A reference to a TargetPool resource to receive the matched traffic. + - For regional forwarding rules, this target must live in the same region as + the forwarding rule. For global forwarding rules, this target must be a global + load balancing resource. The forwarded traffic must be of a type appropriate + to the target object. + - This field is not used for internal load balancing. + returned: success + type: dict + networkTier: + description: + - 'The networking tier used for configuring this address. This field can take + the following values: PREMIUM or STANDARD. If this field is not specified, + it is assumed to be PREMIUM.' + returned: success + type: str + region: + description: + - A reference to the region where the regional forwarding rule resides. + - This field is not applicable to global forwarding rules. + returned: success + type: str ''' ################################################################################ diff --git a/lib/ansible/modules/cloud/google/gcp_compute_global_address.py b/lib/ansible/modules/cloud/google/gcp_compute_global_address.py index 79ef0262a09dff..354d9b015dd618 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_global_address.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_global_address.py @@ -32,54 +32,60 @@ --- module: gcp_compute_global_address description: - - Represents a Global Address resource. Global addresses are used for HTTP(S) load - balancing. +- Represents a Global Address resource. Global addresses are used for HTTP(S) load + balancing. short_description: Creates a GCP GlobalAddress version_added: 2.6 author: Google Inc. (@googlecloudplatform) requirements: - - python >= 2.6 - - requests >= 2.18.4 - - google-auth >= 1.3.0 +- python >= 2.6 +- requests >= 2.18.4 +- google-auth >= 1.3.0 options: - state: - description: - - Whether the given object should exist in GCP - choices: ['present', 'absent'] - default: 'present' + state: description: - description: - - An optional description of this resource. - - Provide this property when you create the resource. - required: false - name: - description: - - Name of the resource. Provided by the client when the resource is created. The name - must be 1-63 characters long, and comply with RFC1035. Specifically, the name must - be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` - which means the first character must be a lowercase letter, and all following characters - must be a dash, lowercase letter, or digit, except the last character, which cannot - be a dash. - required: true - ip_version: - description: - - The IP Version that will be used by this address. Valid options are IPV4 or IPV6. - The default value is IPV4. - required: false - choices: ['IPV4', 'IPV6'] - address_type: - description: - - The type of the address to reserve, default is EXTERNAL. - - "* EXTERNAL indicates public/external single IP address." - - "* INTERNAL indicates internal IP ranges belonging to some network." - required: false - default: EXTERNAL - version_added: 2.8 - choices: ['EXTERNAL', 'INTERNAL'] + - Whether the given object should exist in GCP + choices: + - present + - absent + default: present + description: + description: + - An optional description of this resource. + - Provide this property when you create the resource. + required: false + name: + description: + - Name of the resource. Provided by the client when the resource is created. The + name must be 1-63 characters long, and comply with RFC1035. Specifically, the + name must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` + which means the first character must be a lowercase letter, and all following + characters must be a dash, lowercase letter, or digit, except the last character, + which cannot be a dash. + required: true + ip_version: + description: + - The IP Version that will be used by this address. Valid options are IPV4 or + IPV6. The default value is IPV4. + required: false + choices: + - IPV4 + - IPV6 + address_type: + description: + - The type of the address to reserve, default is EXTERNAL. + - "* EXTERNAL indicates public/external single IP address." + - "* INTERNAL indicates internal IP ranges belonging to some network." + required: false + default: EXTERNAL + version_added: 2.8 + choices: + - EXTERNAL + - INTERNAL extends_documentation_fragment: gcp notes: - - "API Reference: U(https://cloud.google.com/compute/docs/reference/latest/globalAddresses)" - - "Reserving a Static External IP Address: U(https://cloud.google.com/compute/docs/ip-addresses/reserve-static-external-ip-address)" +- 'API Reference: U(https://cloud.google.com/compute/docs/reference/latest/globalAddresses)' +- 'Reserving a Static External IP Address: U(https://cloud.google.com/compute/docs/ip-addresses/reserve-static-external-ip-address)' ''' EXAMPLES = ''' @@ -93,55 +99,55 @@ ''' RETURN = ''' - address: - description: - - The static external IP address represented by this resource. - returned: success - type: str - creationTimestamp: - description: - - Creation timestamp in RFC3339 text format. - returned: success - type: str - description: - description: - - An optional description of this resource. - - Provide this property when you create the resource. - returned: success - type: str - id: - description: - - The unique identifier for the resource. This identifier is defined by the server. - returned: success - type: int - name: - description: - - Name of the resource. Provided by the client when the resource is created. The name - must be 1-63 characters long, and comply with RFC1035. Specifically, the name must - be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` - which means the first character must be a lowercase letter, and all following characters - must be a dash, lowercase letter, or digit, except the last character, which cannot - be a dash. - returned: success - type: str - ipVersion: - description: - - The IP Version that will be used by this address. Valid options are IPV4 or IPV6. - The default value is IPV4. - returned: success - type: str - region: - description: - - A reference to the region where the regional address resides. - returned: success - type: str - addressType: - description: - - The type of the address to reserve, default is EXTERNAL. - - "* EXTERNAL indicates public/external single IP address." - - "* INTERNAL indicates internal IP ranges belonging to some network." - returned: success - type: str +address: + description: + - The static external IP address represented by this resource. + returned: success + type: str +creationTimestamp: + description: + - Creation timestamp in RFC3339 text format. + returned: success + type: str +description: + description: + - An optional description of this resource. + - Provide this property when you create the resource. + returned: success + type: str +id: + description: + - The unique identifier for the resource. This identifier is defined by the server. + returned: success + type: int +name: + description: + - Name of the resource. Provided by the client when the resource is created. The + name must be 1-63 characters long, and comply with RFC1035. Specifically, the + name must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` + which means the first character must be a lowercase letter, and all following + characters must be a dash, lowercase letter, or digit, except the last character, + which cannot be a dash. + returned: success + type: str +ipVersion: + description: + - The IP Version that will be used by this address. Valid options are IPV4 or IPV6. + The default value is IPV4. + returned: success + type: str +region: + description: + - A reference to the region where the regional address resides. + returned: success + type: str +addressType: + description: + - The type of the address to reserve, default is EXTERNAL. + - "* EXTERNAL indicates public/external single IP address." + - "* INTERNAL indicates internal IP ranges belonging to some network." + returned: success + type: str ''' ################################################################################ diff --git a/lib/ansible/modules/cloud/google/gcp_compute_global_address_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_global_address_facts.py index 2e09ef41c9fd61..981079f0550c43 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_global_address_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_global_address_facts.py @@ -32,21 +32,20 @@ --- module: gcp_compute_global_address_facts description: - - Gather facts for GCP GlobalAddress +- Gather facts for GCP GlobalAddress short_description: Gather facts for GCP GlobalAddress version_added: 2.7 author: Google Inc. (@googlecloudplatform) requirements: - - python >= 2.6 - - requests >= 2.18.4 - - google-auth >= 1.3.0 +- python >= 2.6 +- requests >= 2.18.4 +- google-auth >= 1.3.0 options: - filters: - description: - A list of filter value pairs. Available filters are listed here - U(https://cloud.google.com/sdk/gcloud/reference/topic/filters). - Each additional filter in the list will act be added as an AND condition - (filter1 and filter2) + filters: + description: + - A list of filter value pairs. Available filters are listed here U(U(https://cloud.google.com/sdk/gcloud/reference/topic/filters).) + - Each additional filter in the list will act be added as an AND condition (filter1 + and filter2) . extends_documentation_fragment: gcp ''' @@ -62,59 +61,60 @@ RETURN = ''' items: - description: List of items - returned: always - type: complex - contains: - address: - description: - - The static external IP address represented by this resource. - returned: success - type: str - creationTimestamp: - description: - - Creation timestamp in RFC3339 text format. - returned: success - type: str - description: - description: - - An optional description of this resource. - - Provide this property when you create the resource. - returned: success - type: str - id: - description: - - The unique identifier for the resource. This identifier is defined by the server. - returned: success - type: int - name: - description: - - Name of the resource. Provided by the client when the resource is created. The name - must be 1-63 characters long, and comply with RFC1035. Specifically, the name must - be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` - which means the first character must be a lowercase letter, and all following characters - must be a dash, lowercase letter, or digit, except the last character, which cannot - be a dash. - returned: success - type: str - ipVersion: - description: - - The IP Version that will be used by this address. Valid options are IPV4 or IPV6. - The default value is IPV4. - returned: success - type: str - region: - description: - - A reference to the region where the regional address resides. - returned: success - type: str - addressType: - description: - - The type of the address to reserve, default is EXTERNAL. - - "* EXTERNAL indicates public/external single IP address." - - "* INTERNAL indicates internal IP ranges belonging to some network." - returned: success - type: str + description: List of items + returned: always + type: complex + contains: + address: + description: + - The static external IP address represented by this resource. + returned: success + type: str + creationTimestamp: + description: + - Creation timestamp in RFC3339 text format. + returned: success + type: str + description: + description: + - An optional description of this resource. + - Provide this property when you create the resource. + returned: success + type: str + id: + description: + - The unique identifier for the resource. This identifier is defined by the + server. + returned: success + type: int + name: + description: + - Name of the resource. Provided by the client when the resource is created. + The name must be 1-63 characters long, and comply with RFC1035. Specifically, + the name must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` + which means the first character must be a lowercase letter, and all following + characters must be a dash, lowercase letter, or digit, except the last character, + which cannot be a dash. + returned: success + type: str + ipVersion: + description: + - The IP Version that will be used by this address. Valid options are IPV4 or + IPV6. The default value is IPV4. + returned: success + type: str + region: + description: + - A reference to the region where the regional address resides. + returned: success + type: str + addressType: + description: + - The type of the address to reserve, default is EXTERNAL. + - "* EXTERNAL indicates public/external single IP address." + - "* INTERNAL indicates internal IP ranges belonging to some network." + returned: success + type: str ''' ################################################################################ diff --git a/lib/ansible/modules/cloud/google/gcp_compute_global_forwarding_rule.py b/lib/ansible/modules/cloud/google/gcp_compute_global_forwarding_rule.py index 09e563396cc091..b832eb15b46dcc 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_global_forwarding_rule.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_global_forwarding_rule.py @@ -32,145 +32,159 @@ --- module: gcp_compute_global_forwarding_rule description: - - Represents a GlobalForwardingRule resource. Global forwarding rules are used to - forward traffic to the correct load balancer for HTTP load balancing. Global forwarding - rules can only be used for HTTP load balancing. - - For more information, see U(https://cloud.google.com/compute/docs/load-balancing/http/) - . +- Represents a GlobalForwardingRule resource. Global forwarding rules are used to + forward traffic to the correct load balancer for HTTP load balancing. Global forwarding + rules can only be used for HTTP load balancing. +- For more information, see U(https://cloud.google.com/compute/docs/load-balancing/http/) + . short_description: Creates a GCP GlobalForwardingRule version_added: 2.6 author: Google Inc. (@googlecloudplatform) requirements: - - python >= 2.6 - - requests >= 2.18.4 - - google-auth >= 1.3.0 +- python >= 2.6 +- requests >= 2.18.4 +- google-auth >= 1.3.0 options: - state: - description: - - Whether the given object should exist in GCP - choices: ['present', 'absent'] - default: 'present' + state: description: - description: - - An optional description of this resource. Provide this property when you create - the resource. - required: false - ip_address: - description: - - The IP address that this forwarding rule is serving on behalf of. - - Addresses are restricted based on the forwarding rule's load balancing scheme (EXTERNAL - or INTERNAL) and scope (global or regional). - - When the load balancing scheme is EXTERNAL, for global forwarding rules, the address - must be a global IP, and for regional forwarding rules, the address must live in - the same region as the forwarding rule. If this field is empty, an ephemeral IPv4 - address from the same scope (global or regional) will be assigned. A regional forwarding - rule supports IPv4 only. A global forwarding rule supports either IPv4 or IPv6. - - When the load balancing scheme is INTERNAL, this can only be an RFC 1918 IP address - belonging to the network/subnet configured for the forwarding rule. By default, - if this field is empty, an ephemeral internal IP address will be automatically allocated - from the IP range of the subnet or network configured for this forwarding rule. - - 'An address can be specified either by a literal IP address or a URL reference to - an existing Address resource. The following examples are all valid: * 100.1.2.3 - * U(https://www.googleapis.com/compute/v1/projects/project/regions/region/addresses/address) - * projects/project/regions/region/addresses/address * regions/region/addresses/address - * global/addresses/address * address .' - required: false - ip_protocol: - description: - - The IP protocol to which this rule applies. Valid options are TCP, UDP, ESP, AH, - SCTP or ICMP. - - When the load balancing scheme is INTERNAL, only TCP and UDP are valid. - required: false - choices: ['TCP', 'UDP', 'ESP', 'AH', 'SCTP', 'ICMP'] - backend_service: - description: - - A reference to a BackendService to receive the matched traffic. - - This is used for internal load balancing. - - "(not used for external load balancing) ." - - 'This field represents a link to a BackendService resource in GCP. It can be specified - in two ways. You can add `register: name-of-resource` to a gcp_compute_backend_service - task and then set this backend_service field to "{{ name-of-resource }}" Alternatively, - you can set this backend_service to a dictionary with the selfLink key where the - value is the selfLink of your BackendService.' - required: false - ip_version: - description: - - The IP Version that will be used by this forwarding rule. Valid options are IPV4 - or IPV6. This can only be specified for a global forwarding rule. - required: false - choices: ['IPV4', 'IPV6'] - load_balancing_scheme: - description: - - 'This signifies what the ForwardingRule will be used for and can only take the following - values: INTERNAL, EXTERNAL The value of INTERNAL means that this will be used for - Internal Network Load Balancing (TCP, UDP). The value of EXTERNAL means that this - will be used for External Load Balancing (HTTP(S) LB, External TCP/UDP LB, SSL Proxy) - .' - required: false - choices: ['INTERNAL', 'EXTERNAL'] - name: - description: - - Name of the resource; provided by the client when the resource is created. The name - must be 1-63 characters long, and comply with RFC1035. Specifically, the name must - be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` - which means the first character must be a lowercase letter, and all following characters - must be a dash, lowercase letter, or digit, except the last character, which cannot - be a dash. - required: true - network: - description: - - For internal load balancing, this field identifies the network that the load balanced - IP should belong to for this Forwarding Rule. If this field is not specified, the - default network will be used. - - This field is not used for external load balancing. - - 'This field represents a link to a Network resource in GCP. It can be specified - in two ways. You can add `register: name-of-resource` to a gcp_compute_network task - and then set this network field to "{{ name-of-resource }}" Alternatively, you can - set this network to a dictionary with the selfLink key where the value is the selfLink - of your Network.' - required: false - port_range: - description: - - This field is used along with the target field for TargetHttpProxy, TargetHttpsProxy, - TargetSslProxy, TargetTcpProxy, TargetVpnGateway, TargetPool, TargetInstance. - - Applicable only when IPProtocol is TCP, UDP, or SCTP, only packets addressed to - ports in the specified range will be forwarded to target. - - Forwarding rules with the same [IPAddress, IPProtocol] pair must have disjoint port - ranges. - - 'Some types of forwarding target have constraints on the acceptable ports: * TargetHttpProxy: - 80, 8080 * TargetHttpsProxy: 443 * TargetTcpProxy: 25, 43, 110, 143, 195, 443, 465, - 587, 700, 993, 995, 1883, 5222 * TargetSslProxy: 25, 43, 110, - 143, 195, 443, 465, 587, 700, 993, 995, 1883, 5222 * TargetVpnGateway: - 500, 4500 .' - required: false - ports: - description: - - This field is used along with the backend_service field for internal load balancing. - - When the load balancing scheme is INTERNAL, a single port or a comma separated list - of ports can be configured. Only packets addressed to these ports will be forwarded - to the backends configured with this forwarding rule. - - You may specify a maximum of up to 5 ports. - required: false - subnetwork: - description: - - A reference to a subnetwork. - - For internal load balancing, this field identifies the subnetwork that the load - balanced IP should belong to for this Forwarding Rule. - - If the network specified is in auto subnet mode, this field is optional. However, - if the network is in custom subnet mode, a subnetwork must be specified. - - This field is not used for external load balancing. - - 'This field represents a link to a Subnetwork resource in GCP. It can be specified - in two ways. You can add `register: name-of-resource` to a gcp_compute_subnetwork - task and then set this subnetwork field to "{{ name-of-resource }}" Alternatively, - you can set this subnetwork to a dictionary with the selfLink key where the value - is the selfLink of your Subnetwork.' - required: false - target: - description: - - This target must be a global load balancing resource. The forwarded traffic must - be of a type appropriate to the target object. - - 'Valid types: HTTP_PROXY, HTTPS_PROXY, SSL_PROXY, TCP_PROXY .' - required: false + - Whether the given object should exist in GCP + choices: + - present + - absent + default: present + description: + description: + - An optional description of this resource. Provide this property when you create + the resource. + required: false + ip_address: + description: + - The IP address that this forwarding rule is serving on behalf of. + - Addresses are restricted based on the forwarding rule's load balancing scheme + (EXTERNAL or INTERNAL) and scope (global or regional). + - When the load balancing scheme is EXTERNAL, for global forwarding rules, the + address must be a global IP, and for regional forwarding rules, the address + must live in the same region as the forwarding rule. If this field is empty, + an ephemeral IPv4 address from the same scope (global or regional) will be assigned. + A regional forwarding rule supports IPv4 only. A global forwarding rule supports + either IPv4 or IPv6. + - When the load balancing scheme is INTERNAL, this can only be an RFC 1918 IP + address belonging to the network/subnet configured for the forwarding rule. + By default, if this field is empty, an ephemeral internal IP address will be + automatically allocated from the IP range of the subnet or network configured + for this forwarding rule. + - 'An address can be specified either by a literal IP address or a URL reference + to an existing Address resource. The following examples are all valid: * 100.1.2.3 + * U(https://www.googleapis.com/compute/v1/projects/project/regions/region/addresses/address) + * projects/project/regions/region/addresses/address * regions/region/addresses/address + * global/addresses/address * address .' + required: false + ip_protocol: + description: + - The IP protocol to which this rule applies. Valid options are TCP, UDP, ESP, + AH, SCTP or ICMP. + - When the load balancing scheme is INTERNAL, only TCP and UDP are valid. + required: false + choices: + - TCP + - UDP + - ESP + - AH + - SCTP + - ICMP + backend_service: + description: + - A reference to a BackendService to receive the matched traffic. + - This is used for internal load balancing. + - "(not used for external load balancing) ." + - 'This field represents a link to a BackendService resource in GCP. It can be + specified in two ways. You can add `register: name-of-resource` to a gcp_compute_backend_service + task and then set this backend_service field to "{{ name-of-resource }}" Alternatively, + you can set this backend_service to a dictionary with the selfLink key where + the value is the selfLink of your BackendService' + required: false + ip_version: + description: + - The IP Version that will be used by this forwarding rule. Valid options are + IPV4 or IPV6. This can only be specified for a global forwarding rule. + required: false + choices: + - IPV4 + - IPV6 + load_balancing_scheme: + description: + - 'This signifies what the ForwardingRule will be used for and can only take the + following values: INTERNAL, EXTERNAL The value of INTERNAL means that this will + be used for Internal Network Load Balancing (TCP, UDP). The value of EXTERNAL + means that this will be used for External Load Balancing (HTTP(S) LB, External + TCP/UDP LB, SSL Proxy) .' + required: false + choices: + - INTERNAL + - EXTERNAL + name: + description: + - Name of the resource; provided by the client when the resource is created. The + name must be 1-63 characters long, and comply with RFC1035. Specifically, the + name must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` + which means the first character must be a lowercase letter, and all following + characters must be a dash, lowercase letter, or digit, except the last character, + which cannot be a dash. + required: true + network: + description: + - For internal load balancing, this field identifies the network that the load + balanced IP should belong to for this Forwarding Rule. If this field is not + specified, the default network will be used. + - This field is not used for external load balancing. + - 'This field represents a link to a Network resource in GCP. It can be specified + in two ways. You can add `register: name-of-resource` to a gcp_compute_network + task and then set this network field to "{{ name-of-resource }}" Alternatively, + you can set this network to a dictionary with the selfLink key where the value + is the selfLink of your Network' + required: false + port_range: + description: + - This field is used along with the target field for TargetHttpProxy, TargetHttpsProxy, + TargetSslProxy, TargetTcpProxy, TargetVpnGateway, TargetPool, TargetInstance. + - Applicable only when IPProtocol is TCP, UDP, or SCTP, only packets addressed + to ports in the specified range will be forwarded to target. + - Forwarding rules with the same [IPAddress, IPProtocol] pair must have disjoint + port ranges. + - 'Some types of forwarding target have constraints on the acceptable ports: * + TargetHttpProxy: 80, 8080 * TargetHttpsProxy: 443 * TargetTcpProxy: 25, 43, + 110, 143, 195, 443, 465, 587, 700, 993, 995, 1883, 5222 * TargetSslProxy: 25, + 43, 110, 143, 195, 443, 465, 587, 700, 993, 995, 1883, 5222 * TargetVpnGateway: + 500, 4500 .' + required: false + ports: + description: + - This field is used along with the backend_service field for internal load balancing. + - When the load balancing scheme is INTERNAL, a single port or a comma separated + list of ports can be configured. Only packets addressed to these ports will + be forwarded to the backends configured with this forwarding rule. + - You may specify a maximum of up to 5 ports. + required: false + subnetwork: + description: + - A reference to a subnetwork. + - For internal load balancing, this field identifies the subnetwork that the load + balanced IP should belong to for this Forwarding Rule. + - If the network specified is in auto subnet mode, this field is optional. However, + if the network is in custom subnet mode, a subnetwork must be specified. + - This field is not used for external load balancing. + - 'This field represents a link to a Subnetwork resource in GCP. It can be specified + in two ways. You can add `register: name-of-resource` to a gcp_compute_subnetwork + task and then set this subnetwork field to "{{ name-of-resource }}" Alternatively, + you can set this subnetwork to a dictionary with the selfLink key where the + value is the selfLink of your Subnetwork' + required: false + target: + description: + - This target must be a global load balancing resource. The forwarded traffic + must be of a type appropriate to the target object. + - 'Valid types: HTTP_PROXY, HTTPS_PROXY, SSL_PROXY, TCP_PROXY .' + required: false extends_documentation_fragment: gcp ''' @@ -255,137 +269,138 @@ ''' RETURN = ''' - creationTimestamp: - description: - - Creation timestamp in RFC3339 text format. - returned: success - type: str - description: - description: - - An optional description of this resource. Provide this property when you create - the resource. - returned: success - type: str - id: - description: - - The unique identifier for the resource. - returned: success - type: int - IPAddress: - description: - - The IP address that this forwarding rule is serving on behalf of. - - Addresses are restricted based on the forwarding rule's load balancing scheme (EXTERNAL - or INTERNAL) and scope (global or regional). - - When the load balancing scheme is EXTERNAL, for global forwarding rules, the address - must be a global IP, and for regional forwarding rules, the address must live in - the same region as the forwarding rule. If this field is empty, an ephemeral IPv4 - address from the same scope (global or regional) will be assigned. A regional forwarding - rule supports IPv4 only. A global forwarding rule supports either IPv4 or IPv6. - - When the load balancing scheme is INTERNAL, this can only be an RFC 1918 IP address - belonging to the network/subnet configured for the forwarding rule. By default, - if this field is empty, an ephemeral internal IP address will be automatically allocated - from the IP range of the subnet or network configured for this forwarding rule. - - 'An address can be specified either by a literal IP address or a URL reference to - an existing Address resource. The following examples are all valid: * 100.1.2.3 - * U(https://www.googleapis.com/compute/v1/projects/project/regions/region/addresses/address) - * projects/project/regions/region/addresses/address * regions/region/addresses/address - * global/addresses/address * address .' - returned: success - type: str - IPProtocol: - description: - - The IP protocol to which this rule applies. Valid options are TCP, UDP, ESP, AH, - SCTP or ICMP. - - When the load balancing scheme is INTERNAL, only TCP and UDP are valid. - returned: success - type: str - backendService: - description: - - A reference to a BackendService to receive the matched traffic. - - This is used for internal load balancing. - - "(not used for external load balancing) ." - returned: success - type: dict - ipVersion: - description: - - The IP Version that will be used by this forwarding rule. Valid options are IPV4 - or IPV6. This can only be specified for a global forwarding rule. - returned: success - type: str - loadBalancingScheme: - description: - - 'This signifies what the ForwardingRule will be used for and can only take the following - values: INTERNAL, EXTERNAL The value of INTERNAL means that this will be used for - Internal Network Load Balancing (TCP, UDP). The value of EXTERNAL means that this - will be used for External Load Balancing (HTTP(S) LB, External TCP/UDP LB, SSL Proxy) - .' - returned: success - type: str - name: - description: - - Name of the resource; provided by the client when the resource is created. The name - must be 1-63 characters long, and comply with RFC1035. Specifically, the name must - be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` - which means the first character must be a lowercase letter, and all following characters - must be a dash, lowercase letter, or digit, except the last character, which cannot - be a dash. - returned: success - type: str - network: - description: - - For internal load balancing, this field identifies the network that the load balanced - IP should belong to for this Forwarding Rule. If this field is not specified, the - default network will be used. - - This field is not used for external load balancing. - returned: success - type: dict - portRange: - description: - - This field is used along with the target field for TargetHttpProxy, TargetHttpsProxy, - TargetSslProxy, TargetTcpProxy, TargetVpnGateway, TargetPool, TargetInstance. - - Applicable only when IPProtocol is TCP, UDP, or SCTP, only packets addressed to - ports in the specified range will be forwarded to target. - - Forwarding rules with the same [IPAddress, IPProtocol] pair must have disjoint port - ranges. - - 'Some types of forwarding target have constraints on the acceptable ports: * TargetHttpProxy: - 80, 8080 * TargetHttpsProxy: 443 * TargetTcpProxy: 25, 43, 110, 143, 195, 443, 465, - 587, 700, 993, 995, 1883, 5222 * TargetSslProxy: 25, 43, 110, - 143, 195, 443, 465, 587, 700, 993, 995, 1883, 5222 * TargetVpnGateway: - 500, 4500 .' - returned: success - type: str - ports: - description: - - This field is used along with the backend_service field for internal load balancing. - - When the load balancing scheme is INTERNAL, a single port or a comma separated list - of ports can be configured. Only packets addressed to these ports will be forwarded - to the backends configured with this forwarding rule. - - You may specify a maximum of up to 5 ports. - returned: success - type: list - subnetwork: - description: - - A reference to a subnetwork. - - For internal load balancing, this field identifies the subnetwork that the load - balanced IP should belong to for this Forwarding Rule. - - If the network specified is in auto subnet mode, this field is optional. However, - if the network is in custom subnet mode, a subnetwork must be specified. - - This field is not used for external load balancing. - returned: success - type: dict - region: - description: - - A reference to the region where the regional forwarding rule resides. - - This field is not applicable to global forwarding rules. - returned: success - type: str - target: - description: - - This target must be a global load balancing resource. The forwarded traffic must - be of a type appropriate to the target object. - - 'Valid types: HTTP_PROXY, HTTPS_PROXY, SSL_PROXY, TCP_PROXY .' - returned: success - type: str +creationTimestamp: + description: + - Creation timestamp in RFC3339 text format. + returned: success + type: str +description: + description: + - An optional description of this resource. Provide this property when you create + the resource. + returned: success + type: str +id: + description: + - The unique identifier for the resource. + returned: success + type: int +IPAddress: + description: + - The IP address that this forwarding rule is serving on behalf of. + - Addresses are restricted based on the forwarding rule's load balancing scheme + (EXTERNAL or INTERNAL) and scope (global or regional). + - When the load balancing scheme is EXTERNAL, for global forwarding rules, the address + must be a global IP, and for regional forwarding rules, the address must live + in the same region as the forwarding rule. If this field is empty, an ephemeral + IPv4 address from the same scope (global or regional) will be assigned. A regional + forwarding rule supports IPv4 only. A global forwarding rule supports either IPv4 + or IPv6. + - When the load balancing scheme is INTERNAL, this can only be an RFC 1918 IP address + belonging to the network/subnet configured for the forwarding rule. By default, + if this field is empty, an ephemeral internal IP address will be automatically + allocated from the IP range of the subnet or network configured for this forwarding + rule. + - 'An address can be specified either by a literal IP address or a URL reference + to an existing Address resource. The following examples are all valid: * 100.1.2.3 + * U(https://www.googleapis.com/compute/v1/projects/project/regions/region/addresses/address) + * projects/project/regions/region/addresses/address * regions/region/addresses/address + * global/addresses/address * address .' + returned: success + type: str +IPProtocol: + description: + - The IP protocol to which this rule applies. Valid options are TCP, UDP, ESP, AH, + SCTP or ICMP. + - When the load balancing scheme is INTERNAL, only TCP and UDP are valid. + returned: success + type: str +backendService: + description: + - A reference to a BackendService to receive the matched traffic. + - This is used for internal load balancing. + - "(not used for external load balancing) ." + returned: success + type: dict +ipVersion: + description: + - The IP Version that will be used by this forwarding rule. Valid options are IPV4 + or IPV6. This can only be specified for a global forwarding rule. + returned: success + type: str +loadBalancingScheme: + description: + - 'This signifies what the ForwardingRule will be used for and can only take the + following values: INTERNAL, EXTERNAL The value of INTERNAL means that this will + be used for Internal Network Load Balancing (TCP, UDP). The value of EXTERNAL + means that this will be used for External Load Balancing (HTTP(S) LB, External + TCP/UDP LB, SSL Proxy) .' + returned: success + type: str +name: + description: + - Name of the resource; provided by the client when the resource is created. The + name must be 1-63 characters long, and comply with RFC1035. Specifically, the + name must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` + which means the first character must be a lowercase letter, and all following + characters must be a dash, lowercase letter, or digit, except the last character, + which cannot be a dash. + returned: success + type: str +network: + description: + - For internal load balancing, this field identifies the network that the load balanced + IP should belong to for this Forwarding Rule. If this field is not specified, + the default network will be used. + - This field is not used for external load balancing. + returned: success + type: dict +portRange: + description: + - This field is used along with the target field for TargetHttpProxy, TargetHttpsProxy, + TargetSslProxy, TargetTcpProxy, TargetVpnGateway, TargetPool, TargetInstance. + - Applicable only when IPProtocol is TCP, UDP, or SCTP, only packets addressed to + ports in the specified range will be forwarded to target. + - Forwarding rules with the same [IPAddress, IPProtocol] pair must have disjoint + port ranges. + - 'Some types of forwarding target have constraints on the acceptable ports: * TargetHttpProxy: + 80, 8080 * TargetHttpsProxy: 443 * TargetTcpProxy: 25, 43, 110, 143, 195, 443, + 465, 587, 700, 993, 995, 1883, 5222 * TargetSslProxy: 25, 43, 110, 143, 195, 443, + 465, 587, 700, 993, 995, 1883, 5222 * TargetVpnGateway: 500, 4500 .' + returned: success + type: str +ports: + description: + - This field is used along with the backend_service field for internal load balancing. + - When the load balancing scheme is INTERNAL, a single port or a comma separated + list of ports can be configured. Only packets addressed to these ports will be + forwarded to the backends configured with this forwarding rule. + - You may specify a maximum of up to 5 ports. + returned: success + type: list +subnetwork: + description: + - A reference to a subnetwork. + - For internal load balancing, this field identifies the subnetwork that the load + balanced IP should belong to for this Forwarding Rule. + - If the network specified is in auto subnet mode, this field is optional. However, + if the network is in custom subnet mode, a subnetwork must be specified. + - This field is not used for external load balancing. + returned: success + type: dict +region: + description: + - A reference to the region where the regional forwarding rule resides. + - This field is not applicable to global forwarding rules. + returned: success + type: str +target: + description: + - This target must be a global load balancing resource. The forwarded traffic must + be of a type appropriate to the target object. + - 'Valid types: HTTP_PROXY, HTTPS_PROXY, SSL_PROXY, TCP_PROXY .' + returned: success + type: str ''' ################################################################################ diff --git a/lib/ansible/modules/cloud/google/gcp_compute_global_forwarding_rule_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_global_forwarding_rule_facts.py index 3c25d67d0078c5..d28c240513f57f 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_global_forwarding_rule_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_global_forwarding_rule_facts.py @@ -32,21 +32,20 @@ --- module: gcp_compute_global_forwarding_rule_facts description: - - Gather facts for GCP GlobalForwardingRule +- Gather facts for GCP GlobalForwardingRule short_description: Gather facts for GCP GlobalForwardingRule version_added: 2.7 author: Google Inc. (@googlecloudplatform) requirements: - - python >= 2.6 - - requests >= 2.18.4 - - google-auth >= 1.3.0 +- python >= 2.6 +- requests >= 2.18.4 +- google-auth >= 1.3.0 options: - filters: - description: - A list of filter value pairs. Available filters are listed here - U(https://cloud.google.com/sdk/gcloud/reference/topic/filters). - Each additional filter in the list will act be added as an AND condition - (filter1 and filter2) + filters: + description: + - A list of filter value pairs. Available filters are listed here U(U(https://cloud.google.com/sdk/gcloud/reference/topic/filters).) + - Each additional filter in the list will act be added as an AND condition (filter1 + and filter2) . extends_documentation_fragment: gcp ''' @@ -62,141 +61,144 @@ RETURN = ''' items: - description: List of items - returned: always - type: complex - contains: - creationTimestamp: - description: - - Creation timestamp in RFC3339 text format. - returned: success - type: str - description: - description: - - An optional description of this resource. Provide this property when you create - the resource. - returned: success - type: str - id: - description: - - The unique identifier for the resource. - returned: success - type: int - IPAddress: - description: - - The IP address that this forwarding rule is serving on behalf of. - - Addresses are restricted based on the forwarding rule's load balancing scheme (EXTERNAL - or INTERNAL) and scope (global or regional). - - When the load balancing scheme is EXTERNAL, for global forwarding rules, the address - must be a global IP, and for regional forwarding rules, the address must live in - the same region as the forwarding rule. If this field is empty, an ephemeral IPv4 - address from the same scope (global or regional) will be assigned. A regional forwarding - rule supports IPv4 only. A global forwarding rule supports either IPv4 or IPv6. - - When the load balancing scheme is INTERNAL, this can only be an RFC 1918 IP address - belonging to the network/subnet configured for the forwarding rule. By default, - if this field is empty, an ephemeral internal IP address will be automatically allocated - from the IP range of the subnet or network configured for this forwarding rule. - - 'An address can be specified either by a literal IP address or a URL reference to - an existing Address resource. The following examples are all valid: * 100.1.2.3 - * U(https://www.googleapis.com/compute/v1/projects/project/regions/region/addresses/address) - * projects/project/regions/region/addresses/address * regions/region/addresses/address - * global/addresses/address * address .' - returned: success - type: str - IPProtocol: - description: - - The IP protocol to which this rule applies. Valid options are TCP, UDP, ESP, AH, - SCTP or ICMP. - - When the load balancing scheme is INTERNAL, only TCP and UDP are valid. - returned: success - type: str - backendService: - description: - - A reference to a BackendService to receive the matched traffic. - - This is used for internal load balancing. - - "(not used for external load balancing) ." - returned: success - type: dict - ipVersion: - description: - - The IP Version that will be used by this forwarding rule. Valid options are IPV4 - or IPV6. This can only be specified for a global forwarding rule. - returned: success - type: str - loadBalancingScheme: - description: - - 'This signifies what the ForwardingRule will be used for and can only take the following - values: INTERNAL, EXTERNAL The value of INTERNAL means that this will be used for - Internal Network Load Balancing (TCP, UDP). The value of EXTERNAL means that this - will be used for External Load Balancing (HTTP(S) LB, External TCP/UDP LB, SSL Proxy) - .' - returned: success - type: str - name: - description: - - Name of the resource; provided by the client when the resource is created. The name - must be 1-63 characters long, and comply with RFC1035. Specifically, the name must - be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` - which means the first character must be a lowercase letter, and all following characters - must be a dash, lowercase letter, or digit, except the last character, which cannot - be a dash. - returned: success - type: str - network: - description: - - For internal load balancing, this field identifies the network that the load balanced - IP should belong to for this Forwarding Rule. If this field is not specified, the - default network will be used. - - This field is not used for external load balancing. - returned: success - type: dict - portRange: - description: - - This field is used along with the target field for TargetHttpProxy, TargetHttpsProxy, - TargetSslProxy, TargetTcpProxy, TargetVpnGateway, TargetPool, TargetInstance. - - Applicable only when IPProtocol is TCP, UDP, or SCTP, only packets addressed to - ports in the specified range will be forwarded to target. - - Forwarding rules with the same [IPAddress, IPProtocol] pair must have disjoint port - ranges. - - 'Some types of forwarding target have constraints on the acceptable ports: * TargetHttpProxy: - 80, 8080 * TargetHttpsProxy: 443 * TargetTcpProxy: 25, 43, 110, 143, 195, 443, 465, - 587, 700, 993, 995, 1883, 5222 * TargetSslProxy: 25, 43, 110, - 143, 195, 443, 465, 587, 700, 993, 995, 1883, 5222 * TargetVpnGateway: - 500, 4500 .' - returned: success - type: str - ports: - description: - - This field is used along with the backend_service field for internal load balancing. - - When the load balancing scheme is INTERNAL, a single port or a comma separated list - of ports can be configured. Only packets addressed to these ports will be forwarded - to the backends configured with this forwarding rule. - - You may specify a maximum of up to 5 ports. - returned: success - type: list - subnetwork: - description: - - A reference to a subnetwork. - - For internal load balancing, this field identifies the subnetwork that the load - balanced IP should belong to for this Forwarding Rule. - - If the network specified is in auto subnet mode, this field is optional. However, - if the network is in custom subnet mode, a subnetwork must be specified. - - This field is not used for external load balancing. - returned: success - type: dict - region: - description: - - A reference to the region where the regional forwarding rule resides. - - This field is not applicable to global forwarding rules. - returned: success - type: str - target: - description: - - This target must be a global load balancing resource. The forwarded traffic must - be of a type appropriate to the target object. - - 'Valid types: HTTP_PROXY, HTTPS_PROXY, SSL_PROXY, TCP_PROXY .' - returned: success - type: str + description: List of items + returned: always + type: complex + contains: + creationTimestamp: + description: + - Creation timestamp in RFC3339 text format. + returned: success + type: str + description: + description: + - An optional description of this resource. Provide this property when you create + the resource. + returned: success + type: str + id: + description: + - The unique identifier for the resource. + returned: success + type: int + IPAddress: + description: + - The IP address that this forwarding rule is serving on behalf of. + - Addresses are restricted based on the forwarding rule's load balancing scheme + (EXTERNAL or INTERNAL) and scope (global or regional). + - When the load balancing scheme is EXTERNAL, for global forwarding rules, the + address must be a global IP, and for regional forwarding rules, the address + must live in the same region as the forwarding rule. If this field is empty, + an ephemeral IPv4 address from the same scope (global or regional) will be + assigned. A regional forwarding rule supports IPv4 only. A global forwarding + rule supports either IPv4 or IPv6. + - When the load balancing scheme is INTERNAL, this can only be an RFC 1918 IP + address belonging to the network/subnet configured for the forwarding rule. + By default, if this field is empty, an ephemeral internal IP address will + be automatically allocated from the IP range of the subnet or network configured + for this forwarding rule. + - 'An address can be specified either by a literal IP address or a URL reference + to an existing Address resource. The following examples are all valid: * 100.1.2.3 + * U(https://www.googleapis.com/compute/v1/projects/project/regions/region/addresses/address) + * projects/project/regions/region/addresses/address * regions/region/addresses/address + * global/addresses/address * address .' + returned: success + type: str + IPProtocol: + description: + - The IP protocol to which this rule applies. Valid options are TCP, UDP, ESP, + AH, SCTP or ICMP. + - When the load balancing scheme is INTERNAL, only TCP and UDP are valid. + returned: success + type: str + backendService: + description: + - A reference to a BackendService to receive the matched traffic. + - This is used for internal load balancing. + - "(not used for external load balancing) ." + returned: success + type: dict + ipVersion: + description: + - The IP Version that will be used by this forwarding rule. Valid options are + IPV4 or IPV6. This can only be specified for a global forwarding rule. + returned: success + type: str + loadBalancingScheme: + description: + - 'This signifies what the ForwardingRule will be used for and can only take + the following values: INTERNAL, EXTERNAL The value of INTERNAL means that + this will be used for Internal Network Load Balancing (TCP, UDP). The value + of EXTERNAL means that this will be used for External Load Balancing (HTTP(S) + LB, External TCP/UDP LB, SSL Proxy) .' + returned: success + type: str + name: + description: + - Name of the resource; provided by the client when the resource is created. + The name must be 1-63 characters long, and comply with RFC1035. Specifically, + the name must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` + which means the first character must be a lowercase letter, and all following + characters must be a dash, lowercase letter, or digit, except the last character, + which cannot be a dash. + returned: success + type: str + network: + description: + - For internal load balancing, this field identifies the network that the load + balanced IP should belong to for this Forwarding Rule. If this field is not + specified, the default network will be used. + - This field is not used for external load balancing. + returned: success + type: dict + portRange: + description: + - This field is used along with the target field for TargetHttpProxy, TargetHttpsProxy, + TargetSslProxy, TargetTcpProxy, TargetVpnGateway, TargetPool, TargetInstance. + - Applicable only when IPProtocol is TCP, UDP, or SCTP, only packets addressed + to ports in the specified range will be forwarded to target. + - Forwarding rules with the same [IPAddress, IPProtocol] pair must have disjoint + port ranges. + - 'Some types of forwarding target have constraints on the acceptable ports: + * TargetHttpProxy: 80, 8080 * TargetHttpsProxy: 443 * TargetTcpProxy: 25, + 43, 110, 143, 195, 443, 465, 587, 700, 993, 995, 1883, 5222 * TargetSslProxy: + 25, 43, 110, 143, 195, 443, 465, 587, 700, 993, 995, 1883, 5222 * TargetVpnGateway: + 500, 4500 .' + returned: success + type: str + ports: + description: + - This field is used along with the backend_service field for internal load + balancing. + - When the load balancing scheme is INTERNAL, a single port or a comma separated + list of ports can be configured. Only packets addressed to these ports will + be forwarded to the backends configured with this forwarding rule. + - You may specify a maximum of up to 5 ports. + returned: success + type: list + subnetwork: + description: + - A reference to a subnetwork. + - For internal load balancing, this field identifies the subnetwork that the + load balanced IP should belong to for this Forwarding Rule. + - If the network specified is in auto subnet mode, this field is optional. However, + if the network is in custom subnet mode, a subnetwork must be specified. + - This field is not used for external load balancing. + returned: success + type: dict + region: + description: + - A reference to the region where the regional forwarding rule resides. + - This field is not applicable to global forwarding rules. + returned: success + type: str + target: + description: + - This target must be a global load balancing resource. The forwarded traffic + must be of a type appropriate to the target object. + - 'Valid types: HTTP_PROXY, HTTPS_PROXY, SSL_PROXY, TCP_PROXY .' + returned: success + type: str ''' ################################################################################ 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 a7c2f4a330df37..eba7560580ca95 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_health_check.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_health_check.py @@ -32,214 +32,229 @@ --- module: gcp_compute_health_check description: - - Health Checks determine whether instances are responsive and able to do work. - - They are an important part of a comprehensive load balancing configuration, as they - enable monitoring instances behind load balancers. - - Health Checks poll instances at a specified interval. Instances that do not respond - successfully to some number of probes in a row are marked as unhealthy. No new connections - are sent to unhealthy instances, though existing connections will continue. The - health check will continue to poll unhealthy instances. If an instance later responds - successfully to some number of consecutive probes, it is marked healthy again and - can receive new connections. +- Health Checks determine whether instances are responsive and able to do work. +- They are an important part of a comprehensive load balancing configuration, as they + enable monitoring instances behind load balancers. +- Health Checks poll instances at a specified interval. Instances that do not respond + successfully to some number of probes in a row are marked as unhealthy. No new connections + are sent to unhealthy instances, though existing connections will continue. The + health check will continue to poll unhealthy instances. If an instance later responds + successfully to some number of consecutive probes, it is marked healthy again and + can receive new connections. short_description: Creates a GCP HealthCheck version_added: 2.6 author: Google Inc. (@googlecloudplatform) requirements: - - python >= 2.6 - - requests >= 2.18.4 - - google-auth >= 1.3.0 +- python >= 2.6 +- requests >= 2.18.4 +- google-auth >= 1.3.0 options: - state: + state: + description: + - Whether the given object should exist in GCP + choices: + - present + - absent + default: present + check_interval_sec: + description: + - How often (in seconds) to send a health check. The default value is 5 seconds. + required: false + default: '5' + description: + description: + - An optional description of this resource. Provide this property when you create + the resource. + required: false + healthy_threshold: + description: + - A so-far unhealthy instance will be marked healthy after this many consecutive + successes. The default value is 2. + required: false + default: '2' + name: + description: + - Name of the resource. Provided by the client when the resource is created. The + name must be 1-63 characters long, and comply with RFC1035. Specifically, the + name must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` + which means the first character must be a lowercase letter, and all following + characters must be a dash, lowercase letter, or digit, except the last character, + which cannot be a dash. + required: true + timeout_sec: + description: + - How long (in seconds) to wait before claiming failure. + - The default value is 5 seconds. It is invalid for timeoutSec to have greater + value than checkIntervalSec. + required: false + default: '5' + aliases: + - timeout_seconds + unhealthy_threshold: + description: + - A so-far healthy instance will be marked unhealthy after this many consecutive + failures. The default value is 2. + required: false + default: '2' + type: + description: + - Specifies the type of the healthCheck, either TCP, SSL, HTTP or HTTPS. If not + specified, the default is TCP. Exactly one of the protocol-specific health check + field must be specified, which must match type field. + required: false + choices: + - TCP + - SSL + - HTTP + - HTTPS + http_health_check: + description: + - A nested object resource. + required: false + suboptions: + host: + description: + - The value of the host header in the HTTP health check request. + - If left empty (default value), the public IP on behalf of which this health + check is performed will be used. + required: false + request_path: + description: + - The request path of the HTTP health check request. + - The default value is /. + required: false + default: "/" + port: + description: + - The TCP port number for the HTTP health check request. + - The default value is 80. + required: false + port_name: + description: + - Port name as defined in InstanceGroup#NamedPort#name. If both port and port_name + are defined, port takes precedence. + required: false + proxy_header: + description: + - Specifies the type of proxy header to append before sending data to the + backend, either NONE or PROXY_V1. The default is NONE. + required: false + default: NONE + choices: + - NONE + - PROXY_V1 + https_health_check: + description: + - A nested object resource. + required: false + suboptions: + host: + description: + - The value of the host header in the HTTPS health check request. + - If left empty (default value), the public IP on behalf of which this health + check is performed will be used. + required: false + request_path: description: - - Whether the given object should exist in GCP - choices: ['present', 'absent'] - default: 'present' - check_interval_sec: + - The request path of the HTTPS health check request. + - The default value is /. + required: false + default: "/" + port: + description: + - The TCP port number for the HTTPS health check request. + - The default value is 443. + required: false + port_name: description: - - How often (in seconds) to send a health check. The default value is 5 seconds. + - Port name as defined in InstanceGroup#NamedPort#name. If both port and port_name + are defined, port takes precedence. required: false - default: 5 + proxy_header: + description: + - Specifies the type of proxy header to append before sending data to the + backend, either NONE or PROXY_V1. The default is NONE. + required: false + default: NONE + choices: + - NONE + - PROXY_V1 + tcp_health_check: description: + - A nested object resource. + required: false + suboptions: + request: description: - - An optional description of this resource. Provide this property when you create - the resource. + - The application data to send once the TCP connection has been established + (default value is empty). If both request and response are empty, the connection + establishment alone will indicate health. The request data can only be ASCII. required: false - healthy_threshold: + response: description: - - A so-far unhealthy instance will be marked healthy after this many consecutive successes. - The default value is 2. + - 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 - default: 2 - name: + port: description: - - Name of the resource. Provided by the client when the resource is created. The name - must be 1-63 characters long, and comply with RFC1035. Specifically, the name must - be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` - which means the first character must be a lowercase letter, and all following characters - must be a dash, lowercase letter, or digit, except the last character, which cannot - be a dash. - required: true - timeout_sec: + - The TCP port number for the TCP health check request. + - The default value is 443. + required: false + port_name: description: - - How long (in seconds) to wait before claiming failure. - - The default value is 5 seconds. It is invalid for timeoutSec to have greater value - than checkIntervalSec. + - Port name as defined in InstanceGroup#NamedPort#name. If both port and port_name + are defined, port takes precedence. required: false - default: 5 - aliases: [timeout_seconds] - unhealthy_threshold: + proxy_header: description: - - A so-far healthy instance will be marked unhealthy after this many consecutive failures. - The default value is 2. + - Specifies the type of proxy header to append before sending data to the + backend, either NONE or PROXY_V1. The default is NONE. required: false - default: 2 - type: + default: NONE + choices: + - NONE + - PROXY_V1 + ssl_health_check: + description: + - A nested object resource. + required: false + suboptions: + request: description: - - Specifies the type of the healthCheck, either TCP, SSL, HTTP or HTTPS. If not specified, - the default is TCP. Exactly one of the protocol-specific health check field must - be specified, which must match type field. + - The application data to send once the SSL connection has been established + (default value is empty). If both request and response are empty, the connection + establishment alone will indicate health. The request data can only be ASCII. required: false - choices: ['TCP', 'SSL', 'HTTP', 'HTTPS'] - http_health_check: + response: description: - - A nested object resource. + - 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 - suboptions: - host: - description: - - The value of the host header in the HTTP health check request. - - If left empty (default value), the public IP on behalf of which this health check - is performed will be used. - required: false - request_path: - description: - - The request path of the HTTP health check request. - - The default value is /. - required: false - default: / - port: - description: - - The TCP port number for the HTTP health check request. - - The default value is 80. - required: false - port_name: - description: - - Port name as defined in InstanceGroup#NamedPort#name. If both port and port_name - are defined, port takes precedence. - required: false - proxy_header: - description: - - Specifies the type of proxy header to append before sending data to the backend, - either NONE or PROXY_V1. The default is NONE. - required: false - default: NONE - choices: ['NONE', 'PROXY_V1'] - https_health_check: + port: description: - - A nested object resource. + - The TCP port number for the SSL health check request. + - The default value is 443. required: false - suboptions: - host: - description: - - The value of the host header in the HTTPS health check request. - - If left empty (default value), the public IP on behalf of which this health check - is performed will be used. - required: false - request_path: - description: - - The request path of the HTTPS health check request. - - The default value is /. - required: false - default: / - port: - description: - - The TCP port number for the HTTPS health check request. - - The default value is 443. - required: false - port_name: - description: - - Port name as defined in InstanceGroup#NamedPort#name. If both port and port_name - are defined, port takes precedence. - required: false - proxy_header: - description: - - Specifies the type of proxy header to append before sending data to the backend, - either NONE or PROXY_V1. The default is NONE. - required: false - default: NONE - choices: ['NONE', 'PROXY_V1'] - tcp_health_check: + port_name: description: - - A nested object resource. + - Port name as defined in InstanceGroup#NamedPort#name. If both port and port_name + are defined, port takes precedence. required: false - suboptions: - request: - description: - - The application data to send once the TCP connection has been established (default - value is empty). If both request and response are empty, the connection establishment - alone will indicate health. The request data can only be ASCII. - required: false - 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 TCP health check request. - - The default value is 443. - required: false - port_name: - description: - - Port name as defined in InstanceGroup#NamedPort#name. If both port and port_name - are defined, port takes precedence. - required: false - proxy_header: - description: - - Specifies the type of proxy header to append before sending data to the backend, - either NONE or PROXY_V1. The default is NONE. - required: false - default: NONE - choices: ['NONE', 'PROXY_V1'] - ssl_health_check: + proxy_header: description: - - A nested object resource. + - Specifies the type of proxy header to append before sending data to the + backend, either NONE or PROXY_V1. The default is NONE. required: false - suboptions: - request: - description: - - The application data to send once the SSL connection has been established (default - value is empty). If both request and response are empty, the connection establishment - alone will indicate health. The request data can only be ASCII. - required: false - 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 SSL health check request. - - The default value is 443. - required: false - port_name: - description: - - Port name as defined in InstanceGroup#NamedPort#name. If both port and port_name - are defined, port takes precedence. - required: false - proxy_header: - description: - - Specifies the type of proxy header to append before sending data to the backend, - either NONE or PROXY_V1. The default is NONE. - required: false - default: NONE - choices: ['NONE', 'PROXY_V1'] + default: NONE + choices: + - NONE + - PROXY_V1 extends_documentation_fragment: gcp notes: - - "API Reference: U(https://cloud.google.com/compute/docs/reference/rest/latest/healthChecks)" - - "Official Documentation: U(https://cloud.google.com/load-balancing/docs/health-checks)" +- 'API Reference: U(https://cloud.google.com/compute/docs/reference/rest/latest/healthChecks)' +- 'Official Documentation: U(https://cloud.google.com/load-balancing/docs/health-checks)' ''' EXAMPLES = ''' @@ -261,213 +276,213 @@ ''' RETURN = ''' - checkIntervalSec: - description: - - How often (in seconds) to send a health check. The default value is 5 seconds. - returned: success - type: int - creationTimestamp: - description: - - Creation timestamp in RFC3339 text format. - returned: success - type: str - description: - description: - - An optional description of this resource. Provide this property when you create - the resource. - returned: success - type: str - healthyThreshold: - description: - - A so-far unhealthy instance will be marked healthy after this many consecutive successes. - The default value is 2. - returned: success - type: int - id: - description: - - The unique identifier for the resource. This identifier is defined by the server. - returned: success - type: int - name: - description: - - Name of the resource. Provided by the client when the resource is created. The name - must be 1-63 characters long, and comply with RFC1035. Specifically, the name must - be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` - which means the first character must be a lowercase letter, and all following characters - must be a dash, lowercase letter, or digit, except the last character, which cannot - be a dash. - returned: success - type: str - timeoutSec: - description: - - How long (in seconds) to wait before claiming failure. - - The default value is 5 seconds. It is invalid for timeoutSec to have greater value - than checkIntervalSec. - returned: success - type: int - unhealthyThreshold: - description: - - A so-far healthy instance will be marked unhealthy after this many consecutive failures. - The default value is 2. - returned: success - type: int - type: - description: - - Specifies the type of the healthCheck, either TCP, SSL, HTTP or HTTPS. If not specified, - the default is TCP. Exactly one of the protocol-specific health check field must - be specified, which must match type field. - returned: success - type: str - httpHealthCheck: - description: - - A nested object resource. - returned: success - type: complex - contains: - host: - description: - - The value of the host header in the HTTP health check request. - - If left empty (default value), the public IP on behalf of which this health check - is performed will be used. - returned: success - type: str - requestPath: - description: - - The request path of the HTTP health check request. - - The default value is /. - returned: success - type: str - port: - description: - - The TCP port number for the HTTP health check request. - - The default value is 80. - returned: success - type: int - portName: - description: - - Port name as defined in InstanceGroup#NamedPort#name. If both port and port_name - are defined, port takes precedence. - returned: success - type: str - proxyHeader: - description: - - Specifies the type of proxy header to append before sending data to the backend, - either NONE or PROXY_V1. The default is NONE. - returned: success - type: str - httpsHealthCheck: - description: - - A nested object resource. - returned: success - type: complex - contains: - host: - description: - - The value of the host header in the HTTPS health check request. - - If left empty (default value), the public IP on behalf of which this health check - is performed will be used. - returned: success - type: str - requestPath: - description: - - The request path of the HTTPS health check request. - - The default value is /. - returned: success - type: str - port: - description: - - The TCP port number for the HTTPS health check request. - - The default value is 443. - returned: success - type: int - portName: - description: - - Port name as defined in InstanceGroup#NamedPort#name. If both port and port_name - are defined, port takes precedence. - returned: success - type: str - proxyHeader: - description: - - Specifies the type of proxy header to append before sending data to the backend, - either NONE or PROXY_V1. The default is NONE. - returned: success - type: str - tcpHealthCheck: - description: - - A nested object resource. - returned: success - type: complex - contains: - request: - description: - - The application data to send once the TCP connection has been established (default - value is empty). If both request and response are empty, the connection establishment - alone will indicate health. The request data can only be ASCII. - 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 TCP health check request. - - The default value is 443. - returned: success - type: int - portName: - description: - - Port name as defined in InstanceGroup#NamedPort#name. If both port and port_name - are defined, port takes precedence. - returned: success - type: str - proxyHeader: - description: - - Specifies the type of proxy header to append before sending data to the backend, - either NONE or PROXY_V1. The default is NONE. - returned: success - type: str - sslHealthCheck: - description: - - A nested object resource. - returned: success - type: complex - contains: - request: - description: - - The application data to send once the SSL connection has been established (default - value is empty). If both request and response are empty, the connection establishment - alone will indicate health. The request data can only be ASCII. - 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 SSL health check request. - - The default value is 443. - returned: success - type: int - portName: - description: - - Port name as defined in InstanceGroup#NamedPort#name. If both port and port_name - are defined, port takes precedence. - returned: success - type: str - proxyHeader: - description: - - Specifies the type of proxy header to append before sending data to the backend, - either NONE or PROXY_V1. The default is NONE. - returned: success - type: str +checkIntervalSec: + description: + - How often (in seconds) to send a health check. The default value is 5 seconds. + returned: success + type: int +creationTimestamp: + description: + - Creation timestamp in RFC3339 text format. + returned: success + type: str +description: + description: + - An optional description of this resource. Provide this property when you create + the resource. + returned: success + type: str +healthyThreshold: + description: + - A so-far unhealthy instance will be marked healthy after this many consecutive + successes. The default value is 2. + returned: success + type: int +id: + description: + - The unique identifier for the resource. This identifier is defined by the server. + returned: success + type: int +name: + description: + - Name of the resource. Provided by the client when the resource is created. The + name must be 1-63 characters long, and comply with RFC1035. Specifically, the + name must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` + which means the first character must be a lowercase letter, and all following + characters must be a dash, lowercase letter, or digit, except the last character, + which cannot be a dash. + returned: success + type: str +timeoutSec: + description: + - How long (in seconds) to wait before claiming failure. + - The default value is 5 seconds. It is invalid for timeoutSec to have greater value + than checkIntervalSec. + returned: success + type: int +unhealthyThreshold: + description: + - A so-far healthy instance will be marked unhealthy after this many consecutive + failures. The default value is 2. + returned: success + type: int +type: + description: + - Specifies the type of the healthCheck, either TCP, SSL, HTTP or HTTPS. If not + specified, the default is TCP. Exactly one of the protocol-specific health check + field must be specified, which must match type field. + returned: success + type: str +httpHealthCheck: + description: + - A nested object resource. + returned: success + type: complex + contains: + host: + description: + - The value of the host header in the HTTP health check request. + - If left empty (default value), the public IP on behalf of which this health + check is performed will be used. + returned: success + type: str + requestPath: + description: + - The request path of the HTTP health check request. + - The default value is /. + returned: success + type: str + port: + description: + - The TCP port number for the HTTP health check request. + - The default value is 80. + returned: success + type: int + portName: + description: + - Port name as defined in InstanceGroup#NamedPort#name. If both port and port_name + are defined, port takes precedence. + returned: success + type: str + proxyHeader: + description: + - Specifies the type of proxy header to append before sending data to the backend, + either NONE or PROXY_V1. The default is NONE. + returned: success + type: str +httpsHealthCheck: + description: + - A nested object resource. + returned: success + type: complex + contains: + host: + description: + - The value of the host header in the HTTPS health check request. + - If left empty (default value), the public IP on behalf of which this health + check is performed will be used. + returned: success + type: str + requestPath: + description: + - The request path of the HTTPS health check request. + - The default value is /. + returned: success + type: str + port: + description: + - The TCP port number for the HTTPS health check request. + - The default value is 443. + returned: success + type: int + portName: + description: + - Port name as defined in InstanceGroup#NamedPort#name. If both port and port_name + are defined, port takes precedence. + returned: success + type: str + proxyHeader: + description: + - Specifies the type of proxy header to append before sending data to the backend, + either NONE or PROXY_V1. The default is NONE. + returned: success + type: str +tcpHealthCheck: + description: + - A nested object resource. + returned: success + type: complex + contains: + request: + description: + - The application data to send once the TCP connection has been established + (default value is empty). If both request and response are empty, the connection + establishment alone will indicate health. The request data can only be ASCII. + 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 TCP health check request. + - The default value is 443. + returned: success + type: int + portName: + description: + - Port name as defined in InstanceGroup#NamedPort#name. If both port and port_name + are defined, port takes precedence. + returned: success + type: str + proxyHeader: + description: + - Specifies the type of proxy header to append before sending data to the backend, + either NONE or PROXY_V1. The default is NONE. + returned: success + type: str +sslHealthCheck: + description: + - A nested object resource. + returned: success + type: complex + contains: + request: + description: + - The application data to send once the SSL connection has been established + (default value is empty). If both request and response are empty, the connection + establishment alone will indicate health. The request data can only be ASCII. + 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 SSL health check request. + - The default value is 443. + returned: success + type: int + portName: + description: + - Port name as defined in InstanceGroup#NamedPort#name. If both port and port_name + are defined, port takes precedence. + returned: success + type: str + proxyHeader: + description: + - Specifies the type of proxy header to append before sending data to the backend, + either NONE or PROXY_V1. The default is NONE. + returned: success + type: str ''' ################################################################################ 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 4fb8fc5e43694f..1fb027f681f870 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 @@ -32,21 +32,20 @@ --- module: gcp_compute_health_check_facts description: - - Gather facts for GCP HealthCheck +- Gather facts for GCP HealthCheck short_description: Gather facts for GCP HealthCheck version_added: 2.7 author: Google Inc. (@googlecloudplatform) requirements: - - python >= 2.6 - - requests >= 2.18.4 - - google-auth >= 1.3.0 +- python >= 2.6 +- requests >= 2.18.4 +- google-auth >= 1.3.0 options: - filters: - description: - A list of filter value pairs. Available filters are listed here - U(https://cloud.google.com/sdk/gcloud/reference/topic/filters). - Each additional filter in the list will act be added as an AND condition - (filter1 and filter2) + filters: + description: + - A list of filter value pairs. Available filters are listed here U(U(https://cloud.google.com/sdk/gcloud/reference/topic/filters).) + - Each additional filter in the list will act be added as an AND condition (filter1 + and filter2) . extends_documentation_fragment: gcp ''' @@ -62,217 +61,220 @@ RETURN = ''' items: - description: List of items - returned: always - type: complex - contains: - checkIntervalSec: - description: - - How often (in seconds) to send a health check. The default value is 5 seconds. - returned: success - type: int - creationTimestamp: - description: - - Creation timestamp in RFC3339 text format. - returned: success - type: str - description: - description: - - An optional description of this resource. Provide this property when you create - the resource. - returned: success - type: str - healthyThreshold: - description: - - A so-far unhealthy instance will be marked healthy after this many consecutive successes. - The default value is 2. - returned: success - type: int - id: - description: - - The unique identifier for the resource. This identifier is defined by the server. - returned: success - type: int - name: - description: - - Name of the resource. Provided by the client when the resource is created. The name - must be 1-63 characters long, and comply with RFC1035. Specifically, the name must - be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` - which means the first character must be a lowercase letter, and all following characters - must be a dash, lowercase letter, or digit, except the last character, which cannot - be a dash. - returned: success - type: str - timeoutSec: - description: - - How long (in seconds) to wait before claiming failure. - - The default value is 5 seconds. It is invalid for timeoutSec to have greater value - than checkIntervalSec. - returned: success - type: int - unhealthyThreshold: - description: - - A so-far healthy instance will be marked unhealthy after this many consecutive failures. - The default value is 2. - returned: success - type: int - type: - description: - - Specifies the type of the healthCheck, either TCP, SSL, HTTP or HTTPS. If not specified, - the default is TCP. Exactly one of the protocol-specific health check field must - be specified, which must match type field. - returned: success - type: str - httpHealthCheck: - description: - - A nested object resource. - returned: success - type: complex - contains: - host: - description: - - The value of the host header in the HTTP health check request. - - If left empty (default value), the public IP on behalf of which this health check - is performed will be used. - returned: success - type: str - requestPath: - description: - - The request path of the HTTP health check request. - - The default value is /. - returned: success - type: str - port: - description: - - The TCP port number for the HTTP health check request. - - The default value is 80. - returned: success - type: int - portName: - description: - - Port name as defined in InstanceGroup#NamedPort#name. If both port and port_name - are defined, port takes precedence. - returned: success - type: str - proxyHeader: - description: - - Specifies the type of proxy header to append before sending data to the backend, - either NONE or PROXY_V1. The default is NONE. - returned: success - type: str - httpsHealthCheck: - description: - - A nested object resource. - returned: success - type: complex - contains: - host: - description: - - The value of the host header in the HTTPS health check request. - - If left empty (default value), the public IP on behalf of which this health check - is performed will be used. - returned: success - type: str - requestPath: - description: - - The request path of the HTTPS health check request. - - The default value is /. - returned: success - type: str - port: - description: - - The TCP port number for the HTTPS health check request. - - The default value is 443. - returned: success - type: int - portName: - description: - - Port name as defined in InstanceGroup#NamedPort#name. If both port and port_name - are defined, port takes precedence. - returned: success - type: str - proxyHeader: - description: - - Specifies the type of proxy header to append before sending data to the backend, - either NONE or PROXY_V1. The default is NONE. - returned: success - type: str - tcpHealthCheck: - description: - - A nested object resource. - returned: success - type: complex - contains: - request: - description: - - The application data to send once the TCP connection has been established (default - value is empty). If both request and response are empty, the connection establishment - alone will indicate health. The request data can only be ASCII. - 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 TCP health check request. - - The default value is 443. - returned: success - type: int - portName: - description: - - Port name as defined in InstanceGroup#NamedPort#name. If both port and port_name - are defined, port takes precedence. - returned: success - type: str - proxyHeader: - description: - - Specifies the type of proxy header to append before sending data to the backend, - either NONE or PROXY_V1. The default is NONE. - returned: success - type: str - sslHealthCheck: - description: - - A nested object resource. - returned: success - type: complex - contains: - request: - description: - - The application data to send once the SSL connection has been established (default - value is empty). If both request and response are empty, the connection establishment - alone will indicate health. The request data can only be ASCII. - 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 SSL health check request. - - The default value is 443. - returned: success - type: int - portName: - description: - - Port name as defined in InstanceGroup#NamedPort#name. If both port and port_name - are defined, port takes precedence. - returned: success - type: str - proxyHeader: - description: - - Specifies the type of proxy header to append before sending data to the backend, - either NONE or PROXY_V1. The default is NONE. - returned: success - type: str + description: List of items + returned: always + type: complex + contains: + checkIntervalSec: + description: + - How often (in seconds) to send a health check. The default value is 5 seconds. + returned: success + type: int + creationTimestamp: + description: + - Creation timestamp in RFC3339 text format. + returned: success + type: str + description: + description: + - An optional description of this resource. Provide this property when you create + the resource. + returned: success + type: str + healthyThreshold: + description: + - A so-far unhealthy instance will be marked healthy after this many consecutive + successes. The default value is 2. + returned: success + type: int + id: + description: + - The unique identifier for the resource. This identifier is defined by the + server. + returned: success + type: int + name: + description: + - Name of the resource. Provided by the client when the resource is created. + The name must be 1-63 characters long, and comply with RFC1035. Specifically, + the name must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` + which means the first character must be a lowercase letter, and all following + characters must be a dash, lowercase letter, or digit, except the last character, + which cannot be a dash. + returned: success + type: str + timeoutSec: + description: + - How long (in seconds) to wait before claiming failure. + - The default value is 5 seconds. It is invalid for timeoutSec to have greater + value than checkIntervalSec. + returned: success + type: int + unhealthyThreshold: + description: + - A so-far healthy instance will be marked unhealthy after this many consecutive + failures. The default value is 2. + returned: success + type: int + type: + description: + - Specifies the type of the healthCheck, either TCP, SSL, HTTP or HTTPS. If + not specified, the default is TCP. Exactly one of the protocol-specific health + check field must be specified, which must match type field. + returned: success + type: str + httpHealthCheck: + description: + - A nested object resource. + returned: success + type: complex + contains: + host: + description: + - The value of the host header in the HTTP health check request. + - If left empty (default value), the public IP on behalf of which this health + check is performed will be used. + returned: success + type: str + requestPath: + description: + - The request path of the HTTP health check request. + - The default value is /. + returned: success + type: str + port: + description: + - The TCP port number for the HTTP health check request. + - The default value is 80. + returned: success + type: int + portName: + description: + - Port name as defined in InstanceGroup#NamedPort#name. If both port and + port_name are defined, port takes precedence. + returned: success + type: str + proxyHeader: + description: + - Specifies the type of proxy header to append before sending data to the + backend, either NONE or PROXY_V1. The default is NONE. + returned: success + type: str + httpsHealthCheck: + description: + - A nested object resource. + returned: success + type: complex + contains: + host: + description: + - The value of the host header in the HTTPS health check request. + - If left empty (default value), the public IP on behalf of which this health + check is performed will be used. + returned: success + type: str + requestPath: + description: + - The request path of the HTTPS health check request. + - The default value is /. + returned: success + type: str + port: + description: + - The TCP port number for the HTTPS health check request. + - The default value is 443. + returned: success + type: int + portName: + description: + - Port name as defined in InstanceGroup#NamedPort#name. If both port and + port_name are defined, port takes precedence. + returned: success + type: str + proxyHeader: + description: + - Specifies the type of proxy header to append before sending data to the + backend, either NONE or PROXY_V1. The default is NONE. + returned: success + type: str + tcpHealthCheck: + description: + - A nested object resource. + returned: success + type: complex + contains: + request: + description: + - The application data to send once the TCP connection has been established + (default value is empty). If both request and response are empty, the + connection establishment alone will indicate health. The request data + can only be ASCII. + 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 TCP health check request. + - The default value is 443. + returned: success + type: int + portName: + description: + - Port name as defined in InstanceGroup#NamedPort#name. If both port and + port_name are defined, port takes precedence. + returned: success + type: str + proxyHeader: + description: + - Specifies the type of proxy header to append before sending data to the + backend, either NONE or PROXY_V1. The default is NONE. + returned: success + type: str + sslHealthCheck: + description: + - A nested object resource. + returned: success + type: complex + contains: + request: + description: + - The application data to send once the SSL connection has been established + (default value is empty). If both request and response are empty, the + connection establishment alone will indicate health. The request data + can only be ASCII. + 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 SSL health check request. + - The default value is 443. + returned: success + type: int + portName: + description: + - Port name as defined in InstanceGroup#NamedPort#name. If both port and + port_name are defined, port takes precedence. + returned: success + type: str + proxyHeader: + description: + - Specifies the type of proxy header to append before sending data to the + backend, either NONE or PROXY_V1. The default is NONE. + returned: success + type: str ''' ################################################################################ diff --git a/lib/ansible/modules/cloud/google/gcp_compute_http_health_check.py b/lib/ansible/modules/cloud/google/gcp_compute_http_health_check.py index df8c7f67580532..00b0d320208c1d 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_http_health_check.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_http_health_check.py @@ -32,78 +32,82 @@ --- module: gcp_compute_http_health_check description: - - An HttpHealthCheck resource. This resource defines a template for how individual - VMs should be checked for health, via HTTP. +- An HttpHealthCheck resource. This resource defines a template for how individual + VMs should be checked for health, via HTTP. short_description: Creates a GCP HttpHealthCheck version_added: 2.6 author: Google Inc. (@googlecloudplatform) requirements: - - python >= 2.6 - - requests >= 2.18.4 - - google-auth >= 1.3.0 +- python >= 2.6 +- requests >= 2.18.4 +- google-auth >= 1.3.0 options: - state: - description: - - Whether the given object should exist in GCP - choices: ['present', 'absent'] - default: 'present' - check_interval_sec: - description: - - How often (in seconds) to send a health check. The default value is 5 seconds. - required: false - default: 5 - aliases: [check_interval_seconds] + state: description: - description: - - An optional description of this resource. Provide this property when you create - the resource. - required: false - healthy_threshold: - description: - - A so-far unhealthy instance will be marked healthy after this many consecutive successes. - The default value is 2. - required: false - host: - description: - - The value of the host header in the HTTP health check request. If left empty (default - value), the public IP on behalf of which this health check is performed will be - used. - required: false - name: - description: - - Name of the resource. Provided by the client when the resource is created. The name - must be 1-63 characters long, and comply with RFC1035. Specifically, the name must - be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` - which means the first character must be a lowercase letter, and all following characters - must be a dash, lowercase letter, or digit, except the last character, which cannot - be a dash. - required: true - port: - description: - - The TCP port number for the HTTP health check request. - - The default value is 80. - required: false - request_path: - description: - - The request path of the HTTP health check request. - - The default value is /. - required: false - timeout_sec: - description: - - How long (in seconds) to wait before claiming failure. - - The default value is 5 seconds. It is invalid for timeoutSec to have greater value - than checkIntervalSec. - required: false - aliases: [timeout_seconds] - unhealthy_threshold: - description: - - A so-far healthy instance will be marked unhealthy after this many consecutive failures. - The default value is 2. - required: false + - Whether the given object should exist in GCP + choices: + - present + - absent + default: present + check_interval_sec: + description: + - How often (in seconds) to send a health check. The default value is 5 seconds. + required: false + default: '5' + aliases: + - check_interval_seconds + description: + description: + - An optional description of this resource. Provide this property when you create + the resource. + required: false + healthy_threshold: + description: + - A so-far unhealthy instance will be marked healthy after this many consecutive + successes. The default value is 2. + required: false + host: + description: + - The value of the host header in the HTTP health check request. If left empty + (default value), the public IP on behalf of which this health check is performed + will be used. + required: false + name: + description: + - Name of the resource. Provided by the client when the resource is created. The + name must be 1-63 characters long, and comply with RFC1035. Specifically, the + name must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` + which means the first character must be a lowercase letter, and all following + characters must be a dash, lowercase letter, or digit, except the last character, + which cannot be a dash. + required: true + port: + description: + - The TCP port number for the HTTP health check request. + - The default value is 80. + required: false + request_path: + description: + - The request path of the HTTP health check request. + - The default value is /. + required: false + timeout_sec: + description: + - How long (in seconds) to wait before claiming failure. + - The default value is 5 seconds. It is invalid for timeoutSec to have greater + value than checkIntervalSec. + required: false + aliases: + - timeout_seconds + unhealthy_threshold: + description: + - A so-far healthy instance will be marked unhealthy after this many consecutive + failures. The default value is 2. + required: false extends_documentation_fragment: gcp notes: - - "API Reference: U(https://cloud.google.com/compute/docs/reference/latest/httpHealthChecks)" - - "Adding Health Checks: U(https://cloud.google.com/compute/docs/load-balancing/health-checks#legacy_health_checks)" +- 'API Reference: U(https://cloud.google.com/compute/docs/reference/latest/httpHealthChecks)' +- 'Adding Health Checks: U(https://cloud.google.com/compute/docs/load-balancing/health-checks#legacy_health_checks)' ''' EXAMPLES = ''' @@ -121,75 +125,75 @@ ''' RETURN = ''' - checkIntervalSec: - description: - - How often (in seconds) to send a health check. The default value is 5 seconds. - returned: success - type: int - creationTimestamp: - description: - - Creation timestamp in RFC3339 text format. - returned: success - type: str - description: - description: - - An optional description of this resource. Provide this property when you create - the resource. - returned: success - type: str - healthyThreshold: - description: - - A so-far unhealthy instance will be marked healthy after this many consecutive successes. - The default value is 2. - returned: success - type: int - host: - description: - - The value of the host header in the HTTP health check request. If left empty (default - value), the public IP on behalf of which this health check is performed will be - used. - returned: success - type: str - id: - description: - - The unique identifier for the resource. This identifier is defined by the server. - returned: success - type: int - name: - description: - - Name of the resource. Provided by the client when the resource is created. The name - must be 1-63 characters long, and comply with RFC1035. Specifically, the name must - be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` - which means the first character must be a lowercase letter, and all following characters - must be a dash, lowercase letter, or digit, except the last character, which cannot - be a dash. - returned: success - type: str - port: - description: - - The TCP port number for the HTTP health check request. - - The default value is 80. - returned: success - type: int - requestPath: - description: - - The request path of the HTTP health check request. - - The default value is /. - returned: success - type: str - timeoutSec: - description: - - How long (in seconds) to wait before claiming failure. - - The default value is 5 seconds. It is invalid for timeoutSec to have greater value - than checkIntervalSec. - returned: success - type: int - unhealthyThreshold: - description: - - A so-far healthy instance will be marked unhealthy after this many consecutive failures. - The default value is 2. - returned: success - type: int +checkIntervalSec: + description: + - How often (in seconds) to send a health check. The default value is 5 seconds. + returned: success + type: int +creationTimestamp: + description: + - Creation timestamp in RFC3339 text format. + returned: success + type: str +description: + description: + - An optional description of this resource. Provide this property when you create + the resource. + returned: success + type: str +healthyThreshold: + description: + - A so-far unhealthy instance will be marked healthy after this many consecutive + successes. The default value is 2. + returned: success + type: int +host: + description: + - The value of the host header in the HTTP health check request. If left empty (default + value), the public IP on behalf of which this health check is performed will be + used. + returned: success + type: str +id: + description: + - The unique identifier for the resource. This identifier is defined by the server. + returned: success + type: int +name: + description: + - Name of the resource. Provided by the client when the resource is created. The + name must be 1-63 characters long, and comply with RFC1035. Specifically, the + name must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` + which means the first character must be a lowercase letter, and all following + characters must be a dash, lowercase letter, or digit, except the last character, + which cannot be a dash. + returned: success + type: str +port: + description: + - The TCP port number for the HTTP health check request. + - The default value is 80. + returned: success + type: int +requestPath: + description: + - The request path of the HTTP health check request. + - The default value is /. + returned: success + type: str +timeoutSec: + description: + - How long (in seconds) to wait before claiming failure. + - The default value is 5 seconds. It is invalid for timeoutSec to have greater value + than checkIntervalSec. + returned: success + type: int +unhealthyThreshold: + description: + - A so-far healthy instance will be marked unhealthy after this many consecutive + failures. The default value is 2. + returned: success + type: int ''' ################################################################################ diff --git a/lib/ansible/modules/cloud/google/gcp_compute_http_health_check_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_http_health_check_facts.py index 6fc063d0230944..e94eccee3a608f 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_http_health_check_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_http_health_check_facts.py @@ -32,21 +32,20 @@ --- module: gcp_compute_http_health_check_facts description: - - Gather facts for GCP HttpHealthCheck +- Gather facts for GCP HttpHealthCheck short_description: Gather facts for GCP HttpHealthCheck version_added: 2.7 author: Google Inc. (@googlecloudplatform) requirements: - - python >= 2.6 - - requests >= 2.18.4 - - google-auth >= 1.3.0 +- python >= 2.6 +- requests >= 2.18.4 +- google-auth >= 1.3.0 options: - filters: - description: - A list of filter value pairs. Available filters are listed here - U(https://cloud.google.com/sdk/gcloud/reference/topic/filters). - Each additional filter in the list will act be added as an AND condition - (filter1 and filter2) + filters: + description: + - A list of filter value pairs. Available filters are listed here U(U(https://cloud.google.com/sdk/gcloud/reference/topic/filters).) + - Each additional filter in the list will act be added as an AND condition (filter1 + and filter2) . extends_documentation_fragment: gcp ''' @@ -62,79 +61,80 @@ RETURN = ''' items: - description: List of items - returned: always - type: complex - contains: - checkIntervalSec: - description: - - How often (in seconds) to send a health check. The default value is 5 seconds. - returned: success - type: int - creationTimestamp: - description: - - Creation timestamp in RFC3339 text format. - returned: success - type: str - description: - description: - - An optional description of this resource. Provide this property when you create - the resource. - returned: success - type: str - healthyThreshold: - description: - - A so-far unhealthy instance will be marked healthy after this many consecutive successes. - The default value is 2. - returned: success - type: int - host: - description: - - The value of the host header in the HTTP health check request. If left empty (default - value), the public IP on behalf of which this health check is performed will be - used. - returned: success - type: str - id: - description: - - The unique identifier for the resource. This identifier is defined by the server. - returned: success - type: int - name: - description: - - Name of the resource. Provided by the client when the resource is created. The name - must be 1-63 characters long, and comply with RFC1035. Specifically, the name must - be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` - which means the first character must be a lowercase letter, and all following characters - must be a dash, lowercase letter, or digit, except the last character, which cannot - be a dash. - returned: success - type: str - port: - description: - - The TCP port number for the HTTP health check request. - - The default value is 80. - returned: success - type: int - requestPath: - description: - - The request path of the HTTP health check request. - - The default value is /. - returned: success - type: str - timeoutSec: - description: - - How long (in seconds) to wait before claiming failure. - - The default value is 5 seconds. It is invalid for timeoutSec to have greater value - than checkIntervalSec. - returned: success - type: int - unhealthyThreshold: - description: - - A so-far healthy instance will be marked unhealthy after this many consecutive failures. - The default value is 2. - returned: success - type: int + description: List of items + returned: always + type: complex + contains: + checkIntervalSec: + description: + - How often (in seconds) to send a health check. The default value is 5 seconds. + returned: success + type: int + creationTimestamp: + description: + - Creation timestamp in RFC3339 text format. + returned: success + type: str + description: + description: + - An optional description of this resource. Provide this property when you create + the resource. + returned: success + type: str + healthyThreshold: + description: + - A so-far unhealthy instance will be marked healthy after this many consecutive + successes. The default value is 2. + returned: success + type: int + host: + description: + - The value of the host header in the HTTP health check request. If left empty + (default value), the public IP on behalf of which this health check is performed + will be used. + returned: success + type: str + id: + description: + - The unique identifier for the resource. This identifier is defined by the + server. + returned: success + type: int + name: + description: + - Name of the resource. Provided by the client when the resource is created. + The name must be 1-63 characters long, and comply with RFC1035. Specifically, + the name must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` + which means the first character must be a lowercase letter, and all following + characters must be a dash, lowercase letter, or digit, except the last character, + which cannot be a dash. + returned: success + type: str + port: + description: + - The TCP port number for the HTTP health check request. + - The default value is 80. + returned: success + type: int + requestPath: + description: + - The request path of the HTTP health check request. + - The default value is /. + returned: success + type: str + timeoutSec: + description: + - How long (in seconds) to wait before claiming failure. + - The default value is 5 seconds. It is invalid for timeoutSec to have greater + value than checkIntervalSec. + returned: success + type: int + unhealthyThreshold: + description: + - A so-far healthy instance will be marked unhealthy after this many consecutive + failures. The default value is 2. + returned: success + type: int ''' ################################################################################ diff --git a/lib/ansible/modules/cloud/google/gcp_compute_https_health_check.py b/lib/ansible/modules/cloud/google/gcp_compute_https_health_check.py index 96e0101babd639..0803b9ee2ade5a 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_https_health_check.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_https_health_check.py @@ -32,76 +32,79 @@ --- module: gcp_compute_https_health_check description: - - An HttpsHealthCheck resource. This resource defines a template for how individual - VMs should be checked for health, via HTTPS. +- An HttpsHealthCheck resource. This resource defines a template for how individual + VMs should be checked for health, via HTTPS. short_description: Creates a GCP HttpsHealthCheck version_added: 2.6 author: Google Inc. (@googlecloudplatform) requirements: - - python >= 2.6 - - requests >= 2.18.4 - - google-auth >= 1.3.0 +- python >= 2.6 +- requests >= 2.18.4 +- google-auth >= 1.3.0 options: - state: - description: - - Whether the given object should exist in GCP - choices: ['present', 'absent'] - default: 'present' - check_interval_sec: - description: - - How often (in seconds) to send a health check. The default value is 5 seconds. - required: false + state: description: - description: - - An optional description of this resource. Provide this property when you create - the resource. - required: false - healthy_threshold: - description: - - A so-far unhealthy instance will be marked healthy after this many consecutive successes. - The default value is 2. - required: false - host: - description: - - The value of the host header in the HTTPS health check request. If left empty (default - value), the public IP on behalf of which this health check is performed will be - used. - required: false - name: - description: - - Name of the resource. Provided by the client when the resource is created. The name - must be 1-63 characters long, and comply with RFC1035. Specifically, the name must - be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` - which means the first character must be a lowercase letter, and all following characters - must be a dash, lowercase letter, or digit, except the last character, which cannot - be a dash. - required: true - port: - description: - - The TCP port number for the HTTPS health check request. - - The default value is 80. - required: false - request_path: - description: - - The request path of the HTTPS health check request. - - The default value is /. - required: false - timeout_sec: - description: - - How long (in seconds) to wait before claiming failure. - - The default value is 5 seconds. It is invalid for timeoutSec to have greater value - than checkIntervalSec. - required: false - aliases: [timeout_seconds] - unhealthy_threshold: - description: - - A so-far healthy instance will be marked unhealthy after this many consecutive failures. - The default value is 2. - required: false + - Whether the given object should exist in GCP + choices: + - present + - absent + default: present + check_interval_sec: + description: + - How often (in seconds) to send a health check. The default value is 5 seconds. + required: false + description: + description: + - An optional description of this resource. Provide this property when you create + the resource. + required: false + healthy_threshold: + description: + - A so-far unhealthy instance will be marked healthy after this many consecutive + successes. The default value is 2. + required: false + host: + description: + - The value of the host header in the HTTPS health check request. If left empty + (default value), the public IP on behalf of which this health check is performed + will be used. + required: false + name: + description: + - Name of the resource. Provided by the client when the resource is created. The + name must be 1-63 characters long, and comply with RFC1035. Specifically, the + name must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` + which means the first character must be a lowercase letter, and all following + characters must be a dash, lowercase letter, or digit, except the last character, + which cannot be a dash. + required: true + port: + description: + - The TCP port number for the HTTPS health check request. + - The default value is 80. + required: false + request_path: + description: + - The request path of the HTTPS health check request. + - The default value is /. + required: false + timeout_sec: + description: + - How long (in seconds) to wait before claiming failure. + - The default value is 5 seconds. It is invalid for timeoutSec to have greater + value than checkIntervalSec. + required: false + aliases: + - timeout_seconds + unhealthy_threshold: + description: + - A so-far healthy instance will be marked unhealthy after this many consecutive + failures. The default value is 2. + required: false extends_documentation_fragment: gcp notes: - - "API Reference: U(https://cloud.google.com/compute/docs/reference/latest/httpsHealthChecks)" - - "Adding Health Checks: U(https://cloud.google.com/compute/docs/load-balancing/health-checks#legacy_health_checks)" +- 'API Reference: U(https://cloud.google.com/compute/docs/reference/latest/httpsHealthChecks)' +- 'Adding Health Checks: U(https://cloud.google.com/compute/docs/load-balancing/health-checks#legacy_health_checks)' ''' EXAMPLES = ''' @@ -119,75 +122,75 @@ ''' RETURN = ''' - checkIntervalSec: - description: - - How often (in seconds) to send a health check. The default value is 5 seconds. - returned: success - type: int - creationTimestamp: - description: - - Creation timestamp in RFC3339 text format. - returned: success - type: str - description: - description: - - An optional description of this resource. Provide this property when you create - the resource. - returned: success - type: str - healthyThreshold: - description: - - A so-far unhealthy instance will be marked healthy after this many consecutive successes. - The default value is 2. - returned: success - type: int - host: - description: - - The value of the host header in the HTTPS health check request. If left empty (default - value), the public IP on behalf of which this health check is performed will be - used. - returned: success - type: str - id: - description: - - The unique identifier for the resource. This identifier is defined by the server. - returned: success - type: int - name: - description: - - Name of the resource. Provided by the client when the resource is created. The name - must be 1-63 characters long, and comply with RFC1035. Specifically, the name must - be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` - which means the first character must be a lowercase letter, and all following characters - must be a dash, lowercase letter, or digit, except the last character, which cannot - be a dash. - returned: success - type: str - port: - description: - - The TCP port number for the HTTPS health check request. - - The default value is 80. - returned: success - type: int - requestPath: - description: - - The request path of the HTTPS health check request. - - The default value is /. - returned: success - type: str - timeoutSec: - description: - - How long (in seconds) to wait before claiming failure. - - The default value is 5 seconds. It is invalid for timeoutSec to have greater value - than checkIntervalSec. - returned: success - type: int - unhealthyThreshold: - description: - - A so-far healthy instance will be marked unhealthy after this many consecutive failures. - The default value is 2. - returned: success - type: int +checkIntervalSec: + description: + - How often (in seconds) to send a health check. The default value is 5 seconds. + returned: success + type: int +creationTimestamp: + description: + - Creation timestamp in RFC3339 text format. + returned: success + type: str +description: + description: + - An optional description of this resource. Provide this property when you create + the resource. + returned: success + type: str +healthyThreshold: + description: + - A so-far unhealthy instance will be marked healthy after this many consecutive + successes. The default value is 2. + returned: success + type: int +host: + description: + - The value of the host header in the HTTPS health check request. If left empty + (default value), the public IP on behalf of which this health check is performed + will be used. + returned: success + type: str +id: + description: + - The unique identifier for the resource. This identifier is defined by the server. + returned: success + type: int +name: + description: + - Name of the resource. Provided by the client when the resource is created. The + name must be 1-63 characters long, and comply with RFC1035. Specifically, the + name must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` + which means the first character must be a lowercase letter, and all following + characters must be a dash, lowercase letter, or digit, except the last character, + which cannot be a dash. + returned: success + type: str +port: + description: + - The TCP port number for the HTTPS health check request. + - The default value is 80. + returned: success + type: int +requestPath: + description: + - The request path of the HTTPS health check request. + - The default value is /. + returned: success + type: str +timeoutSec: + description: + - How long (in seconds) to wait before claiming failure. + - The default value is 5 seconds. It is invalid for timeoutSec to have greater value + than checkIntervalSec. + returned: success + type: int +unhealthyThreshold: + description: + - A so-far healthy instance will be marked unhealthy after this many consecutive + failures. The default value is 2. + returned: success + type: int ''' ################################################################################ diff --git a/lib/ansible/modules/cloud/google/gcp_compute_https_health_check_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_https_health_check_facts.py index 5a599f764dec93..5061b6ae57f7dc 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_https_health_check_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_https_health_check_facts.py @@ -32,21 +32,20 @@ --- module: gcp_compute_https_health_check_facts description: - - Gather facts for GCP HttpsHealthCheck +- Gather facts for GCP HttpsHealthCheck short_description: Gather facts for GCP HttpsHealthCheck version_added: 2.7 author: Google Inc. (@googlecloudplatform) requirements: - - python >= 2.6 - - requests >= 2.18.4 - - google-auth >= 1.3.0 +- python >= 2.6 +- requests >= 2.18.4 +- google-auth >= 1.3.0 options: - filters: - description: - A list of filter value pairs. Available filters are listed here - U(https://cloud.google.com/sdk/gcloud/reference/topic/filters). - Each additional filter in the list will act be added as an AND condition - (filter1 and filter2) + filters: + description: + - A list of filter value pairs. Available filters are listed here U(U(https://cloud.google.com/sdk/gcloud/reference/topic/filters).) + - Each additional filter in the list will act be added as an AND condition (filter1 + and filter2) . extends_documentation_fragment: gcp ''' @@ -62,79 +61,80 @@ RETURN = ''' items: - description: List of items - returned: always - type: complex - contains: - checkIntervalSec: - description: - - How often (in seconds) to send a health check. The default value is 5 seconds. - returned: success - type: int - creationTimestamp: - description: - - Creation timestamp in RFC3339 text format. - returned: success - type: str - description: - description: - - An optional description of this resource. Provide this property when you create - the resource. - returned: success - type: str - healthyThreshold: - description: - - A so-far unhealthy instance will be marked healthy after this many consecutive successes. - The default value is 2. - returned: success - type: int - host: - description: - - The value of the host header in the HTTPS health check request. If left empty (default - value), the public IP on behalf of which this health check is performed will be - used. - returned: success - type: str - id: - description: - - The unique identifier for the resource. This identifier is defined by the server. - returned: success - type: int - name: - description: - - Name of the resource. Provided by the client when the resource is created. The name - must be 1-63 characters long, and comply with RFC1035. Specifically, the name must - be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` - which means the first character must be a lowercase letter, and all following characters - must be a dash, lowercase letter, or digit, except the last character, which cannot - be a dash. - returned: success - type: str - port: - description: - - The TCP port number for the HTTPS health check request. - - The default value is 80. - returned: success - type: int - requestPath: - description: - - The request path of the HTTPS health check request. - - The default value is /. - returned: success - type: str - timeoutSec: - description: - - How long (in seconds) to wait before claiming failure. - - The default value is 5 seconds. It is invalid for timeoutSec to have greater value - than checkIntervalSec. - returned: success - type: int - unhealthyThreshold: - description: - - A so-far healthy instance will be marked unhealthy after this many consecutive failures. - The default value is 2. - returned: success - type: int + description: List of items + returned: always + type: complex + contains: + checkIntervalSec: + description: + - How often (in seconds) to send a health check. The default value is 5 seconds. + returned: success + type: int + creationTimestamp: + description: + - Creation timestamp in RFC3339 text format. + returned: success + type: str + description: + description: + - An optional description of this resource. Provide this property when you create + the resource. + returned: success + type: str + healthyThreshold: + description: + - A so-far unhealthy instance will be marked healthy after this many consecutive + successes. The default value is 2. + returned: success + type: int + host: + description: + - The value of the host header in the HTTPS health check request. If left empty + (default value), the public IP on behalf of which this health check is performed + will be used. + returned: success + type: str + id: + description: + - The unique identifier for the resource. This identifier is defined by the + server. + returned: success + type: int + name: + description: + - Name of the resource. Provided by the client when the resource is created. + The name must be 1-63 characters long, and comply with RFC1035. Specifically, + the name must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` + which means the first character must be a lowercase letter, and all following + characters must be a dash, lowercase letter, or digit, except the last character, + which cannot be a dash. + returned: success + type: str + port: + description: + - The TCP port number for the HTTPS health check request. + - The default value is 80. + returned: success + type: int + requestPath: + description: + - The request path of the HTTPS health check request. + - The default value is /. + returned: success + type: str + timeoutSec: + description: + - How long (in seconds) to wait before claiming failure. + - The default value is 5 seconds. It is invalid for timeoutSec to have greater + value than checkIntervalSec. + returned: success + type: int + unhealthyThreshold: + description: + - A so-far healthy instance will be marked unhealthy after this many consecutive + failures. The default value is 2. + returned: success + type: int ''' ################################################################################ diff --git a/lib/ansible/modules/cloud/google/gcp_compute_image.py b/lib/ansible/modules/cloud/google/gcp_compute_image.py index bf3307b9856fa8..145d3cee0c9e30 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_image.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_image.py @@ -32,156 +32,161 @@ --- module: gcp_compute_image description: - - Represents an Image resource. - - Google Compute Engine uses operating system images to create the root persistent - disks for your instances. You specify an image when you create an instance. Images - contain a boot loader, an operating system, and a root file system. Linux operating - system images are also capable of running containers on Compute Engine. - - Images can be either public or custom. - - Public images are provided and maintained by Google, open-source communities, and - third-party vendors. By default, all projects have access to these images and can - use them to create instances. Custom images are available only to your project. - You can create a custom image from root persistent disks and other images. Then, - use the custom image to create an instance. +- Represents an Image resource. +- Google Compute Engine uses operating system images to create the root persistent + disks for your instances. You specify an image when you create an instance. Images + contain a boot loader, an operating system, and a root file system. Linux operating + system images are also capable of running containers on Compute Engine. +- Images can be either public or custom. +- Public images are provided and maintained by Google, open-source communities, and + third-party vendors. By default, all projects have access to these images and can + use them to create instances. Custom images are available only to your project. + You can create a custom image from root persistent disks and other images. Then, + use the custom image to create an instance. short_description: Creates a GCP Image version_added: 2.6 author: Google Inc. (@googlecloudplatform) requirements: - - python >= 2.6 - - requests >= 2.18.4 - - google-auth >= 1.3.0 +- python >= 2.6 +- requests >= 2.18.4 +- google-auth >= 1.3.0 options: - state: - description: - - Whether the given object should exist in GCP - choices: ['present', 'absent'] - default: 'present' + state: description: + - Whether the given object should exist in GCP + choices: + - present + - absent + default: present + description: + description: + - An optional description of this resource. Provide this property when you create + the resource. + required: false + disk_size_gb: + description: + - Size of the image when restored onto a persistent disk (in GB). + required: false + family: + description: + - The name of the image family to which this image belongs. You can create disks + by specifying an image family instead of a specific image name. The image family + always returns its latest image that is not deprecated. The name of the image + family must comply with RFC1035. + required: false + guest_os_features: + description: + - A list of features to enable on the guest OS. Applicable for bootable images + only. Currently, only one feature can be enabled, VIRTIO_SCSI_MULTIQUEUE, which + allows each virtual CPU to have its own queue. For Windows images, you can only + enable VIRTIO_SCSI_MULTIQUEUE on images with driver version 1.2.0.1621 or higher. + Linux images with kernel versions 3.17 and higher will support VIRTIO_SCSI_MULTIQUEUE. + - For new Windows images, the server might also populate this field with the value + WINDOWS, to indicate that this is a Windows image. + - This value is purely informational and does not enable or disable any features. + required: false + suboptions: + type: description: - - An optional description of this resource. Provide this property when you create - the resource. - required: false - disk_size_gb: - description: - - Size of the image when restored onto a persistent disk (in GB). - required: false - family: - description: - - The name of the image family to which this image belongs. You can create disks by - specifying an image family instead of a specific image name. The image family always - returns its latest image that is not deprecated. The name of the image family must - comply with RFC1035. - required: false - guest_os_features: - description: - - A list of features to enable on the guest OS. Applicable for bootable images only. - Currently, only one feature can be enabled, VIRTIO_SCSI_MULTIQUEUE, which allows - each virtual CPU to have its own queue. For Windows images, you can only enable - VIRTIO_SCSI_MULTIQUEUE on images with driver version 1.2.0.1621 or higher. Linux - images with kernel versions 3.17 and higher will support VIRTIO_SCSI_MULTIQUEUE. - - For new Windows images, the server might also populate this field with the value - WINDOWS, to indicate that this is a Windows image. - - This value is purely informational and does not enable or disable any features. + - The type of supported feature. Currenty only VIRTIO_SCSI_MULTIQUEUE is supported. + For newer Windows images, the server might also populate this property with + the value WINDOWS to indicate that this is a Windows image. This value is + purely informational and does not enable or disable any features. required: false - suboptions: - type: - description: - - The type of supported feature. Currenty only VIRTIO_SCSI_MULTIQUEUE is supported. - For newer Windows images, the server might also populate this property with the - value WINDOWS to indicate that this is a Windows image. This value is purely informational - and does not enable or disable any features. - required: false - choices: ['VIRTIO_SCSI_MULTIQUEUE'] - image_encryption_key: + choices: + - VIRTIO_SCSI_MULTIQUEUE + image_encryption_key: + description: + - Encrypts the image using a customer-supplied encryption key. + - After you encrypt an image with a customer-supplied key, you must provide the + same key if you use the image later (e.g. to create a disk from the image) . + required: false + suboptions: + raw_key: description: - - Encrypts the image using a customer-supplied encryption key. - - After you encrypt an image with a customer-supplied key, you must provide the same - key if you use the image later (e.g. to create a disk from the image) . + - Specifies a 256-bit customer-supplied encryption key, encoded in RFC 4648 + base64 to either encrypt or decrypt this resource. required: false - suboptions: - raw_key: - description: - - Specifies a 256-bit customer-supplied encryption key, encoded in RFC 4648 base64 - to either encrypt or decrypt this resource. - required: false - sha256: - description: - - The RFC 4648 base64 encoded SHA-256 hash of the customer-supplied encryption key - that protects this resource. - required: false - licenses: + sha256: description: - - Any applicable license URI. + - The RFC 4648 base64 encoded SHA-256 hash of the customer-supplied encryption + key that protects this resource. required: false - name: - description: - - Name of the resource; provided by the client when the resource is created. The name - must be 1-63 characters long, and comply with RFC1035. Specifically, the name must - be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` - which means the first character must be a lowercase letter, and all following characters - must be a dash, lowercase letter, or digit, except the last character, which cannot - be a dash. - required: true - raw_disk: + licenses: + description: + - Any applicable license URI. + required: false + name: + description: + - Name of the resource; provided by the client when the resource is created. The + name must be 1-63 characters long, and comply with RFC1035. Specifically, the + name must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` + which means the first character must be a lowercase letter, and all following + characters must be a dash, lowercase letter, or digit, except the last character, + which cannot be a dash. + required: true + raw_disk: + description: + - The parameters of the raw disk image. + required: false + suboptions: + container_type: description: - - The parameters of the raw disk image. + - The format used to encode and transmit the block device, which should be + TAR. This is just a container and transmission format and not a runtime + format. Provided by the client when the disk image is created. required: false - suboptions: - container_type: - description: - - The format used to encode and transmit the block device, which should be TAR. This - is just a container and transmission format and not a runtime format. Provided by - the client when the disk image is created. - required: false - choices: ['TAR'] - sha1_checksum: - description: - - An optional SHA1 checksum of the disk image before unpackaging. - - This is provided by the client when the disk image is created. - required: false - source: - description: - - The full Google Cloud Storage URL where disk storage is stored You must provide - either this property or the sourceDisk property but not both. - required: false - source_disk: + choices: + - TAR + sha1_checksum: description: - - Refers to a gcompute_disk object You must provide either this property or the rawDisk.source - property but not both to create an image. - - 'This field represents a link to a Disk resource in GCP. It can be specified in - two ways. You can add `register: name-of-resource` to a gcp_compute_disk task and - then set this source_disk field to "{{ name-of-resource }}" Alternatively, you can - set this source_disk to a dictionary with the selfLink key where the value is the - selfLink of your Disk.' + - An optional SHA1 checksum of the disk image before unpackaging. + - This is provided by the client when the disk image is created. required: false - source_disk_encryption_key: + source: description: - - The customer-supplied encryption key of the source disk. Required if the source - disk is protected by a customer-supplied encryption key. + - The full Google Cloud Storage URL where disk storage is stored You must + provide either this property or the sourceDisk property but not both. required: false - suboptions: - raw_key: - description: - - Specifies a 256-bit customer-supplied encryption key, encoded in RFC 4648 base64 - to either encrypt or decrypt this resource. - required: false - sha256: - description: - - The RFC 4648 base64 encoded SHA-256 hash of the customer-supplied encryption key - that protects this resource. - required: false - source_disk_id: + source_disk: + description: + - Refers to a gcompute_disk object You must provide either this property or the + rawDisk.source property but not both to create an image. + - 'This field represents a link to a Disk resource in GCP. It can be specified + in two ways. You can add `register: name-of-resource` to a gcp_compute_disk + task and then set this source_disk field to "{{ name-of-resource }}" Alternatively, + you can set this source_disk to a dictionary with the selfLink key where the + value is the selfLink of your Disk' + required: false + source_disk_encryption_key: + description: + - The customer-supplied encryption key of the source disk. Required if the source + disk is protected by a customer-supplied encryption key. + required: false + suboptions: + raw_key: description: - - The ID value of the disk used to create this image. This value may be used to determine - whether the image was taken from the current or a previous instance of a given disk - name. + - Specifies a 256-bit customer-supplied encryption key, encoded in RFC 4648 + base64 to either encrypt or decrypt this resource. required: false - source_type: + sha256: description: - - The type of the image used to create this disk. The default and only value is RAW - . + - The RFC 4648 base64 encoded SHA-256 hash of the customer-supplied encryption + key that protects this resource. required: false - choices: ['RAW'] + source_disk_id: + description: + - The ID value of the disk used to create this image. This value may be used to + determine whether the image was taken from the current or a previous instance + of a given disk name. + required: false + source_type: + description: + - The type of the image used to create this disk. The default and only value is + RAW . + required: false + choices: + - RAW extends_documentation_fragment: gcp ''' @@ -207,202 +212,202 @@ ''' RETURN = ''' - archiveSizeBytes: - description: - - Size of the image tar.gz archive stored in Google Cloud Storage (in bytes). - returned: success - type: int - creationTimestamp: - description: - - Creation timestamp in RFC3339 text format. - returned: success - type: str +archiveSizeBytes: + description: + - Size of the image tar.gz archive stored in Google Cloud Storage (in bytes). + returned: success + type: int +creationTimestamp: + description: + - Creation timestamp in RFC3339 text format. + returned: success + type: str +deprecated: + description: + - The deprecation status associated with this image. + returned: success + type: complex + contains: + deleted: + description: + - An optional RFC3339 timestamp on or after which the state of this resource + is intended to change to DELETED. This is only informational and the status + will not change unless the client explicitly changes it. + returned: success + type: str deprecated: - description: - - The deprecation status associated with this image. - returned: success - type: complex - contains: - deleted: - description: - - An optional RFC3339 timestamp on or after which the state of this resource is intended - to change to DELETED. This is only informational and the status will not change - unless the client explicitly changes it. - returned: success - type: str - deprecated: - description: - - An optional RFC3339 timestamp on or after which the state of this resource is intended - to change to DEPRECATED. This is only informational and the status will not change - unless the client explicitly changes it. - returned: success - type: str - obsolete: - description: - - An optional RFC3339 timestamp on or after which the state of this resource is intended - to change to OBSOLETE. This is only informational and the status will not change - unless the client explicitly changes it. - returned: success - type: str - replacement: - description: - - The URL of the suggested replacement for a deprecated resource. - - The suggested replacement resource must be the same kind of resource as the deprecated - resource. - returned: success - type: str - state: - description: - - The deprecation state of this resource. This can be DEPRECATED, OBSOLETE, or DELETED. - Operations which create a new resource using a DEPRECATED resource will return successfully, - but with a warning indicating the deprecated resource and recommending its replacement. - Operations which use OBSOLETE or DELETED resources will be rejected and result in - an error. - returned: success - type: str - description: - description: - - An optional description of this resource. Provide this property when you create - the resource. - returned: success - type: str - diskSizeGb: - description: - - Size of the image when restored onto a persistent disk (in GB). - returned: success - type: int - family: - description: - - The name of the image family to which this image belongs. You can create disks by - specifying an image family instead of a specific image name. The image family always - returns its latest image that is not deprecated. The name of the image family must - comply with RFC1035. - returned: success - type: str - guestOsFeatures: - description: - - A list of features to enable on the guest OS. Applicable for bootable images only. - Currently, only one feature can be enabled, VIRTIO_SCSI_MULTIQUEUE, which allows - each virtual CPU to have its own queue. For Windows images, you can only enable - VIRTIO_SCSI_MULTIQUEUE on images with driver version 1.2.0.1621 or higher. Linux - images with kernel versions 3.17 and higher will support VIRTIO_SCSI_MULTIQUEUE. - - For new Windows images, the server might also populate this field with the value - WINDOWS, to indicate that this is a Windows image. - - This value is purely informational and does not enable or disable any features. - returned: success - type: complex - contains: - type: - description: - - The type of supported feature. Currenty only VIRTIO_SCSI_MULTIQUEUE is supported. - For newer Windows images, the server might also populate this property with the - value WINDOWS to indicate that this is a Windows image. This value is purely informational - and does not enable or disable any features. - returned: success - type: str - id: - description: - - The unique identifier for the resource. This identifier is defined by the server. - returned: success - type: int - imageEncryptionKey: - description: - - Encrypts the image using a customer-supplied encryption key. - - After you encrypt an image with a customer-supplied key, you must provide the same - key if you use the image later (e.g. to create a disk from the image) . - returned: success - type: complex - contains: - rawKey: - description: - - Specifies a 256-bit customer-supplied encryption key, encoded in RFC 4648 base64 - to either encrypt or decrypt this resource. - returned: success - type: str - sha256: - description: - - The RFC 4648 base64 encoded SHA-256 hash of the customer-supplied encryption key - that protects this resource. - returned: success - type: str - licenses: - description: - - Any applicable license URI. - returned: success - type: list - name: - description: - - Name of the resource; provided by the client when the resource is created. The name - must be 1-63 characters long, and comply with RFC1035. Specifically, the name must - be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` - which means the first character must be a lowercase letter, and all following characters - must be a dash, lowercase letter, or digit, except the last character, which cannot - be a dash. - returned: success - type: str - rawDisk: - description: - - The parameters of the raw disk image. - returned: success - type: complex - contains: - containerType: - description: - - The format used to encode and transmit the block device, which should be TAR. This - is just a container and transmission format and not a runtime format. Provided by - the client when the disk image is created. - returned: success - type: str - sha1Checksum: - description: - - An optional SHA1 checksum of the disk image before unpackaging. - - This is provided by the client when the disk image is created. - returned: success - type: str - source: - description: - - The full Google Cloud Storage URL where disk storage is stored You must provide - either this property or the sourceDisk property but not both. - returned: success - type: str - sourceDisk: - description: - - Refers to a gcompute_disk object You must provide either this property or the rawDisk.source - property but not both to create an image. - returned: success - type: dict - sourceDiskEncryptionKey: - description: - - The customer-supplied encryption key of the source disk. Required if the source - disk is protected by a customer-supplied encryption key. - returned: success - type: complex - contains: - rawKey: - description: - - Specifies a 256-bit customer-supplied encryption key, encoded in RFC 4648 base64 - to either encrypt or decrypt this resource. - returned: success - type: str - sha256: - description: - - The RFC 4648 base64 encoded SHA-256 hash of the customer-supplied encryption key - that protects this resource. - returned: success - type: str - sourceDiskId: - description: - - The ID value of the disk used to create this image. This value may be used to determine - whether the image was taken from the current or a previous instance of a given disk - name. - returned: success - type: str - sourceType: - description: - - The type of the image used to create this disk. The default and only value is RAW - . - returned: success - type: str + description: + - An optional RFC3339 timestamp on or after which the state of this resource + is intended to change to DEPRECATED. This is only informational and the status + will not change unless the client explicitly changes it. + returned: success + type: str + obsolete: + description: + - An optional RFC3339 timestamp on or after which the state of this resource + is intended to change to OBSOLETE. This is only informational and the status + will not change unless the client explicitly changes it. + returned: success + type: str + replacement: + description: + - The URL of the suggested replacement for a deprecated resource. + - The suggested replacement resource must be the same kind of resource as the + deprecated resource. + returned: success + type: str + state: + description: + - The deprecation state of this resource. This can be DEPRECATED, OBSOLETE, + or DELETED. Operations which create a new resource using a DEPRECATED resource + will return successfully, but with a warning indicating the deprecated resource + and recommending its replacement. Operations which use OBSOLETE or DELETED + resources will be rejected and result in an error. + returned: success + type: str +description: + description: + - An optional description of this resource. Provide this property when you create + the resource. + returned: success + type: str +diskSizeGb: + description: + - Size of the image when restored onto a persistent disk (in GB). + returned: success + type: int +family: + description: + - The name of the image family to which this image belongs. You can create disks + by specifying an image family instead of a specific image name. The image family + always returns its latest image that is not deprecated. The name of the image + family must comply with RFC1035. + returned: success + type: str +guestOsFeatures: + description: + - A list of features to enable on the guest OS. Applicable for bootable images only. + Currently, only one feature can be enabled, VIRTIO_SCSI_MULTIQUEUE, which allows + each virtual CPU to have its own queue. For Windows images, you can only enable + VIRTIO_SCSI_MULTIQUEUE on images with driver version 1.2.0.1621 or higher. Linux + images with kernel versions 3.17 and higher will support VIRTIO_SCSI_MULTIQUEUE. + - For new Windows images, the server might also populate this field with the value + WINDOWS, to indicate that this is a Windows image. + - This value is purely informational and does not enable or disable any features. + returned: success + type: complex + contains: + type: + description: + - The type of supported feature. Currenty only VIRTIO_SCSI_MULTIQUEUE is supported. + For newer Windows images, the server might also populate this property with + the value WINDOWS to indicate that this is a Windows image. This value is + purely informational and does not enable or disable any features. + returned: success + type: str +id: + description: + - The unique identifier for the resource. This identifier is defined by the server. + returned: success + type: int +imageEncryptionKey: + description: + - Encrypts the image using a customer-supplied encryption key. + - After you encrypt an image with a customer-supplied key, you must provide the + same key if you use the image later (e.g. to create a disk from the image) . + returned: success + type: complex + contains: + rawKey: + description: + - Specifies a 256-bit customer-supplied encryption key, encoded in RFC 4648 + base64 to either encrypt or decrypt this resource. + returned: success + type: str + sha256: + description: + - The RFC 4648 base64 encoded SHA-256 hash of the customer-supplied encryption + key that protects this resource. + returned: success + type: str +licenses: + description: + - Any applicable license URI. + returned: success + type: list +name: + description: + - Name of the resource; provided by the client when the resource is created. The + name must be 1-63 characters long, and comply with RFC1035. Specifically, the + name must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` + which means the first character must be a lowercase letter, and all following + characters must be a dash, lowercase letter, or digit, except the last character, + which cannot be a dash. + returned: success + type: str +rawDisk: + description: + - The parameters of the raw disk image. + returned: success + type: complex + contains: + containerType: + description: + - The format used to encode and transmit the block device, which should be TAR. + This is just a container and transmission format and not a runtime format. + Provided by the client when the disk image is created. + returned: success + type: str + sha1Checksum: + description: + - An optional SHA1 checksum of the disk image before unpackaging. + - This is provided by the client when the disk image is created. + returned: success + type: str + source: + description: + - The full Google Cloud Storage URL where disk storage is stored You must provide + either this property or the sourceDisk property but not both. + returned: success + type: str +sourceDisk: + description: + - Refers to a gcompute_disk object You must provide either this property or the + rawDisk.source property but not both to create an image. + returned: success + type: dict +sourceDiskEncryptionKey: + description: + - The customer-supplied encryption key of the source disk. Required if the source + disk is protected by a customer-supplied encryption key. + returned: success + type: complex + contains: + rawKey: + description: + - Specifies a 256-bit customer-supplied encryption key, encoded in RFC 4648 + base64 to either encrypt or decrypt this resource. + returned: success + type: str + sha256: + description: + - The RFC 4648 base64 encoded SHA-256 hash of the customer-supplied encryption + key that protects this resource. + returned: success + type: str +sourceDiskId: + description: + - The ID value of the disk used to create this image. This value may be used to + determine whether the image was taken from the current or a previous instance + of a given disk name. + returned: success + type: str +sourceType: + description: + - The type of the image used to create this disk. The default and only value is + RAW . + returned: success + type: str ''' ################################################################################ diff --git a/lib/ansible/modules/cloud/google/gcp_compute_image_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_image_facts.py index 17ecd7a8d08ac8..0f7f0f52a28166 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_image_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_image_facts.py @@ -32,21 +32,20 @@ --- module: gcp_compute_image_facts description: - - Gather facts for GCP Image +- Gather facts for GCP Image short_description: Gather facts for GCP Image version_added: 2.7 author: Google Inc. (@googlecloudplatform) requirements: - - python >= 2.6 - - requests >= 2.18.4 - - google-auth >= 1.3.0 +- python >= 2.6 +- requests >= 2.18.4 +- google-auth >= 1.3.0 options: - filters: - description: - A list of filter value pairs. Available filters are listed here - U(https://cloud.google.com/sdk/gcloud/reference/topic/filters). - Each additional filter in the list will act be added as an AND condition - (filter1 and filter2) + filters: + description: + - A list of filter value pairs. Available filters are listed here U(U(https://cloud.google.com/sdk/gcloud/reference/topic/filters).) + - Each additional filter in the list will act be added as an AND condition (filter1 + and filter2) . extends_documentation_fragment: gcp ''' @@ -62,206 +61,210 @@ RETURN = ''' items: - description: List of items - returned: always - type: complex - contains: - archiveSizeBytes: - description: - - Size of the image tar.gz archive stored in Google Cloud Storage (in bytes). - returned: success - type: int - creationTimestamp: - description: - - Creation timestamp in RFC3339 text format. - returned: success - type: str + description: List of items + returned: always + type: complex + contains: + archiveSizeBytes: + description: + - Size of the image tar.gz archive stored in Google Cloud Storage (in bytes). + returned: success + type: int + creationTimestamp: + description: + - Creation timestamp in RFC3339 text format. + returned: success + type: str + deprecated: + description: + - The deprecation status associated with this image. + returned: success + type: complex + contains: + deleted: + description: + - An optional RFC3339 timestamp on or after which the state of this resource + is intended to change to DELETED. This is only informational and the status + will not change unless the client explicitly changes it. + returned: success + type: str deprecated: - description: - - The deprecation status associated with this image. - returned: success - type: complex - contains: - deleted: - description: - - An optional RFC3339 timestamp on or after which the state of this resource is intended - to change to DELETED. This is only informational and the status will not change - unless the client explicitly changes it. - returned: success - type: str - deprecated: - description: - - An optional RFC3339 timestamp on or after which the state of this resource is intended - to change to DEPRECATED. This is only informational and the status will not change - unless the client explicitly changes it. - returned: success - type: str - obsolete: - description: - - An optional RFC3339 timestamp on or after which the state of this resource is intended - to change to OBSOLETE. This is only informational and the status will not change - unless the client explicitly changes it. - returned: success - type: str - replacement: - description: - - The URL of the suggested replacement for a deprecated resource. - - The suggested replacement resource must be the same kind of resource as the deprecated - resource. - returned: success - type: str - state: - description: - - The deprecation state of this resource. This can be DEPRECATED, OBSOLETE, or DELETED. - Operations which create a new resource using a DEPRECATED resource will return successfully, - but with a warning indicating the deprecated resource and recommending its replacement. - Operations which use OBSOLETE or DELETED resources will be rejected and result in - an error. - returned: success - type: str - description: - description: - - An optional description of this resource. Provide this property when you create - the resource. - returned: success - type: str - diskSizeGb: - description: - - Size of the image when restored onto a persistent disk (in GB). - returned: success - type: int - family: - description: - - The name of the image family to which this image belongs. You can create disks by - specifying an image family instead of a specific image name. The image family always - returns its latest image that is not deprecated. The name of the image family must - comply with RFC1035. - returned: success - type: str - guestOsFeatures: - description: - - A list of features to enable on the guest OS. Applicable for bootable images only. - Currently, only one feature can be enabled, VIRTIO_SCSI_MULTIQUEUE, which allows - each virtual CPU to have its own queue. For Windows images, you can only enable - VIRTIO_SCSI_MULTIQUEUE on images with driver version 1.2.0.1621 or higher. Linux - images with kernel versions 3.17 and higher will support VIRTIO_SCSI_MULTIQUEUE. - - For new Windows images, the server might also populate this field with the value - WINDOWS, to indicate that this is a Windows image. - - This value is purely informational and does not enable or disable any features. - returned: success - type: complex - contains: - type: - description: - - The type of supported feature. Currenty only VIRTIO_SCSI_MULTIQUEUE is supported. - For newer Windows images, the server might also populate this property with the - value WINDOWS to indicate that this is a Windows image. This value is purely informational - and does not enable or disable any features. - returned: success - type: str - id: - description: - - The unique identifier for the resource. This identifier is defined by the server. - returned: success - type: int - imageEncryptionKey: - description: - - Encrypts the image using a customer-supplied encryption key. - - After you encrypt an image with a customer-supplied key, you must provide the same - key if you use the image later (e.g. to create a disk from the image) . - returned: success - type: complex - contains: - rawKey: - description: - - Specifies a 256-bit customer-supplied encryption key, encoded in RFC 4648 base64 - to either encrypt or decrypt this resource. - returned: success - type: str - sha256: - description: - - The RFC 4648 base64 encoded SHA-256 hash of the customer-supplied encryption key - that protects this resource. - returned: success - type: str - licenses: - description: - - Any applicable license URI. - returned: success - type: list - name: - description: - - Name of the resource; provided by the client when the resource is created. The name - must be 1-63 characters long, and comply with RFC1035. Specifically, the name must - be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` - which means the first character must be a lowercase letter, and all following characters - must be a dash, lowercase letter, or digit, except the last character, which cannot - be a dash. - returned: success - type: str - rawDisk: - description: - - The parameters of the raw disk image. - returned: success - type: complex - contains: - containerType: - description: - - The format used to encode and transmit the block device, which should be TAR. This - is just a container and transmission format and not a runtime format. Provided by - the client when the disk image is created. - returned: success - type: str - sha1Checksum: - description: - - An optional SHA1 checksum of the disk image before unpackaging. - - This is provided by the client when the disk image is created. - returned: success - type: str - source: - description: - - The full Google Cloud Storage URL where disk storage is stored You must provide - either this property or the sourceDisk property but not both. - returned: success - type: str - sourceDisk: - description: - - Refers to a gcompute_disk object You must provide either this property or the rawDisk.source - property but not both to create an image. - returned: success - type: dict - sourceDiskEncryptionKey: - description: - - The customer-supplied encryption key of the source disk. Required if the source - disk is protected by a customer-supplied encryption key. - returned: success - type: complex - contains: - rawKey: - description: - - Specifies a 256-bit customer-supplied encryption key, encoded in RFC 4648 base64 - to either encrypt or decrypt this resource. - returned: success - type: str - sha256: - description: - - The RFC 4648 base64 encoded SHA-256 hash of the customer-supplied encryption key - that protects this resource. - returned: success - type: str - sourceDiskId: - description: - - The ID value of the disk used to create this image. This value may be used to determine - whether the image was taken from the current or a previous instance of a given disk - name. - returned: success - type: str - sourceType: - description: - - The type of the image used to create this disk. The default and only value is RAW - . - returned: success - type: str + description: + - An optional RFC3339 timestamp on or after which the state of this resource + is intended to change to DEPRECATED. This is only informational and the + status will not change unless the client explicitly changes it. + returned: success + type: str + obsolete: + description: + - An optional RFC3339 timestamp on or after which the state of this resource + is intended to change to OBSOLETE. This is only informational and the + status will not change unless the client explicitly changes it. + returned: success + type: str + replacement: + description: + - The URL of the suggested replacement for a deprecated resource. + - The suggested replacement resource must be the same kind of resource as + the deprecated resource. + returned: success + type: str + state: + description: + - The deprecation state of this resource. This can be DEPRECATED, OBSOLETE, + or DELETED. Operations which create a new resource using a DEPRECATED + resource will return successfully, but with a warning indicating the deprecated + resource and recommending its replacement. Operations which use OBSOLETE + or DELETED resources will be rejected and result in an error. + returned: success + type: str + description: + description: + - An optional description of this resource. Provide this property when you create + the resource. + returned: success + type: str + diskSizeGb: + description: + - Size of the image when restored onto a persistent disk (in GB). + returned: success + type: int + family: + description: + - The name of the image family to which this image belongs. You can create disks + by specifying an image family instead of a specific image name. The image + family always returns its latest image that is not deprecated. The name of + the image family must comply with RFC1035. + returned: success + type: str + guestOsFeatures: + description: + - A list of features to enable on the guest OS. Applicable for bootable images + only. Currently, only one feature can be enabled, VIRTIO_SCSI_MULTIQUEUE, + which allows each virtual CPU to have its own queue. For Windows images, you + can only enable VIRTIO_SCSI_MULTIQUEUE on images with driver version 1.2.0.1621 + or higher. Linux images with kernel versions 3.17 and higher will support + VIRTIO_SCSI_MULTIQUEUE. + - For new Windows images, the server might also populate this field with the + value WINDOWS, to indicate that this is a Windows image. + - This value is purely informational and does not enable or disable any features. + returned: success + type: complex + contains: + type: + description: + - The type of supported feature. Currenty only VIRTIO_SCSI_MULTIQUEUE is + supported. For newer Windows images, the server might also populate this + property with the value WINDOWS to indicate that this is a Windows image. + This value is purely informational and does not enable or disable any + features. + returned: success + type: str + id: + description: + - The unique identifier for the resource. This identifier is defined by the + server. + returned: success + type: int + imageEncryptionKey: + description: + - Encrypts the image using a customer-supplied encryption key. + - After you encrypt an image with a customer-supplied key, you must provide + the same key if you use the image later (e.g. to create a disk from the image) + . + returned: success + type: complex + contains: + rawKey: + description: + - Specifies a 256-bit customer-supplied encryption key, encoded in RFC 4648 + base64 to either encrypt or decrypt this resource. + returned: success + type: str + sha256: + description: + - The RFC 4648 base64 encoded SHA-256 hash of the customer-supplied encryption + key that protects this resource. + returned: success + type: str + licenses: + description: + - Any applicable license URI. + returned: success + type: list + name: + description: + - Name of the resource; provided by the client when the resource is created. + The name must be 1-63 characters long, and comply with RFC1035. Specifically, + the name must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` + which means the first character must be a lowercase letter, and all following + characters must be a dash, lowercase letter, or digit, except the last character, + which cannot be a dash. + returned: success + type: str + rawDisk: + description: + - The parameters of the raw disk image. + returned: success + type: complex + contains: + containerType: + description: + - The format used to encode and transmit the block device, which should + be TAR. This is just a container and transmission format and not a runtime + format. Provided by the client when the disk image is created. + returned: success + type: str + sha1Checksum: + description: + - An optional SHA1 checksum of the disk image before unpackaging. + - This is provided by the client when the disk image is created. + returned: success + type: str + source: + description: + - The full Google Cloud Storage URL where disk storage is stored You must + provide either this property or the sourceDisk property but not both. + returned: success + type: str + sourceDisk: + description: + - Refers to a gcompute_disk object You must provide either this property or + the rawDisk.source property but not both to create an image. + returned: success + type: dict + sourceDiskEncryptionKey: + description: + - The customer-supplied encryption key of the source disk. Required if the source + disk is protected by a customer-supplied encryption key. + returned: success + type: complex + contains: + rawKey: + description: + - Specifies a 256-bit customer-supplied encryption key, encoded in RFC 4648 + base64 to either encrypt or decrypt this resource. + returned: success + type: str + sha256: + description: + - The RFC 4648 base64 encoded SHA-256 hash of the customer-supplied encryption + key that protects this resource. + returned: success + type: str + sourceDiskId: + description: + - The ID value of the disk used to create this image. This value may be used + to determine whether the image was taken from the current or a previous instance + of a given disk name. + returned: success + type: str + sourceType: + description: + - The type of the image used to create this disk. The default and only value + is RAW . + returned: success + type: str ''' ################################################################################ diff --git a/lib/ansible/modules/cloud/google/gcp_compute_instance.py b/lib/ansible/modules/cloud/google/gcp_compute_instance.py index 4c52273d079ba2..106f2bf28a23e3 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_instance.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_instance.py @@ -32,357 +32,374 @@ --- module: gcp_compute_instance description: - - An instance is a virtual machine (VM) hosted on Google's infrastructure. +- An instance is a virtual machine (VM) hosted on Google's infrastructure. short_description: Creates a GCP Instance version_added: 2.6 author: Google Inc. (@googlecloudplatform) requirements: - - python >= 2.6 - - requests >= 2.18.4 - - google-auth >= 1.3.0 +- python >= 2.6 +- requests >= 2.18.4 +- google-auth >= 1.3.0 options: - state: + state: + description: + - Whether the given object should exist in GCP + choices: + - present + - absent + default: present + can_ip_forward: + description: + - Allows this instance to send and receive packets with non-matching destination + or source IPs. This is required if you plan to use this instance to forward + routes. + required: false + type: bool + disks: + description: + - An array of disks that are associated with the instances that are created from + this template. + required: false + suboptions: + auto_delete: description: - - Whether the given object should exist in GCP - choices: ['present', 'absent'] - default: 'present' - can_ip_forward: + - Specifies whether the disk will be auto-deleted when the instance is deleted + (but not when the disk is detached from the instance). + - 'Tip: Disks should be set to autoDelete=true so that leftover disks are + not left behind on machine deletion.' + required: false + type: bool + boot: description: - - Allows this instance to send and receive packets with non-matching destination or - source IPs. This is required if you plan to use this instance to forward routes. + - Indicates that this is a boot disk. The virtual machine will use the first + partition of the disk for its root filesystem. required: false type: bool - disks: + device_name: + description: + - Specifies a unique device name of your choice that is reflected into the + /dev/disk/by-id/google-* tree of a Linux operating system running within + the instance. This name can be used to reference the device for mounting, + resizing, and so on, from within the instance. + required: false + disk_encryption_key: description: - - An array of disks that are associated with the instances that are created from this - template. + - Encrypts or decrypts a disk using a customer-supplied encryption key. required: false suboptions: - auto_delete: - description: - - Specifies whether the disk will be auto-deleted when the instance is deleted (but - not when the disk is detached from the instance). - - 'Tip: Disks should be set to autoDelete=true so that leftover disks are not left - behind on machine deletion.' - required: false - type: bool - boot: - description: - - Indicates that this is a boot disk. The virtual machine will use the first partition - of the disk for its root filesystem. - required: false - type: bool - device_name: - description: - - Specifies a unique device name of your choice that is reflected into the /dev/disk/by-id/google-* - tree of a Linux operating system running within the instance. This name can be used - to reference the device for mounting, resizing, and so on, from within the instance. - required: false - disk_encryption_key: - description: - - Encrypts or decrypts a disk using a customer-supplied encryption key. - required: false - suboptions: - raw_key: - description: - - Specifies a 256-bit customer-supplied encryption key, encoded in RFC 4648 base64 - to either encrypt or decrypt this resource. - required: false - rsa_encrypted_key: - description: - - Specifies an RFC 4648 base64 encoded, RSA-wrapped 2048-bit customer-supplied encryption - key to either encrypt or decrypt this resource. - required: false - sha256: - description: - - The RFC 4648 base64 encoded SHA-256 hash of the customer-supplied encryption key - that protects this resource. - required: false - index: - description: - - Assigns a zero-based index to this disk, where 0 is reserved for the boot disk. - For example, if you have many disks attached to an instance, each disk would have - a unique index number. If not specified, the server will choose an appropriate value. - required: false - initialize_params: - description: - - Specifies the parameters for a new disk that will be created alongside the new instance. - Use initialization parameters to create boot disks or local SSDs attached to the - new instance. - required: false - suboptions: - disk_name: - description: - - Specifies the disk name. If not specified, the default is to use the name of the - instance. - required: false - disk_size_gb: - description: - - Specifies the size of the disk in base-2 GB. - required: false - disk_type: - description: - - Reference to a gcompute_disk_type resource. - - Specifies the disk type to use to create the instance. - - If not specified, the default is pd-standard. - required: false - source_image: - description: - - The source image to create this disk. When creating a new instance, one of initializeParams.sourceImage - or disks.source is required. To create a disk with one of the public operating - system images, specify the image by its family name. - required: false - source_image_encryption_key: - description: - - The customer-supplied encryption key of the source image. Required if the source - image is protected by a customer-supplied encryption key. - - Instance templates do not store customer-supplied encryption keys, so you cannot - create disks for instances in a managed instance group if the source images are - encrypted with your own keys. - required: false - suboptions: - raw_key: - description: - - Specifies a 256-bit customer-supplied encryption key, encoded in RFC 4648 base64 - to either encrypt or decrypt this resource. - required: false - sha256: - description: - - The RFC 4648 base64 encoded SHA-256 hash of the customer-supplied encryption key - that protects this resource. - required: false - interface: - description: - - Specifies the disk interface to use for attaching this disk, which is either SCSI - or NVME. The default is SCSI. - - Persistent disks must always use SCSI and the request will fail if you attempt to - attach a persistent disk in any other format than SCSI. - required: false - choices: ['SCSI', 'NVME'] - mode: - description: - - The mode in which to attach this disk, either READ_WRITE or READ_ONLY. If not specified, - the default is to attach the disk in READ_WRITE mode. - required: false - choices: ['READ_WRITE', 'READ_ONLY'] - source: - description: - - Reference to a gcompute_disk resource. When creating a new instance, one of initializeParams.sourceImage - or disks.source is required. - - If desired, you can also attach existing non-root persistent disks using this property. - This field is only applicable for persistent disks. - - 'This field represents a link to a Disk resource in GCP. It can be specified in - two ways. You can add `register: name-of-resource` to a gcp_compute_disk task and - then set this source field to "{{ name-of-resource }}" Alternatively, you can set - this source to a dictionary with the selfLink key where the value is the selfLink - of your Disk.' - required: false - type: - description: - - Specifies the type of the disk, either SCRATCH or PERSISTENT. If not specified, - the default is PERSISTENT. - required: false - choices: ['SCRATCH', 'PERSISTENT'] - guest_accelerators: + raw_key: + description: + - Specifies a 256-bit customer-supplied encryption key, encoded in RFC + 4648 base64 to either encrypt or decrypt this resource. + required: false + rsa_encrypted_key: + description: + - Specifies an RFC 4648 base64 encoded, RSA-wrapped 2048-bit customer-supplied + encryption key to either encrypt or decrypt this resource. + required: false + sha256: + description: + - The RFC 4648 base64 encoded SHA-256 hash of the customer-supplied encryption + key that protects this resource. + required: false + index: + description: + - Assigns a zero-based index to this disk, where 0 is reserved for the boot + disk. For example, if you have many disks attached to an instance, each + disk would have a unique index number. If not specified, the server will + choose an appropriate value. + required: false + initialize_params: description: - - List of the type and count of accelerator cards attached to the instance . + - Specifies the parameters for a new disk that will be created alongside the + new instance. Use initialization parameters to create boot disks or local + SSDs attached to the new instance. required: false suboptions: - accelerator_count: + disk_name: + description: + - Specifies the disk name. If not specified, the default is to use the + name of the instance. + required: false + disk_size_gb: + description: + - Specifies the size of the disk in base-2 GB. + required: false + disk_type: + description: + - Reference to a gcompute_disk_type resource. + - Specifies the disk type to use to create the instance. + - If not specified, the default is pd-standard. + required: false + source_image: + description: + - The source image to create this disk. When creating a new instance, + one of initializeParams.sourceImage or disks.source is required. To + create a disk with one of the public operating system images, specify + the image by its family name. + required: false + source_image_encryption_key: + description: + - The customer-supplied encryption key of the source image. Required if + the source image is protected by a customer-supplied encryption key. + - Instance templates do not store customer-supplied encryption keys, so + you cannot create disks for instances in a managed instance group if + the source images are encrypted with your own keys. + required: false + suboptions: + raw_key: description: - - The number of the guest accelerator cards exposed to this instance. + - Specifies a 256-bit customer-supplied encryption key, encoded in + RFC 4648 base64 to either encrypt or decrypt this resource. required: false - accelerator_type: + sha256: description: - - Full or partial URL of the accelerator type resource to expose to this instance. + - The RFC 4648 base64 encoded SHA-256 hash of the customer-supplied + encryption key that protects this resource. required: false - label_fingerprint: + interface: description: - - A fingerprint for this request, which is essentially a hash of the metadata's contents - and used for optimistic locking. The fingerprint is initially generated by Compute - Engine and changes after every request to modify or update metadata. You must always - provide an up-to-date fingerprint hash in order to update or change metadata. + - Specifies the disk interface to use for attaching this disk, which is either + SCSI or NVME. The default is SCSI. + - Persistent disks must always use SCSI and the request will fail if you attempt + to attach a persistent disk in any other format than SCSI. required: false - metadata: + choices: + - SCSI + - NVME + mode: description: - - The metadata key/value pairs to assign to instances that are created from this template. - These pairs can consist of custom metadata or predefined keys. + - The mode in which to attach this disk, either READ_WRITE or READ_ONLY. If + not specified, the default is to attach the disk in READ_WRITE mode. required: false - machine_type: + choices: + - READ_WRITE + - READ_ONLY + source: description: - - A reference to a machine type which defines VM kind. + - Reference to a gcompute_disk resource. When creating a new instance, one + of initializeParams.sourceImage or disks.source is required. + - If desired, you can also attach existing non-root persistent disks using + this property. This field is only applicable for persistent disks. + - 'This field represents a link to a Disk resource in GCP. It can be specified + in two ways. You can add `register: name-of-resource` to a gcp_compute_disk + task and then set this source field to "{{ name-of-resource }}" Alternatively, + you can set this source to a dictionary with the selfLink key where the + value is the selfLink of your Disk' required: false - min_cpu_platform: + type: description: - - Specifies a minimum CPU platform for the VM instance. Applicable values are the - friendly names of CPU platforms . + - Specifies the type of the disk, either SCRATCH or PERSISTENT. If not specified, + the default is PERSISTENT. required: false - name: + choices: + - SCRATCH + - PERSISTENT + guest_accelerators: + description: + - List of the type and count of accelerator cards attached to the instance . + required: false + suboptions: + accelerator_count: description: - - The name of the resource, provided by the client when initially creating the resource. - The resource name must be 1-63 characters long, and comply with RFC1035. Specifically, - the name must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` - which means the first character must be a lowercase letter, and all following characters - must be a dash, lowercase letter, or digit, except the last character, which cannot - be a dash. + - The number of the guest accelerator cards exposed to this instance. required: false - network_interfaces: + accelerator_type: description: - - An array of configurations for this interface. This specifies how this interface - is configured to interact with other network services, such as connecting to the - internet. Only one network interface is supported per instance. + - Full or partial URL of the accelerator type resource to expose to this instance. required: false - suboptions: - access_configs: - description: - - An array of configurations for this interface. Currently, only one access config, - ONE_TO_ONE_NAT, is supported. If there are no accessConfigs specified, then this - instance will have no external internet access. - required: false - suboptions: - name: - description: - - The name of this access configuration. The default and recommended name is External - NAT but you can use any arbitrary string you would like. For example, My external - IP or Network Access. - required: true - nat_ip: - description: - - Specifies the title of a gcompute_address. - - An external IP address associated with this instance. - - Specify an unused static external IP address available to the project or leave this - field undefined to use an IP from a shared ephemeral IP address pool. If you specify - a static external IP address, it must live in the same region as the zone of the - instance. - - 'This field represents a link to a Address resource in GCP. It can be specified - in two ways. You can add `register: name-of-resource` to a gcp_compute_address task - and then set this nat_ip field to "{{ name-of-resource }}" Alternatively, you can - set this nat_ip to a dictionary with the address key where the value is the address - of your Address.' - required: false - type: - description: - - The type of configuration. The default and only option is ONE_TO_ONE_NAT. - required: true - choices: ['ONE_TO_ONE_NAT'] - alias_ip_ranges: - description: - - An array of alias IP ranges for this network interface. Can only be specified for - network interfaces on subnet-mode networks. - required: false - suboptions: - ip_cidr_range: - description: - - The IP CIDR range represented by this alias IP range. - - This IP CIDR range must belong to the specified subnetwork and cannot contain IP - addresses reserved by system or used by other network interfaces. This range may - be a single IP address (e.g. 10.2.3.4), a netmask (e.g. /24) or a CIDR format string - (e.g. 10.1.2.0/24). - required: false - subnetwork_range_name: - description: - - Optional subnetwork secondary range name specifying the secondary range from which - to allocate the IP CIDR range for this alias IP range. If left unspecified, the - primary range of the subnetwork will be used. - required: false - name: - description: - - The name of the network interface, generated by the server. For network devices, - these are eth0, eth1, etc . - required: false - network: - description: - - Specifies the title of an existing gcompute_network. When creating an instance, - if neither the network nor the subnetwork is specified, the default network global/networks/default - is used; if the network is not specified but the subnetwork is specified, the network - is inferred. - - 'This field represents a link to a Network resource in GCP. It can be specified - in two ways. You can add `register: name-of-resource` to a gcp_compute_network task - and then set this network field to "{{ name-of-resource }}" Alternatively, you can - set this network to a dictionary with the selfLink key where the value is the selfLink - of your Network.' - required: false - network_ip: - description: - - An IPv4 internal network address to assign to the instance for this network interface. - If not specified by the user, an unused internal IP is assigned by the system. - required: false - subnetwork: - description: - - Reference to a gcompute_subnetwork resource. - - If the network resource is in legacy mode, do not provide this property. If the - network is in auto subnet mode, providing the subnetwork is optional. If the network - is in custom subnet mode, then this field should be specified. - - 'This field represents a link to a Subnetwork resource in GCP. It can be specified - in two ways. You can add `register: name-of-resource` to a gcp_compute_subnetwork - task and then set this subnetwork field to "{{ name-of-resource }}" Alternatively, - you can set this subnetwork to a dictionary with the selfLink key where the value - is the selfLink of your Subnetwork.' - required: false - scheduling: + label_fingerprint: + description: + - A fingerprint for this request, which is essentially a hash of the metadata's + contents and used for optimistic locking. The fingerprint is initially generated + by Compute Engine and changes after every request to modify or update metadata. + You must always provide an up-to-date fingerprint hash in order to update or + change metadata. + required: false + metadata: + description: + - The metadata key/value pairs to assign to instances that are created from this + template. These pairs can consist of custom metadata or predefined keys. + required: false + machine_type: + description: + - A reference to a machine type which defines VM kind. + required: false + min_cpu_platform: + description: + - Specifies a minimum CPU platform for the VM instance. Applicable values are + the friendly names of CPU platforms . + required: false + name: + description: + - The name of the resource, provided by the client when initially creating the + resource. The resource name must be 1-63 characters long, and comply with RFC1035. + Specifically, the name must be 1-63 characters long and match the regular expression + `[a-z]([-a-z0-9]*[a-z0-9])?` which means the first character must be a lowercase + letter, and all following characters must be a dash, lowercase letter, or digit, + except the last character, which cannot be a dash. + required: false + network_interfaces: + description: + - An array of configurations for this interface. This specifies how this interface + is configured to interact with other network services, such as connecting to + the internet. Only one network interface is supported per instance. + required: false + suboptions: + access_configs: description: - - Sets the scheduling options for this instance. + - An array of configurations for this interface. Currently, only one access + config, ONE_TO_ONE_NAT, is supported. If there are no accessConfigs specified, + then this instance will have no external internet access. required: false suboptions: - automatic_restart: - description: - - Specifies whether the instance should be automatically restarted if it is terminated - by Compute Engine (not terminated by a user). - - You can only set the automatic restart option for standard instances. Preemptible - instances cannot be automatically restarted. - required: false - type: bool - on_host_maintenance: - description: - - Defines the maintenance behavior for this instance. For standard instances, the - default behavior is MIGRATE. For preemptible instances, the default and only possible - behavior is TERMINATE. - - For more information, see Setting Instance Scheduling Options. - required: false - preemptible: - description: - - Defines whether the instance is preemptible. This can only be set during instance - creation, it cannot be set or changed after the instance has been created. - required: false - type: bool - service_accounts: + name: + description: + - The name of this access configuration. The default and recommended name + is External NAT but you can use any arbitrary string you would like. + For example, My external IP or Network Access. + required: true + nat_ip: + description: + - Specifies the title of a gcompute_address. + - An external IP address associated with this instance. + - Specify an unused static external IP address available to the project + or leave this field undefined to use an IP from a shared ephemeral IP + address pool. If you specify a static external IP address, it must live + in the same region as the zone of the instance. + - 'This field represents a link to a Address resource in GCP. It can be + specified in two ways. You can add `register: name-of-resource` to a + gcp_compute_address task and then set this nat_ip field to "{{ name-of-resource + }}" Alternatively, you can set this nat_ip to a dictionary with the + address key where the value is the address of your Address' + required: false + type: + description: + - The type of configuration. The default and only option is ONE_TO_ONE_NAT. + required: true + choices: + - ONE_TO_ONE_NAT + alias_ip_ranges: description: - - A list of service accounts, with their specified scopes, authorized for this instance. - Only one service account per VM instance is supported. + - An array of alias IP ranges for this network interface. Can only be specified + for network interfaces on subnet-mode networks. required: false suboptions: - email: - description: - - Email address of the service account. - required: false - scopes: - description: - - The list of scopes to be made available for this service account. - required: false - tags: + ip_cidr_range: + description: + - The IP CIDR range represented by this alias IP range. + - This IP CIDR range must belong to the specified subnetwork and cannot + contain IP addresses reserved by system or used by other network interfaces. + This range may be a single IP address (e.g. 10.2.3.4), a netmask (e.g. + /24) or a CIDR format string (e.g. 10.1.2.0/24). + required: false + subnetwork_range_name: + description: + - Optional subnetwork secondary range name specifying the secondary range + from which to allocate the IP CIDR range for this alias IP range. If + left unspecified, the primary range of the subnetwork will be used. + required: false + name: description: - - A list of tags to apply to this instance. Tags are used to identify valid sources - or targets for network firewalls and are specified by the client during instance - creation. The tags can be later modified by the setTags method. Each tag within - the list must comply with RFC1035. + - The name of the network interface, generated by the server. For network + devices, these are eth0, eth1, etc . required: false - suboptions: - fingerprint: - description: - - Specifies a fingerprint for this request, which is essentially a hash of the metadata's - contents and used for optimistic locking. - - The fingerprint is initially generated by Compute Engine and changes after every - request to modify or update metadata. You must always provide an up-to-date fingerprint - hash in order to update or change metadata. - required: false - items: - description: - - An array of tags. Each tag must be 1-63 characters long, and comply with RFC1035. - required: false - zone: + network: + description: + - Specifies the title of an existing gcompute_network. When creating an instance, + if neither the network nor the subnetwork is specified, the default network + global/networks/default is used; if the network is not specified but the + subnetwork is specified, the network is inferred. + - 'This field represents a link to a Network resource in GCP. It can be specified + in two ways. You can add `register: name-of-resource` to a gcp_compute_network + task and then set this network field to "{{ name-of-resource }}" Alternatively, + you can set this network to a dictionary with the selfLink key where the + value is the selfLink of your Network' + required: false + network_ip: + description: + - An IPv4 internal network address to assign to the instance for this network + interface. If not specified by the user, an unused internal IP is assigned + by the system. + required: false + subnetwork: + description: + - Reference to a gcompute_subnetwork resource. + - If the network resource is in legacy mode, do not provide this property. + If the network is in auto subnet mode, providing the subnetwork is optional. + If the network is in custom subnet mode, then this field should be specified. + - 'This field represents a link to a Subnetwork resource in GCP. It can be + specified in two ways. You can add `register: name-of-resource` to a gcp_compute_subnetwork + task and then set this subnetwork field to "{{ name-of-resource }}" Alternatively, + you can set this subnetwork to a dictionary with the selfLink key where + the value is the selfLink of your Subnetwork' + required: false + scheduling: + description: + - Sets the scheduling options for this instance. + required: false + suboptions: + automatic_restart: + description: + - Specifies whether the instance should be automatically restarted if it is + terminated by Compute Engine (not terminated by a user). + - You can only set the automatic restart option for standard instances. Preemptible + instances cannot be automatically restarted. + required: false + type: bool + on_host_maintenance: + description: + - Defines the maintenance behavior for this instance. For standard instances, + the default behavior is MIGRATE. For preemptible instances, the default + and only possible behavior is TERMINATE. + - For more information, see Setting Instance Scheduling Options. + required: false + preemptible: + description: + - Defines whether the instance is preemptible. This can only be set during + instance creation, it cannot be set or changed after the instance has been + created. + required: false + type: bool + service_accounts: + description: + - A list of service accounts, with their specified scopes, authorized for this + instance. Only one service account per VM instance is supported. + required: false + suboptions: + email: + description: + - Email address of the service account. + required: false + scopes: + description: + - The list of scopes to be made available for this service account. + required: false + tags: + description: + - A list of tags to apply to this instance. Tags are used to identify valid sources + or targets for network firewalls and are specified by the client during instance + creation. The tags can be later modified by the setTags method. Each tag within + the list must comply with RFC1035. + required: false + suboptions: + fingerprint: + description: + - Specifies a fingerprint for this request, which is essentially a hash of + the metadata's contents and used for optimistic locking. + - The fingerprint is initially generated by Compute Engine and changes after + every request to modify or update metadata. You must always provide an up-to-date + fingerprint hash in order to update or change metadata. + required: false + items: description: - - A reference to the zone where the machine resides. - required: true + - An array of tags. Each tag must be 1-63 characters long, and comply with + RFC1035. + required: false + zone: + description: + - A reference to the zone where the machine resides. + required: true extends_documentation_fragment: gcp ''' @@ -443,393 +460,398 @@ ''' RETURN = ''' - canIpForward: - description: - - Allows this instance to send and receive packets with non-matching destination or - source IPs. This is required if you plan to use this instance to forward routes. - returned: success - type: bool - cpuPlatform: - description: - - The CPU platform used by this instance. - returned: success - type: str - creationTimestamp: - description: - - Creation timestamp in RFC3339 text format. - returned: success - type: str - disks: - description: - - An array of disks that are associated with the instances that are created from this - template. - returned: success - type: complex - contains: - autoDelete: - description: - - Specifies whether the disk will be auto-deleted when the instance is deleted (but - not when the disk is detached from the instance). - - 'Tip: Disks should be set to autoDelete=true so that leftover disks are not left - behind on machine deletion.' - returned: success - type: bool - boot: - description: - - Indicates that this is a boot disk. The virtual machine will use the first partition - of the disk for its root filesystem. - returned: success - type: bool - deviceName: - description: - - Specifies a unique device name of your choice that is reflected into the /dev/disk/by-id/google-* - tree of a Linux operating system running within the instance. This name can be used - to reference the device for mounting, resizing, and so on, from within the instance. - returned: success - type: str - diskEncryptionKey: - description: - - Encrypts or decrypts a disk using a customer-supplied encryption key. - returned: success - type: complex - contains: - rawKey: - description: - - Specifies a 256-bit customer-supplied encryption key, encoded in RFC 4648 base64 - to either encrypt or decrypt this resource. - returned: success - type: str - rsaEncryptedKey: - description: - - Specifies an RFC 4648 base64 encoded, RSA-wrapped 2048-bit customer-supplied encryption - key to either encrypt or decrypt this resource. - returned: success - type: str - sha256: - description: - - The RFC 4648 base64 encoded SHA-256 hash of the customer-supplied encryption key - that protects this resource. - returned: success - type: str - index: - description: - - Assigns a zero-based index to this disk, where 0 is reserved for the boot disk. - For example, if you have many disks attached to an instance, each disk would have - a unique index number. If not specified, the server will choose an appropriate value. - returned: success - type: int - initializeParams: - description: - - Specifies the parameters for a new disk that will be created alongside the new instance. - Use initialization parameters to create boot disks or local SSDs attached to the - new instance. - returned: success - type: complex - contains: - diskName: - description: - - Specifies the disk name. If not specified, the default is to use the name of the - instance. - returned: success - type: str - diskSizeGb: - description: - - Specifies the size of the disk in base-2 GB. - returned: success - type: int - diskType: - description: - - Reference to a gcompute_disk_type resource. - - Specifies the disk type to use to create the instance. - - If not specified, the default is pd-standard. - returned: success - type: str - sourceImage: - description: - - The source image to create this disk. When creating a new instance, one of initializeParams.sourceImage - or disks.source is required. To create a disk with one of the public operating - system images, specify the image by its family name. - returned: success - type: str - sourceImageEncryptionKey: - description: - - The customer-supplied encryption key of the source image. Required if the source - image is protected by a customer-supplied encryption key. - - Instance templates do not store customer-supplied encryption keys, so you cannot - create disks for instances in a managed instance group if the source images are - encrypted with your own keys. - returned: success - type: complex - contains: - rawKey: - description: - - Specifies a 256-bit customer-supplied encryption key, encoded in RFC 4648 base64 - to either encrypt or decrypt this resource. - returned: success - type: str - sha256: - description: - - The RFC 4648 base64 encoded SHA-256 hash of the customer-supplied encryption key - that protects this resource. - returned: success - type: str - interface: - description: - - Specifies the disk interface to use for attaching this disk, which is either SCSI - or NVME. The default is SCSI. - - Persistent disks must always use SCSI and the request will fail if you attempt to - attach a persistent disk in any other format than SCSI. - returned: success - type: str - mode: - description: - - The mode in which to attach this disk, either READ_WRITE or READ_ONLY. If not specified, - the default is to attach the disk in READ_WRITE mode. - returned: success - type: str - source: - description: - - Reference to a gcompute_disk resource. When creating a new instance, one of initializeParams.sourceImage - or disks.source is required. - - If desired, you can also attach existing non-root persistent disks using this property. - This field is only applicable for persistent disks. - returned: success - type: dict - type: - description: - - Specifies the type of the disk, either SCRATCH or PERSISTENT. If not specified, - the default is PERSISTENT. - returned: success - type: str - guestAccelerators: - description: - - List of the type and count of accelerator cards attached to the instance . - returned: success - type: complex - contains: - acceleratorCount: - description: - - The number of the guest accelerator cards exposed to this instance. - returned: success - type: int - acceleratorType: - description: - - Full or partial URL of the accelerator type resource to expose to this instance. - returned: success - type: str - id: - description: - - The unique identifier for the resource. This identifier is defined by the server. - returned: success - type: int - labelFingerprint: - description: - - A fingerprint for this request, which is essentially a hash of the metadata's contents - and used for optimistic locking. The fingerprint is initially generated by Compute - Engine and changes after every request to modify or update metadata. You must always - provide an up-to-date fingerprint hash in order to update or change metadata. - returned: success - type: str - metadata: - description: - - The metadata key/value pairs to assign to instances that are created from this template. - These pairs can consist of custom metadata or predefined keys. - returned: success - type: dict - machineType: - description: - - A reference to a machine type which defines VM kind. - returned: success - type: str - minCpuPlatform: - description: - - Specifies a minimum CPU platform for the VM instance. Applicable values are the - friendly names of CPU platforms . - returned: success - type: str +canIpForward: + description: + - Allows this instance to send and receive packets with non-matching destination + or source IPs. This is required if you plan to use this instance to forward routes. + returned: success + type: bool +cpuPlatform: + description: + - The CPU platform used by this instance. + returned: success + type: str +creationTimestamp: + description: + - Creation timestamp in RFC3339 text format. + returned: success + type: str +disks: + description: + - An array of disks that are associated with the instances that are created from + this template. + returned: success + type: complex + contains: + autoDelete: + description: + - Specifies whether the disk will be auto-deleted when the instance is deleted + (but not when the disk is detached from the instance). + - 'Tip: Disks should be set to autoDelete=true so that leftover disks are not + left behind on machine deletion.' + returned: success + type: bool + boot: + description: + - Indicates that this is a boot disk. The virtual machine will use the first + partition of the disk for its root filesystem. + returned: success + type: bool + deviceName: + description: + - Specifies a unique device name of your choice that is reflected into the /dev/disk/by-id/google-* + tree of a Linux operating system running within the instance. This name can + be used to reference the device for mounting, resizing, and so on, from within + the instance. + returned: success + type: str + diskEncryptionKey: + description: + - Encrypts or decrypts a disk using a customer-supplied encryption key. + returned: success + type: complex + contains: + rawKey: + description: + - Specifies a 256-bit customer-supplied encryption key, encoded in RFC 4648 + base64 to either encrypt or decrypt this resource. + returned: success + type: str + rsaEncryptedKey: + description: + - Specifies an RFC 4648 base64 encoded, RSA-wrapped 2048-bit customer-supplied + encryption key to either encrypt or decrypt this resource. + returned: success + type: str + sha256: + description: + - The RFC 4648 base64 encoded SHA-256 hash of the customer-supplied encryption + key that protects this resource. + returned: success + type: str + index: + description: + - Assigns a zero-based index to this disk, where 0 is reserved for the boot + disk. For example, if you have many disks attached to an instance, each disk + would have a unique index number. If not specified, the server will choose + an appropriate value. + returned: success + type: int + initializeParams: + description: + - Specifies the parameters for a new disk that will be created alongside the + new instance. Use initialization parameters to create boot disks or local + SSDs attached to the new instance. + returned: success + type: complex + contains: + diskName: + description: + - Specifies the disk name. If not specified, the default is to use the name + of the instance. + returned: success + type: str + diskSizeGb: + description: + - Specifies the size of the disk in base-2 GB. + returned: success + type: int + diskType: + description: + - Reference to a gcompute_disk_type resource. + - Specifies the disk type to use to create the instance. + - If not specified, the default is pd-standard. + returned: success + type: str + sourceImage: + description: + - The source image to create this disk. When creating a new instance, one + of initializeParams.sourceImage or disks.source is required. To create + a disk with one of the public operating system images, specify the image + by its family name. + returned: success + type: str + sourceImageEncryptionKey: + description: + - The customer-supplied encryption key of the source image. Required if + the source image is protected by a customer-supplied encryption key. + - Instance templates do not store customer-supplied encryption keys, so + you cannot create disks for instances in a managed instance group if the + source images are encrypted with your own keys. + returned: success + type: complex + contains: + rawKey: + description: + - Specifies a 256-bit customer-supplied encryption key, encoded in RFC + 4648 base64 to either encrypt or decrypt this resource. + returned: success + type: str + sha256: + description: + - The RFC 4648 base64 encoded SHA-256 hash of the customer-supplied + encryption key that protects this resource. + returned: success + type: str + interface: + description: + - Specifies the disk interface to use for attaching this disk, which is either + SCSI or NVME. The default is SCSI. + - Persistent disks must always use SCSI and the request will fail if you attempt + to attach a persistent disk in any other format than SCSI. + returned: success + type: str + mode: + description: + - The mode in which to attach this disk, either READ_WRITE or READ_ONLY. If + not specified, the default is to attach the disk in READ_WRITE mode. + returned: success + type: str + source: + description: + - Reference to a gcompute_disk resource. When creating a new instance, one of + initializeParams.sourceImage or disks.source is required. + - If desired, you can also attach existing non-root persistent disks using this + property. This field is only applicable for persistent disks. + returned: success + type: dict + type: + description: + - Specifies the type of the disk, either SCRATCH or PERSISTENT. If not specified, + the default is PERSISTENT. + returned: success + type: str +guestAccelerators: + description: + - List of the type and count of accelerator cards attached to the instance . + returned: success + type: complex + contains: + acceleratorCount: + description: + - The number of the guest accelerator cards exposed to this instance. + returned: success + type: int + acceleratorType: + description: + - Full or partial URL of the accelerator type resource to expose to this instance. + returned: success + type: str +id: + description: + - The unique identifier for the resource. This identifier is defined by the server. + returned: success + type: int +labelFingerprint: + description: + - A fingerprint for this request, which is essentially a hash of the metadata's + contents and used for optimistic locking. The fingerprint is initially generated + by Compute Engine and changes after every request to modify or update metadata. + You must always provide an up-to-date fingerprint hash in order to update or change + metadata. + returned: success + type: str +metadata: + description: + - The metadata key/value pairs to assign to instances that are created from this + template. These pairs can consist of custom metadata or predefined keys. + returned: success + type: dict +machineType: + description: + - A reference to a machine type which defines VM kind. + returned: success + type: str +minCpuPlatform: + description: + - Specifies a minimum CPU platform for the VM instance. Applicable values are the + friendly names of CPU platforms . + returned: success + type: str +name: + description: + - The name of the resource, provided by the client when initially creating the resource. + The resource name must be 1-63 characters long, and comply with RFC1035. Specifically, + the name must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` + which means the first character must be a lowercase letter, and all following + characters must be a dash, lowercase letter, or digit, except the last character, + which cannot be a dash. + returned: success + type: str +networkInterfaces: + description: + - An array of configurations for this interface. This specifies how this interface + is configured to interact with other network services, such as connecting to the + internet. Only one network interface is supported per instance. + returned: success + type: complex + contains: + accessConfigs: + description: + - An array of configurations for this interface. Currently, only one access + config, ONE_TO_ONE_NAT, is supported. If there are no accessConfigs specified, + then this instance will have no external internet access. + returned: success + type: complex + contains: + name: + description: + - The name of this access configuration. The default and recommended name + is External NAT but you can use any arbitrary string you would like. For + example, My external IP or Network Access. + returned: success + type: str + natIP: + description: + - Specifies the title of a gcompute_address. + - An external IP address associated with this instance. + - Specify an unused static external IP address available to the project + or leave this field undefined to use an IP from a shared ephemeral IP + address pool. If you specify a static external IP address, it must live + in the same region as the zone of the instance. + returned: success + type: dict + type: + description: + - The type of configuration. The default and only option is ONE_TO_ONE_NAT. + returned: success + type: str + aliasIpRanges: + description: + - An array of alias IP ranges for this network interface. Can only be specified + for network interfaces on subnet-mode networks. + returned: success + type: complex + contains: + ipCidrRange: + description: + - The IP CIDR range represented by this alias IP range. + - This IP CIDR range must belong to the specified subnetwork and cannot + contain IP addresses reserved by system or used by other network interfaces. + This range may be a single IP address (e.g. 10.2.3.4), a netmask (e.g. + /24) or a CIDR format string (e.g. 10.1.2.0/24). + returned: success + type: str + subnetworkRangeName: + description: + - Optional subnetwork secondary range name specifying the secondary range + from which to allocate the IP CIDR range for this alias IP range. If left + unspecified, the primary range of the subnetwork will be used. + returned: success + type: str name: - description: - - The name of the resource, provided by the client when initially creating the resource. - The resource name must be 1-63 characters long, and comply with RFC1035. Specifically, - the name must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` - which means the first character must be a lowercase letter, and all following characters - must be a dash, lowercase letter, or digit, except the last character, which cannot - be a dash. - returned: success - type: str - networkInterfaces: - description: - - An array of configurations for this interface. This specifies how this interface - is configured to interact with other network services, such as connecting to the - internet. Only one network interface is supported per instance. - returned: success - type: complex - contains: - accessConfigs: - description: - - An array of configurations for this interface. Currently, only one access config, - ONE_TO_ONE_NAT, is supported. If there are no accessConfigs specified, then this - instance will have no external internet access. - returned: success - type: complex - contains: - name: - description: - - The name of this access configuration. The default and recommended name is External - NAT but you can use any arbitrary string you would like. For example, My external - IP or Network Access. - returned: success - type: str - natIP: - description: - - Specifies the title of a gcompute_address. - - An external IP address associated with this instance. - - Specify an unused static external IP address available to the project or leave this - field undefined to use an IP from a shared ephemeral IP address pool. If you specify - a static external IP address, it must live in the same region as the zone of the - instance. - returned: success - type: dict - type: - description: - - The type of configuration. The default and only option is ONE_TO_ONE_NAT. - returned: success - type: str - aliasIpRanges: - description: - - An array of alias IP ranges for this network interface. Can only be specified for - network interfaces on subnet-mode networks. - returned: success - type: complex - contains: - ipCidrRange: - description: - - The IP CIDR range represented by this alias IP range. - - This IP CIDR range must belong to the specified subnetwork and cannot contain IP - addresses reserved by system or used by other network interfaces. This range may - be a single IP address (e.g. 10.2.3.4), a netmask (e.g. /24) or a CIDR format string - (e.g. 10.1.2.0/24). - returned: success - type: str - subnetworkRangeName: - description: - - Optional subnetwork secondary range name specifying the secondary range from which - to allocate the IP CIDR range for this alias IP range. If left unspecified, the - primary range of the subnetwork will be used. - returned: success - type: str - name: - description: - - The name of the network interface, generated by the server. For network devices, - these are eth0, eth1, etc . - returned: success - type: str - network: - description: - - Specifies the title of an existing gcompute_network. When creating an instance, - if neither the network nor the subnetwork is specified, the default network global/networks/default - is used; if the network is not specified but the subnetwork is specified, the network - is inferred. - returned: success - type: dict - networkIP: - description: - - An IPv4 internal network address to assign to the instance for this network interface. - If not specified by the user, an unused internal IP is assigned by the system. - returned: success - type: str - subnetwork: - description: - - Reference to a gcompute_subnetwork resource. - - If the network resource is in legacy mode, do not provide this property. If the - network is in auto subnet mode, providing the subnetwork is optional. If the network - is in custom subnet mode, then this field should be specified. - returned: success - type: dict - scheduling: - description: - - Sets the scheduling options for this instance. - returned: success - type: complex - contains: - automaticRestart: - description: - - Specifies whether the instance should be automatically restarted if it is terminated - by Compute Engine (not terminated by a user). - - You can only set the automatic restart option for standard instances. Preemptible - instances cannot be automatically restarted. - returned: success - type: bool - onHostMaintenance: - description: - - Defines the maintenance behavior for this instance. For standard instances, the - default behavior is MIGRATE. For preemptible instances, the default and only possible - behavior is TERMINATE. - - For more information, see Setting Instance Scheduling Options. - returned: success - type: str - preemptible: - description: - - Defines whether the instance is preemptible. This can only be set during instance - creation, it cannot be set or changed after the instance has been created. - returned: success - type: bool - serviceAccounts: - description: - - A list of service accounts, with their specified scopes, authorized for this instance. - Only one service account per VM instance is supported. - returned: success - type: complex - contains: - email: - description: - - Email address of the service account. - returned: success - type: str - scopes: - description: - - The list of scopes to be made available for this service account. - returned: success - type: list - status: - description: - - 'The status of the instance. One of the following values: PROVISIONING, STAGING, - RUNNING, STOPPING, SUSPENDING, SUSPENDED, and TERMINATED.' - returned: success - type: str - statusMessage: - description: - - An optional, human-readable explanation of the status. - returned: success - type: str - tags: - description: - - A list of tags to apply to this instance. Tags are used to identify valid sources - or targets for network firewalls and are specified by the client during instance - creation. The tags can be later modified by the setTags method. Each tag within - the list must comply with RFC1035. - returned: success - type: complex - contains: - fingerprint: - description: - - Specifies a fingerprint for this request, which is essentially a hash of the metadata's - contents and used for optimistic locking. - - The fingerprint is initially generated by Compute Engine and changes after every - request to modify or update metadata. You must always provide an up-to-date fingerprint - hash in order to update or change metadata. - returned: success - type: str - items: - description: - - An array of tags. Each tag must be 1-63 characters long, and comply with RFC1035. - returned: success - type: list - zone: - description: - - A reference to the zone where the machine resides. - returned: success - type: str + description: + - The name of the network interface, generated by the server. For network devices, + these are eth0, eth1, etc . + returned: success + type: str + network: + description: + - Specifies the title of an existing gcompute_network. When creating an instance, + if neither the network nor the subnetwork is specified, the default network + global/networks/default is used; if the network is not specified but the subnetwork + is specified, the network is inferred. + returned: success + type: dict + networkIP: + description: + - An IPv4 internal network address to assign to the instance for this network + interface. If not specified by the user, an unused internal IP is assigned + by the system. + returned: success + type: str + subnetwork: + description: + - Reference to a gcompute_subnetwork resource. + - If the network resource is in legacy mode, do not provide this property. If + the network is in auto subnet mode, providing the subnetwork is optional. + If the network is in custom subnet mode, then this field should be specified. + returned: success + type: dict +scheduling: + description: + - Sets the scheduling options for this instance. + returned: success + type: complex + contains: + automaticRestart: + description: + - Specifies whether the instance should be automatically restarted if it is + terminated by Compute Engine (not terminated by a user). + - You can only set the automatic restart option for standard instances. Preemptible + instances cannot be automatically restarted. + returned: success + type: bool + onHostMaintenance: + description: + - Defines the maintenance behavior for this instance. For standard instances, + the default behavior is MIGRATE. For preemptible instances, the default and + only possible behavior is TERMINATE. + - For more information, see Setting Instance Scheduling Options. + returned: success + type: str + preemptible: + description: + - Defines whether the instance is preemptible. This can only be set during instance + creation, it cannot be set or changed after the instance has been created. + returned: success + type: bool +serviceAccounts: + description: + - A list of service accounts, with their specified scopes, authorized for this instance. + Only one service account per VM instance is supported. + returned: success + type: complex + contains: + email: + description: + - Email address of the service account. + returned: success + type: str + scopes: + description: + - The list of scopes to be made available for this service account. + returned: success + type: list +status: + description: + - 'The status of the instance. One of the following values: PROVISIONING, STAGING, + RUNNING, STOPPING, SUSPENDING, SUSPENDED, and TERMINATED.' + returned: success + type: str +statusMessage: + description: + - An optional, human-readable explanation of the status. + returned: success + type: str +tags: + description: + - A list of tags to apply to this instance. Tags are used to identify valid sources + or targets for network firewalls and are specified by the client during instance + creation. The tags can be later modified by the setTags method. Each tag within + the list must comply with RFC1035. + returned: success + type: complex + contains: + fingerprint: + description: + - Specifies a fingerprint for this request, which is essentially a hash of the + metadata's contents and used for optimistic locking. + - The fingerprint is initially generated by Compute Engine and changes after + every request to modify or update metadata. You must always provide an up-to-date + fingerprint hash in order to update or change metadata. + returned: success + type: str + items: + description: + - An array of tags. Each tag must be 1-63 characters long, and comply with RFC1035. + returned: success + type: list +zone: + description: + - A reference to the zone where the machine resides. + returned: success + type: str ''' ################################################################################ diff --git a/lib/ansible/modules/cloud/google/gcp_compute_instance_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_instance_facts.py index 1d1096b8c3fbac..d267dac692c89a 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_instance_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_instance_facts.py @@ -32,25 +32,24 @@ --- module: gcp_compute_instance_facts description: - - Gather facts for GCP Instance +- Gather facts for GCP Instance short_description: Gather facts for GCP Instance version_added: 2.7 author: Google Inc. (@googlecloudplatform) requirements: - - python >= 2.6 - - requests >= 2.18.4 - - google-auth >= 1.3.0 +- python >= 2.6 +- requests >= 2.18.4 +- google-auth >= 1.3.0 options: - filters: - description: - A list of filter value pairs. Available filters are listed here - U(https://cloud.google.com/sdk/gcloud/reference/topic/filters). - Each additional filter in the list will act be added as an AND condition - (filter1 and filter2) - zone: - description: - - A reference to the zone where the machine resides. - required: true + filters: + description: + - A list of filter value pairs. Available filters are listed here U(U(https://cloud.google.com/sdk/gcloud/reference/topic/filters).) + - Each additional filter in the list will act be added as an AND condition (filter1 + and filter2) . + zone: + description: + - A reference to the zone where the machine resides. + required: true extends_documentation_fragment: gcp ''' @@ -67,397 +66,408 @@ RETURN = ''' items: - description: List of items - returned: always - type: complex - contains: - canIpForward: - description: - - Allows this instance to send and receive packets with non-matching destination or - source IPs. This is required if you plan to use this instance to forward routes. - returned: success - type: bool - cpuPlatform: - description: - - The CPU platform used by this instance. - returned: success - type: str - creationTimestamp: - description: - - Creation timestamp in RFC3339 text format. - returned: success - type: str - disks: - description: - - An array of disks that are associated with the instances that are created from this - template. - returned: success - type: complex - contains: - autoDelete: - description: - - Specifies whether the disk will be auto-deleted when the instance is deleted (but - not when the disk is detached from the instance). - - 'Tip: Disks should be set to autoDelete=true so that leftover disks are not left - behind on machine deletion.' - returned: success - type: bool - boot: - description: - - Indicates that this is a boot disk. The virtual machine will use the first partition - of the disk for its root filesystem. - returned: success - type: bool - deviceName: - description: - - Specifies a unique device name of your choice that is reflected into the /dev/disk/by-id/google-* - tree of a Linux operating system running within the instance. This name can be used - to reference the device for mounting, resizing, and so on, from within the instance. - returned: success - type: str - diskEncryptionKey: - description: - - Encrypts or decrypts a disk using a customer-supplied encryption key. - returned: success - type: complex - contains: - rawKey: - description: - - Specifies a 256-bit customer-supplied encryption key, encoded in RFC 4648 base64 - to either encrypt or decrypt this resource. - returned: success - type: str - rsaEncryptedKey: - description: - - Specifies an RFC 4648 base64 encoded, RSA-wrapped 2048-bit customer-supplied encryption - key to either encrypt or decrypt this resource. - returned: success - type: str - sha256: - description: - - The RFC 4648 base64 encoded SHA-256 hash of the customer-supplied encryption key - that protects this resource. - returned: success - type: str - index: - description: - - Assigns a zero-based index to this disk, where 0 is reserved for the boot disk. - For example, if you have many disks attached to an instance, each disk would have - a unique index number. If not specified, the server will choose an appropriate value. - returned: success - type: int - initializeParams: - description: - - Specifies the parameters for a new disk that will be created alongside the new instance. - Use initialization parameters to create boot disks or local SSDs attached to the - new instance. - returned: success - type: complex - contains: - diskName: - description: - - Specifies the disk name. If not specified, the default is to use the name of the - instance. - returned: success - type: str - diskSizeGb: - description: - - Specifies the size of the disk in base-2 GB. - returned: success - type: int - diskType: - description: - - Reference to a gcompute_disk_type resource. - - Specifies the disk type to use to create the instance. - - If not specified, the default is pd-standard. - returned: success - type: str - sourceImage: - description: - - The source image to create this disk. When creating a new instance, one of initializeParams.sourceImage - or disks.source is required. To create a disk with one of the public operating - system images, specify the image by its family name. - returned: success - type: str - sourceImageEncryptionKey: - description: - - The customer-supplied encryption key of the source image. Required if the source - image is protected by a customer-supplied encryption key. - - Instance templates do not store customer-supplied encryption keys, so you cannot - create disks for instances in a managed instance group if the source images are - encrypted with your own keys. - returned: success - type: complex - contains: - rawKey: - description: - - Specifies a 256-bit customer-supplied encryption key, encoded in RFC 4648 base64 - to either encrypt or decrypt this resource. - returned: success - type: str - sha256: - description: - - The RFC 4648 base64 encoded SHA-256 hash of the customer-supplied encryption key - that protects this resource. - returned: success - type: str - interface: - description: - - Specifies the disk interface to use for attaching this disk, which is either SCSI - or NVME. The default is SCSI. - - Persistent disks must always use SCSI and the request will fail if you attempt to - attach a persistent disk in any other format than SCSI. - returned: success - type: str - mode: - description: - - The mode in which to attach this disk, either READ_WRITE or READ_ONLY. If not specified, - the default is to attach the disk in READ_WRITE mode. - returned: success - type: str - source: - description: - - Reference to a gcompute_disk resource. When creating a new instance, one of initializeParams.sourceImage - or disks.source is required. - - If desired, you can also attach existing non-root persistent disks using this property. - This field is only applicable for persistent disks. - returned: success - type: dict - type: - description: - - Specifies the type of the disk, either SCRATCH or PERSISTENT. If not specified, - the default is PERSISTENT. - returned: success - type: str - guestAccelerators: - description: - - List of the type and count of accelerator cards attached to the instance . - returned: success - type: complex - contains: - acceleratorCount: - description: - - The number of the guest accelerator cards exposed to this instance. - returned: success - type: int - acceleratorType: - description: - - Full or partial URL of the accelerator type resource to expose to this instance. - returned: success - type: str - id: - description: - - The unique identifier for the resource. This identifier is defined by the server. - returned: success - type: int - labelFingerprint: - description: - - A fingerprint for this request, which is essentially a hash of the metadata's contents - and used for optimistic locking. The fingerprint is initially generated by Compute - Engine and changes after every request to modify or update metadata. You must always - provide an up-to-date fingerprint hash in order to update or change metadata. - returned: success - type: str - metadata: - description: - - The metadata key/value pairs to assign to instances that are created from this template. - These pairs can consist of custom metadata or predefined keys. - returned: success - type: dict - machineType: - description: - - A reference to a machine type which defines VM kind. - returned: success - type: str - minCpuPlatform: - description: - - Specifies a minimum CPU platform for the VM instance. Applicable values are the - friendly names of CPU platforms . - returned: success - type: str + description: List of items + returned: always + type: complex + contains: + canIpForward: + description: + - Allows this instance to send and receive packets with non-matching destination + or source IPs. This is required if you plan to use this instance to forward + routes. + returned: success + type: bool + cpuPlatform: + description: + - The CPU platform used by this instance. + returned: success + type: str + creationTimestamp: + description: + - Creation timestamp in RFC3339 text format. + returned: success + type: str + disks: + description: + - An array of disks that are associated with the instances that are created + from this template. + returned: success + type: complex + contains: + autoDelete: + description: + - Specifies whether the disk will be auto-deleted when the instance is deleted + (but not when the disk is detached from the instance). + - 'Tip: Disks should be set to autoDelete=true so that leftover disks are + not left behind on machine deletion.' + returned: success + type: bool + boot: + description: + - Indicates that this is a boot disk. The virtual machine will use the first + partition of the disk for its root filesystem. + returned: success + type: bool + deviceName: + description: + - Specifies a unique device name of your choice that is reflected into the + /dev/disk/by-id/google-* tree of a Linux operating system running within + the instance. This name can be used to reference the device for mounting, + resizing, and so on, from within the instance. + returned: success + type: str + diskEncryptionKey: + description: + - Encrypts or decrypts a disk using a customer-supplied encryption key. + returned: success + type: complex + contains: + rawKey: + description: + - Specifies a 256-bit customer-supplied encryption key, encoded in RFC + 4648 base64 to either encrypt or decrypt this resource. + returned: success + type: str + rsaEncryptedKey: + description: + - Specifies an RFC 4648 base64 encoded, RSA-wrapped 2048-bit customer-supplied + encryption key to either encrypt or decrypt this resource. + returned: success + type: str + sha256: + description: + - The RFC 4648 base64 encoded SHA-256 hash of the customer-supplied + encryption key that protects this resource. + returned: success + type: str + index: + description: + - Assigns a zero-based index to this disk, where 0 is reserved for the boot + disk. For example, if you have many disks attached to an instance, each + disk would have a unique index number. If not specified, the server will + choose an appropriate value. + returned: success + type: int + initializeParams: + description: + - Specifies the parameters for a new disk that will be created alongside + the new instance. Use initialization parameters to create boot disks or + local SSDs attached to the new instance. + returned: success + type: complex + contains: + diskName: + description: + - Specifies the disk name. If not specified, the default is to use the + name of the instance. + returned: success + type: str + diskSizeGb: + description: + - Specifies the size of the disk in base-2 GB. + returned: success + type: int + diskType: + description: + - Reference to a gcompute_disk_type resource. + - Specifies the disk type to use to create the instance. + - If not specified, the default is pd-standard. + returned: success + type: str + sourceImage: + description: + - The source image to create this disk. When creating a new instance, + one of initializeParams.sourceImage or disks.source is required. To + create a disk with one of the public operating system images, specify + the image by its family name. + returned: success + type: str + sourceImageEncryptionKey: + description: + - The customer-supplied encryption key of the source image. Required + if the source image is protected by a customer-supplied encryption + key. + - Instance templates do not store customer-supplied encryption keys, + so you cannot create disks for instances in a managed instance group + if the source images are encrypted with your own keys. + returned: success + type: complex + contains: + rawKey: + description: + - Specifies a 256-bit customer-supplied encryption key, encoded + in RFC 4648 base64 to either encrypt or decrypt this resource. + returned: success + type: str + sha256: + description: + - The RFC 4648 base64 encoded SHA-256 hash of the customer-supplied + encryption key that protects this resource. + returned: success + type: str + interface: + description: + - Specifies the disk interface to use for attaching this disk, which is + either SCSI or NVME. The default is SCSI. + - Persistent disks must always use SCSI and the request will fail if you + attempt to attach a persistent disk in any other format than SCSI. + returned: success + type: str + mode: + description: + - The mode in which to attach this disk, either READ_WRITE or READ_ONLY. + If not specified, the default is to attach the disk in READ_WRITE mode. + returned: success + type: str + source: + description: + - Reference to a gcompute_disk resource. When creating a new instance, one + of initializeParams.sourceImage or disks.source is required. + - If desired, you can also attach existing non-root persistent disks using + this property. This field is only applicable for persistent disks. + returned: success + type: dict + type: + description: + - Specifies the type of the disk, either SCRATCH or PERSISTENT. If not specified, + the default is PERSISTENT. + returned: success + type: str + guestAccelerators: + description: + - List of the type and count of accelerator cards attached to the instance . + returned: success + type: complex + contains: + acceleratorCount: + description: + - The number of the guest accelerator cards exposed to this instance. + returned: success + type: int + acceleratorType: + description: + - Full or partial URL of the accelerator type resource to expose to this + instance. + returned: success + type: str + id: + description: + - The unique identifier for the resource. This identifier is defined by the + server. + returned: success + type: int + labelFingerprint: + description: + - A fingerprint for this request, which is essentially a hash of the metadata's + contents and used for optimistic locking. The fingerprint is initially generated + by Compute Engine and changes after every request to modify or update metadata. + You must always provide an up-to-date fingerprint hash in order to update + or change metadata. + returned: success + type: str + metadata: + description: + - The metadata key/value pairs to assign to instances that are created from + this template. These pairs can consist of custom metadata or predefined keys. + returned: success + type: dict + machineType: + description: + - A reference to a machine type which defines VM kind. + returned: success + type: str + minCpuPlatform: + description: + - Specifies a minimum CPU platform for the VM instance. Applicable values are + the friendly names of CPU platforms . + returned: success + type: str + name: + description: + - The name of the resource, provided by the client when initially creating the + resource. The resource name must be 1-63 characters long, and comply with + RFC1035. Specifically, the name must be 1-63 characters long and match the + regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` which means the first character + must be a lowercase letter, and all following characters must be a dash, lowercase + letter, or digit, except the last character, which cannot be a dash. + returned: success + type: str + networkInterfaces: + description: + - An array of configurations for this interface. This specifies how this interface + is configured to interact with other network services, such as connecting + to the internet. Only one network interface is supported per instance. + returned: success + type: complex + contains: + accessConfigs: + description: + - An array of configurations for this interface. Currently, only one access + config, ONE_TO_ONE_NAT, is supported. If there are no accessConfigs specified, + then this instance will have no external internet access. + returned: success + type: complex + contains: + name: + description: + - The name of this access configuration. The default and recommended + name is External NAT but you can use any arbitrary string you would + like. For example, My external IP or Network Access. + returned: success + type: str + natIP: + description: + - Specifies the title of a gcompute_address. + - An external IP address associated with this instance. + - Specify an unused static external IP address available to the project + or leave this field undefined to use an IP from a shared ephemeral + IP address pool. If you specify a static external IP address, it must + live in the same region as the zone of the instance. + returned: success + type: dict + type: + description: + - The type of configuration. The default and only option is ONE_TO_ONE_NAT. + returned: success + type: str + aliasIpRanges: + description: + - An array of alias IP ranges for this network interface. Can only be specified + for network interfaces on subnet-mode networks. + returned: success + type: complex + contains: + ipCidrRange: + description: + - The IP CIDR range represented by this alias IP range. + - This IP CIDR range must belong to the specified subnetwork and cannot + contain IP addresses reserved by system or used by other network interfaces. + This range may be a single IP address (e.g. 10.2.3.4), a netmask (e.g. + /24) or a CIDR format string (e.g. 10.1.2.0/24). + returned: success + type: str + subnetworkRangeName: + description: + - Optional subnetwork secondary range name specifying the secondary + range from which to allocate the IP CIDR range for this alias IP range. + If left unspecified, the primary range of the subnetwork will be used. + returned: success + type: str name: - description: - - The name of the resource, provided by the client when initially creating the resource. - The resource name must be 1-63 characters long, and comply with RFC1035. Specifically, - the name must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` - which means the first character must be a lowercase letter, and all following characters - must be a dash, lowercase letter, or digit, except the last character, which cannot - be a dash. - returned: success - type: str - networkInterfaces: - description: - - An array of configurations for this interface. This specifies how this interface - is configured to interact with other network services, such as connecting to the - internet. Only one network interface is supported per instance. - returned: success - type: complex - contains: - accessConfigs: - description: - - An array of configurations for this interface. Currently, only one access config, - ONE_TO_ONE_NAT, is supported. If there are no accessConfigs specified, then this - instance will have no external internet access. - returned: success - type: complex - contains: - name: - description: - - The name of this access configuration. The default and recommended name is External - NAT but you can use any arbitrary string you would like. For example, My external - IP or Network Access. - returned: success - type: str - natIP: - description: - - Specifies the title of a gcompute_address. - - An external IP address associated with this instance. - - Specify an unused static external IP address available to the project or leave this - field undefined to use an IP from a shared ephemeral IP address pool. If you specify - a static external IP address, it must live in the same region as the zone of the - instance. - returned: success - type: dict - type: - description: - - The type of configuration. The default and only option is ONE_TO_ONE_NAT. - returned: success - type: str - aliasIpRanges: - description: - - An array of alias IP ranges for this network interface. Can only be specified for - network interfaces on subnet-mode networks. - returned: success - type: complex - contains: - ipCidrRange: - description: - - The IP CIDR range represented by this alias IP range. - - This IP CIDR range must belong to the specified subnetwork and cannot contain IP - addresses reserved by system or used by other network interfaces. This range may - be a single IP address (e.g. 10.2.3.4), a netmask (e.g. /24) or a CIDR format string - (e.g. 10.1.2.0/24). - returned: success - type: str - subnetworkRangeName: - description: - - Optional subnetwork secondary range name specifying the secondary range from which - to allocate the IP CIDR range for this alias IP range. If left unspecified, the - primary range of the subnetwork will be used. - returned: success - type: str - name: - description: - - The name of the network interface, generated by the server. For network devices, - these are eth0, eth1, etc . - returned: success - type: str - network: - description: - - Specifies the title of an existing gcompute_network. When creating an instance, - if neither the network nor the subnetwork is specified, the default network global/networks/default - is used; if the network is not specified but the subnetwork is specified, the network - is inferred. - returned: success - type: dict - networkIP: - description: - - An IPv4 internal network address to assign to the instance for this network interface. - If not specified by the user, an unused internal IP is assigned by the system. - returned: success - type: str - subnetwork: - description: - - Reference to a gcompute_subnetwork resource. - - If the network resource is in legacy mode, do not provide this property. If the - network is in auto subnet mode, providing the subnetwork is optional. If the network - is in custom subnet mode, then this field should be specified. - returned: success - type: dict - scheduling: - description: - - Sets the scheduling options for this instance. - returned: success - type: complex - contains: - automaticRestart: - description: - - Specifies whether the instance should be automatically restarted if it is terminated - by Compute Engine (not terminated by a user). - - You can only set the automatic restart option for standard instances. Preemptible - instances cannot be automatically restarted. - returned: success - type: bool - onHostMaintenance: - description: - - Defines the maintenance behavior for this instance. For standard instances, the - default behavior is MIGRATE. For preemptible instances, the default and only possible - behavior is TERMINATE. - - For more information, see Setting Instance Scheduling Options. - returned: success - type: str - preemptible: - description: - - Defines whether the instance is preemptible. This can only be set during instance - creation, it cannot be set or changed after the instance has been created. - returned: success - type: bool - serviceAccounts: - description: - - A list of service accounts, with their specified scopes, authorized for this instance. - Only one service account per VM instance is supported. - returned: success - type: complex - contains: - email: - description: - - Email address of the service account. - returned: success - type: str - scopes: - description: - - The list of scopes to be made available for this service account. - returned: success - type: list - status: - description: - - 'The status of the instance. One of the following values: PROVISIONING, STAGING, - RUNNING, STOPPING, SUSPENDING, SUSPENDED, and TERMINATED.' - returned: success - type: str - statusMessage: - description: - - An optional, human-readable explanation of the status. - returned: success - type: str - tags: - description: - - A list of tags to apply to this instance. Tags are used to identify valid sources - or targets for network firewalls and are specified by the client during instance - creation. The tags can be later modified by the setTags method. Each tag within - the list must comply with RFC1035. - returned: success - type: complex - contains: - fingerprint: - description: - - Specifies a fingerprint for this request, which is essentially a hash of the metadata's - contents and used for optimistic locking. - - The fingerprint is initially generated by Compute Engine and changes after every - request to modify or update metadata. You must always provide an up-to-date fingerprint - hash in order to update or change metadata. - returned: success - type: str - items: - description: - - An array of tags. Each tag must be 1-63 characters long, and comply with RFC1035. - returned: success - type: list - zone: - description: - - A reference to the zone where the machine resides. - returned: success - type: str + description: + - The name of the network interface, generated by the server. For network + devices, these are eth0, eth1, etc . + returned: success + type: str + network: + description: + - Specifies the title of an existing gcompute_network. When creating an + instance, if neither the network nor the subnetwork is specified, the + default network global/networks/default is used; if the network is not + specified but the subnetwork is specified, the network is inferred. + returned: success + type: dict + networkIP: + description: + - An IPv4 internal network address to assign to the instance for this network + interface. If not specified by the user, an unused internal IP is assigned + by the system. + returned: success + type: str + subnetwork: + description: + - Reference to a gcompute_subnetwork resource. + - If the network resource is in legacy mode, do not provide this property. + If the network is in auto subnet mode, providing the subnetwork is optional. + If the network is in custom subnet mode, then this field should be specified. + returned: success + type: dict + scheduling: + description: + - Sets the scheduling options for this instance. + returned: success + type: complex + contains: + automaticRestart: + description: + - Specifies whether the instance should be automatically restarted if it + is terminated by Compute Engine (not terminated by a user). + - You can only set the automatic restart option for standard instances. + Preemptible instances cannot be automatically restarted. + returned: success + type: bool + onHostMaintenance: + description: + - Defines the maintenance behavior for this instance. For standard instances, + the default behavior is MIGRATE. For preemptible instances, the default + and only possible behavior is TERMINATE. + - For more information, see Setting Instance Scheduling Options. + returned: success + type: str + preemptible: + description: + - Defines whether the instance is preemptible. This can only be set during + instance creation, it cannot be set or changed after the instance has + been created. + returned: success + type: bool + serviceAccounts: + description: + - A list of service accounts, with their specified scopes, authorized for this + instance. Only one service account per VM instance is supported. + returned: success + type: complex + contains: + email: + description: + - Email address of the service account. + returned: success + type: str + scopes: + description: + - The list of scopes to be made available for this service account. + returned: success + type: list + status: + description: + - 'The status of the instance. One of the following values: PROVISIONING, STAGING, + RUNNING, STOPPING, SUSPENDING, SUSPENDED, and TERMINATED.' + returned: success + type: str + statusMessage: + description: + - An optional, human-readable explanation of the status. + returned: success + type: str + tags: + description: + - A list of tags to apply to this instance. Tags are used to identify valid + sources or targets for network firewalls and are specified by the client during + instance creation. The tags can be later modified by the setTags method. Each + tag within the list must comply with RFC1035. + returned: success + type: complex + contains: + fingerprint: + description: + - Specifies a fingerprint for this request, which is essentially a hash + of the metadata's contents and used for optimistic locking. + - The fingerprint is initially generated by Compute Engine and changes after + every request to modify or update metadata. You must always provide an + up-to-date fingerprint hash in order to update or change metadata. + returned: success + type: str + items: + description: + - An array of tags. Each tag must be 1-63 characters long, and comply with + RFC1035. + returned: success + type: list + zone: + description: + - A reference to the zone where the machine resides. + returned: success + type: str ''' ################################################################################ diff --git a/lib/ansible/modules/cloud/google/gcp_compute_instance_group.py b/lib/ansible/modules/cloud/google/gcp_compute_instance_group.py index f1b711e03f9aa4..b12100e25f47c0 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_instance_group.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_instance_group.py @@ -32,87 +32,89 @@ --- module: gcp_compute_instance_group description: - - Represents an Instance Group resource. Instance groups are self-managed and can - contain identical or different instances. Instance groups do not use an instance - template. Unlike managed instance groups, you must create and add instances to an - instance group manually. +- Represents an Instance Group resource. Instance groups are self-managed and can + contain identical or different instances. Instance groups do not use an instance + template. Unlike managed instance groups, you must create and add instances to an + instance group manually. short_description: Creates a GCP InstanceGroup version_added: 2.6 author: Google Inc. (@googlecloudplatform) requirements: - - python >= 2.6 - - requests >= 2.18.4 - - google-auth >= 1.3.0 +- python >= 2.6 +- requests >= 2.18.4 +- google-auth >= 1.3.0 options: - state: - description: - - Whether the given object should exist in GCP - choices: ['present', 'absent'] - default: 'present' + state: description: + - Whether the given object should exist in GCP + choices: + - present + - absent + default: present + description: + description: + - An optional description of this resource. Provide this property when you create + the resource. + required: false + name: + description: + - The name of the instance group. + - The name must be 1-63 characters long, and comply with RFC1035. + required: false + named_ports: + description: + - Assigns a name to a port number. + - 'For example: {name: "http", port: 80}.' + - This allows the system to reference ports by the assigned name instead of a + port number. Named ports can also contain multiple ports. + - 'For example: [{name: "http", port: 80},{name: "http", port: 8080}] Named ports + apply to all instances in this instance group.' + required: false + suboptions: + name: description: - - An optional description of this resource. Provide this property when you create - the resource. - required: false - name: - description: - - The name of the instance group. - - The name must be 1-63 characters long, and comply with RFC1035. - required: false - named_ports: - description: - - Assigns a name to a port number. - - 'For example: {name: "http", port: 80}.' - - This allows the system to reference ports by the assigned name instead of a port - number. Named ports can also contain multiple ports. - - 'For example: [{name: "http", port: 80},{name: "http", port: 8080}] Named ports - apply to all instances in this instance group.' - required: false - suboptions: - name: - description: - - The name for this named port. - - The name must be 1-63 characters long, and comply with RFC1035. - required: false - port: - description: - - The port number, which can be a value between 1 and 65535. - required: false - network: - description: - - The network to which all instances in the instance group belong. - - 'This field represents a link to a Network resource in GCP. It can be specified - in two ways. You can add `register: name-of-resource` to a gcp_compute_network task - and then set this network field to "{{ name-of-resource }}" Alternatively, you can - set this network to a dictionary with the selfLink key where the value is the selfLink - of your Network.' - required: false - region: - description: - - The region where the instance group is located (for regional resources). - required: false - subnetwork: - description: - - The subnetwork to which all instances in the instance group belong. - - 'This field represents a link to a Subnetwork resource in GCP. It can be specified - in two ways. You can add `register: name-of-resource` to a gcp_compute_subnetwork - task and then set this subnetwork field to "{{ name-of-resource }}" Alternatively, - you can set this subnetwork to a dictionary with the selfLink key where the value - is the selfLink of your Subnetwork.' + - The name for this named port. + - The name must be 1-63 characters long, and comply with RFC1035. required: false - zone: + port: description: - - A reference to the zone where the instance group resides. - required: true - instances: - description: - - The list of instances associated with this InstanceGroup. - - All instances must be created before being added to an InstanceGroup. - - All instances not in this list will be removed from the InstanceGroup and will not - be deleted. - - Only the full identifier of the instance will be returned. + - The port number, which can be a value between 1 and 65535. required: false - version_added: 2.8 + network: + description: + - The network to which all instances in the instance group belong. + - 'This field represents a link to a Network resource in GCP. It can be specified + in two ways. You can add `register: name-of-resource` to a gcp_compute_network + task and then set this network field to "{{ name-of-resource }}" Alternatively, + you can set this network to a dictionary with the selfLink key where the value + is the selfLink of your Network' + required: false + region: + description: + - The region where the instance group is located (for regional resources). + required: false + subnetwork: + description: + - The subnetwork to which all instances in the instance group belong. + - 'This field represents a link to a Subnetwork resource in GCP. It can be specified + in two ways. You can add `register: name-of-resource` to a gcp_compute_subnetwork + task and then set this subnetwork field to "{{ name-of-resource }}" Alternatively, + you can set this subnetwork to a dictionary with the selfLink key where the + value is the selfLink of your Subnetwork' + required: false + zone: + description: + - A reference to the zone where the instance group resides. + required: true + instances: + description: + - The list of instances associated with this InstanceGroup. + - All instances must be created before being added to an InstanceGroup. + - All instances not in this list will be removed from the InstanceGroup and will + not be deleted. + - Only the full identifier of the instance will be returned. + required: false + version_added: 2.8 extends_documentation_fragment: gcp ''' @@ -141,79 +143,79 @@ ''' RETURN = ''' - creationTimestamp: - description: - - Creation timestamp in RFC3339 text format. - returned: success - type: str - description: - description: - - An optional description of this resource. Provide this property when you create - the resource. - returned: success - type: str - id: - description: - - A unique identifier for this instance group. - returned: success - type: int +creationTimestamp: + description: + - Creation timestamp in RFC3339 text format. + returned: success + type: str +description: + description: + - An optional description of this resource. Provide this property when you create + the resource. + returned: success + type: str +id: + description: + - A unique identifier for this instance group. + returned: success + type: int +name: + description: + - The name of the instance group. + - The name must be 1-63 characters long, and comply with RFC1035. + returned: success + type: str +namedPorts: + description: + - Assigns a name to a port number. + - 'For example: {name: "http", port: 80}.' + - This allows the system to reference ports by the assigned name instead of a port + number. Named ports can also contain multiple ports. + - 'For example: [{name: "http", port: 80},{name: "http", port: 8080}] Named ports + apply to all instances in this instance group.' + returned: success + type: complex + contains: name: - description: - - The name of the instance group. - - The name must be 1-63 characters long, and comply with RFC1035. - returned: success - type: str - namedPorts: - description: - - Assigns a name to a port number. - - 'For example: {name: "http", port: 80}.' - - This allows the system to reference ports by the assigned name instead of a port - number. Named ports can also contain multiple ports. - - 'For example: [{name: "http", port: 80},{name: "http", port: 8080}] Named ports - apply to all instances in this instance group.' - returned: success - type: complex - contains: - name: - description: - - The name for this named port. - - The name must be 1-63 characters long, and comply with RFC1035. - returned: success - type: str - port: - description: - - The port number, which can be a value between 1 and 65535. - returned: success - type: int - network: - description: - - The network to which all instances in the instance group belong. - returned: success - type: dict - region: - description: - - The region where the instance group is located (for regional resources). - returned: success - type: str - subnetwork: - description: - - The subnetwork to which all instances in the instance group belong. - returned: success - type: dict - zone: - description: - - A reference to the zone where the instance group resides. - returned: success - type: str - instances: - description: - - The list of instances associated with this InstanceGroup. - - All instances must be created before being added to an InstanceGroup. - - All instances not in this list will be removed from the InstanceGroup and will not - be deleted. - - Only the full identifier of the instance will be returned. - returned: success - type: list + description: + - The name for this named port. + - The name must be 1-63 characters long, and comply with RFC1035. + returned: success + type: str + port: + description: + - The port number, which can be a value between 1 and 65535. + returned: success + type: int +network: + description: + - The network to which all instances in the instance group belong. + returned: success + type: dict +region: + description: + - The region where the instance group is located (for regional resources). + returned: success + type: str +subnetwork: + description: + - The subnetwork to which all instances in the instance group belong. + returned: success + type: dict +zone: + description: + - A reference to the zone where the instance group resides. + returned: success + type: str +instances: + description: + - The list of instances associated with this InstanceGroup. + - All instances must be created before being added to an InstanceGroup. + - All instances not in this list will be removed from the InstanceGroup and will + not be deleted. + - Only the full identifier of the instance will be returned. + returned: success + type: list ''' ################################################################################ diff --git a/lib/ansible/modules/cloud/google/gcp_compute_instance_group_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_instance_group_facts.py index 952363ec5abc60..02334cca7e7b45 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_instance_group_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_instance_group_facts.py @@ -32,25 +32,24 @@ --- module: gcp_compute_instance_group_facts description: - - Gather facts for GCP InstanceGroup +- Gather facts for GCP InstanceGroup short_description: Gather facts for GCP InstanceGroup version_added: 2.7 author: Google Inc. (@googlecloudplatform) requirements: - - python >= 2.6 - - requests >= 2.18.4 - - google-auth >= 1.3.0 +- python >= 2.6 +- requests >= 2.18.4 +- google-auth >= 1.3.0 options: - filters: - description: - A list of filter value pairs. Available filters are listed here - U(https://cloud.google.com/sdk/gcloud/reference/topic/filters). - Each additional filter in the list will act be added as an AND condition - (filter1 and filter2) - zone: - description: - - A reference to the zone where the instance group resides. - required: true + filters: + description: + - A list of filter value pairs. Available filters are listed here U(U(https://cloud.google.com/sdk/gcloud/reference/topic/filters).) + - Each additional filter in the list will act be added as an AND condition (filter1 + and filter2) . + zone: + description: + - A reference to the zone where the instance group resides. + required: true extends_documentation_fragment: gcp ''' @@ -67,83 +66,83 @@ RETURN = ''' items: - description: List of items - returned: always - type: complex - contains: - creationTimestamp: - description: - - Creation timestamp in RFC3339 text format. - returned: success - type: str - description: - description: - - An optional description of this resource. Provide this property when you create - the resource. - returned: success - type: str - id: - description: - - A unique identifier for this instance group. - returned: success - type: int + description: List of items + returned: always + type: complex + contains: + creationTimestamp: + description: + - Creation timestamp in RFC3339 text format. + returned: success + type: str + description: + description: + - An optional description of this resource. Provide this property when you create + the resource. + returned: success + type: str + id: + description: + - A unique identifier for this instance group. + returned: success + type: int + name: + description: + - The name of the instance group. + - The name must be 1-63 characters long, and comply with RFC1035. + returned: success + type: str + namedPorts: + description: + - Assigns a name to a port number. + - 'For example: {name: "http", port: 80}.' + - This allows the system to reference ports by the assigned name instead of + a port number. Named ports can also contain multiple ports. + - 'For example: [{name: "http", port: 80},{name: "http", port: 8080}] Named + ports apply to all instances in this instance group.' + returned: success + type: complex + contains: name: - description: - - The name of the instance group. - - The name must be 1-63 characters long, and comply with RFC1035. - returned: success - type: str - namedPorts: - description: - - Assigns a name to a port number. - - 'For example: {name: "http", port: 80}.' - - This allows the system to reference ports by the assigned name instead of a port - number. Named ports can also contain multiple ports. - - 'For example: [{name: "http", port: 80},{name: "http", port: 8080}] Named ports - apply to all instances in this instance group.' - returned: success - type: complex - contains: - name: - description: - - The name for this named port. - - The name must be 1-63 characters long, and comply with RFC1035. - returned: success - type: str - port: - description: - - The port number, which can be a value between 1 and 65535. - returned: success - type: int - network: - description: - - The network to which all instances in the instance group belong. - returned: success - type: dict - region: - description: - - The region where the instance group is located (for regional resources). - returned: success - type: str - subnetwork: - description: - - The subnetwork to which all instances in the instance group belong. - returned: success - type: dict - zone: - description: - - A reference to the zone where the instance group resides. - returned: success - type: str - instances: - description: - - The list of instances associated with this InstanceGroup. - - All instances must be created before being added to an InstanceGroup. - - All instances not in this list will be removed from the InstanceGroup and will not - be deleted. - - Only the full identifier of the instance will be returned. - returned: success - type: list + description: + - The name for this named port. + - The name must be 1-63 characters long, and comply with RFC1035. + returned: success + type: str + port: + description: + - The port number, which can be a value between 1 and 65535. + returned: success + type: int + network: + description: + - The network to which all instances in the instance group belong. + returned: success + type: dict + region: + description: + - The region where the instance group is located (for regional resources). + returned: success + type: str + subnetwork: + description: + - The subnetwork to which all instances in the instance group belong. + returned: success + type: dict + zone: + description: + - A reference to the zone where the instance group resides. + returned: success + type: str + instances: + description: + - The list of instances associated with this InstanceGroup. + - All instances must be created before being added to an InstanceGroup. + - All instances not in this list will be removed from the InstanceGroup and + will not be deleted. + - Only the full identifier of the instance will be returned. + returned: success + type: list ''' ################################################################################ diff --git a/lib/ansible/modules/cloud/google/gcp_compute_instance_group_manager.py b/lib/ansible/modules/cloud/google/gcp_compute_instance_group_manager.py index f48f8c2d69749f..9bdc1cdbbbea8f 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_instance_group_manager.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_instance_group_manager.py @@ -32,82 +32,86 @@ --- module: gcp_compute_instance_group_manager description: - - Creates a managed instance group using the information that you specify in the request. - After the group is created, it schedules an action to create instances in the group - using the specified instance template. This operation is marked as DONE when the - group is created even if the instances in the group have not yet been created. You - must separately verify the status of the individual instances. - - A managed instance group can have up to 1000 VM instances per group. +- Creates a managed instance group using the information that you specify in the request. + After the group is created, it schedules an action to create instances in the group + using the specified instance template. This operation is marked as DONE when the + group is created even if the instances in the group have not yet been created. You + must separately verify the status of the individual instances. +- A managed instance group can have up to 1000 VM instances per group. short_description: Creates a GCP InstanceGroupManager version_added: 2.6 author: Google Inc. (@googlecloudplatform) requirements: - - python >= 2.6 - - requests >= 2.18.4 - - google-auth >= 1.3.0 +- python >= 2.6 +- requests >= 2.18.4 +- google-auth >= 1.3.0 options: - state: - description: - - Whether the given object should exist in GCP - choices: ['present', 'absent'] - default: 'present' - base_instance_name: - description: - - The base instance name to use for instances in this group. The value must be 1-58 - characters long. Instances are named by appending a hyphen and a random four-character - string to the base instance name. - - The base instance name must comply with RFC1035. - required: true + state: description: + - Whether the given object should exist in GCP + choices: + - present + - absent + default: present + base_instance_name: + description: + - The base instance name to use for instances in this group. The value must be + 1-58 characters long. Instances are named by appending a hyphen and a random + four-character string to the base instance name. + - The base instance name must comply with RFC1035. + required: true + description: + description: + - An optional description of this resource. Provide this property when you create + the resource. + required: false + instance_template: + description: + - The instance template that is specified for this managed instance group. The + group uses this template to create all new instances in the managed instance + group. + - 'This field represents a link to a InstanceTemplate resource in GCP. It can + be specified in two ways. You can add `register: name-of-resource` to a gcp_compute_instance_template + task and then set this instance_template field to "{{ name-of-resource }}" Alternatively, + you can set this instance_template to a dictionary with the selfLink key where + the value is the selfLink of your InstanceTemplate' + required: true + name: + description: + - The name of the managed instance group. The name must be 1-63 characters long, + and comply with RFC1035. + required: true + named_ports: + description: + - Named ports configured for the Instance Groups complementary to this Instance + Group Manager. + required: false + suboptions: + name: description: - - An optional description of this resource. Provide this property when you create - the resource. - required: false - instance_template: - description: - - The instance template that is specified for this managed instance group. The group - uses this template to create all new instances in the managed instance group. - - 'This field represents a link to a InstanceTemplate resource in GCP. It can be specified - in two ways. You can add `register: name-of-resource` to a gcp_compute_instance_template - task and then set this instance_template field to "{{ name-of-resource }}" Alternatively, - you can set this instance_template to a dictionary with the selfLink key where the - value is the selfLink of your InstanceTemplate.' - required: true - name: - description: - - The name of the managed instance group. The name must be 1-63 characters long, and - comply with RFC1035. - required: true - named_ports: - description: - - Named ports configured for the Instance Groups complementary to this Instance Group - Manager. - required: false - suboptions: - name: - description: - - The name for this named port. The name must be 1-63 characters long, and comply - with RFC1035. - required: false - port: - description: - - The port number, which can be a value between 1 and 65535. - required: false - target_pools: - description: - - TargetPool resources to which instances in the instanceGroup field are added. The - target pools automatically apply to all of the instances in the managed instance - group. + - The name for this named port. The name must be 1-63 characters long, and + comply with RFC1035. required: false - target_size: + port: description: - - The target number of running instances for this managed instance group. Deleting - or abandoning instances reduces this number. Resizing the group changes this number. + - The port number, which can be a value between 1 and 65535. required: false - zone: - description: - - The zone the managed instance group resides. - required: true + target_pools: + description: + - TargetPool resources to which instances in the instanceGroup field are added. + The target pools automatically apply to all of the instances in the managed + instance group. + required: false + target_size: + description: + - The target number of running instances for this managed instance group. Deleting + or abandoning instances reduces this number. Resizing the group changes this + number. + required: false + zone: + description: + - The zone the managed instance group resides. + required: true extends_documentation_fragment: gcp ''' @@ -167,151 +171,151 @@ ''' RETURN = ''' - baseInstanceName: - description: - - The base instance name to use for instances in this group. The value must be 1-58 - characters long. Instances are named by appending a hyphen and a random four-character - string to the base instance name. - - The base instance name must comply with RFC1035. - returned: success - type: str - creationTimestamp: - description: - - The creation timestamp for this managed instance group in RFC3339 text format. - returned: success - type: str - currentActions: - description: - - The list of instance actions and the number of instances in this managed instance - group that are scheduled for each of those actions. - returned: success - type: complex - contains: - abandoning: - description: - - The total number of instances in the managed instance group that are scheduled to - be abandoned. Abandoning an instance removes it from the managed instance group - without deleting it. - returned: success - type: int - creating: - description: - - The number of instances in the managed instance group that are scheduled to be created - or are currently being created. If the group fails to create any of these instances, - it tries again until it creates the instance successfully. - - If you have disabled creation retries, this field will not be populated; instead, - the creatingWithoutRetries field will be populated. - returned: success - type: int - creatingWithoutRetries: - description: - - The number of instances that the managed instance group will attempt to create. - The group attempts to create each instance only once. If the group fails to create - any of these instances, it decreases the group's targetSize value accordingly. - returned: success - type: int - deleting: - description: - - The number of instances in the managed instance group that are scheduled to be deleted - or are currently being deleted. - returned: success - type: int - none: - description: - - The number of instances in the managed instance group that are running and have - no scheduled actions. - returned: success - type: int - recreating: - description: - - The number of instances in the managed instance group that are scheduled to be recreated - or are currently being being recreated. - - Recreating an instance deletes the existing root persistent disk and creates a new - disk from the image that is defined in the instance template. - returned: success - type: int - refreshing: - description: - - The number of instances in the managed instance group that are being reconfigured - with properties that do not require a restart or a recreate action. For example, - setting or removing target pools for the instance. - returned: success - type: int - restarting: - description: - - The number of instances in the managed instance group that are scheduled to be restarted - or are currently being restarted. - returned: success - type: int - description: - description: - - An optional description of this resource. Provide this property when you create - the resource. - returned: success - type: str - id: - description: - - A unique identifier for this resource. - returned: success - type: int - instanceGroup: - description: - - The instance group being managed. - returned: success - type: dict - instanceTemplate: - description: - - The instance template that is specified for this managed instance group. The group - uses this template to create all new instances in the managed instance group. - returned: success - type: dict +baseInstanceName: + description: + - The base instance name to use for instances in this group. The value must be 1-58 + characters long. Instances are named by appending a hyphen and a random four-character + string to the base instance name. + - The base instance name must comply with RFC1035. + returned: success + type: str +creationTimestamp: + description: + - The creation timestamp for this managed instance group in RFC3339 text format. + returned: success + type: str +currentActions: + description: + - The list of instance actions and the number of instances in this managed instance + group that are scheduled for each of those actions. + returned: success + type: complex + contains: + abandoning: + description: + - The total number of instances in the managed instance group that are scheduled + to be abandoned. Abandoning an instance removes it from the managed instance + group without deleting it. + returned: success + type: int + creating: + description: + - The number of instances in the managed instance group that are scheduled to + be created or are currently being created. If the group fails to create any + of these instances, it tries again until it creates the instance successfully. + - If you have disabled creation retries, this field will not be populated; instead, + the creatingWithoutRetries field will be populated. + returned: success + type: int + creatingWithoutRetries: + description: + - The number of instances that the managed instance group will attempt to create. + The group attempts to create each instance only once. If the group fails to + create any of these instances, it decreases the group's targetSize value accordingly. + returned: success + type: int + deleting: + description: + - The number of instances in the managed instance group that are scheduled to + be deleted or are currently being deleted. + returned: success + type: int + none: + description: + - The number of instances in the managed instance group that are running and + have no scheduled actions. + returned: success + type: int + recreating: + description: + - The number of instances in the managed instance group that are scheduled to + be recreated or are currently being being recreated. + - Recreating an instance deletes the existing root persistent disk and creates + a new disk from the image that is defined in the instance template. + returned: success + type: int + refreshing: + description: + - The number of instances in the managed instance group that are being reconfigured + with properties that do not require a restart or a recreate action. For example, + setting or removing target pools for the instance. + returned: success + type: int + restarting: + description: + - The number of instances in the managed instance group that are scheduled to + be restarted or are currently being restarted. + returned: success + type: int +description: + description: + - An optional description of this resource. Provide this property when you create + the resource. + returned: success + type: str +id: + description: + - A unique identifier for this resource. + returned: success + type: int +instanceGroup: + description: + - The instance group being managed. + returned: success + type: dict +instanceTemplate: + description: + - The instance template that is specified for this managed instance group. The group + uses this template to create all new instances in the managed instance group. + returned: success + type: dict +name: + description: + - The name of the managed instance group. The name must be 1-63 characters long, + and comply with RFC1035. + returned: success + type: str +namedPorts: + description: + - Named ports configured for the Instance Groups complementary to this Instance + Group Manager. + returned: success + type: complex + contains: name: - description: - - The name of the managed instance group. The name must be 1-63 characters long, and - comply with RFC1035. - returned: success - type: str - namedPorts: - description: - - Named ports configured for the Instance Groups complementary to this Instance Group - Manager. - returned: success - type: complex - contains: - name: - description: - - The name for this named port. The name must be 1-63 characters long, and comply - with RFC1035. - returned: success - type: str - port: - description: - - The port number, which can be a value between 1 and 65535. - returned: success - type: int - region: - description: - - The region this managed instance group resides (for regional resources). - returned: success - type: str - targetPools: - description: - - TargetPool resources to which instances in the instanceGroup field are added. The - target pools automatically apply to all of the instances in the managed instance - group. - returned: success - type: list - targetSize: - description: - - The target number of running instances for this managed instance group. Deleting - or abandoning instances reduces this number. Resizing the group changes this number. - returned: success - type: int - zone: - description: - - The zone the managed instance group resides. - returned: success - type: str + description: + - The name for this named port. The name must be 1-63 characters long, and comply + with RFC1035. + returned: success + type: str + port: + description: + - The port number, which can be a value between 1 and 65535. + returned: success + type: int +region: + description: + - The region this managed instance group resides (for regional resources). + returned: success + type: str +targetPools: + description: + - TargetPool resources to which instances in the instanceGroup field are added. + The target pools automatically apply to all of the instances in the managed instance + group. + returned: success + type: list +targetSize: + description: + - The target number of running instances for this managed instance group. Deleting + or abandoning instances reduces this number. Resizing the group changes this number. + returned: success + type: int +zone: + description: + - The zone the managed instance group resides. + returned: success + type: str ''' ################################################################################ diff --git a/lib/ansible/modules/cloud/google/gcp_compute_instance_group_manager_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_instance_group_manager_facts.py index 5db47bbdb1998b..33b45ec75cfefb 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_instance_group_manager_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_instance_group_manager_facts.py @@ -32,25 +32,24 @@ --- module: gcp_compute_instance_group_manager_facts description: - - Gather facts for GCP InstanceGroupManager +- Gather facts for GCP InstanceGroupManager short_description: Gather facts for GCP InstanceGroupManager version_added: 2.7 author: Google Inc. (@googlecloudplatform) requirements: - - python >= 2.6 - - requests >= 2.18.4 - - google-auth >= 1.3.0 +- python >= 2.6 +- requests >= 2.18.4 +- google-auth >= 1.3.0 options: - filters: - description: - A list of filter value pairs. Available filters are listed here - U(https://cloud.google.com/sdk/gcloud/reference/topic/filters). - Each additional filter in the list will act be added as an AND condition - (filter1 and filter2) - zone: - description: - - The zone the managed instance group resides. - required: true + filters: + description: + - A list of filter value pairs. Available filters are listed here U(U(https://cloud.google.com/sdk/gcloud/reference/topic/filters).) + - Each additional filter in the list will act be added as an AND condition (filter1 + and filter2) . + zone: + description: + - The zone the managed instance group resides. + required: true extends_documentation_fragment: gcp ''' @@ -67,155 +66,158 @@ RETURN = ''' items: - description: List of items - returned: always - type: complex - contains: - baseInstanceName: - description: - - The base instance name to use for instances in this group. The value must be 1-58 - characters long. Instances are named by appending a hyphen and a random four-character - string to the base instance name. - - The base instance name must comply with RFC1035. - returned: success - type: str - creationTimestamp: - description: - - The creation timestamp for this managed instance group in RFC3339 text format. - returned: success - type: str - currentActions: - description: - - The list of instance actions and the number of instances in this managed instance - group that are scheduled for each of those actions. - returned: success - type: complex - contains: - abandoning: - description: - - The total number of instances in the managed instance group that are scheduled to - be abandoned. Abandoning an instance removes it from the managed instance group - without deleting it. - returned: success - type: int - creating: - description: - - The number of instances in the managed instance group that are scheduled to be created - or are currently being created. If the group fails to create any of these instances, - it tries again until it creates the instance successfully. - - If you have disabled creation retries, this field will not be populated; instead, - the creatingWithoutRetries field will be populated. - returned: success - type: int - creatingWithoutRetries: - description: - - The number of instances that the managed instance group will attempt to create. - The group attempts to create each instance only once. If the group fails to create - any of these instances, it decreases the group's targetSize value accordingly. - returned: success - type: int - deleting: - description: - - The number of instances in the managed instance group that are scheduled to be deleted - or are currently being deleted. - returned: success - type: int - none: - description: - - The number of instances in the managed instance group that are running and have - no scheduled actions. - returned: success - type: int - recreating: - description: - - The number of instances in the managed instance group that are scheduled to be recreated - or are currently being being recreated. - - Recreating an instance deletes the existing root persistent disk and creates a new - disk from the image that is defined in the instance template. - returned: success - type: int - refreshing: - description: - - The number of instances in the managed instance group that are being reconfigured - with properties that do not require a restart or a recreate action. For example, - setting or removing target pools for the instance. - returned: success - type: int - restarting: - description: - - The number of instances in the managed instance group that are scheduled to be restarted - or are currently being restarted. - returned: success - type: int - description: - description: - - An optional description of this resource. Provide this property when you create - the resource. - returned: success - type: str - id: - description: - - A unique identifier for this resource. - returned: success - type: int - instanceGroup: - description: - - The instance group being managed. - returned: success - type: dict - instanceTemplate: - description: - - The instance template that is specified for this managed instance group. The group - uses this template to create all new instances in the managed instance group. - returned: success - type: dict + description: List of items + returned: always + type: complex + contains: + baseInstanceName: + description: + - The base instance name to use for instances in this group. The value must + be 1-58 characters long. Instances are named by appending a hyphen and a random + four-character string to the base instance name. + - The base instance name must comply with RFC1035. + returned: success + type: str + creationTimestamp: + description: + - The creation timestamp for this managed instance group in RFC3339 text format. + returned: success + type: str + currentActions: + description: + - The list of instance actions and the number of instances in this managed instance + group that are scheduled for each of those actions. + returned: success + type: complex + contains: + abandoning: + description: + - The total number of instances in the managed instance group that are scheduled + to be abandoned. Abandoning an instance removes it from the managed instance + group without deleting it. + returned: success + type: int + creating: + description: + - The number of instances in the managed instance group that are scheduled + to be created or are currently being created. If the group fails to create + any of these instances, it tries again until it creates the instance successfully. + - If you have disabled creation retries, this field will not be populated; + instead, the creatingWithoutRetries field will be populated. + returned: success + type: int + creatingWithoutRetries: + description: + - The number of instances that the managed instance group will attempt to + create. The group attempts to create each instance only once. If the group + fails to create any of these instances, it decreases the group's targetSize + value accordingly. + returned: success + type: int + deleting: + description: + - The number of instances in the managed instance group that are scheduled + to be deleted or are currently being deleted. + returned: success + type: int + none: + description: + - The number of instances in the managed instance group that are running + and have no scheduled actions. + returned: success + type: int + recreating: + description: + - The number of instances in the managed instance group that are scheduled + to be recreated or are currently being being recreated. + - Recreating an instance deletes the existing root persistent disk and creates + a new disk from the image that is defined in the instance template. + returned: success + type: int + refreshing: + description: + - The number of instances in the managed instance group that are being reconfigured + with properties that do not require a restart or a recreate action. For + example, setting or removing target pools for the instance. + returned: success + type: int + restarting: + description: + - The number of instances in the managed instance group that are scheduled + to be restarted or are currently being restarted. + returned: success + type: int + description: + description: + - An optional description of this resource. Provide this property when you create + the resource. + returned: success + type: str + id: + description: + - A unique identifier for this resource. + returned: success + type: int + instanceGroup: + description: + - The instance group being managed. + returned: success + type: dict + instanceTemplate: + description: + - The instance template that is specified for this managed instance group. The + group uses this template to create all new instances in the managed instance + group. + returned: success + type: dict + name: + description: + - The name of the managed instance group. The name must be 1-63 characters long, + and comply with RFC1035. + returned: success + type: str + namedPorts: + description: + - Named ports configured for the Instance Groups complementary to this Instance + Group Manager. + returned: success + type: complex + contains: name: - description: - - The name of the managed instance group. The name must be 1-63 characters long, and - comply with RFC1035. - returned: success - type: str - namedPorts: - description: - - Named ports configured for the Instance Groups complementary to this Instance Group - Manager. - returned: success - type: complex - contains: - name: - description: - - The name for this named port. The name must be 1-63 characters long, and comply - with RFC1035. - returned: success - type: str - port: - description: - - The port number, which can be a value between 1 and 65535. - returned: success - type: int - region: - description: - - The region this managed instance group resides (for regional resources). - returned: success - type: str - targetPools: - description: - - TargetPool resources to which instances in the instanceGroup field are added. The - target pools automatically apply to all of the instances in the managed instance - group. - returned: success - type: list - targetSize: - description: - - The target number of running instances for this managed instance group. Deleting - or abandoning instances reduces this number. Resizing the group changes this number. - returned: success - type: int - zone: - description: - - The zone the managed instance group resides. - returned: success - type: str + description: + - The name for this named port. The name must be 1-63 characters long, and + comply with RFC1035. + returned: success + type: str + port: + description: + - The port number, which can be a value between 1 and 65535. + returned: success + type: int + region: + description: + - The region this managed instance group resides (for regional resources). + returned: success + type: str + targetPools: + description: + - TargetPool resources to which instances in the instanceGroup field are added. + The target pools automatically apply to all of the instances in the managed + instance group. + returned: success + type: list + targetSize: + description: + - The target number of running instances for this managed instance group. Deleting + or abandoning instances reduces this number. Resizing the group changes this + number. + returned: success + type: int + zone: + description: + - The zone the managed instance group resides. + returned: success + type: str ''' ################################################################################ diff --git a/lib/ansible/modules/cloud/google/gcp_compute_instance_template.py b/lib/ansible/modules/cloud/google/gcp_compute_instance_template.py index 519f965f156676..b26273b93b2071 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_instance_template.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_instance_template.py @@ -32,361 +32,384 @@ --- module: gcp_compute_instance_template description: - - Defines an Instance Template resource that provides configuration settings for your - virtual machine instances. Instance templates are not tied to the lifetime of an - instance and can be used and reused as to deploy virtual machines. You can also - use different templates to create different virtual machine configurations. Instance - templates are required when you create a managed instance group. - - 'Tip: Disks should be set to autoDelete=true so that leftover disks are not left - behind on machine deletion.' +- Defines an Instance Template resource that provides configuration settings for your + virtual machine instances. Instance templates are not tied to the lifetime of an + instance and can be used and reused as to deploy virtual machines. You can also + use different templates to create different virtual machine configurations. Instance + templates are required when you create a managed instance group. +- 'Tip: Disks should be set to autoDelete=true so that leftover disks are not left + behind on machine deletion.' short_description: Creates a GCP InstanceTemplate version_added: 2.6 author: Google Inc. (@googlecloudplatform) requirements: - - python >= 2.6 - - requests >= 2.18.4 - - google-auth >= 1.3.0 +- python >= 2.6 +- requests >= 2.18.4 +- google-auth >= 1.3.0 options: - state: - description: - - Whether the given object should exist in GCP - choices: ['present', 'absent'] - default: 'present' + state: + description: + - Whether the given object should exist in GCP + choices: + - present + - absent + default: present + description: + description: + - An optional description of this resource. Provide this property when you create + the resource. + required: false + name: description: + - Name of the resource. The name is 1-63 characters long and complies with RFC1035. + required: true + properties: + description: + - The instance properties for this instance template. + required: false + suboptions: + can_ip_forward: description: - - An optional description of this resource. Provide this property when you create - the resource. + - Enables instances created based on this template to send packets with source + IP addresses other than their own and receive packets with destination IP + addresses other than their own. If these instances will be used as an IP + gateway or it will be set as the next-hop in a Route resource, specify true. + If unsure, leave this set to false. required: false - name: + type: bool + description: description: - - Name of the resource. The name is 1-63 characters long and complies with RFC1035. - required: true - properties: + - An optional text description for the instances that are created from this + instance template. + required: false + disks: description: - - The instance properties for this instance template. + - An array of disks that are associated with the instances that are created + from this template. required: false suboptions: - can_ip_forward: + auto_delete: + description: + - Specifies whether the disk will be auto-deleted when the instance is + deleted (but not when the disk is detached from the instance). + - 'Tip: Disks should be set to autoDelete=true so that leftover disks + are not left behind on machine deletion.' + required: false + type: bool + boot: + description: + - Indicates that this is a boot disk. The virtual machine will use the + first partition of the disk for its root filesystem. + required: false + type: bool + device_name: + description: + - Specifies a unique device name of your choice that is reflected into + the /dev/disk/by-id/google-* tree of a Linux operating system running + within the instance. This name can be used to reference the device for + mounting, resizing, and so on, from within the instance. + required: false + disk_encryption_key: + description: + - Encrypts or decrypts a disk using a customer-supplied encryption key. + required: false + suboptions: + raw_key: description: - - Enables instances created based on this template to send packets with source IP - addresses other than their own and receive packets with destination IP addresses - other than their own. If these instances will be used as an IP gateway or it will - be set as the next-hop in a Route resource, specify true. If unsure, leave this - set to false. + - Specifies a 256-bit customer-supplied encryption key, encoded in + RFC 4648 base64 to either encrypt or decrypt this resource. required: false - type: bool - description: + rsa_encrypted_key: description: - - An optional text description for the instances that are created from this instance - template. + - Specifies an RFC 4648 base64 encoded, RSA-wrapped 2048-bit customer-supplied + encryption key to either encrypt or decrypt this resource. required: false - disks: + sha256: description: - - An array of disks that are associated with the instances that are created from this - template. + - The RFC 4648 base64 encoded SHA-256 hash of the customer-supplied + encryption key that protects this resource. required: false - suboptions: - auto_delete: - description: - - Specifies whether the disk will be auto-deleted when the instance is deleted (but - not when the disk is detached from the instance). - - 'Tip: Disks should be set to autoDelete=true so that leftover disks are not left - behind on machine deletion.' - required: false - type: bool - boot: - description: - - Indicates that this is a boot disk. The virtual machine will use the first partition - of the disk for its root filesystem. - required: false - type: bool - device_name: - description: - - Specifies a unique device name of your choice that is reflected into the /dev/disk/by-id/google-* - tree of a Linux operating system running within the instance. This name can be used - to reference the device for mounting, resizing, and so on, from within the instance. - required: false - disk_encryption_key: - description: - - Encrypts or decrypts a disk using a customer-supplied encryption key. - required: false - suboptions: - raw_key: - description: - - Specifies a 256-bit customer-supplied encryption key, encoded in RFC 4648 base64 - to either encrypt or decrypt this resource. - required: false - rsa_encrypted_key: - description: - - Specifies an RFC 4648 base64 encoded, RSA-wrapped 2048-bit customer-supplied encryption - key to either encrypt or decrypt this resource. - required: false - sha256: - description: - - The RFC 4648 base64 encoded SHA-256 hash of the customer-supplied encryption key - that protects this resource. - required: false - index: - description: - - Assigns a zero-based index to this disk, where 0 is reserved for the boot disk. - For example, if you have many disks attached to an instance, each disk would have - a unique index number. If not specified, the server will choose an appropriate value. - required: false - initialize_params: - description: - - Specifies the parameters for a new disk that will be created alongside the new instance. - Use initialization parameters to create boot disks or local SSDs attached to the - new instance. - required: false - suboptions: - disk_name: - description: - - Specifies the disk name. If not specified, the default is to use the name of the - instance. - required: false - disk_size_gb: - description: - - Specifies the size of the disk in base-2 GB. - required: false - disk_type: - description: - - Reference to a gcompute_disk_type resource. - - Specifies the disk type to use to create the instance. - - If not specified, the default is pd-standard. - required: false - source_image: - description: - - The source image to create this disk. When creating a new instance, one of initializeParams.sourceImage - or disks.source is required. To create a disk with one of the public operating - system images, specify the image by its family name. - required: false - source_image_encryption_key: - description: - - The customer-supplied encryption key of the source image. Required if the source - image is protected by a customer-supplied encryption key. - - Instance templates do not store customer-supplied encryption keys, so you cannot - create disks for instances in a managed instance group if the source images are - encrypted with your own keys. - required: false - suboptions: - raw_key: - description: - - Specifies a 256-bit customer-supplied encryption key, encoded in RFC 4648 base64 - to either encrypt or decrypt this resource. - required: false - sha256: - description: - - The RFC 4648 base64 encoded SHA-256 hash of the customer-supplied encryption key - that protects this resource. - required: false - interface: - description: - - Specifies the disk interface to use for attaching this disk, which is either SCSI - or NVME. The default is SCSI. - - Persistent disks must always use SCSI and the request will fail if you attempt to - attach a persistent disk in any other format than SCSI. - required: false - choices: ['SCSI', 'NVME'] - mode: - description: - - The mode in which to attach this disk, either READ_WRITE or READ_ONLY. If not specified, - the default is to attach the disk in READ_WRITE mode. - required: false - choices: ['READ_WRITE', 'READ_ONLY'] - source: - description: - - Reference to a gcompute_disk resource. When creating a new instance, one of initializeParams.sourceImage - or disks.source is required. - - If desired, you can also attach existing non-root persistent disks using this property. - This field is only applicable for persistent disks. - - Note that for InstanceTemplate, specify the disk name, not the URL for the disk. - - 'This field represents a link to a Disk resource in GCP. It can be specified in - two ways. You can add `register: name-of-resource` to a gcp_compute_disk task and - then set this source field to "{{ name-of-resource }}" Alternatively, you can set - this source to a dictionary with the name key where the value is the name of your - Disk.' - required: false - type: - description: - - Specifies the type of the disk, either SCRATCH or PERSISTENT. If not specified, - the default is PERSISTENT. - required: false - choices: ['SCRATCH', 'PERSISTENT'] - machine_type: + index: + description: + - Assigns a zero-based index to this disk, where 0 is reserved for the + boot disk. For example, if you have many disks attached to an instance, + each disk would have a unique index number. If not specified, the server + will choose an appropriate value. + required: false + initialize_params: + description: + - Specifies the parameters for a new disk that will be created alongside + the new instance. Use initialization parameters to create boot disks + or local SSDs attached to the new instance. + required: false + suboptions: + disk_name: description: - - Reference to a gcompute_machine_type resource. - required: true - metadata: + - Specifies the disk name. If not specified, the default is to use + the name of the instance. + required: false + disk_size_gb: description: - - The metadata key/value pairs to assign to instances that are created from this template. - These pairs can consist of custom metadata or predefined keys. + - Specifies the size of the disk in base-2 GB. required: false - guest_accelerators: + disk_type: description: - - List of the type and count of accelerator cards attached to the instance . + - Reference to a gcompute_disk_type resource. + - Specifies the disk type to use to create the instance. + - If not specified, the default is pd-standard. required: false - suboptions: - accelerator_count: - description: - - The number of the guest accelerator cards exposed to this instance. - required: false - accelerator_type: - description: - - Full or partial URL of the accelerator type resource to expose to this instance. - required: false - network_interfaces: + source_image: description: - - An array of configurations for this interface. This specifies how this interface - is configured to interact with other network services, such as connecting to the - internet. Only one network interface is supported per instance. + - The source image to create this disk. When creating a new instance, + one of initializeParams.sourceImage or disks.source is required. + To create a disk with one of the public operating system images, + specify the image by its family name. required: false - suboptions: - access_configs: - description: - - An array of configurations for this interface. Currently, only one access config, - ONE_TO_ONE_NAT, is supported. If there are no accessConfigs specified, then this - instance will have no external internet access. - required: false - suboptions: - name: - description: - - The name of this access configuration. The default and recommended name is External - NAT but you can use any arbitrary string you would like. For example, My external - IP or Network Access. - required: true - nat_ip: - description: - - Specifies the title of a gcompute_address. - - An external IP address associated with this instance. - - Specify an unused static external IP address available to the project or leave this - field undefined to use an IP from a shared ephemeral IP address pool. If you specify - a static external IP address, it must live in the same region as the zone of the - instance. - - 'This field represents a link to a Address resource in GCP. It can be specified - in two ways. You can add `register: name-of-resource` to a gcp_compute_address task - and then set this nat_ip field to "{{ name-of-resource }}" Alternatively, you can - set this nat_ip to a dictionary with the address key where the value is the address - of your Address.' - required: false - type: - description: - - The type of configuration. The default and only option is ONE_TO_ONE_NAT. - required: true - choices: ['ONE_TO_ONE_NAT'] - alias_ip_ranges: - description: - - An array of alias IP ranges for this network interface. Can only be specified for - network interfaces on subnet-mode networks. - required: false - suboptions: - ip_cidr_range: - description: - - The IP CIDR range represented by this alias IP range. - - This IP CIDR range must belong to the specified subnetwork and cannot contain IP - addresses reserved by system or used by other network interfaces. This range may - be a single IP address (e.g. 10.2.3.4), a netmask (e.g. /24) or a CIDR format string - (e.g. 10.1.2.0/24). - required: false - subnetwork_range_name: - description: - - Optional subnetwork secondary range name specifying the secondary range from which - to allocate the IP CIDR range for this alias IP range. If left unspecified, the - primary range of the subnetwork will be used. - required: false - name: - description: - - The name of the network interface, generated by the server. For network devices, - these are eth0, eth1, etc . - required: false - network: - description: - - Specifies the title of an existing gcompute_network. When creating an instance, - if neither the network nor the subnetwork is specified, the default network global/networks/default - is used; if the network is not specified but the subnetwork is specified, the network - is inferred. - - 'This field represents a link to a Network resource in GCP. It can be specified - in two ways. You can add `register: name-of-resource` to a gcp_compute_network task - and then set this network field to "{{ name-of-resource }}" Alternatively, you can - set this network to a dictionary with the selfLink key where the value is the selfLink - of your Network.' - required: false - network_ip: - description: - - An IPv4 internal network address to assign to the instance for this network interface. - If not specified by the user, an unused internal IP is assigned by the system. - required: false - subnetwork: - description: - - Reference to a gcompute_subnetwork resource. - - If the network resource is in legacy mode, do not provide this property. If the - network is in auto subnet mode, providing the subnetwork is optional. If the network - is in custom subnet mode, then this field should be specified. - - 'This field represents a link to a Subnetwork resource in GCP. It can be specified - in two ways. You can add `register: name-of-resource` to a gcp_compute_subnetwork - task and then set this subnetwork field to "{{ name-of-resource }}" Alternatively, - you can set this subnetwork to a dictionary with the selfLink key where the value - is the selfLink of your Subnetwork.' - required: false - scheduling: + source_image_encryption_key: description: - - Sets the scheduling options for this instance. + - The customer-supplied encryption key of the source image. Required + if the source image is protected by a customer-supplied encryption + key. + - Instance templates do not store customer-supplied encryption keys, + so you cannot create disks for instances in a managed instance group + if the source images are encrypted with your own keys. required: false suboptions: - automatic_restart: - description: - - Specifies whether the instance should be automatically restarted if it is terminated - by Compute Engine (not terminated by a user). - - You can only set the automatic restart option for standard instances. Preemptible - instances cannot be automatically restarted. - required: false - type: bool - on_host_maintenance: - description: - - Defines the maintenance behavior for this instance. For standard instances, the - default behavior is MIGRATE. For preemptible instances, the default and only possible - behavior is TERMINATE. - - For more information, see Setting Instance Scheduling Options. - required: false - preemptible: - description: - - Defines whether the instance is preemptible. This can only be set during instance - creation, it cannot be set or changed after the instance has been created. - required: false - type: bool - service_accounts: + raw_key: + description: + - Specifies a 256-bit customer-supplied encryption key, encoded + in RFC 4648 base64 to either encrypt or decrypt this resource. + required: false + sha256: + description: + - The RFC 4648 base64 encoded SHA-256 hash of the customer-supplied + encryption key that protects this resource. + required: false + interface: + description: + - Specifies the disk interface to use for attaching this disk, which is + either SCSI or NVME. The default is SCSI. + - Persistent disks must always use SCSI and the request will fail if you + attempt to attach a persistent disk in any other format than SCSI. + required: false + choices: + - SCSI + - NVME + mode: + description: + - The mode in which to attach this disk, either READ_WRITE or READ_ONLY. + If not specified, the default is to attach the disk in READ_WRITE mode. + required: false + choices: + - READ_WRITE + - READ_ONLY + source: + description: + - Reference to a gcompute_disk resource. When creating a new instance, + one of initializeParams.sourceImage or disks.source is required. + - If desired, you can also attach existing non-root persistent disks using + this property. This field is only applicable for persistent disks. + - Note that for InstanceTemplate, specify the disk name, not the URL for + the disk. + - 'This field represents a link to a Disk resource in GCP. It can be specified + in two ways. You can add `register: name-of-resource` to a gcp_compute_disk + task and then set this source field to "{{ name-of-resource }}" Alternatively, + you can set this source to a dictionary with the name key where the + value is the name of your Disk' + required: false + type: + description: + - Specifies the type of the disk, either SCRATCH or PERSISTENT. If not + specified, the default is PERSISTENT. + required: false + choices: + - SCRATCH + - PERSISTENT + machine_type: + description: + - Reference to a gcompute_machine_type resource. + required: true + metadata: + description: + - The metadata key/value pairs to assign to instances that are created from + this template. These pairs can consist of custom metadata or predefined + keys. + required: false + guest_accelerators: + description: + - List of the type and count of accelerator cards attached to the instance + . + required: false + suboptions: + accelerator_count: + description: + - The number of the guest accelerator cards exposed to this instance. + required: false + accelerator_type: + description: + - Full or partial URL of the accelerator type resource to expose to this + instance. + required: false + network_interfaces: + description: + - An array of configurations for this interface. This specifies how this interface + is configured to interact with other network services, such as connecting + to the internet. Only one network interface is supported per instance. + required: false + suboptions: + access_configs: + description: + - An array of configurations for this interface. Currently, only one access + config, ONE_TO_ONE_NAT, is supported. If there are no accessConfigs + specified, then this instance will have no external internet access. + required: false + suboptions: + name: description: - - A list of service accounts, with their specified scopes, authorized for this instance. - Only one service account per VM instance is supported. + - The name of this access configuration. The default and recommended + name is External NAT but you can use any arbitrary string you would + like. For example, My external IP or Network Access. + required: true + nat_ip: + description: + - Specifies the title of a gcompute_address. + - An external IP address associated with this instance. + - Specify an unused static external IP address available to the project + or leave this field undefined to use an IP from a shared ephemeral + IP address pool. If you specify a static external IP address, it + must live in the same region as the zone of the instance. + - 'This field represents a link to a Address resource in GCP. It can + be specified in two ways. You can add `register: name-of-resource` + to a gcp_compute_address task and then set this nat_ip field to + "{{ name-of-resource }}" Alternatively, you can set this nat_ip + to a dictionary with the address key where the value is the address + of your Address' required: false - suboptions: - email: - description: - - Email address of the service account. - required: false - scopes: - description: - - The list of scopes to be made available for this service account. - required: false - tags: + type: description: - - A list of tags to apply to this instance. Tags are used to identify valid sources - or targets for network firewalls and are specified by the client during instance - creation. The tags can be later modified by the setTags method. Each tag within - the list must comply with RFC1035. + - The type of configuration. The default and only option is ONE_TO_ONE_NAT. + required: true + choices: + - ONE_TO_ONE_NAT + alias_ip_ranges: + description: + - An array of alias IP ranges for this network interface. Can only be + specified for network interfaces on subnet-mode networks. + required: false + suboptions: + ip_cidr_range: + description: + - The IP CIDR range represented by this alias IP range. + - This IP CIDR range must belong to the specified subnetwork and cannot + contain IP addresses reserved by system or used by other network + interfaces. This range may be a single IP address (e.g. 10.2.3.4), + a netmask (e.g. /24) or a CIDR format string (e.g. 10.1.2.0/24). required: false - suboptions: - fingerprint: - description: - - Specifies a fingerprint for this request, which is essentially a hash of the metadata's - contents and used for optimistic locking. - - The fingerprint is initially generated by Compute Engine and changes after every - request to modify or update metadata. You must always provide an up-to-date fingerprint - hash in order to update or change metadata. - required: false - items: - description: - - An array of tags. Each tag must be 1-63 characters long, and comply with RFC1035. - required: false + subnetwork_range_name: + description: + - Optional subnetwork secondary range name specifying the secondary + range from which to allocate the IP CIDR range for this alias IP + range. If left unspecified, the primary range of the subnetwork + will be used. + required: false + name: + description: + - The name of the network interface, generated by the server. For network + devices, these are eth0, eth1, etc . + required: false + network: + description: + - Specifies the title of an existing gcompute_network. When creating an + instance, if neither the network nor the subnetwork is specified, the + default network global/networks/default is used; if the network is not + specified but the subnetwork is specified, the network is inferred. + - 'This field represents a link to a Network resource in GCP. It can be + specified in two ways. You can add `register: name-of-resource` to a + gcp_compute_network task and then set this network field to "{{ name-of-resource + }}" Alternatively, you can set this network to a dictionary with the + selfLink key where the value is the selfLink of your Network' + required: false + network_ip: + description: + - An IPv4 internal network address to assign to the instance for this + network interface. If not specified by the user, an unused internal + IP is assigned by the system. + required: false + subnetwork: + description: + - Reference to a gcompute_subnetwork resource. + - If the network resource is in legacy mode, do not provide this property. + If the network is in auto subnet mode, providing the subnetwork is optional. + If the network is in custom subnet mode, then this field should be specified. + - 'This field represents a link to a Subnetwork resource in GCP. It can + be specified in two ways. You can add `register: name-of-resource` to + a gcp_compute_subnetwork task and then set this subnetwork field to + "{{ name-of-resource }}" Alternatively, you can set this subnetwork + to a dictionary with the selfLink key where the value is the selfLink + of your Subnetwork' + required: false + scheduling: + description: + - Sets the scheduling options for this instance. + required: false + suboptions: + automatic_restart: + description: + - Specifies whether the instance should be automatically restarted if + it is terminated by Compute Engine (not terminated by a user). + - You can only set the automatic restart option for standard instances. + Preemptible instances cannot be automatically restarted. + required: false + type: bool + on_host_maintenance: + description: + - Defines the maintenance behavior for this instance. For standard instances, + the default behavior is MIGRATE. For preemptible instances, the default + and only possible behavior is TERMINATE. + - For more information, see Setting Instance Scheduling Options. + required: false + preemptible: + description: + - Defines whether the instance is preemptible. This can only be set during + instance creation, it cannot be set or changed after the instance has + been created. + required: false + type: bool + service_accounts: + description: + - A list of service accounts, with their specified scopes, authorized for + this instance. Only one service account per VM instance is supported. + required: false + suboptions: + email: + description: + - Email address of the service account. + required: false + scopes: + description: + - The list of scopes to be made available for this service account. + required: false + tags: + description: + - A list of tags to apply to this instance. Tags are used to identify valid + sources or targets for network firewalls and are specified by the client + during instance creation. The tags can be later modified by the setTags + method. Each tag within the list must comply with RFC1035. + required: false + suboptions: + fingerprint: + description: + - Specifies a fingerprint for this request, which is essentially a hash + of the metadata's contents and used for optimistic locking. + - The fingerprint is initially generated by Compute Engine and changes + after every request to modify or update metadata. You must always provide + an up-to-date fingerprint hash in order to update or change metadata. + required: false + items: + description: + - An array of tags. Each tag must be 1-63 characters long, and comply + with RFC1035. + required: false extends_documentation_fragment: gcp ''' @@ -433,375 +456,384 @@ ''' RETURN = ''' - creationTimestamp: - description: - - Creation timestamp in RFC3339 text format. - returned: success - type: str +creationTimestamp: + description: + - Creation timestamp in RFC3339 text format. + returned: success + type: str +description: + description: + - An optional description of this resource. Provide this property when you create + the resource. + returned: success + type: str +id: + description: + - The unique identifier for the resource. This identifier is defined by the server. + returned: success + type: int +name: + description: + - Name of the resource. The name is 1-63 characters long and complies with RFC1035. + returned: success + type: str +properties: + description: + - The instance properties for this instance template. + returned: success + type: complex + contains: + canIpForward: + description: + - Enables instances created based on this template to send packets with source + IP addresses other than their own and receive packets with destination IP + addresses other than their own. If these instances will be used as an IP gateway + or it will be set as the next-hop in a Route resource, specify true. If unsure, + leave this set to false. + returned: success + type: bool description: - description: - - An optional description of this resource. Provide this property when you create - the resource. - returned: success - type: str - id: - description: - - The unique identifier for the resource. This identifier is defined by the server. - returned: success - type: int - name: - description: - - Name of the resource. The name is 1-63 characters long and complies with RFC1035. - returned: success - type: str - properties: - description: - - The instance properties for this instance template. - returned: success - type: complex - contains: - canIpForward: - description: - - Enables instances created based on this template to send packets with source IP - addresses other than their own and receive packets with destination IP addresses - other than their own. If these instances will be used as an IP gateway or it will - be set as the next-hop in a Route resource, specify true. If unsure, leave this - set to false. - returned: success - type: bool - description: - description: - - An optional text description for the instances that are created from this instance - template. - returned: success - type: str - disks: - description: - - An array of disks that are associated with the instances that are created from this - template. - returned: success - type: complex - contains: - autoDelete: - description: - - Specifies whether the disk will be auto-deleted when the instance is deleted (but - not when the disk is detached from the instance). - - 'Tip: Disks should be set to autoDelete=true so that leftover disks are not left - behind on machine deletion.' - returned: success - type: bool - boot: - description: - - Indicates that this is a boot disk. The virtual machine will use the first partition - of the disk for its root filesystem. - returned: success - type: bool - deviceName: - description: - - Specifies a unique device name of your choice that is reflected into the /dev/disk/by-id/google-* - tree of a Linux operating system running within the instance. This name can be used - to reference the device for mounting, resizing, and so on, from within the instance. - returned: success - type: str - diskEncryptionKey: - description: - - Encrypts or decrypts a disk using a customer-supplied encryption key. - returned: success - type: complex - contains: - rawKey: - description: - - Specifies a 256-bit customer-supplied encryption key, encoded in RFC 4648 base64 - to either encrypt or decrypt this resource. - returned: success - type: str - rsaEncryptedKey: - description: - - Specifies an RFC 4648 base64 encoded, RSA-wrapped 2048-bit customer-supplied encryption - key to either encrypt or decrypt this resource. - returned: success - type: str - sha256: - description: - - The RFC 4648 base64 encoded SHA-256 hash of the customer-supplied encryption key - that protects this resource. - returned: success - type: str - index: - description: - - Assigns a zero-based index to this disk, where 0 is reserved for the boot disk. - For example, if you have many disks attached to an instance, each disk would have - a unique index number. If not specified, the server will choose an appropriate value. - returned: success - type: int - initializeParams: - description: - - Specifies the parameters for a new disk that will be created alongside the new instance. - Use initialization parameters to create boot disks or local SSDs attached to the - new instance. - returned: success - type: complex - contains: - diskName: - description: - - Specifies the disk name. If not specified, the default is to use the name of the - instance. - returned: success - type: str - diskSizeGb: - description: - - Specifies the size of the disk in base-2 GB. - returned: success - type: int - diskType: - description: - - Reference to a gcompute_disk_type resource. - - Specifies the disk type to use to create the instance. - - If not specified, the default is pd-standard. - returned: success - type: str - sourceImage: - description: - - The source image to create this disk. When creating a new instance, one of initializeParams.sourceImage - or disks.source is required. To create a disk with one of the public operating - system images, specify the image by its family name. - returned: success - type: str - sourceImageEncryptionKey: - description: - - The customer-supplied encryption key of the source image. Required if the source - image is protected by a customer-supplied encryption key. - - Instance templates do not store customer-supplied encryption keys, so you cannot - create disks for instances in a managed instance group if the source images are - encrypted with your own keys. - returned: success - type: complex - contains: - rawKey: - description: - - Specifies a 256-bit customer-supplied encryption key, encoded in RFC 4648 base64 - to either encrypt or decrypt this resource. - returned: success - type: str - sha256: - description: - - The RFC 4648 base64 encoded SHA-256 hash of the customer-supplied encryption key - that protects this resource. - returned: success - type: str - interface: - description: - - Specifies the disk interface to use for attaching this disk, which is either SCSI - or NVME. The default is SCSI. - - Persistent disks must always use SCSI and the request will fail if you attempt to - attach a persistent disk in any other format than SCSI. - returned: success - type: str - mode: - description: - - The mode in which to attach this disk, either READ_WRITE or READ_ONLY. If not specified, - the default is to attach the disk in READ_WRITE mode. - returned: success - type: str - source: - description: - - Reference to a gcompute_disk resource. When creating a new instance, one of initializeParams.sourceImage - or disks.source is required. - - If desired, you can also attach existing non-root persistent disks using this property. - This field is only applicable for persistent disks. - - Note that for InstanceTemplate, specify the disk name, not the URL for the disk. - returned: success - type: dict - type: - description: - - Specifies the type of the disk, either SCRATCH or PERSISTENT. If not specified, - the default is PERSISTENT. - returned: success - type: str - machineType: - description: - - Reference to a gcompute_machine_type resource. - returned: success - type: str - metadata: - description: - - The metadata key/value pairs to assign to instances that are created from this template. - These pairs can consist of custom metadata or predefined keys. - returned: success - type: dict - guestAccelerators: - description: - - List of the type and count of accelerator cards attached to the instance . - returned: success - type: complex - contains: - acceleratorCount: - description: - - The number of the guest accelerator cards exposed to this instance. - returned: success - type: int - acceleratorType: - description: - - Full or partial URL of the accelerator type resource to expose to this instance. - returned: success - type: str - networkInterfaces: - description: - - An array of configurations for this interface. This specifies how this interface - is configured to interact with other network services, such as connecting to the - internet. Only one network interface is supported per instance. - returned: success - type: complex - contains: - accessConfigs: - description: - - An array of configurations for this interface. Currently, only one access config, - ONE_TO_ONE_NAT, is supported. If there are no accessConfigs specified, then this - instance will have no external internet access. - returned: success - type: complex - contains: - name: - description: - - The name of this access configuration. The default and recommended name is External - NAT but you can use any arbitrary string you would like. For example, My external - IP or Network Access. - returned: success - type: str - natIP: - description: - - Specifies the title of a gcompute_address. - - An external IP address associated with this instance. - - Specify an unused static external IP address available to the project or leave this - field undefined to use an IP from a shared ephemeral IP address pool. If you specify - a static external IP address, it must live in the same region as the zone of the - instance. - returned: success - type: dict - type: - description: - - The type of configuration. The default and only option is ONE_TO_ONE_NAT. - returned: success - type: str - aliasIpRanges: - description: - - An array of alias IP ranges for this network interface. Can only be specified for - network interfaces on subnet-mode networks. - returned: success - type: complex - contains: - ipCidrRange: - description: - - The IP CIDR range represented by this alias IP range. - - This IP CIDR range must belong to the specified subnetwork and cannot contain IP - addresses reserved by system or used by other network interfaces. This range may - be a single IP address (e.g. 10.2.3.4), a netmask (e.g. /24) or a CIDR format string - (e.g. 10.1.2.0/24). - returned: success - type: str - subnetworkRangeName: - description: - - Optional subnetwork secondary range name specifying the secondary range from which - to allocate the IP CIDR range for this alias IP range. If left unspecified, the - primary range of the subnetwork will be used. - returned: success - type: str - name: - description: - - The name of the network interface, generated by the server. For network devices, - these are eth0, eth1, etc . - returned: success - type: str - network: - description: - - Specifies the title of an existing gcompute_network. When creating an instance, - if neither the network nor the subnetwork is specified, the default network global/networks/default - is used; if the network is not specified but the subnetwork is specified, the network - is inferred. - returned: success - type: dict - networkIP: - description: - - An IPv4 internal network address to assign to the instance for this network interface. - If not specified by the user, an unused internal IP is assigned by the system. - returned: success - type: str - subnetwork: - description: - - Reference to a gcompute_subnetwork resource. - - If the network resource is in legacy mode, do not provide this property. If the - network is in auto subnet mode, providing the subnetwork is optional. If the network - is in custom subnet mode, then this field should be specified. - returned: success - type: dict - scheduling: - description: - - Sets the scheduling options for this instance. - returned: success - type: complex - contains: - automaticRestart: - description: - - Specifies whether the instance should be automatically restarted if it is terminated - by Compute Engine (not terminated by a user). - - You can only set the automatic restart option for standard instances. Preemptible - instances cannot be automatically restarted. - returned: success - type: bool - onHostMaintenance: - description: - - Defines the maintenance behavior for this instance. For standard instances, the - default behavior is MIGRATE. For preemptible instances, the default and only possible - behavior is TERMINATE. - - For more information, see Setting Instance Scheduling Options. - returned: success - type: str - preemptible: - description: - - Defines whether the instance is preemptible. This can only be set during instance - creation, it cannot be set or changed after the instance has been created. - returned: success - type: bool - serviceAccounts: - description: - - A list of service accounts, with their specified scopes, authorized for this instance. - Only one service account per VM instance is supported. - returned: success - type: complex - contains: - email: - description: - - Email address of the service account. - returned: success - type: str - scopes: - description: - - The list of scopes to be made available for this service account. - returned: success - type: list - tags: - description: - - A list of tags to apply to this instance. Tags are used to identify valid sources - or targets for network firewalls and are specified by the client during instance - creation. The tags can be later modified by the setTags method. Each tag within - the list must comply with RFC1035. - returned: success - type: complex - contains: - fingerprint: - description: - - Specifies a fingerprint for this request, which is essentially a hash of the metadata's - contents and used for optimistic locking. - - The fingerprint is initially generated by Compute Engine and changes after every - request to modify or update metadata. You must always provide an up-to-date fingerprint - hash in order to update or change metadata. - returned: success - type: str - items: - description: - - An array of tags. Each tag must be 1-63 characters long, and comply with RFC1035. - returned: success - type: list + description: + - An optional text description for the instances that are created from this + instance template. + returned: success + type: str + disks: + description: + - An array of disks that are associated with the instances that are created + from this template. + returned: success + type: complex + contains: + autoDelete: + description: + - Specifies whether the disk will be auto-deleted when the instance is deleted + (but not when the disk is detached from the instance). + - 'Tip: Disks should be set to autoDelete=true so that leftover disks are + not left behind on machine deletion.' + returned: success + type: bool + boot: + description: + - Indicates that this is a boot disk. The virtual machine will use the first + partition of the disk for its root filesystem. + returned: success + type: bool + deviceName: + description: + - Specifies a unique device name of your choice that is reflected into the + /dev/disk/by-id/google-* tree of a Linux operating system running within + the instance. This name can be used to reference the device for mounting, + resizing, and so on, from within the instance. + returned: success + type: str + diskEncryptionKey: + description: + - Encrypts or decrypts a disk using a customer-supplied encryption key. + returned: success + type: complex + contains: + rawKey: + description: + - Specifies a 256-bit customer-supplied encryption key, encoded in RFC + 4648 base64 to either encrypt or decrypt this resource. + returned: success + type: str + rsaEncryptedKey: + description: + - Specifies an RFC 4648 base64 encoded, RSA-wrapped 2048-bit customer-supplied + encryption key to either encrypt or decrypt this resource. + returned: success + type: str + sha256: + description: + - The RFC 4648 base64 encoded SHA-256 hash of the customer-supplied + encryption key that protects this resource. + returned: success + type: str + index: + description: + - Assigns a zero-based index to this disk, where 0 is reserved for the boot + disk. For example, if you have many disks attached to an instance, each + disk would have a unique index number. If not specified, the server will + choose an appropriate value. + returned: success + type: int + initializeParams: + description: + - Specifies the parameters for a new disk that will be created alongside + the new instance. Use initialization parameters to create boot disks or + local SSDs attached to the new instance. + returned: success + type: complex + contains: + diskName: + description: + - Specifies the disk name. If not specified, the default is to use the + name of the instance. + returned: success + type: str + diskSizeGb: + description: + - Specifies the size of the disk in base-2 GB. + returned: success + type: int + diskType: + description: + - Reference to a gcompute_disk_type resource. + - Specifies the disk type to use to create the instance. + - If not specified, the default is pd-standard. + returned: success + type: str + sourceImage: + description: + - The source image to create this disk. When creating a new instance, + one of initializeParams.sourceImage or disks.source is required. To + create a disk with one of the public operating system images, specify + the image by its family name. + returned: success + type: str + sourceImageEncryptionKey: + description: + - The customer-supplied encryption key of the source image. Required + if the source image is protected by a customer-supplied encryption + key. + - Instance templates do not store customer-supplied encryption keys, + so you cannot create disks for instances in a managed instance group + if the source images are encrypted with your own keys. + returned: success + type: complex + contains: + rawKey: + description: + - Specifies a 256-bit customer-supplied encryption key, encoded + in RFC 4648 base64 to either encrypt or decrypt this resource. + returned: success + type: str + sha256: + description: + - The RFC 4648 base64 encoded SHA-256 hash of the customer-supplied + encryption key that protects this resource. + returned: success + type: str + interface: + description: + - Specifies the disk interface to use for attaching this disk, which is + either SCSI or NVME. The default is SCSI. + - Persistent disks must always use SCSI and the request will fail if you + attempt to attach a persistent disk in any other format than SCSI. + returned: success + type: str + mode: + description: + - The mode in which to attach this disk, either READ_WRITE or READ_ONLY. + If not specified, the default is to attach the disk in READ_WRITE mode. + returned: success + type: str + source: + description: + - Reference to a gcompute_disk resource. When creating a new instance, one + of initializeParams.sourceImage or disks.source is required. + - If desired, you can also attach existing non-root persistent disks using + this property. This field is only applicable for persistent disks. + - Note that for InstanceTemplate, specify the disk name, not the URL for + the disk. + returned: success + type: dict + type: + description: + - Specifies the type of the disk, either SCRATCH or PERSISTENT. If not specified, + the default is PERSISTENT. + returned: success + type: str + machineType: + description: + - Reference to a gcompute_machine_type resource. + returned: success + type: str + metadata: + description: + - The metadata key/value pairs to assign to instances that are created from + this template. These pairs can consist of custom metadata or predefined keys. + returned: success + type: dict + guestAccelerators: + description: + - List of the type and count of accelerator cards attached to the instance . + returned: success + type: complex + contains: + acceleratorCount: + description: + - The number of the guest accelerator cards exposed to this instance. + returned: success + type: int + acceleratorType: + description: + - Full or partial URL of the accelerator type resource to expose to this + instance. + returned: success + type: str + networkInterfaces: + description: + - An array of configurations for this interface. This specifies how this interface + is configured to interact with other network services, such as connecting + to the internet. Only one network interface is supported per instance. + returned: success + type: complex + contains: + accessConfigs: + description: + - An array of configurations for this interface. Currently, only one access + config, ONE_TO_ONE_NAT, is supported. If there are no accessConfigs specified, + then this instance will have no external internet access. + returned: success + type: complex + contains: + name: + description: + - The name of this access configuration. The default and recommended + name is External NAT but you can use any arbitrary string you would + like. For example, My external IP or Network Access. + returned: success + type: str + natIP: + description: + - Specifies the title of a gcompute_address. + - An external IP address associated with this instance. + - Specify an unused static external IP address available to the project + or leave this field undefined to use an IP from a shared ephemeral + IP address pool. If you specify a static external IP address, it must + live in the same region as the zone of the instance. + returned: success + type: dict + type: + description: + - The type of configuration. The default and only option is ONE_TO_ONE_NAT. + returned: success + type: str + aliasIpRanges: + description: + - An array of alias IP ranges for this network interface. Can only be specified + for network interfaces on subnet-mode networks. + returned: success + type: complex + contains: + ipCidrRange: + description: + - The IP CIDR range represented by this alias IP range. + - This IP CIDR range must belong to the specified subnetwork and cannot + contain IP addresses reserved by system or used by other network interfaces. + This range may be a single IP address (e.g. 10.2.3.4), a netmask (e.g. + /24) or a CIDR format string (e.g. 10.1.2.0/24). + returned: success + type: str + subnetworkRangeName: + description: + - Optional subnetwork secondary range name specifying the secondary + range from which to allocate the IP CIDR range for this alias IP range. + If left unspecified, the primary range of the subnetwork will be used. + returned: success + type: str + name: + description: + - The name of the network interface, generated by the server. For network + devices, these are eth0, eth1, etc . + returned: success + type: str + network: + description: + - Specifies the title of an existing gcompute_network. When creating an + instance, if neither the network nor the subnetwork is specified, the + default network global/networks/default is used; if the network is not + specified but the subnetwork is specified, the network is inferred. + returned: success + type: dict + networkIP: + description: + - An IPv4 internal network address to assign to the instance for this network + interface. If not specified by the user, an unused internal IP is assigned + by the system. + returned: success + type: str + subnetwork: + description: + - Reference to a gcompute_subnetwork resource. + - If the network resource is in legacy mode, do not provide this property. + If the network is in auto subnet mode, providing the subnetwork is optional. + If the network is in custom subnet mode, then this field should be specified. + returned: success + type: dict + scheduling: + description: + - Sets the scheduling options for this instance. + returned: success + type: complex + contains: + automaticRestart: + description: + - Specifies whether the instance should be automatically restarted if it + is terminated by Compute Engine (not terminated by a user). + - You can only set the automatic restart option for standard instances. + Preemptible instances cannot be automatically restarted. + returned: success + type: bool + onHostMaintenance: + description: + - Defines the maintenance behavior for this instance. For standard instances, + the default behavior is MIGRATE. For preemptible instances, the default + and only possible behavior is TERMINATE. + - For more information, see Setting Instance Scheduling Options. + returned: success + type: str + preemptible: + description: + - Defines whether the instance is preemptible. This can only be set during + instance creation, it cannot be set or changed after the instance has + been created. + returned: success + type: bool + serviceAccounts: + description: + - A list of service accounts, with their specified scopes, authorized for this + instance. Only one service account per VM instance is supported. + returned: success + type: complex + contains: + email: + description: + - Email address of the service account. + returned: success + type: str + scopes: + description: + - The list of scopes to be made available for this service account. + returned: success + type: list + tags: + description: + - A list of tags to apply to this instance. Tags are used to identify valid + sources or targets for network firewalls and are specified by the client during + instance creation. The tags can be later modified by the setTags method. Each + tag within the list must comply with RFC1035. + returned: success + type: complex + contains: + fingerprint: + description: + - Specifies a fingerprint for this request, which is essentially a hash + of the metadata's contents and used for optimistic locking. + - The fingerprint is initially generated by Compute Engine and changes after + every request to modify or update metadata. You must always provide an + up-to-date fingerprint hash in order to update or change metadata. + returned: success + type: str + items: + description: + - An array of tags. Each tag must be 1-63 characters long, and comply with + RFC1035. + returned: success + type: list ''' ################################################################################ diff --git a/lib/ansible/modules/cloud/google/gcp_compute_instance_template_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_instance_template_facts.py index 5d687b9d9284ae..052d58190e1d23 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_instance_template_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_instance_template_facts.py @@ -32,21 +32,20 @@ --- module: gcp_compute_instance_template_facts description: - - Gather facts for GCP InstanceTemplate +- Gather facts for GCP InstanceTemplate short_description: Gather facts for GCP InstanceTemplate version_added: 2.7 author: Google Inc. (@googlecloudplatform) requirements: - - python >= 2.6 - - requests >= 2.18.4 - - google-auth >= 1.3.0 +- python >= 2.6 +- requests >= 2.18.4 +- google-auth >= 1.3.0 options: - filters: - description: - A list of filter value pairs. Available filters are listed here - U(https://cloud.google.com/sdk/gcloud/reference/topic/filters). - Each additional filter in the list will act be added as an AND condition - (filter1 and filter2) + filters: + description: + - A list of filter value pairs. Available filters are listed here U(U(https://cloud.google.com/sdk/gcloud/reference/topic/filters).) + - Each additional filter in the list will act be added as an AND condition (filter1 + and filter2) . extends_documentation_fragment: gcp ''' @@ -62,379 +61,398 @@ RETURN = ''' items: - description: List of items - returned: always - type: complex - contains: - creationTimestamp: - description: - - Creation timestamp in RFC3339 text format. - returned: success - type: str + description: List of items + returned: always + type: complex + contains: + creationTimestamp: + description: + - Creation timestamp in RFC3339 text format. + returned: success + type: str + description: + description: + - An optional description of this resource. Provide this property when you create + the resource. + returned: success + type: str + id: + description: + - The unique identifier for the resource. This identifier is defined by the + server. + returned: success + type: int + name: + description: + - Name of the resource. The name is 1-63 characters long and complies with RFC1035. + returned: success + type: str + properties: + description: + - The instance properties for this instance template. + returned: success + type: complex + contains: + canIpForward: + description: + - Enables instances created based on this template to send packets with + source IP addresses other than their own and receive packets with destination + IP addresses other than their own. If these instances will be used as + an IP gateway or it will be set as the next-hop in a Route resource, specify + true. If unsure, leave this set to false. + returned: success + type: bool description: - description: - - An optional description of this resource. Provide this property when you create - the resource. - returned: success - type: str - id: - description: - - The unique identifier for the resource. This identifier is defined by the server. - returned: success - type: int - name: - description: - - Name of the resource. The name is 1-63 characters long and complies with RFC1035. - returned: success - type: str - properties: - description: - - The instance properties for this instance template. - returned: success - type: complex - contains: - canIpForward: - description: - - Enables instances created based on this template to send packets with source IP - addresses other than their own and receive packets with destination IP addresses - other than their own. If these instances will be used as an IP gateway or it will - be set as the next-hop in a Route resource, specify true. If unsure, leave this - set to false. - returned: success - type: bool - description: - description: - - An optional text description for the instances that are created from this instance - template. - returned: success - type: str - disks: - description: - - An array of disks that are associated with the instances that are created from this - template. - returned: success - type: complex - contains: - autoDelete: - description: - - Specifies whether the disk will be auto-deleted when the instance is deleted (but - not when the disk is detached from the instance). - - 'Tip: Disks should be set to autoDelete=true so that leftover disks are not left - behind on machine deletion.' - returned: success - type: bool - boot: - description: - - Indicates that this is a boot disk. The virtual machine will use the first partition - of the disk for its root filesystem. - returned: success - type: bool - deviceName: - description: - - Specifies a unique device name of your choice that is reflected into the /dev/disk/by-id/google-* - tree of a Linux operating system running within the instance. This name can be used - to reference the device for mounting, resizing, and so on, from within the instance. - returned: success - type: str - diskEncryptionKey: - description: - - Encrypts or decrypts a disk using a customer-supplied encryption key. - returned: success - type: complex - contains: - rawKey: - description: - - Specifies a 256-bit customer-supplied encryption key, encoded in RFC 4648 base64 - to either encrypt or decrypt this resource. - returned: success - type: str - rsaEncryptedKey: - description: - - Specifies an RFC 4648 base64 encoded, RSA-wrapped 2048-bit customer-supplied encryption - key to either encrypt or decrypt this resource. - returned: success - type: str - sha256: - description: - - The RFC 4648 base64 encoded SHA-256 hash of the customer-supplied encryption key - that protects this resource. - returned: success - type: str - index: - description: - - Assigns a zero-based index to this disk, where 0 is reserved for the boot disk. - For example, if you have many disks attached to an instance, each disk would have - a unique index number. If not specified, the server will choose an appropriate value. - returned: success - type: int - initializeParams: - description: - - Specifies the parameters for a new disk that will be created alongside the new instance. - Use initialization parameters to create boot disks or local SSDs attached to the - new instance. - returned: success - type: complex - contains: - diskName: - description: - - Specifies the disk name. If not specified, the default is to use the name of the - instance. - returned: success - type: str - diskSizeGb: - description: - - Specifies the size of the disk in base-2 GB. - returned: success - type: int - diskType: - description: - - Reference to a gcompute_disk_type resource. - - Specifies the disk type to use to create the instance. - - If not specified, the default is pd-standard. - returned: success - type: str - sourceImage: - description: - - The source image to create this disk. When creating a new instance, one of initializeParams.sourceImage - or disks.source is required. To create a disk with one of the public operating - system images, specify the image by its family name. - returned: success - type: str - sourceImageEncryptionKey: - description: - - The customer-supplied encryption key of the source image. Required if the source - image is protected by a customer-supplied encryption key. - - Instance templates do not store customer-supplied encryption keys, so you cannot - create disks for instances in a managed instance group if the source images are - encrypted with your own keys. - returned: success - type: complex - contains: - rawKey: - description: - - Specifies a 256-bit customer-supplied encryption key, encoded in RFC 4648 base64 - to either encrypt or decrypt this resource. - returned: success - type: str - sha256: - description: - - The RFC 4648 base64 encoded SHA-256 hash of the customer-supplied encryption key - that protects this resource. - returned: success - type: str - interface: - description: - - Specifies the disk interface to use for attaching this disk, which is either SCSI - or NVME. The default is SCSI. - - Persistent disks must always use SCSI and the request will fail if you attempt to - attach a persistent disk in any other format than SCSI. - returned: success - type: str - mode: - description: - - The mode in which to attach this disk, either READ_WRITE or READ_ONLY. If not specified, - the default is to attach the disk in READ_WRITE mode. - returned: success - type: str - source: - description: - - Reference to a gcompute_disk resource. When creating a new instance, one of initializeParams.sourceImage - or disks.source is required. - - If desired, you can also attach existing non-root persistent disks using this property. - This field is only applicable for persistent disks. - - Note that for InstanceTemplate, specify the disk name, not the URL for the disk. - returned: success - type: dict - type: - description: - - Specifies the type of the disk, either SCRATCH or PERSISTENT. If not specified, - the default is PERSISTENT. - returned: success - type: str - machineType: - description: - - Reference to a gcompute_machine_type resource. - returned: success - type: str - metadata: - description: - - The metadata key/value pairs to assign to instances that are created from this template. - These pairs can consist of custom metadata or predefined keys. - returned: success - type: dict - guestAccelerators: - description: - - List of the type and count of accelerator cards attached to the instance . - returned: success - type: complex - contains: - acceleratorCount: - description: - - The number of the guest accelerator cards exposed to this instance. - returned: success - type: int - acceleratorType: - description: - - Full or partial URL of the accelerator type resource to expose to this instance. - returned: success - type: str - networkInterfaces: - description: - - An array of configurations for this interface. This specifies how this interface - is configured to interact with other network services, such as connecting to the - internet. Only one network interface is supported per instance. - returned: success - type: complex - contains: - accessConfigs: - description: - - An array of configurations for this interface. Currently, only one access config, - ONE_TO_ONE_NAT, is supported. If there are no accessConfigs specified, then this - instance will have no external internet access. - returned: success - type: complex - contains: - name: - description: - - The name of this access configuration. The default and recommended name is External - NAT but you can use any arbitrary string you would like. For example, My external - IP or Network Access. - returned: success - type: str - natIP: - description: - - Specifies the title of a gcompute_address. - - An external IP address associated with this instance. - - Specify an unused static external IP address available to the project or leave this - field undefined to use an IP from a shared ephemeral IP address pool. If you specify - a static external IP address, it must live in the same region as the zone of the - instance. - returned: success - type: dict - type: - description: - - The type of configuration. The default and only option is ONE_TO_ONE_NAT. - returned: success - type: str - aliasIpRanges: - description: - - An array of alias IP ranges for this network interface. Can only be specified for - network interfaces on subnet-mode networks. - returned: success - type: complex - contains: - ipCidrRange: - description: - - The IP CIDR range represented by this alias IP range. - - This IP CIDR range must belong to the specified subnetwork and cannot contain IP - addresses reserved by system or used by other network interfaces. This range may - be a single IP address (e.g. 10.2.3.4), a netmask (e.g. /24) or a CIDR format string - (e.g. 10.1.2.0/24). - returned: success - type: str - subnetworkRangeName: - description: - - Optional subnetwork secondary range name specifying the secondary range from which - to allocate the IP CIDR range for this alias IP range. If left unspecified, the - primary range of the subnetwork will be used. - returned: success - type: str - name: - description: - - The name of the network interface, generated by the server. For network devices, - these are eth0, eth1, etc . - returned: success - type: str - network: - description: - - Specifies the title of an existing gcompute_network. When creating an instance, - if neither the network nor the subnetwork is specified, the default network global/networks/default - is used; if the network is not specified but the subnetwork is specified, the network - is inferred. - returned: success - type: dict - networkIP: - description: - - An IPv4 internal network address to assign to the instance for this network interface. - If not specified by the user, an unused internal IP is assigned by the system. - returned: success - type: str - subnetwork: - description: - - Reference to a gcompute_subnetwork resource. - - If the network resource is in legacy mode, do not provide this property. If the - network is in auto subnet mode, providing the subnetwork is optional. If the network - is in custom subnet mode, then this field should be specified. - returned: success - type: dict - scheduling: - description: - - Sets the scheduling options for this instance. - returned: success - type: complex - contains: - automaticRestart: - description: - - Specifies whether the instance should be automatically restarted if it is terminated - by Compute Engine (not terminated by a user). - - You can only set the automatic restart option for standard instances. Preemptible - instances cannot be automatically restarted. - returned: success - type: bool - onHostMaintenance: - description: - - Defines the maintenance behavior for this instance. For standard instances, the - default behavior is MIGRATE. For preemptible instances, the default and only possible - behavior is TERMINATE. - - For more information, see Setting Instance Scheduling Options. - returned: success - type: str - preemptible: - description: - - Defines whether the instance is preemptible. This can only be set during instance - creation, it cannot be set or changed after the instance has been created. - returned: success - type: bool - serviceAccounts: - description: - - A list of service accounts, with their specified scopes, authorized for this instance. - Only one service account per VM instance is supported. - returned: success - type: complex - contains: - email: - description: - - Email address of the service account. - returned: success - type: str - scopes: - description: - - The list of scopes to be made available for this service account. - returned: success - type: list - tags: - description: - - A list of tags to apply to this instance. Tags are used to identify valid sources - or targets for network firewalls and are specified by the client during instance - creation. The tags can be later modified by the setTags method. Each tag within - the list must comply with RFC1035. - returned: success - type: complex - contains: - fingerprint: - description: - - Specifies a fingerprint for this request, which is essentially a hash of the metadata's - contents and used for optimistic locking. - - The fingerprint is initially generated by Compute Engine and changes after every - request to modify or update metadata. You must always provide an up-to-date fingerprint - hash in order to update or change metadata. - returned: success - type: str - items: - description: - - An array of tags. Each tag must be 1-63 characters long, and comply with RFC1035. - returned: success - type: list + description: + - An optional text description for the instances that are created from this + instance template. + returned: success + type: str + disks: + description: + - An array of disks that are associated with the instances that are created + from this template. + returned: success + type: complex + contains: + autoDelete: + description: + - Specifies whether the disk will be auto-deleted when the instance + is deleted (but not when the disk is detached from the instance). + - 'Tip: Disks should be set to autoDelete=true so that leftover disks + are not left behind on machine deletion.' + returned: success + type: bool + boot: + description: + - Indicates that this is a boot disk. The virtual machine will use the + first partition of the disk for its root filesystem. + returned: success + type: bool + deviceName: + description: + - Specifies a unique device name of your choice that is reflected into + the /dev/disk/by-id/google-* tree of a Linux operating system running + within the instance. This name can be used to reference the device + for mounting, resizing, and so on, from within the instance. + returned: success + type: str + diskEncryptionKey: + description: + - Encrypts or decrypts a disk using a customer-supplied encryption key. + returned: success + type: complex + contains: + rawKey: + description: + - Specifies a 256-bit customer-supplied encryption key, encoded + in RFC 4648 base64 to either encrypt or decrypt this resource. + returned: success + type: str + rsaEncryptedKey: + description: + - Specifies an RFC 4648 base64 encoded, RSA-wrapped 2048-bit customer-supplied + encryption key to either encrypt or decrypt this resource. + returned: success + type: str + sha256: + description: + - The RFC 4648 base64 encoded SHA-256 hash of the customer-supplied + encryption key that protects this resource. + returned: success + type: str + index: + description: + - Assigns a zero-based index to this disk, where 0 is reserved for the + boot disk. For example, if you have many disks attached to an instance, + each disk would have a unique index number. If not specified, the + server will choose an appropriate value. + returned: success + type: int + initializeParams: + description: + - Specifies the parameters for a new disk that will be created alongside + the new instance. Use initialization parameters to create boot disks + or local SSDs attached to the new instance. + returned: success + type: complex + contains: + diskName: + description: + - Specifies the disk name. If not specified, the default is to use + the name of the instance. + returned: success + type: str + diskSizeGb: + description: + - Specifies the size of the disk in base-2 GB. + returned: success + type: int + diskType: + description: + - Reference to a gcompute_disk_type resource. + - Specifies the disk type to use to create the instance. + - If not specified, the default is pd-standard. + returned: success + type: str + sourceImage: + description: + - The source image to create this disk. When creating a new instance, + one of initializeParams.sourceImage or disks.source is required. + To create a disk with one of the public operating system images, + specify the image by its family name. + returned: success + type: str + sourceImageEncryptionKey: + description: + - The customer-supplied encryption key of the source image. Required + if the source image is protected by a customer-supplied encryption + key. + - Instance templates do not store customer-supplied encryption keys, + so you cannot create disks for instances in a managed instance + group if the source images are encrypted with your own keys. + returned: success + type: complex + contains: + rawKey: + description: + - Specifies a 256-bit customer-supplied encryption key, encoded + in RFC 4648 base64 to either encrypt or decrypt this resource. + returned: success + type: str + sha256: + description: + - The RFC 4648 base64 encoded SHA-256 hash of the customer-supplied + encryption key that protects this resource. + returned: success + type: str + interface: + description: + - Specifies the disk interface to use for attaching this disk, which + is either SCSI or NVME. The default is SCSI. + - Persistent disks must always use SCSI and the request will fail if + you attempt to attach a persistent disk in any other format than SCSI. + returned: success + type: str + mode: + description: + - The mode in which to attach this disk, either READ_WRITE or READ_ONLY. + If not specified, the default is to attach the disk in READ_WRITE + mode. + returned: success + type: str + source: + description: + - Reference to a gcompute_disk resource. When creating a new instance, + one of initializeParams.sourceImage or disks.source is required. + - If desired, you can also attach existing non-root persistent disks + using this property. This field is only applicable for persistent + disks. + - Note that for InstanceTemplate, specify the disk name, not the URL + for the disk. + returned: success + type: dict + type: + description: + - Specifies the type of the disk, either SCRATCH or PERSISTENT. If not + specified, the default is PERSISTENT. + returned: success + type: str + machineType: + description: + - Reference to a gcompute_machine_type resource. + returned: success + type: str + metadata: + description: + - The metadata key/value pairs to assign to instances that are created from + this template. These pairs can consist of custom metadata or predefined + keys. + returned: success + type: dict + guestAccelerators: + description: + - List of the type and count of accelerator cards attached to the instance + . + returned: success + type: complex + contains: + acceleratorCount: + description: + - The number of the guest accelerator cards exposed to this instance. + returned: success + type: int + acceleratorType: + description: + - Full or partial URL of the accelerator type resource to expose to + this instance. + returned: success + type: str + networkInterfaces: + description: + - An array of configurations for this interface. This specifies how this + interface is configured to interact with other network services, such + as connecting to the internet. Only one network interface is supported + per instance. + returned: success + type: complex + contains: + accessConfigs: + description: + - An array of configurations for this interface. Currently, only one + access config, ONE_TO_ONE_NAT, is supported. If there are no accessConfigs + specified, then this instance will have no external internet access. + returned: success + type: complex + contains: + name: + description: + - The name of this access configuration. The default and recommended + name is External NAT but you can use any arbitrary string you + would like. For example, My external IP or Network Access. + returned: success + type: str + natIP: + description: + - Specifies the title of a gcompute_address. + - An external IP address associated with this instance. + - Specify an unused static external IP address available to the + project or leave this field undefined to use an IP from a shared + ephemeral IP address pool. If you specify a static external IP + address, it must live in the same region as the zone of the instance. + returned: success + type: dict + type: + description: + - The type of configuration. The default and only option is ONE_TO_ONE_NAT. + returned: success + type: str + aliasIpRanges: + description: + - An array of alias IP ranges for this network interface. Can only be + specified for network interfaces on subnet-mode networks. + returned: success + type: complex + contains: + ipCidrRange: + description: + - The IP CIDR range represented by this alias IP range. + - This IP CIDR range must belong to the specified subnetwork and + cannot contain IP addresses reserved by system or used by other + network interfaces. This range may be a single IP address (e.g. + 10.2.3.4), a netmask (e.g. /24) or a CIDR format string (e.g. + 10.1.2.0/24). + returned: success + type: str + subnetworkRangeName: + description: + - Optional subnetwork secondary range name specifying the secondary + range from which to allocate the IP CIDR range for this alias + IP range. If left unspecified, the primary range of the subnetwork + will be used. + returned: success + type: str + name: + description: + - The name of the network interface, generated by the server. For network + devices, these are eth0, eth1, etc . + returned: success + type: str + network: + description: + - Specifies the title of an existing gcompute_network. When creating + an instance, if neither the network nor the subnetwork is specified, + the default network global/networks/default is used; if the network + is not specified but the subnetwork is specified, the network is inferred. + returned: success + type: dict + networkIP: + description: + - An IPv4 internal network address to assign to the instance for this + network interface. If not specified by the user, an unused internal + IP is assigned by the system. + returned: success + type: str + subnetwork: + description: + - Reference to a gcompute_subnetwork resource. + - If the network resource is in legacy mode, do not provide this property. + If the network is in auto subnet mode, providing the subnetwork is + optional. If the network is in custom subnet mode, then this field + should be specified. + returned: success + type: dict + scheduling: + description: + - Sets the scheduling options for this instance. + returned: success + type: complex + contains: + automaticRestart: + description: + - Specifies whether the instance should be automatically restarted if + it is terminated by Compute Engine (not terminated by a user). + - You can only set the automatic restart option for standard instances. + Preemptible instances cannot be automatically restarted. + returned: success + type: bool + onHostMaintenance: + description: + - Defines the maintenance behavior for this instance. For standard instances, + the default behavior is MIGRATE. For preemptible instances, the default + and only possible behavior is TERMINATE. + - For more information, see Setting Instance Scheduling Options. + returned: success + type: str + preemptible: + description: + - Defines whether the instance is preemptible. This can only be set + during instance creation, it cannot be set or changed after the instance + has been created. + returned: success + type: bool + serviceAccounts: + description: + - A list of service accounts, with their specified scopes, authorized for + this instance. Only one service account per VM instance is supported. + returned: success + type: complex + contains: + email: + description: + - Email address of the service account. + returned: success + type: str + scopes: + description: + - The list of scopes to be made available for this service account. + returned: success + type: list + tags: + description: + - A list of tags to apply to this instance. Tags are used to identify valid + sources or targets for network firewalls and are specified by the client + during instance creation. The tags can be later modified by the setTags + method. Each tag within the list must comply with RFC1035. + returned: success + type: complex + contains: + fingerprint: + description: + - Specifies a fingerprint for this request, which is essentially a hash + of the metadata's contents and used for optimistic locking. + - The fingerprint is initially generated by Compute Engine and changes + after every request to modify or update metadata. You must always + provide an up-to-date fingerprint hash in order to update or change + metadata. + returned: success + type: str + items: + description: + - An array of tags. Each tag must be 1-63 characters long, and comply + with RFC1035. + returned: success + type: list ''' ################################################################################ diff --git a/lib/ansible/modules/cloud/google/gcp_compute_interconnect_attachment.py b/lib/ansible/modules/cloud/google/gcp_compute_interconnect_attachment.py index eb9598d3706357..b11a094b50a20d 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_interconnect_attachment.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_interconnect_attachment.py @@ -32,55 +32,57 @@ --- module: gcp_compute_interconnect_attachment description: - - Represents an InterconnectAttachment (VLAN attachment) resource. For more information, - see Creating VLAN Attachments. +- Represents an InterconnectAttachment (VLAN attachment) resource. For more information, + see Creating VLAN Attachments. short_description: Creates a GCP InterconnectAttachment version_added: 2.8 author: Google Inc. (@googlecloudplatform) requirements: - - python >= 2.6 - - requests >= 2.18.4 - - google-auth >= 1.3.0 +- python >= 2.6 +- requests >= 2.18.4 +- google-auth >= 1.3.0 options: - state: - description: - - Whether the given object should exist in GCP - choices: ['present', 'absent'] - default: 'present' - interconnect: - description: - - URL of the underlying Interconnect object that this attachment's traffic will traverse - through. - required: true + state: description: - description: - - An optional description of this resource. . - required: false - router: - description: - - URL of the cloud router to be used for dynamic routing. This router must be in the - same region as this InterconnectAttachment. The InterconnectAttachment will automatically - connect the Interconnect to the network & region within which the Cloud Router is - configured. - - 'This field represents a link to a Router resource in GCP. It can be specified in - two ways. You can add `register: name-of-resource` to a gcp_compute_router task - and then set this router field to "{{ name-of-resource }}" Alternatively, you can - set this router to a dictionary with the selfLink key where the value is the selfLink - of your Router.' - required: true - name: - description: - - Name of the resource. Provided by the client when the resource is created. The name - must be 1-63 characters long, and comply with RFC1035. Specifically, the name must - be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` - which means the first character must be a lowercase letter, and all following characters - must be a dash, lowercase letter, or digit, except the last character, which cannot - be a dash. - required: true - region: - description: - - Region where the regional interconnect attachment resides. - required: true + - Whether the given object should exist in GCP + choices: + - present + - absent + default: present + interconnect: + description: + - URL of the underlying Interconnect object that this attachment's traffic will + traverse through. + required: true + description: + description: + - An optional description of this resource. . + required: false + router: + description: + - URL of the cloud router to be used for dynamic routing. This router must be + in the same region as this InterconnectAttachment. The InterconnectAttachment + will automatically connect the Interconnect to the network & region within which + the Cloud Router is configured. + - 'This field represents a link to a Router resource in GCP. It can be specified + in two ways. You can add `register: name-of-resource` to a gcp_compute_router + task and then set this router field to "{{ name-of-resource }}" Alternatively, + you can set this router to a dictionary with the selfLink key where the value + is the selfLink of your Router' + required: true + name: + description: + - Name of the resource. Provided by the client when the resource is created. The + name must be 1-63 characters long, and comply with RFC1035. Specifically, the + name must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` + which means the first character must be a lowercase letter, and all following + characters must be a dash, lowercase letter, or digit, except the last character, + which cannot be a dash. + required: true + region: + description: + - Region where the regional interconnect attachment resides. + required: true extends_documentation_fragment: gcp ''' @@ -99,81 +101,81 @@ ''' RETURN = ''' - cloudRouterIpAddress: - description: - - IPv4 address + prefix length to be configured on Cloud Router Interface for this - interconnect attachment. - returned: success - type: str - customerRouterIpAddress: - description: - - IPv4 address + prefix length to be configured on the customer router subinterface - for this interconnect attachment. - returned: success - type: str - interconnect: - description: - - URL of the underlying Interconnect object that this attachment's traffic will traverse - through. - returned: success - type: str - description: - description: - - An optional description of this resource. . - returned: success - type: str - privateInterconnectInfo: - description: - - Information specific to an InterconnectAttachment. This property is populated if - the interconnect that this is attached to is of type DEDICATED. - returned: success - type: complex - contains: - tag8021q: - description: - - 802.1q encapsulation tag to be used for traffic between Google and the customer, - going to and from this network and region. - returned: success - type: int - googleReferenceId: - description: - - Google reference ID, to be used when raising support tickets with Google or otherwise - to debug backend connectivity issues. - returned: success - type: str - router: - description: - - URL of the cloud router to be used for dynamic routing. This router must be in the - same region as this InterconnectAttachment. The InterconnectAttachment will automatically - connect the Interconnect to the network & region within which the Cloud Router is - configured. - returned: success - type: dict - creationTimestamp: - description: - - Creation timestamp in RFC3339 text format. - returned: success - type: str - id: - description: - - The unique identifier for the resource. This identifier is defined by the server. - returned: success - type: str - name: - description: - - Name of the resource. Provided by the client when the resource is created. The name - must be 1-63 characters long, and comply with RFC1035. Specifically, the name must - be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` - which means the first character must be a lowercase letter, and all following characters - must be a dash, lowercase letter, or digit, except the last character, which cannot - be a dash. - returned: success - type: str - region: - description: - - Region where the regional interconnect attachment resides. - returned: success - type: str +cloudRouterIpAddress: + description: + - IPv4 address + prefix length to be configured on Cloud Router Interface for this + interconnect attachment. + returned: success + type: str +customerRouterIpAddress: + description: + - IPv4 address + prefix length to be configured on the customer router subinterface + for this interconnect attachment. + returned: success + type: str +interconnect: + description: + - URL of the underlying Interconnect object that this attachment's traffic will + traverse through. + returned: success + type: str +description: + description: + - An optional description of this resource. . + returned: success + type: str +privateInterconnectInfo: + description: + - Information specific to an InterconnectAttachment. This property is populated + if the interconnect that this is attached to is of type DEDICATED. + returned: success + type: complex + contains: + tag8021q: + description: + - 802.1q encapsulation tag to be used for traffic between Google and the customer, + going to and from this network and region. + returned: success + type: int +googleReferenceId: + description: + - Google reference ID, to be used when raising support tickets with Google or otherwise + to debug backend connectivity issues. + returned: success + type: str +router: + description: + - URL of the cloud router to be used for dynamic routing. This router must be in + the same region as this InterconnectAttachment. The InterconnectAttachment will + automatically connect the Interconnect to the network & region within which the + Cloud Router is configured. + returned: success + type: dict +creationTimestamp: + description: + - Creation timestamp in RFC3339 text format. + returned: success + type: str +id: + description: + - The unique identifier for the resource. This identifier is defined by the server. + returned: success + type: str +name: + description: + - Name of the resource. Provided by the client when the resource is created. The + name must be 1-63 characters long, and comply with RFC1035. Specifically, the + name must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` + which means the first character must be a lowercase letter, and all following + characters must be a dash, lowercase letter, or digit, except the last character, + which cannot be a dash. + returned: success + type: str +region: + description: + - Region where the regional interconnect attachment resides. + returned: success + type: str ''' ################################################################################ diff --git a/lib/ansible/modules/cloud/google/gcp_compute_interconnect_attachment_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_interconnect_attachment_facts.py index 2472df5d00ed86..92a23f949a28c9 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_interconnect_attachment_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_interconnect_attachment_facts.py @@ -32,25 +32,24 @@ --- module: gcp_compute_interconnect_attachment_facts description: - - Gather facts for GCP InterconnectAttachment +- Gather facts for GCP InterconnectAttachment short_description: Gather facts for GCP InterconnectAttachment version_added: 2.8 author: Google Inc. (@googlecloudplatform) requirements: - - python >= 2.6 - - requests >= 2.18.4 - - google-auth >= 1.3.0 +- python >= 2.6 +- requests >= 2.18.4 +- google-auth >= 1.3.0 options: - filters: - description: - A list of filter value pairs. Available filters are listed here - U(https://cloud.google.com/sdk/gcloud/reference/topic/filters). - Each additional filter in the list will act be added as an AND condition - (filter1 and filter2) - region: - description: - - Region where the regional interconnect attachment resides. - required: true + filters: + description: + - A list of filter value pairs. Available filters are listed here U(U(https://cloud.google.com/sdk/gcloud/reference/topic/filters).) + - Each additional filter in the list will act be added as an AND condition (filter1 + and filter2) . + region: + description: + - Region where the regional interconnect attachment resides. + required: true extends_documentation_fragment: gcp ''' @@ -67,85 +66,86 @@ RETURN = ''' items: - description: List of items - returned: always - type: complex - contains: - cloudRouterIpAddress: - description: - - IPv4 address + prefix length to be configured on Cloud Router Interface for this - interconnect attachment. - returned: success - type: str - customerRouterIpAddress: - description: - - IPv4 address + prefix length to be configured on the customer router subinterface - for this interconnect attachment. - returned: success - type: str - interconnect: - description: - - URL of the underlying Interconnect object that this attachment's traffic will traverse - through. - returned: success - type: str - description: - description: - - An optional description of this resource. . - returned: success - type: str - privateInterconnectInfo: - description: - - Information specific to an InterconnectAttachment. This property is populated if - the interconnect that this is attached to is of type DEDICATED. - returned: success - type: complex - contains: - tag8021q: - description: - - 802.1q encapsulation tag to be used for traffic between Google and the customer, - going to and from this network and region. - returned: success - type: int - googleReferenceId: - description: - - Google reference ID, to be used when raising support tickets with Google or otherwise - to debug backend connectivity issues. - returned: success - type: str - router: - description: - - URL of the cloud router to be used for dynamic routing. This router must be in the - same region as this InterconnectAttachment. The InterconnectAttachment will automatically - connect the Interconnect to the network & region within which the Cloud Router is - configured. - returned: success - type: dict - creationTimestamp: - description: - - Creation timestamp in RFC3339 text format. - returned: success - type: str - id: - description: - - The unique identifier for the resource. This identifier is defined by the server. - returned: success - type: str - name: - description: - - Name of the resource. Provided by the client when the resource is created. The name - must be 1-63 characters long, and comply with RFC1035. Specifically, the name must - be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` - which means the first character must be a lowercase letter, and all following characters - must be a dash, lowercase letter, or digit, except the last character, which cannot - be a dash. - returned: success - type: str - region: - description: - - Region where the regional interconnect attachment resides. - returned: success - type: str + description: List of items + returned: always + type: complex + contains: + cloudRouterIpAddress: + description: + - IPv4 address + prefix length to be configured on Cloud Router Interface for + this interconnect attachment. + returned: success + type: str + customerRouterIpAddress: + description: + - IPv4 address + prefix length to be configured on the customer router subinterface + for this interconnect attachment. + returned: success + type: str + interconnect: + description: + - URL of the underlying Interconnect object that this attachment's traffic will + traverse through. + returned: success + type: str + description: + description: + - An optional description of this resource. . + returned: success + type: str + privateInterconnectInfo: + description: + - Information specific to an InterconnectAttachment. This property is populated + if the interconnect that this is attached to is of type DEDICATED. + returned: success + type: complex + contains: + tag8021q: + description: + - 802.1q encapsulation tag to be used for traffic between Google and the + customer, going to and from this network and region. + returned: success + type: int + googleReferenceId: + description: + - Google reference ID, to be used when raising support tickets with Google or + otherwise to debug backend connectivity issues. + returned: success + type: str + router: + description: + - URL of the cloud router to be used for dynamic routing. This router must be + in the same region as this InterconnectAttachment. The InterconnectAttachment + will automatically connect the Interconnect to the network & region within + which the Cloud Router is configured. + returned: success + type: dict + creationTimestamp: + description: + - Creation timestamp in RFC3339 text format. + returned: success + type: str + id: + description: + - The unique identifier for the resource. This identifier is defined by the + server. + returned: success + type: str + name: + description: + - Name of the resource. Provided by the client when the resource is created. + The name must be 1-63 characters long, and comply with RFC1035. Specifically, + the name must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` + which means the first character must be a lowercase letter, and all following + characters must be a dash, lowercase letter, or digit, except the last character, + which cannot be a dash. + returned: success + type: str + region: + description: + - Region where the regional interconnect attachment resides. + returned: success + type: str ''' ################################################################################ diff --git a/lib/ansible/modules/cloud/google/gcp_compute_network.py b/lib/ansible/modules/cloud/google/gcp_compute_network.py index 4eccbc5fc1fa3c..e4d52c9dd19250 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_network.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_network.py @@ -32,78 +32,83 @@ --- module: gcp_compute_network description: - - Represents a Network resource. - - Your Cloud Platform Console project can contain multiple networks, and each network - can have multiple instances attached to it. A network allows you to define a gateway - IP and the network range for the instances attached to that network. Every project - is provided with a default network with preset configurations and firewall rules. - You can choose to customize the default network by adding or removing rules, or - you can create new networks in that project. Generally, most users only need one - network, although you can have up to five networks per project by default. - - A network belongs to only one project, and each instance can only belong to one - network. All Compute Engine networks use the IPv4 protocol. Compute Engine currently - does not support IPv6. However, Google is a major advocate of IPv6 and it is an - important future direction. +- Represents a Network resource. +- Your Cloud Platform Console project can contain multiple networks, and each network + can have multiple instances attached to it. A network allows you to define a gateway + IP and the network range for the instances attached to that network. Every project + is provided with a default network with preset configurations and firewall rules. + You can choose to customize the default network by adding or removing rules, or + you can create new networks in that project. Generally, most users only need one + network, although you can have up to five networks per project by default. +- A network belongs to only one project, and each instance can only belong to one + network. All Compute Engine networks use the IPv4 protocol. Compute Engine currently + does not support IPv6. However, Google is a major advocate of IPv6 and it is an + important future direction. short_description: Creates a GCP Network version_added: 2.6 author: Google Inc. (@googlecloudplatform) requirements: - - python >= 2.6 - - requests >= 2.18.4 - - google-auth >= 1.3.0 +- python >= 2.6 +- requests >= 2.18.4 +- google-auth >= 1.3.0 options: - state: - description: - - Whether the given object should exist in GCP - choices: ['present', 'absent'] - default: 'present' + state: description: + - Whether the given object should exist in GCP + choices: + - present + - absent + default: present + description: + description: + - An optional description of this resource. Provide this property when you create + the resource. + required: false + ipv4_range: + description: + - 'The range of internal addresses that are legal on this network. This range + is a CIDR specification, for example: 192.168.0.0/16. Provided by the client + when the network is created.' + required: false + name: + description: + - Name of the resource. Provided by the client when the resource is created. The + name must be 1-63 characters long, and comply with RFC1035. Specifically, the + name must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` + which means the first character must be a lowercase letter, and all following + characters must be a dash, lowercase letter, or digit, except the last character, + which cannot be a dash. + required: true + auto_create_subnetworks: + description: + - When set to true, the network is created in "auto subnet mode". When set to + false, the network is in "custom subnet mode". + - In "auto subnet mode", a newly created network is assigned the default CIDR + of 10.128.0.0/9 and it automatically creates one subnetwork per region. + required: false + type: bool + routing_config: + description: + - The network-level routing configuration for this network. Used by Cloud Router + to determine what type of network-wide routing behavior to enforce. + required: false + version_added: 2.8 + suboptions: + routing_mode: description: - - An optional description of this resource. Provide this property when you create - the resource. - required: false - ipv4_range: - description: - - 'The range of internal addresses that are legal on this network. This range is a - CIDR specification, for example: 192.168.0.0/16. Provided by the client when the - network is created.' - required: false - name: - description: - - Name of the resource. Provided by the client when the resource is created. The name - must be 1-63 characters long, and comply with RFC1035. Specifically, the name must - be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` - which means the first character must be a lowercase letter, and all following characters - must be a dash, lowercase letter, or digit, except the last character, which cannot - be a dash. + - The network-wide routing mode to use. If set to REGIONAL, this network's + cloud routers will only advertise routes with subnetworks of this network + in the same region as the router. If set to GLOBAL, this network's cloud + routers will advertise routes with all subnetworks of this network, across + regions. required: true - auto_create_subnetworks: - description: - - When set to true, the network is created in "auto subnet mode". When set to false, - the network is in "custom subnet mode". - - In "auto subnet mode", a newly created network is assigned the default CIDR of 10.128.0.0/9 - and it automatically creates one subnetwork per region. - required: false - type: bool - routing_config: - description: - - The network-level routing configuration for this network. Used by Cloud Router to - determine what type of network-wide routing behavior to enforce. - required: false - version_added: 2.8 - suboptions: - routing_mode: - description: - - The network-wide routing mode to use. If set to REGIONAL, this network's cloud routers - will only advertise routes with subnetworks of this network in the same region as - the router. If set to GLOBAL, this network's cloud routers will advertise routes - with all subnetworks of this network, across regions. - required: true - choices: ['REGIONAL', 'GLOBAL'] + choices: + - REGIONAL + - GLOBAL extends_documentation_fragment: gcp notes: - - "API Reference: U(https://cloud.google.com/compute/docs/reference/rest/v1/networks)" - - "Official Documentation: U(https://cloud.google.com/vpc/docs/vpc)" +- 'API Reference: U(https://cloud.google.com/compute/docs/reference/rest/v1/networks)' +- 'Official Documentation: U(https://cloud.google.com/vpc/docs/vpc)' ''' EXAMPLES = ''' @@ -118,74 +123,74 @@ ''' RETURN = ''' - description: - description: - - An optional description of this resource. Provide this property when you create - the resource. - returned: success - type: str - gateway_ipv4: - description: - - A gateway address for default routing to other networks. This value is read only - and is selected by the Google Compute Engine, typically as the first usable address - in the IPv4Range. - returned: success - type: str - id: - description: - - The unique identifier for the resource. - returned: success - type: int - ipv4_range: - description: - - 'The range of internal addresses that are legal on this network. This range is a - CIDR specification, for example: 192.168.0.0/16. Provided by the client when the - network is created.' - returned: success - type: str - name: - description: - - Name of the resource. Provided by the client when the resource is created. The name - must be 1-63 characters long, and comply with RFC1035. Specifically, the name must - be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` - which means the first character must be a lowercase letter, and all following characters - must be a dash, lowercase letter, or digit, except the last character, which cannot - be a dash. - returned: success - type: str - subnetworks: - description: - - Server-defined fully-qualified URLs for all subnetworks in this network. - returned: success - type: list - autoCreateSubnetworks: - description: - - When set to true, the network is created in "auto subnet mode". When set to false, - the network is in "custom subnet mode". - - In "auto subnet mode", a newly created network is assigned the default CIDR of 10.128.0.0/9 - and it automatically creates one subnetwork per region. - returned: success - type: bool - creationTimestamp: - description: - - Creation timestamp in RFC3339 text format. - returned: success - type: str - routingConfig: - description: - - The network-level routing configuration for this network. Used by Cloud Router to - determine what type of network-wide routing behavior to enforce. - returned: success - type: complex - contains: - routingMode: - description: - - The network-wide routing mode to use. If set to REGIONAL, this network's cloud routers - will only advertise routes with subnetworks of this network in the same region as - the router. If set to GLOBAL, this network's cloud routers will advertise routes - with all subnetworks of this network, across regions. - returned: success - type: str +description: + description: + - An optional description of this resource. Provide this property when you create + the resource. + returned: success + type: str +gateway_ipv4: + description: + - A gateway address for default routing to other networks. This value is read only + and is selected by the Google Compute Engine, typically as the first usable address + in the IPv4Range. + returned: success + type: str +id: + description: + - The unique identifier for the resource. + returned: success + type: int +ipv4_range: + description: + - 'The range of internal addresses that are legal on this network. This range is + a CIDR specification, for example: 192.168.0.0/16. Provided by the client when + the network is created.' + returned: success + type: str +name: + description: + - Name of the resource. Provided by the client when the resource is created. The + name must be 1-63 characters long, and comply with RFC1035. Specifically, the + name must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` + which means the first character must be a lowercase letter, and all following + characters must be a dash, lowercase letter, or digit, except the last character, + which cannot be a dash. + returned: success + type: str +subnetworks: + description: + - Server-defined fully-qualified URLs for all subnetworks in this network. + returned: success + type: list +autoCreateSubnetworks: + description: + - When set to true, the network is created in "auto subnet mode". When set to false, + the network is in "custom subnet mode". + - In "auto subnet mode", a newly created network is assigned the default CIDR of + 10.128.0.0/9 and it automatically creates one subnetwork per region. + returned: success + type: bool +creationTimestamp: + description: + - Creation timestamp in RFC3339 text format. + returned: success + type: str +routingConfig: + description: + - The network-level routing configuration for this network. Used by Cloud Router + to determine what type of network-wide routing behavior to enforce. + returned: success + type: complex + contains: + routingMode: + description: + - The network-wide routing mode to use. If set to REGIONAL, this network's cloud + routers will only advertise routes with subnetworks of this network in the + same region as the router. If set to GLOBAL, this network's cloud routers + will advertise routes with all subnetworks of this network, across regions. + returned: success + type: str ''' ################################################################################ diff --git a/lib/ansible/modules/cloud/google/gcp_compute_network_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_network_facts.py index f7c87a316c6d6e..4e70ab0b2cc61e 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_network_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_network_facts.py @@ -32,21 +32,20 @@ --- module: gcp_compute_network_facts description: - - Gather facts for GCP Network +- Gather facts for GCP Network short_description: Gather facts for GCP Network version_added: 2.7 author: Google Inc. (@googlecloudplatform) requirements: - - python >= 2.6 - - requests >= 2.18.4 - - google-auth >= 1.3.0 +- python >= 2.6 +- requests >= 2.18.4 +- google-auth >= 1.3.0 options: - filters: - description: - A list of filter value pairs. Available filters are listed here - U(https://cloud.google.com/sdk/gcloud/reference/topic/filters). - Each additional filter in the list will act be added as an AND condition - (filter1 and filter2) + filters: + description: + - A list of filter value pairs. Available filters are listed here U(U(https://cloud.google.com/sdk/gcloud/reference/topic/filters).) + - Each additional filter in the list will act be added as an AND condition (filter1 + and filter2) . extends_documentation_fragment: gcp ''' @@ -62,78 +61,79 @@ RETURN = ''' items: - description: List of items - returned: always - type: complex - contains: - description: - description: - - An optional description of this resource. Provide this property when you create - the resource. - returned: success - type: str - gateway_ipv4: - description: - - A gateway address for default routing to other networks. This value is read only - and is selected by the Google Compute Engine, typically as the first usable address - in the IPv4Range. - returned: success - type: str - id: - description: - - The unique identifier for the resource. - returned: success - type: int - ipv4_range: - description: - - 'The range of internal addresses that are legal on this network. This range is a - CIDR specification, for example: 192.168.0.0/16. Provided by the client when the - network is created.' - returned: success - type: str - name: - description: - - Name of the resource. Provided by the client when the resource is created. The name - must be 1-63 characters long, and comply with RFC1035. Specifically, the name must - be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` - which means the first character must be a lowercase letter, and all following characters - must be a dash, lowercase letter, or digit, except the last character, which cannot - be a dash. - returned: success - type: str - subnetworks: - description: - - Server-defined fully-qualified URLs for all subnetworks in this network. - returned: success - type: list - autoCreateSubnetworks: - description: - - When set to true, the network is created in "auto subnet mode". When set to false, - the network is in "custom subnet mode". - - In "auto subnet mode", a newly created network is assigned the default CIDR of 10.128.0.0/9 - and it automatically creates one subnetwork per region. - returned: success - type: bool - creationTimestamp: - description: - - Creation timestamp in RFC3339 text format. - returned: success - type: str - routingConfig: - description: - - The network-level routing configuration for this network. Used by Cloud Router to - determine what type of network-wide routing behavior to enforce. - returned: success - type: complex - contains: - routingMode: - description: - - The network-wide routing mode to use. If set to REGIONAL, this network's cloud routers - will only advertise routes with subnetworks of this network in the same region as - the router. If set to GLOBAL, this network's cloud routers will advertise routes - with all subnetworks of this network, across regions. - returned: success - type: str + description: List of items + returned: always + type: complex + contains: + description: + description: + - An optional description of this resource. Provide this property when you create + the resource. + returned: success + type: str + gateway_ipv4: + description: + - A gateway address for default routing to other networks. This value is read + only and is selected by the Google Compute Engine, typically as the first + usable address in the IPv4Range. + returned: success + type: str + id: + description: + - The unique identifier for the resource. + returned: success + type: int + ipv4_range: + description: + - 'The range of internal addresses that are legal on this network. This range + is a CIDR specification, for example: 192.168.0.0/16. Provided by the client + when the network is created.' + returned: success + type: str + name: + description: + - Name of the resource. Provided by the client when the resource is created. + The name must be 1-63 characters long, and comply with RFC1035. Specifically, + the name must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` + which means the first character must be a lowercase letter, and all following + characters must be a dash, lowercase letter, or digit, except the last character, + which cannot be a dash. + returned: success + type: str + subnetworks: + description: + - Server-defined fully-qualified URLs for all subnetworks in this network. + returned: success + type: list + autoCreateSubnetworks: + description: + - When set to true, the network is created in "auto subnet mode". When set to + false, the network is in "custom subnet mode". + - In "auto subnet mode", a newly created network is assigned the default CIDR + of 10.128.0.0/9 and it automatically creates one subnetwork per region. + returned: success + type: bool + creationTimestamp: + description: + - Creation timestamp in RFC3339 text format. + returned: success + type: str + routingConfig: + description: + - The network-level routing configuration for this network. Used by Cloud Router + to determine what type of network-wide routing behavior to enforce. + returned: success + type: complex + contains: + routingMode: + description: + - The network-wide routing mode to use. If set to REGIONAL, this network's + cloud routers will only advertise routes with subnetworks of this network + in the same region as the router. If set to GLOBAL, this network's cloud + routers will advertise routes with all subnetworks of this network, across + regions. + returned: success + type: str ''' ################################################################################ diff --git a/lib/ansible/modules/cloud/google/gcp_compute_region_disk.py b/lib/ansible/modules/cloud/google/gcp_compute_region_disk.py index 819da0ab38eab9..efa4603da9dc47 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_region_disk.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_region_disk.py @@ -32,127 +32,128 @@ --- module: gcp_compute_region_disk description: - - Persistent disks are durable storage devices that function similarly to the physical - disks in a desktop or a server. Compute Engine manages the hardware behind these - devices to ensure data redundancy and optimize performance for you. Persistent disks - are available as either standard hard disk drives (HDD) or solid-state drives (SSD). - - Persistent disks are located independently from your virtual machine instances, - so you can detach or move persistent disks to keep your data even after you delete - your instances. Persistent disk performance scales automatically with size, so you - can resize your existing persistent disks or add more persistent disks to an instance - to meet your performance and storage space requirements. - - Add a persistent disk to your instance when you need reliable and affordable storage - with consistent performance characteristics. +- Persistent disks are durable storage devices that function similarly to the physical + disks in a desktop or a server. Compute Engine manages the hardware behind these + devices to ensure data redundancy and optimize performance for you. Persistent disks + are available as either standard hard disk drives (HDD) or solid-state drives (SSD). +- Persistent disks are located independently from your virtual machine instances, + so you can detach or move persistent disks to keep your data even after you delete + your instances. Persistent disk performance scales automatically with size, so you + can resize your existing persistent disks or add more persistent disks to an instance + to meet your performance and storage space requirements. +- Add a persistent disk to your instance when you need reliable and affordable storage + with consistent performance characteristics. short_description: Creates a GCP RegionDisk version_added: 2.8 author: Google Inc. (@googlecloudplatform) requirements: - - python >= 2.6 - - requests >= 2.18.4 - - google-auth >= 1.3.0 +- python >= 2.6 +- requests >= 2.18.4 +- google-auth >= 1.3.0 options: - state: - description: - - Whether the given object should exist in GCP - choices: ['present', 'absent'] - default: 'present' + state: description: + - Whether the given object should exist in GCP + choices: + - present + - absent + default: present + description: + description: + - An optional description of this resource. Provide this property when you create + the resource. + required: false + labels: + description: + - Labels to apply to this disk. A list of key->value pairs. + required: false + licenses: + description: + - Any applicable publicly visible licenses. + required: false + name: + description: + - Name of the resource. Provided by the client when the resource is created. The + name must be 1-63 characters long, and comply with RFC1035. Specifically, the + name must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` + which means the first character must be a lowercase letter, and all following + characters must be a dash, lowercase letter, or digit, except the last character, + which cannot be a dash. + required: true + size_gb: + description: + - Size of the persistent disk, specified in GB. You can specify this field when + creating a persistent disk using the sourceImage or sourceSnapshot parameter, + or specify it alone to create an empty persistent disk. + - If you specify this field along with sourceImage or sourceSnapshot, the value + of sizeGb must not be less than the size of the sourceImage or the size of the + snapshot. + required: false + replica_zones: + description: + - URLs of the zones where the disk should be replicated to. + required: true + type: + description: + - URL of the disk type resource describing which disk type to use to create the + disk. Provide this when creating the disk. + required: false + region: + description: + - A reference to the region where the disk resides. + required: true + disk_encryption_key: + description: + - Encrypts the disk using a customer-supplied encryption key. + - After you encrypt a disk with a customer-supplied key, you must provide the + same key if you use the disk later (e.g. to create a disk snapshot or an image, + or to attach the disk to a virtual machine). + - Customer-supplied encryption keys do not protect access to metadata of the disk. + - If you do not provide an encryption key when creating the disk, then the disk + will be encrypted using an automatically generated key and you do not need to + provide a key to use the disk later. + required: false + suboptions: + raw_key: description: - - An optional description of this resource. Provide this property when you create - the resource. - required: false - labels: - description: - - Labels to apply to this disk. A list of key->value pairs. - required: false - licenses: - description: - - Any applicable publicly visible licenses. - required: false - name: - description: - - Name of the resource. Provided by the client when the resource is created. The name - must be 1-63 characters long, and comply with RFC1035. Specifically, the name must - be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` - which means the first character must be a lowercase letter, and all following characters - must be a dash, lowercase letter, or digit, except the last character, which cannot - be a dash. - required: true - size_gb: - description: - - Size of the persistent disk, specified in GB. You can specify this field when creating - a persistent disk using the sourceImage or sourceSnapshot parameter, or specify - it alone to create an empty persistent disk. - - If you specify this field along with sourceImage or sourceSnapshot, the value of - sizeGb must not be less than the size of the sourceImage or the size of the snapshot. - required: false - replica_zones: - description: - - URLs of the zones where the disk should be replicated to. - required: true - type: - description: - - URL of the disk type resource describing which disk type to use to create the disk. - Provide this when creating the disk. + - Specifies a 256-bit customer-supplied encryption key, encoded in RFC 4648 + base64 to either encrypt or decrypt this resource. required: false - region: + sha256: description: - - A reference to the region where the disk resides. - required: true - disk_encryption_key: - description: - - Encrypts the disk using a customer-supplied encryption key. - - After you encrypt a disk with a customer-supplied key, you must provide the same - key if you use the disk later (e.g. to create a disk snapshot or an image, or to - attach the disk to a virtual machine). - - Customer-supplied encryption keys do not protect access to metadata of the disk. - - If you do not provide an encryption key when creating the disk, then the disk will - be encrypted using an automatically generated key and you do not need to provide - a key to use the disk later. + - The RFC 4648 base64 encoded SHA-256 hash of the customer-supplied encryption + key that protects this resource. required: false - suboptions: - raw_key: - description: - - Specifies a 256-bit customer-supplied encryption key, encoded in RFC 4648 base64 - to either encrypt or decrypt this resource. - required: false - sha256: - description: - - The RFC 4648 base64 encoded SHA-256 hash of the customer-supplied encryption key - that protects this resource. - required: false - source_snapshot: + source_snapshot: + description: + - The source snapshot used to create this disk. You can provide this as a partial + or full URL to the resource. + - 'This field represents a link to a Snapshot resource in GCP. It can be specified + in two ways. You can add `register: name-of-resource` to a gcp_compute_snapshot + task and then set this source_snapshot field to "{{ name-of-resource }}" Alternatively, + you can set this source_snapshot to a dictionary with the selfLink key where + the value is the selfLink of your Snapshot' + required: false + source_snapshot_encryption_key: + description: + - The customer-supplied encryption key of the source snapshot. Required if the + source snapshot is protected by a customer-supplied encryption key. + required: false + suboptions: + raw_key: description: - - 'The source snapshot used to create this disk. You can provide this as a partial or - full URL to the resource. For example, the following are valid values: * - `U(https://www.googleapis.com/compute/v1/projects/project/global/snapshots/snapshot`) - * `projects/project/global/snapshots/snapshot` * `global/snapshots/snapshot` .' - - 'This field represents a link to a Snapshot resource in GCP. It can be specified - in two ways. You can add `register: name-of-resource` to a gcp_compute_snapshot - task and then set this source_snapshot field to "{{ name-of-resource }}" Alternatively, - you can set this source_snapshot to a dictionary with the selfLink key where the - value is the selfLink of your Snapshot.' + - Specifies a 256-bit customer-supplied encryption key, encoded in RFC 4648 + base64 to either encrypt or decrypt this resource. required: false - source_snapshot_encryption_key: + sha256: description: - - The customer-supplied encryption key of the source snapshot. Required if the source - snapshot is protected by a customer-supplied encryption key. + - The RFC 4648 base64 encoded SHA-256 hash of the customer-supplied encryption + key that protects this resource. required: false - suboptions: - raw_key: - description: - - Specifies a 256-bit customer-supplied encryption key, encoded in RFC 4648 base64 - to either encrypt or decrypt this resource. - required: false - sha256: - description: - - The RFC 4648 base64 encoded SHA-256 hash of the customer-supplied encryption key - that protects this resource. - required: false extends_documentation_fragment: gcp notes: - - "API Reference: U(https://cloud.google.com/compute/docs/reference/rest/beta/regionDisks)" - - "Adding or Resizing Regional Persistent Disks: U(https://cloud.google.com/compute/docs/disks/regional-persistent-disk)" +- 'API Reference: U(https://cloud.google.com/compute/docs/reference/rest/beta/regionDisks)' +- 'Adding or Resizing Regional Persistent Disks: U(https://cloud.google.com/compute/docs/disks/regional-persistent-disk)' ''' EXAMPLES = ''' @@ -173,150 +174,149 @@ ''' RETURN = ''' - labelFingerprint: - description: - - The fingerprint used for optimistic locking of this resource. Used internally during - updates. - returned: success - type: str - creationTimestamp: - description: - - Creation timestamp in RFC3339 text format. - returned: success - type: str - description: - description: - - An optional description of this resource. Provide this property when you create - the resource. - returned: success - type: str - id: - description: - - The unique identifier for the resource. - returned: success - type: int - lastAttachTimestamp: - description: - - Last attach timestamp in RFC3339 text format. - returned: success - type: str - lastDetachTimestamp: - description: - - Last dettach timestamp in RFC3339 text format. - returned: success - type: str - labels: - description: - - Labels to apply to this disk. A list of key->value pairs. - returned: success - type: dict - licenses: - description: - - Any applicable publicly visible licenses. - returned: success - type: list - name: - description: - - Name of the resource. Provided by the client when the resource is created. The name - must be 1-63 characters long, and comply with RFC1035. Specifically, the name must - be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` - which means the first character must be a lowercase letter, and all following characters - must be a dash, lowercase letter, or digit, except the last character, which cannot - be a dash. - returned: success - type: str - sizeGb: - description: - - Size of the persistent disk, specified in GB. You can specify this field when creating - a persistent disk using the sourceImage or sourceSnapshot parameter, or specify - it alone to create an empty persistent disk. - - If you specify this field along with sourceImage or sourceSnapshot, the value of - sizeGb must not be less than the size of the sourceImage or the size of the snapshot. - returned: success - type: int - users: - description: - - 'Links to the users of the disk (attached instances) in form: project/zones/zone/instances/instance - .' - returned: success - type: list - replicaZones: - description: - - URLs of the zones where the disk should be replicated to. - returned: success - type: list - type: - description: - - URL of the disk type resource describing which disk type to use to create the disk. - Provide this when creating the disk. - returned: success - type: str - region: - description: - - A reference to the region where the disk resides. - returned: success - type: str - diskEncryptionKey: - description: - - Encrypts the disk using a customer-supplied encryption key. - - After you encrypt a disk with a customer-supplied key, you must provide the same - key if you use the disk later (e.g. to create a disk snapshot or an image, or to - attach the disk to a virtual machine). - - Customer-supplied encryption keys do not protect access to metadata of the disk. - - If you do not provide an encryption key when creating the disk, then the disk will - be encrypted using an automatically generated key and you do not need to provide - a key to use the disk later. - returned: success - type: complex - contains: - rawKey: - description: - - Specifies a 256-bit customer-supplied encryption key, encoded in RFC 4648 base64 - to either encrypt or decrypt this resource. - returned: success - type: str - sha256: - description: - - The RFC 4648 base64 encoded SHA-256 hash of the customer-supplied encryption key - that protects this resource. - returned: success - type: str - sourceSnapshot: - description: - - 'The source snapshot used to create this disk. You can provide this as a partial or - full URL to the resource. For example, the following are valid values: * - `U(https://www.googleapis.com/compute/v1/projects/project/global/snapshots/snapshot`) - * `projects/project/global/snapshots/snapshot` * `global/snapshots/snapshot` .' - returned: success - type: dict - sourceSnapshotEncryptionKey: - description: - - The customer-supplied encryption key of the source snapshot. Required if the source - snapshot is protected by a customer-supplied encryption key. - returned: success - type: complex - contains: - rawKey: - description: - - Specifies a 256-bit customer-supplied encryption key, encoded in RFC 4648 base64 - to either encrypt or decrypt this resource. - returned: success - type: str - sha256: - description: - - The RFC 4648 base64 encoded SHA-256 hash of the customer-supplied encryption key - that protects this resource. - returned: success - type: str - sourceSnapshotId: - description: - - The unique ID of the snapshot used to create this disk. This value identifies the - exact snapshot that was used to create this persistent disk. For example, if you - created the persistent disk from a snapshot that was later deleted and recreated - under the same name, the source snapshot ID would identify the exact version of - the snapshot that was used. - returned: success - type: str +labelFingerprint: + description: + - The fingerprint used for optimistic locking of this resource. Used internally + during updates. + returned: success + type: str +creationTimestamp: + description: + - Creation timestamp in RFC3339 text format. + returned: success + type: str +description: + description: + - An optional description of this resource. Provide this property when you create + the resource. + returned: success + type: str +id: + description: + - The unique identifier for the resource. + returned: success + type: int +lastAttachTimestamp: + description: + - Last attach timestamp in RFC3339 text format. + returned: success + type: str +lastDetachTimestamp: + description: + - Last dettach timestamp in RFC3339 text format. + returned: success + type: str +labels: + description: + - Labels to apply to this disk. A list of key->value pairs. + returned: success + type: dict +licenses: + description: + - Any applicable publicly visible licenses. + returned: success + type: list +name: + description: + - Name of the resource. Provided by the client when the resource is created. The + name must be 1-63 characters long, and comply with RFC1035. Specifically, the + name must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` + which means the first character must be a lowercase letter, and all following + characters must be a dash, lowercase letter, or digit, except the last character, + which cannot be a dash. + returned: success + type: str +sizeGb: + description: + - Size of the persistent disk, specified in GB. You can specify this field when + creating a persistent disk using the sourceImage or sourceSnapshot parameter, + or specify it alone to create an empty persistent disk. + - If you specify this field along with sourceImage or sourceSnapshot, the value + of sizeGb must not be less than the size of the sourceImage or the size of the + snapshot. + returned: success + type: int +users: + description: + - 'Links to the users of the disk (attached instances) in form: project/zones/zone/instances/instance + .' + returned: success + type: list +replicaZones: + description: + - URLs of the zones where the disk should be replicated to. + returned: success + type: list +type: + description: + - URL of the disk type resource describing which disk type to use to create the + disk. Provide this when creating the disk. + returned: success + type: str +region: + description: + - A reference to the region where the disk resides. + returned: success + type: str +diskEncryptionKey: + description: + - Encrypts the disk using a customer-supplied encryption key. + - After you encrypt a disk with a customer-supplied key, you must provide the same + key if you use the disk later (e.g. to create a disk snapshot or an image, or + to attach the disk to a virtual machine). + - Customer-supplied encryption keys do not protect access to metadata of the disk. + - If you do not provide an encryption key when creating the disk, then the disk + will be encrypted using an automatically generated key and you do not need to + provide a key to use the disk later. + returned: success + type: complex + contains: + rawKey: + description: + - Specifies a 256-bit customer-supplied encryption key, encoded in RFC 4648 + base64 to either encrypt or decrypt this resource. + returned: success + type: str + sha256: + description: + - The RFC 4648 base64 encoded SHA-256 hash of the customer-supplied encryption + key that protects this resource. + returned: success + type: str +sourceSnapshot: + description: + - The source snapshot used to create this disk. You can provide this as a partial + or full URL to the resource. + returned: success + type: dict +sourceSnapshotEncryptionKey: + description: + - The customer-supplied encryption key of the source snapshot. Required if the source + snapshot is protected by a customer-supplied encryption key. + returned: success + type: complex + contains: + rawKey: + description: + - Specifies a 256-bit customer-supplied encryption key, encoded in RFC 4648 + base64 to either encrypt or decrypt this resource. + returned: success + type: str + sha256: + description: + - The RFC 4648 base64 encoded SHA-256 hash of the customer-supplied encryption + key that protects this resource. + returned: success + type: str +sourceSnapshotId: + description: + - The unique ID of the snapshot used to create this disk. This value identifies + the exact snapshot that was used to create this persistent disk. For example, + if you created the persistent disk from a snapshot that was later deleted and + recreated under the same name, the source snapshot ID would identify the exact + version of the snapshot that was used. + returned: success + type: str ''' ################################################################################ diff --git a/lib/ansible/modules/cloud/google/gcp_compute_region_disk_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_region_disk_facts.py index 99810136f6c186..76dbfa764295de 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_region_disk_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_region_disk_facts.py @@ -32,25 +32,24 @@ --- module: gcp_compute_region_disk_facts description: - - Gather facts for GCP RegionDisk +- Gather facts for GCP RegionDisk short_description: Gather facts for GCP RegionDisk version_added: 2.8 author: Google Inc. (@googlecloudplatform) requirements: - - python >= 2.6 - - requests >= 2.18.4 - - google-auth >= 1.3.0 +- python >= 2.6 +- requests >= 2.18.4 +- google-auth >= 1.3.0 options: - filters: - description: - A list of filter value pairs. Available filters are listed here - U(https://cloud.google.com/sdk/gcloud/reference/topic/filters). - Each additional filter in the list will act be added as an AND condition - (filter1 and filter2) - region: - description: - - A reference to the region where the disk resides. - required: true + filters: + description: + - A list of filter value pairs. Available filters are listed here U(U(https://cloud.google.com/sdk/gcloud/reference/topic/filters).) + - Each additional filter in the list will act be added as an AND condition (filter1 + and filter2) . + region: + description: + - A reference to the region where the disk resides. + required: true extends_documentation_fragment: gcp ''' @@ -67,154 +66,154 @@ RETURN = ''' items: - description: List of items - returned: always - type: complex - contains: - labelFingerprint: - description: - - The fingerprint used for optimistic locking of this resource. Used internally during - updates. - returned: success - type: str - creationTimestamp: - description: - - Creation timestamp in RFC3339 text format. - returned: success - type: str - description: - description: - - An optional description of this resource. Provide this property when you create - the resource. - returned: success - type: str - id: - description: - - The unique identifier for the resource. - returned: success - type: int - lastAttachTimestamp: - description: - - Last attach timestamp in RFC3339 text format. - returned: success - type: str - lastDetachTimestamp: - description: - - Last dettach timestamp in RFC3339 text format. - returned: success - type: str - labels: - description: - - Labels to apply to this disk. A list of key->value pairs. - returned: success - type: dict - licenses: - description: - - Any applicable publicly visible licenses. - returned: success - type: list - name: - description: - - Name of the resource. Provided by the client when the resource is created. The name - must be 1-63 characters long, and comply with RFC1035. Specifically, the name must - be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` - which means the first character must be a lowercase letter, and all following characters - must be a dash, lowercase letter, or digit, except the last character, which cannot - be a dash. - returned: success - type: str - sizeGb: - description: - - Size of the persistent disk, specified in GB. You can specify this field when creating - a persistent disk using the sourceImage or sourceSnapshot parameter, or specify - it alone to create an empty persistent disk. - - If you specify this field along with sourceImage or sourceSnapshot, the value of - sizeGb must not be less than the size of the sourceImage or the size of the snapshot. - returned: success - type: int - users: - description: - - 'Links to the users of the disk (attached instances) in form: project/zones/zone/instances/instance - .' - returned: success - type: list - replicaZones: - description: - - URLs of the zones where the disk should be replicated to. - returned: success - type: list - type: - description: - - URL of the disk type resource describing which disk type to use to create the disk. - Provide this when creating the disk. - returned: success - type: str - region: - description: - - A reference to the region where the disk resides. - returned: success - type: str - diskEncryptionKey: - description: - - Encrypts the disk using a customer-supplied encryption key. - - After you encrypt a disk with a customer-supplied key, you must provide the same - key if you use the disk later (e.g. to create a disk snapshot or an image, or to - attach the disk to a virtual machine). - - Customer-supplied encryption keys do not protect access to metadata of the disk. - - If you do not provide an encryption key when creating the disk, then the disk will - be encrypted using an automatically generated key and you do not need to provide - a key to use the disk later. - returned: success - type: complex - contains: - rawKey: - description: - - Specifies a 256-bit customer-supplied encryption key, encoded in RFC 4648 base64 - to either encrypt or decrypt this resource. - returned: success - type: str - sha256: - description: - - The RFC 4648 base64 encoded SHA-256 hash of the customer-supplied encryption key - that protects this resource. - returned: success - type: str - sourceSnapshot: - description: - - 'The source snapshot used to create this disk. You can provide this as a partial - or full URL to the resource. For example, the following are valid values: * - `U(https://www.googleapis.com/compute/v1/projects/project/global/snapshots/snapshot`) - * `projects/project/global/snapshots/snapshot` * `global/snapshots/snapshot` .' - returned: success - type: dict - sourceSnapshotEncryptionKey: - description: - - The customer-supplied encryption key of the source snapshot. Required if the source - snapshot is protected by a customer-supplied encryption key. - returned: success - type: complex - contains: - rawKey: - description: - - Specifies a 256-bit customer-supplied encryption key, encoded in RFC 4648 base64 - to either encrypt or decrypt this resource. - returned: success - type: str - sha256: - description: - - The RFC 4648 base64 encoded SHA-256 hash of the customer-supplied encryption key - that protects this resource. - returned: success - type: str - sourceSnapshotId: - description: - - The unique ID of the snapshot used to create this disk. This value identifies the - exact snapshot that was used to create this persistent disk. For example, if you - created the persistent disk from a snapshot that was later deleted and recreated - under the same name, the source snapshot ID would identify the exact version of - the snapshot that was used. - returned: success - type: str + description: List of items + returned: always + type: complex + contains: + labelFingerprint: + description: + - The fingerprint used for optimistic locking of this resource. Used internally + during updates. + returned: success + type: str + creationTimestamp: + description: + - Creation timestamp in RFC3339 text format. + returned: success + type: str + description: + description: + - An optional description of this resource. Provide this property when you create + the resource. + returned: success + type: str + id: + description: + - The unique identifier for the resource. + returned: success + type: int + lastAttachTimestamp: + description: + - Last attach timestamp in RFC3339 text format. + returned: success + type: str + lastDetachTimestamp: + description: + - Last dettach timestamp in RFC3339 text format. + returned: success + type: str + labels: + description: + - Labels to apply to this disk. A list of key->value pairs. + returned: success + type: dict + licenses: + description: + - Any applicable publicly visible licenses. + returned: success + type: list + name: + description: + - Name of the resource. Provided by the client when the resource is created. + The name must be 1-63 characters long, and comply with RFC1035. Specifically, + the name must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` + which means the first character must be a lowercase letter, and all following + characters must be a dash, lowercase letter, or digit, except the last character, + which cannot be a dash. + returned: success + type: str + sizeGb: + description: + - Size of the persistent disk, specified in GB. You can specify this field when + creating a persistent disk using the sourceImage or sourceSnapshot parameter, + or specify it alone to create an empty persistent disk. + - If you specify this field along with sourceImage or sourceSnapshot, the value + of sizeGb must not be less than the size of the sourceImage or the size of + the snapshot. + returned: success + type: int + users: + description: + - 'Links to the users of the disk (attached instances) in form: project/zones/zone/instances/instance + .' + returned: success + type: list + replicaZones: + description: + - URLs of the zones where the disk should be replicated to. + returned: success + type: list + type: + description: + - URL of the disk type resource describing which disk type to use to create + the disk. Provide this when creating the disk. + returned: success + type: str + region: + description: + - A reference to the region where the disk resides. + returned: success + type: str + diskEncryptionKey: + description: + - Encrypts the disk using a customer-supplied encryption key. + - After you encrypt a disk with a customer-supplied key, you must provide the + same key if you use the disk later (e.g. to create a disk snapshot or an image, + or to attach the disk to a virtual machine). + - Customer-supplied encryption keys do not protect access to metadata of the + disk. + - If you do not provide an encryption key when creating the disk, then the disk + will be encrypted using an automatically generated key and you do not need + to provide a key to use the disk later. + returned: success + type: complex + contains: + rawKey: + description: + - Specifies a 256-bit customer-supplied encryption key, encoded in RFC 4648 + base64 to either encrypt or decrypt this resource. + returned: success + type: str + sha256: + description: + - The RFC 4648 base64 encoded SHA-256 hash of the customer-supplied encryption + key that protects this resource. + returned: success + type: str + sourceSnapshot: + description: + - The source snapshot used to create this disk. You can provide this as a partial + or full URL to the resource. + returned: success + type: dict + sourceSnapshotEncryptionKey: + description: + - The customer-supplied encryption key of the source snapshot. Required if the + source snapshot is protected by a customer-supplied encryption key. + returned: success + type: complex + contains: + rawKey: + description: + - Specifies a 256-bit customer-supplied encryption key, encoded in RFC 4648 + base64 to either encrypt or decrypt this resource. + returned: success + type: str + sha256: + description: + - The RFC 4648 base64 encoded SHA-256 hash of the customer-supplied encryption + key that protects this resource. + returned: success + type: str + sourceSnapshotId: + description: + - The unique ID of the snapshot used to create this disk. This value identifies + the exact snapshot that was used to create this persistent disk. For example, + if you created the persistent disk from a snapshot that was later deleted + and recreated under the same name, the source snapshot ID would identify the + exact version of the snapshot that was used. + returned: success + type: str ''' ################################################################################ diff --git a/lib/ansible/modules/cloud/google/gcp_compute_route.py b/lib/ansible/modules/cloud/google/gcp_compute_route.py index bbda85c765e77f..5bd29a366a4886 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_route.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_route.py @@ -32,103 +32,105 @@ --- module: gcp_compute_route description: - - Represents a Route resource. - - A route is a rule that specifies how certain packets should be handled by the virtual - network. Routes are associated with virtual machines by tag, and the set of routes - for a particular virtual machine is called its routing table. For each packet leaving - a virtual machine, the system searches that virtual machine's routing table for - a single best matching route. - - Routes match packets by destination IP address, preferring smaller or more specific - ranges over larger ones. If there is a tie, the system selects the route with the - smallest priority value. If there is still a tie, it uses the layer three and four - packet headers to select just one of the remaining matching routes. The packet is - then forwarded as specified by the next_hop field of the winning route -- either - to another virtual machine destination, a virtual machine gateway or a Compute Engine-operated - gateway. Packets that do not match any route in the sending virtual machine's routing - table will be dropped. - - A Route resource must have exactly one specification of either nextHopGateway, nextHopInstance, - nextHopIp, or nextHopVpnTunnel. +- Represents a Route resource. +- A route is a rule that specifies how certain packets should be handled by the virtual + network. Routes are associated with virtual machines by tag, and the set of routes + for a particular virtual machine is called its routing table. For each packet leaving + a virtual machine, the system searches that virtual machine's routing table for + a single best matching route. +- Routes match packets by destination IP address, preferring smaller or more specific + ranges over larger ones. If there is a tie, the system selects the route with the + smallest priority value. If there is still a tie, it uses the layer three and four + packet headers to select just one of the remaining matching routes. The packet is + then forwarded as specified by the next_hop field of the winning route -- either + to another virtual machine destination, a virtual machine gateway or a Compute Engine-operated + gateway. Packets that do not match any route in the sending virtual machine's routing + table will be dropped. +- A Route resource must have exactly one specification of either nextHopGateway, nextHopInstance, + nextHopIp, or nextHopVpnTunnel. short_description: Creates a GCP Route version_added: 2.6 author: Google Inc. (@googlecloudplatform) requirements: - - python >= 2.6 - - requests >= 2.18.4 - - google-auth >= 1.3.0 +- python >= 2.6 +- requests >= 2.18.4 +- google-auth >= 1.3.0 options: - state: - description: - - Whether the given object should exist in GCP - choices: ['present', 'absent'] - default: 'present' - dest_range: - description: - - The destination range of outgoing packets that this route applies to. - - Only IPv4 is supported. - required: true + state: description: - description: - - An optional description of this resource. Provide this property when you create - the resource. - required: false - version_added: 2.7 - name: - description: - - Name of the resource. Provided by the client when the resource is created. The name - must be 1-63 characters long, and comply with RFC1035. Specifically, the name must - be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` - which means the first character must be a lowercase letter, and all following characters - must be a dash, lowercase letter, or digit, except the last character, which cannot - be a dash. - required: true - network: - description: - - The network that this route applies to. - - 'This field represents a link to a Network resource in GCP. It can be specified - in two ways. You can add `register: name-of-resource` to a gcp_compute_network task - and then set this network field to "{{ name-of-resource }}" Alternatively, you can - set this network to a dictionary with the selfLink key where the value is the selfLink - of your Network.' - required: true - priority: - description: - - The priority of this route. Priority is used to break ties in cases where there - is more than one matching route of equal prefix length. - - In the case of two routes with equal prefix length, the one with the lowest-numbered - priority value wins. - - Default value is 1000. Valid range is 0 through 65535. - required: false - tags: - description: - - A list of instance tags to which this route applies. - required: false - next_hop_gateway: - description: - - URL to a gateway that should handle matching packets. - - 'Currently, you can only specify the internet gateway, using a full or partial valid - URL: * U(https://www.googleapis.com/compute/v1/projects/project/global/gateways/default-internet-gateway) - * projects/project/global/gateways/default-internet-gateway * global/gateways/default-internet-gateway - .' - required: false - next_hop_instance: - description: - - URL to an instance that should handle matching packets. - - 'You can specify this as a full or partial URL. For example: * U(https://www.googleapis.com/compute/v1/projects/project/zones/zone/) - instances/instance * projects/project/zones/zone/instances/instance * zones/zone/instances/instance - .' - required: false - next_hop_ip: - description: - - Network IP address of an instance that should handle matching packets. - required: false - next_hop_vpn_tunnel: - description: - - URL to a VpnTunnel that should handle matching packets. - required: false + - Whether the given object should exist in GCP + choices: + - present + - absent + default: present + dest_range: + description: + - The destination range of outgoing packets that this route applies to. + - Only IPv4 is supported. + required: true + description: + description: + - An optional description of this resource. Provide this property when you create + the resource. + required: false + version_added: 2.7 + name: + description: + - Name of the resource. Provided by the client when the resource is created. The + name must be 1-63 characters long, and comply with RFC1035. Specifically, the + name must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` + which means the first character must be a lowercase letter, and all following + characters must be a dash, lowercase letter, or digit, except the last character, + which cannot be a dash. + required: true + network: + description: + - The network that this route applies to. + - 'This field represents a link to a Network resource in GCP. It can be specified + in two ways. You can add `register: name-of-resource` to a gcp_compute_network + task and then set this network field to "{{ name-of-resource }}" Alternatively, + you can set this network to a dictionary with the selfLink key where the value + is the selfLink of your Network' + required: true + priority: + description: + - The priority of this route. Priority is used to break ties in cases where there + is more than one matching route of equal prefix length. + - In the case of two routes with equal prefix length, the one with the lowest-numbered + priority value wins. + - Default value is 1000. Valid range is 0 through 65535. + required: false + tags: + description: + - A list of instance tags to which this route applies. + required: false + next_hop_gateway: + description: + - URL to a gateway that should handle matching packets. + - 'Currently, you can only specify the internet gateway, using a full or partial + valid URL: * U(https://www.googleapis.com/compute/v1/projects/project/global/gateways/default-internet-gateway) + * projects/project/global/gateways/default-internet-gateway * global/gateways/default-internet-gateway + .' + required: false + next_hop_instance: + description: + - URL to an instance that should handle matching packets. + - 'You can specify this as a full or partial URL. For example: * U(https://www.googleapis.com/compute/v1/projects/project/zones/zone/) + instances/instance * projects/project/zones/zone/instances/instance * zones/zone/instances/instance + .' + required: false + next_hop_ip: + description: + - Network IP address of an instance that should handle matching packets. + required: false + next_hop_vpn_tunnel: + description: + - URL to a VpnTunnel that should handle matching packets. + required: false extends_documentation_fragment: gcp notes: - - "API Reference: U(https://cloud.google.com/compute/docs/reference/rest/v1/routes)" - - "Using Routes: U(https://cloud.google.com/vpc/docs/using-routes)" +- 'API Reference: U(https://cloud.google.com/compute/docs/reference/rest/v1/routes)' +- 'Using Routes: U(https://cloud.google.com/vpc/docs/using-routes)' ''' EXAMPLES = ''' @@ -157,79 +159,79 @@ ''' RETURN = ''' - destRange: - description: - - The destination range of outgoing packets that this route applies to. - - Only IPv4 is supported. - returned: success - type: str - description: - description: - - An optional description of this resource. Provide this property when you create - the resource. - returned: success - type: str - name: - description: - - Name of the resource. Provided by the client when the resource is created. The name - must be 1-63 characters long, and comply with RFC1035. Specifically, the name must - be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` - which means the first character must be a lowercase letter, and all following characters - must be a dash, lowercase letter, or digit, except the last character, which cannot - be a dash. - returned: success - type: str - network: - description: - - The network that this route applies to. - returned: success - type: dict - priority: - description: - - The priority of this route. Priority is used to break ties in cases where there - is more than one matching route of equal prefix length. - - In the case of two routes with equal prefix length, the one with the lowest-numbered - priority value wins. - - Default value is 1000. Valid range is 0 through 65535. - returned: success - type: int - tags: - description: - - A list of instance tags to which this route applies. - returned: success - type: list - nextHopGateway: - description: - - URL to a gateway that should handle matching packets. - - 'Currently, you can only specify the internet gateway, using a full or partial valid - URL: * U(https://www.googleapis.com/compute/v1/projects/project/global/gateways/default-internet-gateway) - * projects/project/global/gateways/default-internet-gateway * global/gateways/default-internet-gateway - .' - returned: success - type: str - nextHopInstance: - description: - - URL to an instance that should handle matching packets. - - 'You can specify this as a full or partial URL. For example: * U(https://www.googleapis.com/compute/v1/projects/project/zones/zone/) - instances/instance * projects/project/zones/zone/instances/instance * zones/zone/instances/instance - .' - returned: success - type: str - nextHopIp: - description: - - Network IP address of an instance that should handle matching packets. - returned: success - type: str - nextHopVpnTunnel: - description: - - URL to a VpnTunnel that should handle matching packets. - returned: success - type: str - nextHopNetwork: - description: - - URL to a Network that should handle matching packets. - returned: success - type: str +destRange: + description: + - The destination range of outgoing packets that this route applies to. + - Only IPv4 is supported. + returned: success + type: str +description: + description: + - An optional description of this resource. Provide this property when you create + the resource. + returned: success + type: str +name: + description: + - Name of the resource. Provided by the client when the resource is created. The + name must be 1-63 characters long, and comply with RFC1035. Specifically, the + name must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` + which means the first character must be a lowercase letter, and all following + characters must be a dash, lowercase letter, or digit, except the last character, + which cannot be a dash. + returned: success + type: str +network: + description: + - The network that this route applies to. + returned: success + type: dict +priority: + description: + - The priority of this route. Priority is used to break ties in cases where there + is more than one matching route of equal prefix length. + - In the case of two routes with equal prefix length, the one with the lowest-numbered + priority value wins. + - Default value is 1000. Valid range is 0 through 65535. + returned: success + type: int +tags: + description: + - A list of instance tags to which this route applies. + returned: success + type: list +nextHopGateway: + description: + - URL to a gateway that should handle matching packets. + - 'Currently, you can only specify the internet gateway, using a full or partial + valid URL: * U(https://www.googleapis.com/compute/v1/projects/project/global/gateways/default-internet-gateway) + * projects/project/global/gateways/default-internet-gateway * global/gateways/default-internet-gateway + .' + returned: success + type: str +nextHopInstance: + description: + - URL to an instance that should handle matching packets. + - 'You can specify this as a full or partial URL. For example: * U(https://www.googleapis.com/compute/v1/projects/project/zones/zone/) + instances/instance * projects/project/zones/zone/instances/instance * zones/zone/instances/instance + .' + returned: success + type: str +nextHopIp: + description: + - Network IP address of an instance that should handle matching packets. + returned: success + type: str +nextHopVpnTunnel: + description: + - URL to a VpnTunnel that should handle matching packets. + returned: success + type: str +nextHopNetwork: + description: + - URL to a Network that should handle matching packets. + returned: success + type: str ''' ################################################################################ diff --git a/lib/ansible/modules/cloud/google/gcp_compute_route_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_route_facts.py index 312d9af00cf598..da6e4e4114b14e 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_route_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_route_facts.py @@ -32,21 +32,20 @@ --- module: gcp_compute_route_facts description: - - Gather facts for GCP Route +- Gather facts for GCP Route short_description: Gather facts for GCP Route version_added: 2.7 author: Google Inc. (@googlecloudplatform) requirements: - - python >= 2.6 - - requests >= 2.18.4 - - google-auth >= 1.3.0 +- python >= 2.6 +- requests >= 2.18.4 +- google-auth >= 1.3.0 options: - filters: - description: - A list of filter value pairs. Available filters are listed here - U(https://cloud.google.com/sdk/gcloud/reference/topic/filters). - Each additional filter in the list will act be added as an AND condition - (filter1 and filter2) + filters: + description: + - A list of filter value pairs. Available filters are listed here U(U(https://cloud.google.com/sdk/gcloud/reference/topic/filters).) + - Each additional filter in the list will act be added as an AND condition (filter1 + and filter2) . extends_documentation_fragment: gcp ''' @@ -62,83 +61,83 @@ RETURN = ''' items: - description: List of items - returned: always - type: complex - contains: - destRange: - description: - - The destination range of outgoing packets that this route applies to. - - Only IPv4 is supported. - returned: success - type: str - description: - description: - - An optional description of this resource. Provide this property when you create - the resource. - returned: success - type: str - name: - description: - - Name of the resource. Provided by the client when the resource is created. The name - must be 1-63 characters long, and comply with RFC1035. Specifically, the name must - be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` - which means the first character must be a lowercase letter, and all following characters - must be a dash, lowercase letter, or digit, except the last character, which cannot - be a dash. - returned: success - type: str - network: - description: - - The network that this route applies to. - returned: success - type: dict - priority: - description: - - The priority of this route. Priority is used to break ties in cases where there - is more than one matching route of equal prefix length. - - In the case of two routes with equal prefix length, the one with the lowest-numbered - priority value wins. - - Default value is 1000. Valid range is 0 through 65535. - returned: success - type: int - tags: - description: - - A list of instance tags to which this route applies. - returned: success - type: list - nextHopGateway: - description: - - URL to a gateway that should handle matching packets. - - 'Currently, you can only specify the internet gateway, using a full or partial valid - URL: * U(https://www.googleapis.com/compute/v1/projects/project/global/gateways/default-internet-gateway) - * projects/project/global/gateways/default-internet-gateway * global/gateways/default-internet-gateway - .' - returned: success - type: str - nextHopInstance: - description: - - URL to an instance that should handle matching packets. - - 'You can specify this as a full or partial URL. For example: * U(https://www.googleapis.com/compute/v1/projects/project/zones/zone/) - instances/instance * projects/project/zones/zone/instances/instance * zones/zone/instances/instance - .' - returned: success - type: str - nextHopIp: - description: - - Network IP address of an instance that should handle matching packets. - returned: success - type: str - nextHopVpnTunnel: - description: - - URL to a VpnTunnel that should handle matching packets. - returned: success - type: str - nextHopNetwork: - description: - - URL to a Network that should handle matching packets. - returned: success - type: str + description: List of items + returned: always + type: complex + contains: + destRange: + description: + - The destination range of outgoing packets that this route applies to. + - Only IPv4 is supported. + returned: success + type: str + description: + description: + - An optional description of this resource. Provide this property when you create + the resource. + returned: success + type: str + name: + description: + - Name of the resource. Provided by the client when the resource is created. + The name must be 1-63 characters long, and comply with RFC1035. Specifically, + the name must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` + which means the first character must be a lowercase letter, and all following + characters must be a dash, lowercase letter, or digit, except the last character, + which cannot be a dash. + returned: success + type: str + network: + description: + - The network that this route applies to. + returned: success + type: dict + priority: + description: + - The priority of this route. Priority is used to break ties in cases where + there is more than one matching route of equal prefix length. + - In the case of two routes with equal prefix length, the one with the lowest-numbered + priority value wins. + - Default value is 1000. Valid range is 0 through 65535. + returned: success + type: int + tags: + description: + - A list of instance tags to which this route applies. + returned: success + type: list + nextHopGateway: + description: + - URL to a gateway that should handle matching packets. + - 'Currently, you can only specify the internet gateway, using a full or partial + valid URL: * U(https://www.googleapis.com/compute/v1/projects/project/global/gateways/default-internet-gateway) + * projects/project/global/gateways/default-internet-gateway * global/gateways/default-internet-gateway + .' + returned: success + type: str + nextHopInstance: + description: + - URL to an instance that should handle matching packets. + - 'You can specify this as a full or partial URL. For example: * U(https://www.googleapis.com/compute/v1/projects/project/zones/zone/) + instances/instance * projects/project/zones/zone/instances/instance * zones/zone/instances/instance + .' + returned: success + type: str + nextHopIp: + description: + - Network IP address of an instance that should handle matching packets. + returned: success + type: str + nextHopVpnTunnel: + description: + - URL to a VpnTunnel that should handle matching packets. + returned: success + type: str + nextHopNetwork: + description: + - URL to a Network that should handle matching packets. + returned: success + type: str ''' ################################################################################ diff --git a/lib/ansible/modules/cloud/google/gcp_compute_router.py b/lib/ansible/modules/cloud/google/gcp_compute_router.py index 40d88a7d9e9996..c3b225a2711eeb 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_router.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_router.py @@ -32,91 +32,97 @@ --- module: gcp_compute_router description: - - Represents a Router resource. +- Represents a Router resource. short_description: Creates a GCP Router version_added: 2.7 author: Google Inc. (@googlecloudplatform) requirements: - - python >= 2.6 - - requests >= 2.18.4 - - google-auth >= 1.3.0 +- python >= 2.6 +- requests >= 2.18.4 +- google-auth >= 1.3.0 options: - state: - description: - - Whether the given object should exist in GCP - choices: ['present', 'absent'] - default: 'present' - name: + state: + description: + - Whether the given object should exist in GCP + choices: + - present + - absent + default: present + name: + description: + - Name of the resource. The name must be 1-63 characters long, and comply with + RFC1035. Specifically, the name must be 1-63 characters long and match the regular + expression `[a-z]([-a-z0-9]*[a-z0-9])?` which means the first character must + be a lowercase letter, and all following characters must be a dash, lowercase + letter, or digit, except the last character, which cannot be a dash. + required: true + description: + description: + - An optional description of this resource. + required: false + network: + description: + - A reference to the network to which this router belongs. + - 'This field represents a link to a Network resource in GCP. It can be specified + in two ways. You can add `register: name-of-resource` to a gcp_compute_network + task and then set this network field to "{{ name-of-resource }}" Alternatively, + you can set this network to a dictionary with the selfLink key where the value + is the selfLink of your Network' + required: true + bgp: + description: + - BGP information specific to this router. + required: false + suboptions: + asn: description: - - Name of the resource. The name must be 1-63 characters long, and comply with RFC1035. - Specifically, the name must be 1-63 characters long and match the regular expression - `[a-z]([-a-z0-9]*[a-z0-9])?` which means the first character must be a lowercase - letter, and all following characters must be a dash, lowercase letter, or digit, - except the last character, which cannot be a dash. + - Local BGP Autonomous System Number (ASN). Must be an RFC6996 private ASN, + either 16-bit or 32-bit. The value will be fixed for this router resource. + All VPN tunnels that link to this router will have the same local ASN. required: true - description: + advertise_mode: description: - - An optional description of this resource. + - User-specified flag to indicate which mode to use for advertisement. + - 'Valid values of this enum field are: DEFAULT, CUSTOM .' required: false - network: + default: DEFAULT + choices: + - DEFAULT + - CUSTOM + advertised_groups: description: - - A reference to the network to which this router belongs. - - 'This field represents a link to a Network resource in GCP. It can be specified - in two ways. You can add `register: name-of-resource` to a gcp_compute_network task - and then set this network field to "{{ name-of-resource }}" Alternatively, you can - set this network to a dictionary with the selfLink key where the value is the selfLink - of your Network.' - required: true - bgp: + - User-specified list of prefix groups to advertise in custom mode. + - This field can only be populated if advertiseMode is CUSTOM and is advertised + to all peers of the router. These groups will be advertised in addition + to any specified prefixes. Leave this field blank to advertise no custom + groups. + - 'This enum field has the one valid value: ALL_SUBNETS .' + required: false + advertised_ip_ranges: description: - - BGP information specific to this router. + - User-specified list of individual IP ranges to advertise in custom mode. + This field can only be populated if advertiseMode is CUSTOM and is advertised + to all peers of the router. These IP ranges will be advertised in addition + to any specified groups. + - Leave this field blank to advertise no custom IP ranges. required: false suboptions: - asn: - description: - - Local BGP Autonomous System Number (ASN). Must be an RFC6996 private ASN, either - 16-bit or 32-bit. The value will be fixed for this router resource. All VPN tunnels - that link to this router will have the same local ASN. - required: true - advertise_mode: - description: - - User-specified flag to indicate which mode to use for advertisement. - - 'Valid values of this enum field are: DEFAULT, CUSTOM .' - required: false - default: DEFAULT - choices: ['DEFAULT', 'CUSTOM'] - advertised_groups: - description: - - User-specified list of prefix groups to advertise in custom mode. - - This field can only be populated if advertiseMode is CUSTOM and is advertised to - all peers of the router. These groups will be advertised in addition to any specified - prefixes. Leave this field blank to advertise no custom groups. - - 'This enum field has the one valid value: ALL_SUBNETS .' - required: false - advertised_ip_ranges: - description: - - User-specified list of individual IP ranges to advertise in custom mode. This field - can only be populated if advertiseMode is CUSTOM and is advertised to all peers - of the router. These IP ranges will be advertised in addition to any specified groups. - - Leave this field blank to advertise no custom IP ranges. - required: false - suboptions: - range: - description: - - The IP range to advertise. The value must be a CIDR-formatted string. - required: false - description: - description: - - User-specified description for the IP range. - required: false - region: - description: - - Region where the router resides. - required: true + range: + description: + - The IP range to advertise. The value must be a CIDR-formatted string. + required: false + description: + description: + - User-specified description for the IP range. + required: false + region: + description: + - Region where the router resides. + required: true extends_documentation_fragment: gcp notes: - - "API Reference: U(https://cloud.google.com/compute/docs/reference/rest/v1/routers)" - - "Google Cloud Router: U(https://cloud.google.com/router/docs/)" +- 'API Reference: U(https://cloud.google.com/compute/docs/reference/rest/v1/routers)' +- 'Google Cloud Router: U(https://cloud.google.com/router/docs/)' ''' EXAMPLES = ''' @@ -149,87 +155,88 @@ ''' RETURN = ''' - id: - description: - - The unique identifier for the resource. - returned: success - type: int - creationTimestamp: - description: - - Creation timestamp in RFC3339 text format. - returned: success - type: str - name: - description: - - Name of the resource. The name must be 1-63 characters long, and comply with RFC1035. - Specifically, the name must be 1-63 characters long and match the regular expression - `[a-z]([-a-z0-9]*[a-z0-9])?` which means the first character must be a lowercase - letter, and all following characters must be a dash, lowercase letter, or digit, - except the last character, which cannot be a dash. - returned: success - type: str - description: - description: - - An optional description of this resource. - returned: success - type: str - network: - description: - - A reference to the network to which this router belongs. - returned: success - type: dict - bgp: - description: - - BGP information specific to this router. - returned: success - type: complex - contains: - asn: - description: - - Local BGP Autonomous System Number (ASN). Must be an RFC6996 private ASN, either - 16-bit or 32-bit. The value will be fixed for this router resource. All VPN tunnels - that link to this router will have the same local ASN. - returned: success - type: int - advertiseMode: - description: - - User-specified flag to indicate which mode to use for advertisement. - - 'Valid values of this enum field are: DEFAULT, CUSTOM .' - returned: success - type: str - advertisedGroups: - description: - - User-specified list of prefix groups to advertise in custom mode. - - This field can only be populated if advertiseMode is CUSTOM and is advertised to - all peers of the router. These groups will be advertised in addition to any specified - prefixes. Leave this field blank to advertise no custom groups. - - 'This enum field has the one valid value: ALL_SUBNETS .' - returned: success - type: list - advertisedIpRanges: - description: - - User-specified list of individual IP ranges to advertise in custom mode. This field - can only be populated if advertiseMode is CUSTOM and is advertised to all peers - of the router. These IP ranges will be advertised in addition to any specified groups. - - Leave this field blank to advertise no custom IP ranges. - returned: success - type: complex - contains: - range: - description: - - The IP range to advertise. The value must be a CIDR-formatted string. - returned: success - type: str - description: - description: - - User-specified description for the IP range. - returned: success - type: str - region: +id: + description: + - The unique identifier for the resource. + returned: success + type: int +creationTimestamp: + description: + - Creation timestamp in RFC3339 text format. + returned: success + type: str +name: + description: + - Name of the resource. The name must be 1-63 characters long, and comply with RFC1035. + Specifically, the name must be 1-63 characters long and match the regular expression + `[a-z]([-a-z0-9]*[a-z0-9])?` which means the first character must be a lowercase + letter, and all following characters must be a dash, lowercase letter, or digit, + except the last character, which cannot be a dash. + returned: success + type: str +description: + description: + - An optional description of this resource. + returned: success + type: str +network: + description: + - A reference to the network to which this router belongs. + returned: success + type: dict +bgp: + description: + - BGP information specific to this router. + returned: success + type: complex + contains: + asn: + description: + - Local BGP Autonomous System Number (ASN). Must be an RFC6996 private ASN, + either 16-bit or 32-bit. The value will be fixed for this router resource. + All VPN tunnels that link to this router will have the same local ASN. + returned: success + type: int + advertiseMode: + description: + - User-specified flag to indicate which mode to use for advertisement. + - 'Valid values of this enum field are: DEFAULT, CUSTOM .' + returned: success + type: str + advertisedGroups: + description: + - User-specified list of prefix groups to advertise in custom mode. + - This field can only be populated if advertiseMode is CUSTOM and is advertised + to all peers of the router. These groups will be advertised in addition to + any specified prefixes. Leave this field blank to advertise no custom groups. + - 'This enum field has the one valid value: ALL_SUBNETS .' + returned: success + type: list + advertisedIpRanges: + description: + - User-specified list of individual IP ranges to advertise in custom mode. This + field can only be populated if advertiseMode is CUSTOM and is advertised to + all peers of the router. These IP ranges will be advertised in addition to + any specified groups. + - Leave this field blank to advertise no custom IP ranges. + returned: success + type: complex + contains: + range: + description: + - The IP range to advertise. The value must be a CIDR-formatted string. + returned: success + type: str description: - - Region where the router resides. - returned: success - type: str + description: + - User-specified description for the IP range. + returned: success + type: str +region: + description: + - Region where the router resides. + returned: success + type: str ''' ################################################################################ diff --git a/lib/ansible/modules/cloud/google/gcp_compute_router_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_router_facts.py index ae9057d727fb8a..4f34effad6902e 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_router_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_router_facts.py @@ -32,25 +32,24 @@ --- module: gcp_compute_router_facts description: - - Gather facts for GCP Router +- Gather facts for GCP Router short_description: Gather facts for GCP Router version_added: 2.7 author: Google Inc. (@googlecloudplatform) requirements: - - python >= 2.6 - - requests >= 2.18.4 - - google-auth >= 1.3.0 +- python >= 2.6 +- requests >= 2.18.4 +- google-auth >= 1.3.0 options: - filters: - description: - A list of filter value pairs. Available filters are listed here - U(https://cloud.google.com/sdk/gcloud/reference/topic/filters). - Each additional filter in the list will act be added as an AND condition - (filter1 and filter2) - region: - description: - - Region where the router resides. - required: true + filters: + description: + - A list of filter value pairs. Available filters are listed here U(U(https://cloud.google.com/sdk/gcloud/reference/topic/filters).) + - Each additional filter in the list will act be added as an AND condition (filter1 + and filter2) . + region: + description: + - Region where the router resides. + required: true extends_documentation_fragment: gcp ''' @@ -67,91 +66,93 @@ RETURN = ''' items: - description: List of items - returned: always - type: complex - contains: - id: - description: - - The unique identifier for the resource. - returned: success - type: int - creationTimestamp: - description: - - Creation timestamp in RFC3339 text format. - returned: success - type: str - name: - description: - - Name of the resource. The name must be 1-63 characters long, and comply with RFC1035. - Specifically, the name must be 1-63 characters long and match the regular expression - `[a-z]([-a-z0-9]*[a-z0-9])?` which means the first character must be a lowercase - letter, and all following characters must be a dash, lowercase letter, or digit, - except the last character, which cannot be a dash. - returned: success - type: str - description: + description: List of items + returned: always + type: complex + contains: + id: + description: + - The unique identifier for the resource. + returned: success + type: int + creationTimestamp: + description: + - Creation timestamp in RFC3339 text format. + returned: success + type: str + name: + description: + - Name of the resource. The name must be 1-63 characters long, and comply with + RFC1035. Specifically, the name must be 1-63 characters long and match the + regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` which means the first character + must be a lowercase letter, and all following characters must be a dash, lowercase + letter, or digit, except the last character, which cannot be a dash. + returned: success + type: str + description: + description: + - An optional description of this resource. + returned: success + type: str + network: + description: + - A reference to the network to which this router belongs. + returned: success + type: dict + bgp: + description: + - BGP information specific to this router. + returned: success + type: complex + contains: + asn: + description: + - Local BGP Autonomous System Number (ASN). Must be an RFC6996 private ASN, + either 16-bit or 32-bit. The value will be fixed for this router resource. + All VPN tunnels that link to this router will have the same local ASN. + returned: success + type: int + advertiseMode: + description: + - User-specified flag to indicate which mode to use for advertisement. + - 'Valid values of this enum field are: DEFAULT, CUSTOM .' + returned: success + type: str + advertisedGroups: + description: + - User-specified list of prefix groups to advertise in custom mode. + - This field can only be populated if advertiseMode is CUSTOM and is advertised + to all peers of the router. These groups will be advertised in addition + to any specified prefixes. Leave this field blank to advertise no custom + groups. + - 'This enum field has the one valid value: ALL_SUBNETS .' + returned: success + type: list + advertisedIpRanges: + description: + - User-specified list of individual IP ranges to advertise in custom mode. + This field can only be populated if advertiseMode is CUSTOM and is advertised + to all peers of the router. These IP ranges will be advertised in addition + to any specified groups. + - Leave this field blank to advertise no custom IP ranges. + returned: success + type: complex + contains: + range: + description: + - The IP range to advertise. The value must be a CIDR-formatted string. + returned: success + type: str description: - - An optional description of this resource. - returned: success - type: str - network: - description: - - A reference to the network to which this router belongs. - returned: success - type: dict - bgp: - description: - - BGP information specific to this router. - returned: success - type: complex - contains: - asn: - description: - - Local BGP Autonomous System Number (ASN). Must be an RFC6996 private ASN, either - 16-bit or 32-bit. The value will be fixed for this router resource. All VPN tunnels - that link to this router will have the same local ASN. - returned: success - type: int - advertiseMode: - description: - - User-specified flag to indicate which mode to use for advertisement. - - 'Valid values of this enum field are: DEFAULT, CUSTOM .' - returned: success - type: str - advertisedGroups: - description: - - User-specified list of prefix groups to advertise in custom mode. - - This field can only be populated if advertiseMode is CUSTOM and is advertised to - all peers of the router. These groups will be advertised in addition to any specified - prefixes. Leave this field blank to advertise no custom groups. - - 'This enum field has the one valid value: ALL_SUBNETS .' - returned: success - type: list - advertisedIpRanges: - description: - - User-specified list of individual IP ranges to advertise in custom mode. This field - can only be populated if advertiseMode is CUSTOM and is advertised to all peers - of the router. These IP ranges will be advertised in addition to any specified groups. - - Leave this field blank to advertise no custom IP ranges. - returned: success - type: complex - contains: - range: - description: - - The IP range to advertise. The value must be a CIDR-formatted string. - returned: success - type: str - description: - description: - - User-specified description for the IP range. - returned: success - type: str - region: - description: - - Region where the router resides. - returned: success - type: str + description: + - User-specified description for the IP range. + returned: success + type: str + region: + description: + - Region where the router resides. + returned: success + type: str ''' ################################################################################ diff --git a/lib/ansible/modules/cloud/google/gcp_compute_ssl_certificate.py b/lib/ansible/modules/cloud/google/gcp_compute_ssl_certificate.py index 5fdd494b04bbfa..ebe6cbe1b5b324 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_ssl_certificate.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_ssl_certificate.py @@ -32,49 +32,51 @@ --- module: gcp_compute_ssl_certificate description: - - An SslCertificate resource, used for HTTPS load balancing. This resource provides - a mechanism to upload an SSL key and certificate to the load balancer to serve secure - connections from the user. +- An SslCertificate resource, used for HTTPS load balancing. This resource provides + a mechanism to upload an SSL key and certificate to the load balancer to serve secure + connections from the user. short_description: Creates a GCP SslCertificate version_added: 2.6 author: Google Inc. (@googlecloudplatform) requirements: - - python >= 2.6 - - requests >= 2.18.4 - - google-auth >= 1.3.0 +- python >= 2.6 +- requests >= 2.18.4 +- google-auth >= 1.3.0 options: - state: - description: - - Whether the given object should exist in GCP - choices: ['present', 'absent'] - default: 'present' - certificate: - description: - - The certificate in PEM format. - - The certificate chain must be no greater than 5 certs long. - - The chain must include at least one intermediate cert. - required: true + state: description: - description: - - An optional description of this resource. - required: false - name: - description: - - Name of the resource. Provided by the client when the resource is created. The name - must be 1-63 characters long, and comply with RFC1035. Specifically, the name must - be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` - which means the first character must be a lowercase letter, and all following characters - must be a dash, lowercase letter, or digit, except the last character, which cannot - be a dash. - required: false - private_key: - description: - - The write-only private key in PEM format. - required: true + - Whether the given object should exist in GCP + choices: + - present + - absent + default: present + certificate: + description: + - The certificate in PEM format. + - The certificate chain must be no greater than 5 certs long. + - The chain must include at least one intermediate cert. + required: true + description: + description: + - An optional description of this resource. + required: false + name: + description: + - Name of the resource. Provided by the client when the resource is created. The + name must be 1-63 characters long, and comply with RFC1035. Specifically, the + name must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` + which means the first character must be a lowercase letter, and all following + characters must be a dash, lowercase letter, or digit, except the last character, + which cannot be a dash. + required: false + private_key: + description: + - The write-only private key in PEM format. + required: true extends_documentation_fragment: gcp notes: - - "API Reference: U(https://cloud.google.com/compute/docs/reference/rest/v1/sslCertificates)" - - "Official Documentation: U(https://cloud.google.com/load-balancing/docs/ssl-certificates)" +- 'API Reference: U(https://cloud.google.com/compute/docs/reference/rest/v1/sslCertificates)' +- 'Official Documentation: U(https://cloud.google.com/load-balancing/docs/ssl-certificates)' ''' EXAMPLES = ''' @@ -113,43 +115,43 @@ ''' RETURN = ''' - certificate: - description: - - The certificate in PEM format. - - The certificate chain must be no greater than 5 certs long. - - The chain must include at least one intermediate cert. - returned: success - type: str - creationTimestamp: - description: - - Creation timestamp in RFC3339 text format. - returned: success - type: str - description: - description: - - An optional description of this resource. - returned: success - type: str - id: - description: - - The unique identifier for the resource. - returned: success - type: int - name: - description: - - Name of the resource. Provided by the client when the resource is created. The name - must be 1-63 characters long, and comply with RFC1035. Specifically, the name must - be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` - which means the first character must be a lowercase letter, and all following characters - must be a dash, lowercase letter, or digit, except the last character, which cannot - be a dash. - returned: success - type: str - privateKey: - description: - - The write-only private key in PEM format. - returned: success - type: str +certificate: + description: + - The certificate in PEM format. + - The certificate chain must be no greater than 5 certs long. + - The chain must include at least one intermediate cert. + returned: success + type: str +creationTimestamp: + description: + - Creation timestamp in RFC3339 text format. + returned: success + type: str +description: + description: + - An optional description of this resource. + returned: success + type: str +id: + description: + - The unique identifier for the resource. + returned: success + type: int +name: + description: + - Name of the resource. Provided by the client when the resource is created. The + name must be 1-63 characters long, and comply with RFC1035. Specifically, the + name must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` + which means the first character must be a lowercase letter, and all following + characters must be a dash, lowercase letter, or digit, except the last character, + which cannot be a dash. + returned: success + type: str +privateKey: + description: + - The write-only private key in PEM format. + returned: success + type: str ''' ################################################################################ diff --git a/lib/ansible/modules/cloud/google/gcp_compute_ssl_certificate_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_ssl_certificate_facts.py index 4fc37c9483f34f..69600b237b4ebb 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_ssl_certificate_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_ssl_certificate_facts.py @@ -32,21 +32,20 @@ --- module: gcp_compute_ssl_certificate_facts description: - - Gather facts for GCP SslCertificate +- Gather facts for GCP SslCertificate short_description: Gather facts for GCP SslCertificate version_added: 2.7 author: Google Inc. (@googlecloudplatform) requirements: - - python >= 2.6 - - requests >= 2.18.4 - - google-auth >= 1.3.0 +- python >= 2.6 +- requests >= 2.18.4 +- google-auth >= 1.3.0 options: - filters: - description: - A list of filter value pairs. Available filters are listed here - U(https://cloud.google.com/sdk/gcloud/reference/topic/filters). - Each additional filter in the list will act be added as an AND condition - (filter1 and filter2) + filters: + description: + - A list of filter value pairs. Available filters are listed here U(U(https://cloud.google.com/sdk/gcloud/reference/topic/filters).) + - Each additional filter in the list will act be added as an AND condition (filter1 + and filter2) . extends_documentation_fragment: gcp ''' @@ -62,47 +61,47 @@ RETURN = ''' items: - description: List of items - returned: always - type: complex - contains: - certificate: - description: - - The certificate in PEM format. - - The certificate chain must be no greater than 5 certs long. - - The chain must include at least one intermediate cert. - returned: success - type: str - creationTimestamp: - description: - - Creation timestamp in RFC3339 text format. - returned: success - type: str - description: - description: - - An optional description of this resource. - returned: success - type: str - id: - description: - - The unique identifier for the resource. - returned: success - type: int - name: - description: - - Name of the resource. Provided by the client when the resource is created. The name - must be 1-63 characters long, and comply with RFC1035. Specifically, the name must - be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` - which means the first character must be a lowercase letter, and all following characters - must be a dash, lowercase letter, or digit, except the last character, which cannot - be a dash. - returned: success - type: str - privateKey: - description: - - The write-only private key in PEM format. - returned: success - type: str + description: List of items + returned: always + type: complex + contains: + certificate: + description: + - The certificate in PEM format. + - The certificate chain must be no greater than 5 certs long. + - The chain must include at least one intermediate cert. + returned: success + type: str + creationTimestamp: + description: + - Creation timestamp in RFC3339 text format. + returned: success + type: str + description: + description: + - An optional description of this resource. + returned: success + type: str + id: + description: + - The unique identifier for the resource. + returned: success + type: int + name: + description: + - Name of the resource. Provided by the client when the resource is created. + The name must be 1-63 characters long, and comply with RFC1035. Specifically, + the name must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` + which means the first character must be a lowercase letter, and all following + characters must be a dash, lowercase letter, or digit, except the last character, + which cannot be a dash. + returned: success + type: str + privateKey: + description: + - The write-only private key in PEM format. + returned: success + type: str ''' ################################################################################ diff --git a/lib/ansible/modules/cloud/google/gcp_compute_ssl_policy.py b/lib/ansible/modules/cloud/google/gcp_compute_ssl_policy.py index 003eaf34eb07e2..654393126b5b5c 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_ssl_policy.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_ssl_policy.py @@ -32,58 +32,68 @@ --- module: gcp_compute_ssl_policy description: - - Represents a SSL policy. SSL policies give you the ability to control the features - of SSL that your SSL proxy or HTTPS load balancer negotiates. +- Represents a SSL policy. SSL policies give you the ability to control the features + of SSL that your SSL proxy or HTTPS load balancer negotiates. short_description: Creates a GCP SslPolicy version_added: 2.7 author: Google Inc. (@googlecloudplatform) requirements: - - python >= 2.6 - - requests >= 2.18.4 - - google-auth >= 1.3.0 +- python >= 2.6 +- requests >= 2.18.4 +- google-auth >= 1.3.0 options: - state: - description: - - Whether the given object should exist in GCP - choices: ['present', 'absent'] - default: 'present' + state: description: - description: - - An optional description of this resource. - required: false - name: - description: - - Name of the resource. Provided by the client when the resource is created. The name - must be 1-63 characters long, and comply with RFC1035. Specifically, the name must - be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` - which means the first character must be a lowercase letter, and all following characters - must be a dash, lowercase letter, or digit, except the last character, which cannot - be a dash. - required: true - profile: - description: - - Profile specifies the set of SSL features that can be used by the load balancer - when negotiating SSL with clients. This can be one of `COMPATIBLE`, `MODERN`, `RESTRICTED`, - or `CUSTOM`. If using `CUSTOM`, the set of SSL features to enable must be specified - in the `customFeatures` field. - required: false - choices: ['COMPATIBLE', 'MODERN', 'RESTRICTED', 'CUSTOM'] - min_tls_version: - description: - - The minimum version of SSL protocol that can be used by the clients to establish - a connection with the load balancer. This can be one of `TLS_1_0`, `TLS_1_1`, `TLS_1_2`. - required: false - choices: ['TLS_1_0', 'TLS_1_1', 'TLS_1_2'] - custom_features: - description: - - A list of features enabled when the selected profile is CUSTOM. The method returns - the set of features that can be specified in this list. This field must be empty - if the profile is not CUSTOM. - required: false + - Whether the given object should exist in GCP + choices: + - present + - absent + default: present + description: + description: + - An optional description of this resource. + required: false + name: + description: + - Name of the resource. Provided by the client when the resource is created. The + name must be 1-63 characters long, and comply with RFC1035. Specifically, the + name must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` + which means the first character must be a lowercase letter, and all following + characters must be a dash, lowercase letter, or digit, except the last character, + which cannot be a dash. + required: true + profile: + description: + - Profile specifies the set of SSL features that can be used by the load balancer + when negotiating SSL with clients. This can be one of `COMPATIBLE`, `MODERN`, + `RESTRICTED`, or `CUSTOM`. If using `CUSTOM`, the set of SSL features to enable + must be specified in the `customFeatures` field. + required: false + choices: + - COMPATIBLE + - MODERN + - RESTRICTED + - CUSTOM + min_tls_version: + description: + - The minimum version of SSL protocol that can be used by the clients to establish + a connection with the load balancer. This can be one of `TLS_1_0`, `TLS_1_1`, + `TLS_1_2`. + required: false + choices: + - TLS_1_0 + - TLS_1_1 + - TLS_1_2 + custom_features: + description: + - A list of features enabled when the selected profile is CUSTOM. The method returns + the set of features that can be specified in this list. This field must be empty + if the profile is not CUSTOM. + required: false extends_documentation_fragment: gcp notes: - - "API Reference: U(https://cloud.google.com/compute/docs/reference/rest/v1/sslPolicies)" - - "Using SSL Policies: U(https://cloud.google.com/compute/docs/load-balancing/ssl-policies)" +- 'API Reference: U(https://cloud.google.com/compute/docs/reference/rest/v1/sslPolicies)' +- 'Using SSL Policies: U(https://cloud.google.com/compute/docs/load-balancing/ssl-policies)' ''' EXAMPLES = ''' @@ -102,80 +112,81 @@ ''' RETURN = ''' - creationTimestamp: - description: - - Creation timestamp in RFC3339 text format. - returned: success - type: str - description: - description: - - An optional description of this resource. - returned: success - type: str - id: - description: - - The unique identifier for the resource. - returned: success - type: int - name: - description: - - Name of the resource. Provided by the client when the resource is created. The name - must be 1-63 characters long, and comply with RFC1035. Specifically, the name must - be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` - which means the first character must be a lowercase letter, and all following characters - must be a dash, lowercase letter, or digit, except the last character, which cannot - be a dash. - returned: success - type: str - profile: - description: - - Profile specifies the set of SSL features that can be used by the load balancer - when negotiating SSL with clients. This can be one of `COMPATIBLE`, `MODERN`, `RESTRICTED`, - or `CUSTOM`. If using `CUSTOM`, the set of SSL features to enable must be specified - in the `customFeatures` field. - returned: success - type: str - minTlsVersion: - description: - - The minimum version of SSL protocol that can be used by the clients to establish - a connection with the load balancer. This can be one of `TLS_1_0`, `TLS_1_1`, `TLS_1_2`. - returned: success - type: str - enabledFeatures: - description: - - The list of features enabled in the SSL policy. - returned: success - type: list - customFeatures: - description: - - A list of features enabled when the selected profile is CUSTOM. The method returns - the set of features that can be specified in this list. This field must be empty - if the profile is not CUSTOM. - returned: success - type: list - fingerprint: - description: - - Fingerprint of this resource. A hash of the contents stored in this object. This - field is used in optimistic locking. - returned: success - type: str - warnings: - description: - - If potential misconfigurations are detected for this SSL policy, this field will - be populated with warning messages. - returned: success - type: complex - contains: - code: - description: - - A warning code, if applicable. - returned: success - type: str - message: - description: - - A human-readable description of the warning code. - returned: success - type: str +creationTimestamp: + description: + - Creation timestamp in RFC3339 text format. + returned: success + type: str +description: + description: + - An optional description of this resource. + returned: success + type: str +id: + description: + - The unique identifier for the resource. + returned: success + type: int +name: + description: + - Name of the resource. Provided by the client when the resource is created. The + name must be 1-63 characters long, and comply with RFC1035. Specifically, the + name must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` + which means the first character must be a lowercase letter, and all following + characters must be a dash, lowercase letter, or digit, except the last character, + which cannot be a dash. + returned: success + type: str +profile: + description: + - Profile specifies the set of SSL features that can be used by the load balancer + when negotiating SSL with clients. This can be one of `COMPATIBLE`, `MODERN`, + `RESTRICTED`, or `CUSTOM`. If using `CUSTOM`, the set of SSL features to enable + must be specified in the `customFeatures` field. + returned: success + type: str +minTlsVersion: + description: + - The minimum version of SSL protocol that can be used by the clients to establish + a connection with the load balancer. This can be one of `TLS_1_0`, `TLS_1_1`, + `TLS_1_2`. + returned: success + type: str +enabledFeatures: + description: + - The list of features enabled in the SSL policy. + returned: success + type: list +customFeatures: + description: + - A list of features enabled when the selected profile is CUSTOM. The method returns + the set of features that can be specified in this list. This field must be empty + if the profile is not CUSTOM. + returned: success + type: list +fingerprint: + description: + - Fingerprint of this resource. A hash of the contents stored in this object. This + field is used in optimistic locking. + returned: success + type: str +warnings: + description: + - If potential misconfigurations are detected for this SSL policy, this field will + be populated with warning messages. + returned: success + type: complex + contains: + code: + description: + - A warning code, if applicable. + returned: success + type: str + message: + description: + - A human-readable description of the warning code. + returned: success + type: str ''' ################################################################################ diff --git a/lib/ansible/modules/cloud/google/gcp_compute_ssl_policy_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_ssl_policy_facts.py index 80de3606b99228..95e0b1592ddae9 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_ssl_policy_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_ssl_policy_facts.py @@ -32,21 +32,20 @@ --- module: gcp_compute_ssl_policy_facts description: - - Gather facts for GCP SslPolicy +- Gather facts for GCP SslPolicy short_description: Gather facts for GCP SslPolicy version_added: 2.7 author: Google Inc. (@googlecloudplatform) requirements: - - python >= 2.6 - - requests >= 2.18.4 - - google-auth >= 1.3.0 +- python >= 2.6 +- requests >= 2.18.4 +- google-auth >= 1.3.0 options: - filters: - description: - A list of filter value pairs. Available filters are listed here - U(https://cloud.google.com/sdk/gcloud/reference/topic/filters). - Each additional filter in the list will act be added as an AND condition - (filter1 and filter2) + filters: + description: + - A list of filter value pairs. Available filters are listed here U(U(https://cloud.google.com/sdk/gcloud/reference/topic/filters).) + - Each additional filter in the list will act be added as an AND condition (filter1 + and filter2) . extends_documentation_fragment: gcp ''' @@ -62,84 +61,85 @@ RETURN = ''' items: - description: List of items - returned: always - type: complex - contains: - creationTimestamp: - description: - - Creation timestamp in RFC3339 text format. - returned: success - type: str - description: - description: - - An optional description of this resource. - returned: success - type: str - id: - description: - - The unique identifier for the resource. - returned: success - type: int - name: - description: - - Name of the resource. Provided by the client when the resource is created. The name - must be 1-63 characters long, and comply with RFC1035. Specifically, the name must - be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` - which means the first character must be a lowercase letter, and all following characters - must be a dash, lowercase letter, or digit, except the last character, which cannot - be a dash. - returned: success - type: str - profile: - description: - - Profile specifies the set of SSL features that can be used by the load balancer - when negotiating SSL with clients. This can be one of `COMPATIBLE`, `MODERN`, `RESTRICTED`, - or `CUSTOM`. If using `CUSTOM`, the set of SSL features to enable must be specified - in the `customFeatures` field. - returned: success - type: str - minTlsVersion: - description: - - The minimum version of SSL protocol that can be used by the clients to establish - a connection with the load balancer. This can be one of `TLS_1_0`, `TLS_1_1`, `TLS_1_2`. - returned: success - type: str - enabledFeatures: - description: - - The list of features enabled in the SSL policy. - returned: success - type: list - customFeatures: - description: - - A list of features enabled when the selected profile is CUSTOM. The method returns - the set of features that can be specified in this list. This field must be empty - if the profile is not CUSTOM. - returned: success - type: list - fingerprint: - description: - - Fingerprint of this resource. A hash of the contents stored in this object. This - field is used in optimistic locking. - returned: success - type: str - warnings: - description: - - If potential misconfigurations are detected for this SSL policy, this field will - be populated with warning messages. - returned: success - type: complex - contains: - code: - description: - - A warning code, if applicable. - returned: success - type: str - message: - description: - - A human-readable description of the warning code. - returned: success - type: str + description: List of items + returned: always + type: complex + contains: + creationTimestamp: + description: + - Creation timestamp in RFC3339 text format. + returned: success + type: str + description: + description: + - An optional description of this resource. + returned: success + type: str + id: + description: + - The unique identifier for the resource. + returned: success + type: int + name: + description: + - Name of the resource. Provided by the client when the resource is created. + The name must be 1-63 characters long, and comply with RFC1035. Specifically, + the name must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` + which means the first character must be a lowercase letter, and all following + characters must be a dash, lowercase letter, or digit, except the last character, + which cannot be a dash. + returned: success + type: str + profile: + description: + - Profile specifies the set of SSL features that can be used by the load balancer + when negotiating SSL with clients. This can be one of `COMPATIBLE`, `MODERN`, + `RESTRICTED`, or `CUSTOM`. If using `CUSTOM`, the set of SSL features to enable + must be specified in the `customFeatures` field. + returned: success + type: str + minTlsVersion: + description: + - The minimum version of SSL protocol that can be used by the clients to establish + a connection with the load balancer. This can be one of `TLS_1_0`, `TLS_1_1`, + `TLS_1_2`. + returned: success + type: str + enabledFeatures: + description: + - The list of features enabled in the SSL policy. + returned: success + type: list + customFeatures: + description: + - A list of features enabled when the selected profile is CUSTOM. The method + returns the set of features that can be specified in this list. This field + must be empty if the profile is not CUSTOM. + returned: success + type: list + fingerprint: + description: + - Fingerprint of this resource. A hash of the contents stored in this object. + This field is used in optimistic locking. + returned: success + type: str + warnings: + description: + - If potential misconfigurations are detected for this SSL policy, this field + will be populated with warning messages. + returned: success + type: complex + contains: + code: + description: + - A warning code, if applicable. + returned: success + type: str + message: + description: + - A human-readable description of the warning code. + returned: success + type: str ''' ################################################################################ diff --git a/lib/ansible/modules/cloud/google/gcp_compute_subnetwork.py b/lib/ansible/modules/cloud/google/gcp_compute_subnetwork.py index 9348fb629385fa..359e3c3b662d6a 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_subnetwork.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_subnetwork.py @@ -32,109 +32,111 @@ --- module: gcp_compute_subnetwork description: - - A VPC network is a virtual version of the traditional physical networks that exist - within and between physical data centers. A VPC network provides connectivity for - your Compute Engine virtual machine (VM) instances, Container Engine containers, - App Engine Flex services, and other network-related resources. - - Each GCP project contains one or more VPC networks. Each VPC network is a global - entity spanning all GCP regions. This global VPC network allows VM instances and - other resources to communicate with each other via internal, private IP addresses. - - Each VPC network is subdivided into subnets, and each subnet is contained within - a single region. You can have more than one subnet in a region for a given VPC network. - Each subnet has a contiguous private RFC1918 IP space. You create instances, containers, - and the like in these subnets. - - When you create an instance, you must create it in a subnet, and the instance draws - its internal IP address from that subnet. - - Virtual machine (VM) instances in a VPC network can communicate with instances in - all other subnets of the same VPC network, regardless of region, using their RFC1918 - private IP addresses. You can isolate portions of the network, even entire subnets, - using firewall rules. +- A VPC network is a virtual version of the traditional physical networks that exist + within and between physical data centers. A VPC network provides connectivity for + your Compute Engine virtual machine (VM) instances, Container Engine containers, + App Engine Flex services, and other network-related resources. +- Each GCP project contains one or more VPC networks. Each VPC network is a global + entity spanning all GCP regions. This global VPC network allows VM instances and + other resources to communicate with each other via internal, private IP addresses. +- Each VPC network is subdivided into subnets, and each subnet is contained within + a single region. You can have more than one subnet in a region for a given VPC network. + Each subnet has a contiguous private RFC1918 IP space. You create instances, containers, + and the like in these subnets. +- When you create an instance, you must create it in a subnet, and the instance draws + its internal IP address from that subnet. +- Virtual machine (VM) instances in a VPC network can communicate with instances in + all other subnets of the same VPC network, regardless of region, using their RFC1918 + private IP addresses. You can isolate portions of the network, even entire subnets, + using firewall rules. short_description: Creates a GCP Subnetwork version_added: 2.6 author: Google Inc. (@googlecloudplatform) requirements: - - python >= 2.6 - - requests >= 2.18.4 - - google-auth >= 1.3.0 +- python >= 2.6 +- requests >= 2.18.4 +- google-auth >= 1.3.0 options: - state: - description: - - Whether the given object should exist in GCP - choices: ['present', 'absent'] - default: 'present' + state: description: + - Whether the given object should exist in GCP + choices: + - present + - absent + default: present + description: + description: + - An optional description of this resource. Provide this property when you create + the resource. This field can be set only at resource creation time. + required: false + ip_cidr_range: + description: + - The range of internal addresses that are owned by this subnetwork. + - Provide this property when you create the subnetwork. For example, 10.0.0.0/8 + or 192.168.0.0/16. Ranges must be unique and non-overlapping within a network. + Only IPv4 is supported. + required: true + name: + description: + - The name of the resource, provided by the client when initially creating the + resource. The name must be 1-63 characters long, and comply with RFC1035. Specifically, + the name must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` + which means the first character must be a lowercase letter, and all following + characters must be a dash, lowercase letter, or digit, except the last character, + which cannot be a dash. + required: true + network: + description: + - The network this subnet belongs to. + - Only networks that are in the distributed mode can have subnetworks. + - 'This field represents a link to a Network resource in GCP. It can be specified + in two ways. You can add `register: name-of-resource` to a gcp_compute_network + task and then set this network field to "{{ name-of-resource }}" Alternatively, + you can set this network to a dictionary with the selfLink key where the value + is the selfLink of your Network' + required: true + enable_flow_logs: + description: + - Whether to enable flow logging for this subnetwork. + required: false + type: bool + version_added: 2.8 + secondary_ip_ranges: + description: + - An array of configurations for secondary IP ranges for VM instances contained + in this subnetwork. The primary IP of such VM must belong to the primary ipCidrRange + of the subnetwork. The alias IPs may belong to either primary or secondary ranges. + required: false + version_added: 2.8 + suboptions: + range_name: description: - - An optional description of this resource. Provide this property when you create - the resource. This field can be set only at resource creation time. - required: false - ip_cidr_range: - description: - - The range of internal addresses that are owned by this subnetwork. - - Provide this property when you create the subnetwork. For example, 10.0.0.0/8 or - 192.168.0.0/16. Ranges must be unique and non-overlapping within a network. Only - IPv4 is supported. - required: true - name: - description: - - The name of the resource, provided by the client when initially creating the resource. - The name must be 1-63 characters long, and comply with RFC1035. Specifically, the - name must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` - which means the first character must be a lowercase letter, and all following characters - must be a dash, lowercase letter, or digit, except the last character, which cannot - be a dash. - required: true - network: - description: - - The network this subnet belongs to. - - Only networks that are in the distributed mode can have subnetworks. - - 'This field represents a link to a Network resource in GCP. It can be specified - in two ways. You can add `register: name-of-resource` to a gcp_compute_network task - and then set this network field to "{{ name-of-resource }}" Alternatively, you can - set this network to a dictionary with the selfLink key where the value is the selfLink - of your Network.' + - The name associated with this subnetwork secondary range, used when adding + an alias IP range to a VM instance. The name must be 1-63 characters long, + and comply with RFC1035. The name must be unique within the subnetwork. required: true - enable_flow_logs: + ip_cidr_range: description: - - Whether to enable flow logging for this subnetwork. - required: false - type: bool - version_added: 2.8 - secondary_ip_ranges: - description: - - An array of configurations for secondary IP ranges for VM instances contained in - this subnetwork. The primary IP of such VM must belong to the primary ipCidrRange - of the subnetwork. The alias IPs may belong to either primary or secondary ranges. - required: false - version_added: 2.8 - suboptions: - range_name: - description: - - The name associated with this subnetwork secondary range, used when adding an alias - IP range to a VM instance. The name must be 1-63 characters long, and comply with - RFC1035. The name must be unique within the subnetwork. - required: true - ip_cidr_range: - description: - - The range of IP addresses belonging to this subnetwork secondary range. Provide - this property when you create the subnetwork. - - Ranges must be unique and non-overlapping with all primary and secondary IP ranges - within a network. Only IPv4 is supported. - required: true - private_ip_google_access: - description: - - Whether the VMs in this subnet can access Google services without assigned external - IP addresses. - required: false - type: bool - region: - description: - - URL of the GCP region for this subnetwork. + - The range of IP addresses belonging to this subnetwork secondary range. + Provide this property when you create the subnetwork. + - Ranges must be unique and non-overlapping with all primary and secondary + IP ranges within a network. Only IPv4 is supported. required: true + private_ip_google_access: + description: + - Whether the VMs in this subnet can access Google services without assigned external + IP addresses. + required: false + type: bool + region: + description: + - URL of the GCP region for this subnetwork. + required: true extends_documentation_fragment: gcp notes: - - "API Reference: U(https://cloud.google.com/compute/docs/reference/rest/beta/subnetworks)" - - "Private Google Access: U(https://cloud.google.com/vpc/docs/configure-private-google-access)" - - "Cloud Networking: U(https://cloud.google.com/vpc/docs/using-vpc)" +- 'API Reference: U(https://cloud.google.com/compute/docs/reference/rest/beta/subnetworks)' +- 'Private Google Access: U(https://cloud.google.com/vpc/docs/configure-private-google-access)' +- 'Cloud Networking: U(https://cloud.google.com/vpc/docs/using-vpc)' ''' EXAMPLES = ''' @@ -161,97 +163,97 @@ ''' RETURN = ''' - creationTimestamp: - description: - - Creation timestamp in RFC3339 text format. - returned: success - type: str - description: - description: - - An optional description of this resource. Provide this property when you create - the resource. This field can be set only at resource creation time. - returned: success - type: str - gatewayAddress: - description: - - The gateway address for default routes to reach destination addresses outside this - subnetwork. - returned: success - type: str - id: - description: - - The unique identifier for the resource. - returned: success - type: int +creationTimestamp: + description: + - Creation timestamp in RFC3339 text format. + returned: success + type: str +description: + description: + - An optional description of this resource. Provide this property when you create + the resource. This field can be set only at resource creation time. + returned: success + type: str +gatewayAddress: + description: + - The gateway address for default routes to reach destination addresses outside + this subnetwork. + returned: success + type: str +id: + description: + - The unique identifier for the resource. + returned: success + type: int +ipCidrRange: + description: + - The range of internal addresses that are owned by this subnetwork. + - Provide this property when you create the subnetwork. For example, 10.0.0.0/8 + or 192.168.0.0/16. Ranges must be unique and non-overlapping within a network. + Only IPv4 is supported. + returned: success + type: str +name: + description: + - The name of the resource, provided by the client when initially creating the resource. + The name must be 1-63 characters long, and comply with RFC1035. Specifically, + the name must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` + which means the first character must be a lowercase letter, and all following + characters must be a dash, lowercase letter, or digit, except the last character, + which cannot be a dash. + returned: success + type: str +network: + description: + - The network this subnet belongs to. + - Only networks that are in the distributed mode can have subnetworks. + returned: success + type: dict +enableFlowLogs: + description: + - Whether to enable flow logging for this subnetwork. + returned: success + type: bool +fingerprint: + description: + - Fingerprint of this resource. This field is used internally during updates of + this resource. + returned: success + type: str +secondaryIpRanges: + description: + - An array of configurations for secondary IP ranges for VM instances contained + in this subnetwork. The primary IP of such VM must belong to the primary ipCidrRange + of the subnetwork. The alias IPs may belong to either primary or secondary ranges. + returned: success + type: complex + contains: + rangeName: + description: + - The name associated with this subnetwork secondary range, used when adding + an alias IP range to a VM instance. The name must be 1-63 characters long, + and comply with RFC1035. The name must be unique within the subnetwork. + returned: success + type: str ipCidrRange: - description: - - The range of internal addresses that are owned by this subnetwork. - - Provide this property when you create the subnetwork. For example, 10.0.0.0/8 or - 192.168.0.0/16. Ranges must be unique and non-overlapping within a network. Only - IPv4 is supported. - returned: success - type: str - name: - description: - - The name of the resource, provided by the client when initially creating the resource. - The name must be 1-63 characters long, and comply with RFC1035. Specifically, the - name must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` - which means the first character must be a lowercase letter, and all following characters - must be a dash, lowercase letter, or digit, except the last character, which cannot - be a dash. - returned: success - type: str - network: - description: - - The network this subnet belongs to. - - Only networks that are in the distributed mode can have subnetworks. - returned: success - type: dict - enableFlowLogs: - description: - - Whether to enable flow logging for this subnetwork. - returned: success - type: bool - fingerprint: - description: - - Fingerprint of this resource. This field is used internally during updates of this - resource. - returned: success - type: str - secondaryIpRanges: - description: - - An array of configurations for secondary IP ranges for VM instances contained in - this subnetwork. The primary IP of such VM must belong to the primary ipCidrRange - of the subnetwork. The alias IPs may belong to either primary or secondary ranges. - returned: success - type: complex - contains: - rangeName: - description: - - The name associated with this subnetwork secondary range, used when adding an alias - IP range to a VM instance. The name must be 1-63 characters long, and comply with - RFC1035. The name must be unique within the subnetwork. - returned: success - type: str - ipCidrRange: - description: - - The range of IP addresses belonging to this subnetwork secondary range. Provide - this property when you create the subnetwork. - - Ranges must be unique and non-overlapping with all primary and secondary IP ranges - within a network. Only IPv4 is supported. - returned: success - type: str - privateIpGoogleAccess: - description: - - Whether the VMs in this subnet can access Google services without assigned external - IP addresses. - returned: success - type: bool - region: - description: - - URL of the GCP region for this subnetwork. - returned: success - type: str + description: + - The range of IP addresses belonging to this subnetwork secondary range. Provide + this property when you create the subnetwork. + - Ranges must be unique and non-overlapping with all primary and secondary IP + ranges within a network. Only IPv4 is supported. + returned: success + type: str +privateIpGoogleAccess: + description: + - Whether the VMs in this subnet can access Google services without assigned external + IP addresses. + returned: success + type: bool +region: + description: + - URL of the GCP region for this subnetwork. + returned: success + type: str ''' ################################################################################ diff --git a/lib/ansible/modules/cloud/google/gcp_compute_subnetwork_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_subnetwork_facts.py index 2952d3a1514e37..8d04ae349c01ff 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_subnetwork_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_subnetwork_facts.py @@ -32,25 +32,24 @@ --- module: gcp_compute_subnetwork_facts description: - - Gather facts for GCP Subnetwork +- Gather facts for GCP Subnetwork short_description: Gather facts for GCP Subnetwork version_added: 2.7 author: Google Inc. (@googlecloudplatform) requirements: - - python >= 2.6 - - requests >= 2.18.4 - - google-auth >= 1.3.0 +- python >= 2.6 +- requests >= 2.18.4 +- google-auth >= 1.3.0 options: - filters: - description: - A list of filter value pairs. Available filters are listed here - U(https://cloud.google.com/sdk/gcloud/reference/topic/filters). - Each additional filter in the list will act be added as an AND condition - (filter1 and filter2) - region: - description: - - URL of the GCP region for this subnetwork. - required: true + filters: + description: + - A list of filter value pairs. Available filters are listed here U(U(https://cloud.google.com/sdk/gcloud/reference/topic/filters).) + - Each additional filter in the list will act be added as an AND condition (filter1 + and filter2) . + region: + description: + - URL of the GCP region for this subnetwork. + required: true extends_documentation_fragment: gcp ''' @@ -67,101 +66,102 @@ RETURN = ''' items: - description: List of items - returned: always - type: complex - contains: - creationTimestamp: - description: - - Creation timestamp in RFC3339 text format. - returned: success - type: str - description: - description: - - An optional description of this resource. Provide this property when you create - the resource. This field can be set only at resource creation time. - returned: success - type: str - gatewayAddress: - description: - - The gateway address for default routes to reach destination addresses outside this - subnetwork. - returned: success - type: str - id: - description: - - The unique identifier for the resource. - returned: success - type: int + description: List of items + returned: always + type: complex + contains: + creationTimestamp: + description: + - Creation timestamp in RFC3339 text format. + returned: success + type: str + description: + description: + - An optional description of this resource. Provide this property when you create + the resource. This field can be set only at resource creation time. + returned: success + type: str + gatewayAddress: + description: + - The gateway address for default routes to reach destination addresses outside + this subnetwork. + returned: success + type: str + id: + description: + - The unique identifier for the resource. + returned: success + type: int + ipCidrRange: + description: + - The range of internal addresses that are owned by this subnetwork. + - Provide this property when you create the subnetwork. For example, 10.0.0.0/8 + or 192.168.0.0/16. Ranges must be unique and non-overlapping within a network. + Only IPv4 is supported. + returned: success + type: str + name: + description: + - The name of the resource, provided by the client when initially creating the + resource. The name must be 1-63 characters long, and comply with RFC1035. + Specifically, the name must be 1-63 characters long and match the regular + expression `[a-z]([-a-z0-9]*[a-z0-9])?` which means the first character must + be a lowercase letter, and all following characters must be a dash, lowercase + letter, or digit, except the last character, which cannot be a dash. + returned: success + type: str + network: + description: + - The network this subnet belongs to. + - Only networks that are in the distributed mode can have subnetworks. + returned: success + type: dict + enableFlowLogs: + description: + - Whether to enable flow logging for this subnetwork. + returned: success + type: bool + fingerprint: + description: + - Fingerprint of this resource. This field is used internally during updates + of this resource. + returned: success + type: str + secondaryIpRanges: + description: + - An array of configurations for secondary IP ranges for VM instances contained + in this subnetwork. The primary IP of such VM must belong to the primary ipCidrRange + of the subnetwork. The alias IPs may belong to either primary or secondary + ranges. + returned: success + type: complex + contains: + rangeName: + description: + - The name associated with this subnetwork secondary range, used when adding + an alias IP range to a VM instance. The name must be 1-63 characters long, + and comply with RFC1035. The name must be unique within the subnetwork. + returned: success + type: str ipCidrRange: - description: - - The range of internal addresses that are owned by this subnetwork. - - Provide this property when you create the subnetwork. For example, 10.0.0.0/8 or - 192.168.0.0/16. Ranges must be unique and non-overlapping within a network. Only - IPv4 is supported. - returned: success - type: str - name: - description: - - The name of the resource, provided by the client when initially creating the resource. - The name must be 1-63 characters long, and comply with RFC1035. Specifically, the - name must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` - which means the first character must be a lowercase letter, and all following characters - must be a dash, lowercase letter, or digit, except the last character, which cannot - be a dash. - returned: success - type: str - network: - description: - - The network this subnet belongs to. - - Only networks that are in the distributed mode can have subnetworks. - returned: success - type: dict - enableFlowLogs: - description: - - Whether to enable flow logging for this subnetwork. - returned: success - type: bool - fingerprint: - description: - - Fingerprint of this resource. This field is used internally during updates of this - resource. - returned: success - type: str - secondaryIpRanges: - description: - - An array of configurations for secondary IP ranges for VM instances contained in - this subnetwork. The primary IP of such VM must belong to the primary ipCidrRange - of the subnetwork. The alias IPs may belong to either primary or secondary ranges. - returned: success - type: complex - contains: - rangeName: - description: - - The name associated with this subnetwork secondary range, used when adding an alias - IP range to a VM instance. The name must be 1-63 characters long, and comply with - RFC1035. The name must be unique within the subnetwork. - returned: success - type: str - ipCidrRange: - description: - - The range of IP addresses belonging to this subnetwork secondary range. Provide - this property when you create the subnetwork. - - Ranges must be unique and non-overlapping with all primary and secondary IP ranges - within a network. Only IPv4 is supported. - returned: success - type: str - privateIpGoogleAccess: - description: - - Whether the VMs in this subnet can access Google services without assigned external - IP addresses. - returned: success - type: bool - region: - description: - - URL of the GCP region for this subnetwork. - returned: success - type: str + description: + - The range of IP addresses belonging to this subnetwork secondary range. + Provide this property when you create the subnetwork. + - Ranges must be unique and non-overlapping with all primary and secondary + IP ranges within a network. Only IPv4 is supported. + returned: success + type: str + privateIpGoogleAccess: + description: + - Whether the VMs in this subnet can access Google services without assigned + external IP addresses. + returned: success + type: bool + region: + description: + - URL of the GCP region for this subnetwork. + returned: success + type: str ''' ################################################################################ diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_http_proxy.py b/lib/ansible/modules/cloud/google/gcp_compute_target_http_proxy.py index 808d4d3c28bff1..1d67ec9ee272be 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_http_proxy.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_http_proxy.py @@ -32,47 +32,50 @@ --- module: gcp_compute_target_http_proxy description: - - Represents a TargetHttpProxy resource, which is used by one or more global forwarding - rule to route incoming HTTP requests to a URL map. +- Represents a TargetHttpProxy resource, which is used by one or more global forwarding + rule to route incoming HTTP requests to a URL map. short_description: Creates a GCP TargetHttpProxy version_added: 2.6 author: Google Inc. (@googlecloudplatform) requirements: - - python >= 2.6 - - requests >= 2.18.4 - - google-auth >= 1.3.0 +- python >= 2.6 +- requests >= 2.18.4 +- google-auth >= 1.3.0 options: - state: - description: - - Whether the given object should exist in GCP - choices: ['present', 'absent'] - default: 'present' + state: description: - description: - - An optional description of this resource. - required: false - name: - description: - - Name of the resource. Provided by the client when the resource is created. The name - must be 1-63 characters long, and comply with RFC1035. Specifically, the name must - be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` - which means the first character must be a lowercase letter, and all following characters - must be a dash, lowercase letter, or digit, except the last character, which cannot - be a dash. - required: true - url_map: - description: - - A reference to the UrlMap resource that defines the mapping from URL to the BackendService. - - 'This field represents a link to a UrlMap resource in GCP. It can be specified in - two ways. You can add `register: name-of-resource` to a gcp_compute_url_map task - and then set this url_map field to "{{ name-of-resource }}" Alternatively, you can - set this url_map to a dictionary with the selfLink key where the value is the selfLink - of your UrlMap.' - required: true + - Whether the given object should exist in GCP + choices: + - present + - absent + default: present + description: + description: + - An optional description of this resource. + required: false + name: + description: + - Name of the resource. Provided by the client when the resource is created. The + name must be 1-63 characters long, and comply with RFC1035. Specifically, the + name must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` + which means the first character must be a lowercase letter, and all following + characters must be a dash, lowercase letter, or digit, except the last character, + which cannot be a dash. + required: true + url_map: + description: + - A reference to the UrlMap resource that defines the mapping from URL to the + BackendService. + - 'This field represents a link to a UrlMap resource in GCP. It can be specified + in two ways. You can add `register: name-of-resource` to a gcp_compute_url_map + task and then set this url_map field to "{{ name-of-resource }}" Alternatively, + you can set this url_map to a dictionary with the selfLink key where the value + is the selfLink of your UrlMap' + required: true extends_documentation_fragment: gcp notes: - - "API Reference: U(https://cloud.google.com/compute/docs/reference/latest/targetHttpProxies)" - - "Official Documentation: U(https://cloud.google.com/compute/docs/load-balancing/http/target-proxies)" +- 'API Reference: U(https://cloud.google.com/compute/docs/reference/latest/targetHttpProxies)' +- 'Official Documentation: U(https://cloud.google.com/compute/docs/load-balancing/http/target-proxies)' ''' EXAMPLES = ''' @@ -134,36 +137,36 @@ ''' RETURN = ''' - creationTimestamp: - description: - - Creation timestamp in RFC3339 text format. - returned: success - type: str - description: - description: - - An optional description of this resource. - returned: success - type: str - id: - description: - - The unique identifier for the resource. - returned: success - type: int - name: - description: - - Name of the resource. Provided by the client when the resource is created. The name - must be 1-63 characters long, and comply with RFC1035. Specifically, the name must - be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` - which means the first character must be a lowercase letter, and all following characters - must be a dash, lowercase letter, or digit, except the last character, which cannot - be a dash. - returned: success - type: str - urlMap: - description: - - A reference to the UrlMap resource that defines the mapping from URL to the BackendService. - returned: success - type: dict +creationTimestamp: + description: + - Creation timestamp in RFC3339 text format. + returned: success + type: str +description: + description: + - An optional description of this resource. + returned: success + type: str +id: + description: + - The unique identifier for the resource. + returned: success + type: int +name: + description: + - Name of the resource. Provided by the client when the resource is created. The + name must be 1-63 characters long, and comply with RFC1035. Specifically, the + name must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` + which means the first character must be a lowercase letter, and all following + characters must be a dash, lowercase letter, or digit, except the last character, + which cannot be a dash. + returned: success + type: str +urlMap: + description: + - A reference to the UrlMap resource that defines the mapping from URL to the BackendService. + returned: success + type: dict ''' ################################################################################ diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_http_proxy_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_target_http_proxy_facts.py index 0506a929cacfa8..532b45575ce247 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_http_proxy_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_http_proxy_facts.py @@ -32,21 +32,20 @@ --- module: gcp_compute_target_http_proxy_facts description: - - Gather facts for GCP TargetHttpProxy +- Gather facts for GCP TargetHttpProxy short_description: Gather facts for GCP TargetHttpProxy version_added: 2.7 author: Google Inc. (@googlecloudplatform) requirements: - - python >= 2.6 - - requests >= 2.18.4 - - google-auth >= 1.3.0 +- python >= 2.6 +- requests >= 2.18.4 +- google-auth >= 1.3.0 options: - filters: - description: - A list of filter value pairs. Available filters are listed here - U(https://cloud.google.com/sdk/gcloud/reference/topic/filters). - Each additional filter in the list will act be added as an AND condition - (filter1 and filter2) + filters: + description: + - A list of filter value pairs. Available filters are listed here U(U(https://cloud.google.com/sdk/gcloud/reference/topic/filters).) + - Each additional filter in the list will act be added as an AND condition (filter1 + and filter2) . extends_documentation_fragment: gcp ''' @@ -62,40 +61,41 @@ RETURN = ''' items: - description: List of items - returned: always - type: complex - contains: - creationTimestamp: - description: - - Creation timestamp in RFC3339 text format. - returned: success - type: str - description: - description: - - An optional description of this resource. - returned: success - type: str - id: - description: - - The unique identifier for the resource. - returned: success - type: int - name: - description: - - Name of the resource. Provided by the client when the resource is created. The name - must be 1-63 characters long, and comply with RFC1035. Specifically, the name must - be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` - which means the first character must be a lowercase letter, and all following characters - must be a dash, lowercase letter, or digit, except the last character, which cannot - be a dash. - returned: success - type: str - urlMap: - description: - - A reference to the UrlMap resource that defines the mapping from URL to the BackendService. - returned: success - type: dict + description: List of items + returned: always + type: complex + contains: + creationTimestamp: + description: + - Creation timestamp in RFC3339 text format. + returned: success + type: str + description: + description: + - An optional description of this resource. + returned: success + type: str + id: + description: + - The unique identifier for the resource. + returned: success + type: int + name: + description: + - Name of the resource. Provided by the client when the resource is created. + The name must be 1-63 characters long, and comply with RFC1035. Specifically, + the name must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` + which means the first character must be a lowercase letter, and all following + characters must be a dash, lowercase letter, or digit, except the last character, + which cannot be a dash. + returned: success + type: str + urlMap: + description: + - A reference to the UrlMap resource that defines the mapping from URL to the + BackendService. + returned: success + type: dict ''' ################################################################################ diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_https_proxy.py b/lib/ansible/modules/cloud/google/gcp_compute_target_https_proxy.py index fc298bdc89ba78..7c848e915b59c3 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_https_proxy.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_https_proxy.py @@ -32,62 +32,69 @@ --- module: gcp_compute_target_https_proxy description: - - Represents a TargetHttpsProxy resource, which is used by one or more global forwarding - rule to route incoming HTTPS requests to a URL map. +- Represents a TargetHttpsProxy resource, which is used by one or more global forwarding + rule to route incoming HTTPS requests to a URL map. short_description: Creates a GCP TargetHttpsProxy version_added: 2.6 author: Google Inc. (@googlecloudplatform) requirements: - - python >= 2.6 - - requests >= 2.18.4 - - google-auth >= 1.3.0 +- python >= 2.6 +- requests >= 2.18.4 +- google-auth >= 1.3.0 options: - state: - description: - - Whether the given object should exist in GCP - choices: ['present', 'absent'] - default: 'present' + state: description: - description: - - An optional description of this resource. - required: false - name: - description: - - Name of the resource. Provided by the client when the resource is created. The name - must be 1-63 characters long, and comply with RFC1035. Specifically, the name must - be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` - which means the first character must be a lowercase letter, and all following characters - must be a dash, lowercase letter, or digit, except the last character, which cannot - be a dash. - required: true - quic_override: - description: - - Specifies the QUIC override policy for this resource. This determines whether the - load balancer will attempt to negotiate QUIC with clients or not. Can specify one - of NONE, ENABLE, or DISABLE. If NONE is specified, uses the QUIC policy with no - user overrides, which is equivalent to DISABLE. Not specifying this field is equivalent - to specifying NONE. - required: false - version_added: 2.7 - choices: ['NONE', 'ENABLE', 'DISABLE'] - ssl_certificates: - description: - - A list of SslCertificate resources that are used to authenticate connections between - users and the load balancer. Currently, exactly one SSL certificate must be specified. - required: true - url_map: - description: - - A reference to the UrlMap resource that defines the mapping from URL to the BackendService. - - 'This field represents a link to a UrlMap resource in GCP. It can be specified in - two ways. You can add `register: name-of-resource` to a gcp_compute_url_map task - and then set this url_map field to "{{ name-of-resource }}" Alternatively, you can - set this url_map to a dictionary with the selfLink key where the value is the selfLink - of your UrlMap.' - required: true + - Whether the given object should exist in GCP + choices: + - present + - absent + default: present + description: + description: + - An optional description of this resource. + required: false + name: + description: + - Name of the resource. Provided by the client when the resource is created. The + name must be 1-63 characters long, and comply with RFC1035. Specifically, the + name must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` + which means the first character must be a lowercase letter, and all following + characters must be a dash, lowercase letter, or digit, except the last character, + which cannot be a dash. + required: true + quic_override: + description: + - Specifies the QUIC override policy for this resource. This determines whether + the load balancer will attempt to negotiate QUIC with clients or not. Can specify + one of NONE, ENABLE, or DISABLE. If NONE is specified, uses the QUIC policy + with no user overrides, which is equivalent to DISABLE. Not specifying this + field is equivalent to specifying NONE. + required: false + version_added: 2.7 + choices: + - NONE + - ENABLE + - DISABLE + ssl_certificates: + description: + - A list of SslCertificate resources that are used to authenticate connections + between users and the load balancer. Currently, exactly one SSL certificate + must be specified. + required: true + url_map: + description: + - A reference to the UrlMap resource that defines the mapping from URL to the + BackendService. + - 'This field represents a link to a UrlMap resource in GCP. It can be specified + in two ways. You can add `register: name-of-resource` to a gcp_compute_url_map + task and then set this url_map field to "{{ name-of-resource }}" Alternatively, + you can set this url_map to a dictionary with the selfLink key where the value + is the selfLink of your UrlMap' + required: true extends_documentation_fragment: gcp notes: - - "API Reference: U(https://cloud.google.com/compute/docs/reference/latest/targetHttpsProxies)" - - "Official Documentation: U(https://cloud.google.com/compute/docs/load-balancing/http/target-proxies)" +- 'API Reference: U(https://cloud.google.com/compute/docs/reference/latest/targetHttpsProxies)' +- 'Official Documentation: U(https://cloud.google.com/compute/docs/load-balancing/http/target-proxies)' ''' EXAMPLES = ''' @@ -185,51 +192,51 @@ ''' RETURN = ''' - creationTimestamp: - description: - - Creation timestamp in RFC3339 text format. - returned: success - type: str - description: - description: - - An optional description of this resource. - returned: success - type: str - id: - description: - - The unique identifier for the resource. - returned: success - type: int - name: - description: - - Name of the resource. Provided by the client when the resource is created. The name - must be 1-63 characters long, and comply with RFC1035. Specifically, the name must - be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` - which means the first character must be a lowercase letter, and all following characters - must be a dash, lowercase letter, or digit, except the last character, which cannot - be a dash. - returned: success - type: str - quicOverride: - description: - - Specifies the QUIC override policy for this resource. This determines whether the - load balancer will attempt to negotiate QUIC with clients or not. Can specify one - of NONE, ENABLE, or DISABLE. If NONE is specified, uses the QUIC policy with no - user overrides, which is equivalent to DISABLE. Not specifying this field is equivalent - to specifying NONE. - returned: success - type: str - sslCertificates: - description: - - A list of SslCertificate resources that are used to authenticate connections between - users and the load balancer. Currently, exactly one SSL certificate must be specified. - returned: success - type: list - urlMap: - description: - - A reference to the UrlMap resource that defines the mapping from URL to the BackendService. - returned: success - type: dict +creationTimestamp: + description: + - Creation timestamp in RFC3339 text format. + returned: success + type: str +description: + description: + - An optional description of this resource. + returned: success + type: str +id: + description: + - The unique identifier for the resource. + returned: success + type: int +name: + description: + - Name of the resource. Provided by the client when the resource is created. The + name must be 1-63 characters long, and comply with RFC1035. Specifically, the + name must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` + which means the first character must be a lowercase letter, and all following + characters must be a dash, lowercase letter, or digit, except the last character, + which cannot be a dash. + returned: success + type: str +quicOverride: + description: + - Specifies the QUIC override policy for this resource. This determines whether + the load balancer will attempt to negotiate QUIC with clients or not. Can specify + one of NONE, ENABLE, or DISABLE. If NONE is specified, uses the QUIC policy with + no user overrides, which is equivalent to DISABLE. Not specifying this field is + equivalent to specifying NONE. + returned: success + type: str +sslCertificates: + description: + - A list of SslCertificate resources that are used to authenticate connections between + users and the load balancer. Currently, exactly one SSL certificate must be specified. + returned: success + type: list +urlMap: + description: + - A reference to the UrlMap resource that defines the mapping from URL to the BackendService. + returned: success + type: dict ''' ################################################################################ diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_https_proxy_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_target_https_proxy_facts.py index 1b536b643bba2d..61b08ccc8aa8d8 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_https_proxy_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_https_proxy_facts.py @@ -32,21 +32,20 @@ --- module: gcp_compute_target_https_proxy_facts description: - - Gather facts for GCP TargetHttpsProxy +- Gather facts for GCP TargetHttpsProxy short_description: Gather facts for GCP TargetHttpsProxy version_added: 2.7 author: Google Inc. (@googlecloudplatform) requirements: - - python >= 2.6 - - requests >= 2.18.4 - - google-auth >= 1.3.0 +- python >= 2.6 +- requests >= 2.18.4 +- google-auth >= 1.3.0 options: - filters: - description: - A list of filter value pairs. Available filters are listed here - U(https://cloud.google.com/sdk/gcloud/reference/topic/filters). - Each additional filter in the list will act be added as an AND condition - (filter1 and filter2) + filters: + description: + - A list of filter value pairs. Available filters are listed here U(U(https://cloud.google.com/sdk/gcloud/reference/topic/filters).) + - Each additional filter in the list will act be added as an AND condition (filter1 + and filter2) . extends_documentation_fragment: gcp ''' @@ -62,55 +61,57 @@ RETURN = ''' items: - description: List of items - returned: always - type: complex - contains: - creationTimestamp: - description: - - Creation timestamp in RFC3339 text format. - returned: success - type: str - description: - description: - - An optional description of this resource. - returned: success - type: str - id: - description: - - The unique identifier for the resource. - returned: success - type: int - name: - description: - - Name of the resource. Provided by the client when the resource is created. The name - must be 1-63 characters long, and comply with RFC1035. Specifically, the name must - be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` - which means the first character must be a lowercase letter, and all following characters - must be a dash, lowercase letter, or digit, except the last character, which cannot - be a dash. - returned: success - type: str - quicOverride: - description: - - Specifies the QUIC override policy for this resource. This determines whether the - load balancer will attempt to negotiate QUIC with clients or not. Can specify one - of NONE, ENABLE, or DISABLE. If NONE is specified, uses the QUIC policy with no - user overrides, which is equivalent to DISABLE. Not specifying this field is equivalent - to specifying NONE. - returned: success - type: str - sslCertificates: - description: - - A list of SslCertificate resources that are used to authenticate connections between - users and the load balancer. Currently, exactly one SSL certificate must be specified. - returned: success - type: list - urlMap: - description: - - A reference to the UrlMap resource that defines the mapping from URL to the BackendService. - returned: success - type: dict + description: List of items + returned: always + type: complex + contains: + creationTimestamp: + description: + - Creation timestamp in RFC3339 text format. + returned: success + type: str + description: + description: + - An optional description of this resource. + returned: success + type: str + id: + description: + - The unique identifier for the resource. + returned: success + type: int + name: + description: + - Name of the resource. Provided by the client when the resource is created. + The name must be 1-63 characters long, and comply with RFC1035. Specifically, + the name must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` + which means the first character must be a lowercase letter, and all following + characters must be a dash, lowercase letter, or digit, except the last character, + which cannot be a dash. + returned: success + type: str + quicOverride: + description: + - Specifies the QUIC override policy for this resource. This determines whether + the load balancer will attempt to negotiate QUIC with clients or not. Can + specify one of NONE, ENABLE, or DISABLE. If NONE is specified, uses the QUIC + policy with no user overrides, which is equivalent to DISABLE. Not specifying + this field is equivalent to specifying NONE. + returned: success + type: str + sslCertificates: + description: + - A list of SslCertificate resources that are used to authenticate connections + between users and the load balancer. Currently, exactly one SSL certificate + must be specified. + returned: success + type: list + urlMap: + description: + - A reference to the UrlMap resource that defines the mapping from URL to the + BackendService. + returned: success + type: dict ''' ################################################################################ diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_pool.py b/lib/ansible/modules/cloud/google/gcp_compute_target_pool.py index b6fab8bb0f256e..bac2c213786158 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_pool.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_pool.py @@ -32,101 +32,106 @@ --- module: gcp_compute_target_pool description: - - Represents a TargetPool resource, used for Load Balancing. +- Represents a TargetPool resource, used for Load Balancing. short_description: Creates a GCP TargetPool version_added: 2.6 author: Google Inc. (@googlecloudplatform) requirements: - - python >= 2.6 - - requests >= 2.18.4 - - google-auth >= 1.3.0 +- python >= 2.6 +- requests >= 2.18.4 +- google-auth >= 1.3.0 options: - state: - description: - - Whether the given object should exist in GCP - choices: ['present', 'absent'] - default: 'present' - backup_pool: - description: - - This field is applicable only when the containing target pool is serving a forwarding - rule as the primary pool, and its failoverRatio field is properly set to a value - between [0, 1]. - - 'backupPool and failoverRatio together define the fallback behavior of the primary - target pool: if the ratio of the healthy instances in the primary pool is at or - below failoverRatio, traffic arriving at the load-balanced IP will be directed to - the backup pool.' - - In case where failoverRatio and backupPool are not set, or all the instances in - the backup pool are unhealthy, the traffic will be directed back to the primary - pool in the "force" mode, where traffic will be spread to the healthy instances - with the best effort, or to all instances when no instance is healthy. - - 'This field represents a link to a TargetPool resource in GCP. It can be specified - in two ways. You can add `register: name-of-resource` to a gcp_compute_target_pool - task and then set this backup_pool field to "{{ name-of-resource }}" Alternatively, - you can set this backup_pool to a dictionary with the selfLink key where the value - is the selfLink of your TargetPool.' - required: false + state: description: - description: - - An optional description of this resource. - required: false - failover_ratio: - description: - - This field is applicable only when the containing target pool is serving a forwarding - rule as the primary pool (i.e., not as a backup pool to some other target pool). - The value of the field must be in [0, 1]. - - 'If set, backupPool must also be set. They together define the fallback behavior - of the primary target pool: if the ratio of the healthy instances in the primary - pool is at or below this number, traffic arriving at the load-balanced IP will be - directed to the backup pool.' - - In case where failoverRatio is not set or all the instances in the backup pool are - unhealthy, the traffic will be directed back to the primary pool in the "force" - mode, where traffic will be spread to the healthy instances with the best effort, - or to all instances when no instance is healthy. - required: false - health_check: - description: - - A reference to a HttpHealthCheck resource. - - A member instance in this pool is considered healthy if and only if the health checks - pass. If not specified it means all member instances will be considered healthy - at all times. - - 'This field represents a link to a HttpHealthCheck resource in GCP. It can be specified - in two ways. You can add `register: name-of-resource` to a gcp_compute_http_health_check - task and then set this health_check field to "{{ name-of-resource }}" Alternatively, - you can set this health_check to a dictionary with the selfLink key where the value - is the selfLink of your HttpHealthCheck.' - required: false - instances: - description: - - A list of virtual machine instances serving this pool. - - They must live in zones contained in the same region as this pool. - required: false - name: - description: - - Name of the resource. Provided by the client when the resource is created. The name - must be 1-63 characters long, and comply with RFC1035. Specifically, the name must - be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` - which means the first character must be a lowercase letter, and all following characters - must be a dash, lowercase letter, or digit, except the last character, which cannot - be a dash. - required: true - session_affinity: - description: - - 'Session affinity option. Must be one of these values: - NONE: Connections from - the same client IP may go to any instance in the pool.' - - "- CLIENT_IP: Connections from the same client IP will go to the same instance - in the pool while that instance remains healthy." - - "- CLIENT_IP_PROTO: Connections from the same client IP with the same IP protocol - will go to the same instance in the pool while that instance remains healthy." - required: false - choices: ['NONE', 'CLIENT_IP', 'CLIENT_IP_PROTO'] - region: - description: - - The region where the target pool resides. - required: true + - Whether the given object should exist in GCP + choices: + - present + - absent + default: present + backup_pool: + description: + - This field is applicable only when the containing target pool is serving a forwarding + rule as the primary pool, and its failoverRatio field is properly set to a value + between [0, 1]. + - 'backupPool and failoverRatio together define the fallback behavior of the primary + target pool: if the ratio of the healthy instances in the primary pool is at + or below failoverRatio, traffic arriving at the load-balanced IP will be directed + to the backup pool.' + - In case where failoverRatio and backupPool are not set, or all the instances + in the backup pool are unhealthy, the traffic will be directed back to the primary + pool in the "force" mode, where traffic will be spread to the healthy instances + with the best effort, or to all instances when no instance is healthy. + - 'This field represents a link to a TargetPool resource in GCP. It can be specified + in two ways. You can add `register: name-of-resource` to a gcp_compute_target_pool + task and then set this backup_pool field to "{{ name-of-resource }}" Alternatively, + you can set this backup_pool to a dictionary with the selfLink key where the + value is the selfLink of your TargetPool' + required: false + description: + description: + - An optional description of this resource. + required: false + failover_ratio: + description: + - This field is applicable only when the containing target pool is serving a forwarding + rule as the primary pool (i.e., not as a backup pool to some other target pool). + The value of the field must be in [0, 1]. + - 'If set, backupPool must also be set. They together define the fallback behavior + of the primary target pool: if the ratio of the healthy instances in the primary + pool is at or below this number, traffic arriving at the load-balanced IP will + be directed to the backup pool.' + - In case where failoverRatio is not set or all the instances in the backup pool + are unhealthy, the traffic will be directed back to the primary pool in the + "force" mode, where traffic will be spread to the healthy instances with the + best effort, or to all instances when no instance is healthy. + required: false + health_check: + description: + - A reference to a HttpHealthCheck resource. + - A member instance in this pool is considered healthy if and only if the health + checks pass. If not specified it means all member instances will be considered + healthy at all times. + - 'This field represents a link to a HttpHealthCheck resource in GCP. It can be + specified in two ways. You can add `register: name-of-resource` to a gcp_compute_http_health_check + task and then set this health_check field to "{{ name-of-resource }}" Alternatively, + you can set this health_check to a dictionary with the selfLink key where the + value is the selfLink of your HttpHealthCheck' + required: false + instances: + description: + - A list of virtual machine instances serving this pool. + - They must live in zones contained in the same region as this pool. + required: false + name: + description: + - Name of the resource. Provided by the client when the resource is created. The + name must be 1-63 characters long, and comply with RFC1035. Specifically, the + name must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` + which means the first character must be a lowercase letter, and all following + characters must be a dash, lowercase letter, or digit, except the last character, + which cannot be a dash. + required: true + session_affinity: + description: + - 'Session affinity option. Must be one of these values: - NONE: Connections from + the same client IP may go to any instance in the pool.' + - "- CLIENT_IP: Connections from the same client IP will go to the same instance + in the pool while that instance remains healthy." + - "- CLIENT_IP_PROTO: Connections from the same client IP with the same IP protocol + will go to the same instance in the pool while that instance remains healthy." + required: false + choices: + - NONE + - CLIENT_IP + - CLIENT_IP_PROTO + region: + description: + - The region where the target pool resides. + required: true extends_documentation_fragment: gcp notes: - - "API Reference: U(https://cloud.google.com/compute/docs/reference/rest/v1/targetPools)" - - "Official Documentation: U(https://cloud.google.com/compute/docs/load-balancing/network/target-pools)" +- 'API Reference: U(https://cloud.google.com/compute/docs/reference/rest/v1/targetPools)' +- 'Official Documentation: U(https://cloud.google.com/compute/docs/load-balancing/network/target-pools)' ''' EXAMPLES = ''' @@ -141,90 +146,90 @@ ''' RETURN = ''' - backupPool: - description: - - This field is applicable only when the containing target pool is serving a forwarding - rule as the primary pool, and its failoverRatio field is properly set to a value - between [0, 1]. - - 'backupPool and failoverRatio together define the fallback behavior of the primary - target pool: if the ratio of the healthy instances in the primary pool is at or - below failoverRatio, traffic arriving at the load-balanced IP will be directed to - the backup pool.' - - In case where failoverRatio and backupPool are not set, or all the instances in - the backup pool are unhealthy, the traffic will be directed back to the primary - pool in the "force" mode, where traffic will be spread to the healthy instances - with the best effort, or to all instances when no instance is healthy. - returned: success - type: dict - creationTimestamp: - description: - - Creation timestamp in RFC3339 text format. - returned: success - type: str - description: - description: - - An optional description of this resource. - returned: success - type: str - failoverRatio: - description: - - This field is applicable only when the containing target pool is serving a forwarding - rule as the primary pool (i.e., not as a backup pool to some other target pool). - The value of the field must be in [0, 1]. - - 'If set, backupPool must also be set. They together define the fallback behavior - of the primary target pool: if the ratio of the healthy instances in the primary - pool is at or below this number, traffic arriving at the load-balanced IP will be - directed to the backup pool.' - - In case where failoverRatio is not set or all the instances in the backup pool are - unhealthy, the traffic will be directed back to the primary pool in the "force" - mode, where traffic will be spread to the healthy instances with the best effort, - or to all instances when no instance is healthy. - returned: success - type: str - healthCheck: - description: - - A reference to a HttpHealthCheck resource. - - A member instance in this pool is considered healthy if and only if the health checks - pass. If not specified it means all member instances will be considered healthy - at all times. - returned: success - type: dict - id: - description: - - The unique identifier for the resource. - returned: success - type: int - instances: - description: - - A list of virtual machine instances serving this pool. - - They must live in zones contained in the same region as this pool. - returned: success - type: list - name: - description: - - Name of the resource. Provided by the client when the resource is created. The name - must be 1-63 characters long, and comply with RFC1035. Specifically, the name must - be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` - which means the first character must be a lowercase letter, and all following characters - must be a dash, lowercase letter, or digit, except the last character, which cannot - be a dash. - returned: success - type: str - sessionAffinity: - description: - - 'Session affinity option. Must be one of these values: - NONE: Connections from - the same client IP may go to any instance in the pool.' - - "- CLIENT_IP: Connections from the same client IP will go to the same instance - in the pool while that instance remains healthy." - - "- CLIENT_IP_PROTO: Connections from the same client IP with the same IP protocol - will go to the same instance in the pool while that instance remains healthy." - returned: success - type: str - region: - description: - - The region where the target pool resides. - returned: success - type: str +backupPool: + description: + - This field is applicable only when the containing target pool is serving a forwarding + rule as the primary pool, and its failoverRatio field is properly set to a value + between [0, 1]. + - 'backupPool and failoverRatio together define the fallback behavior of the primary + target pool: if the ratio of the healthy instances in the primary pool is at or + below failoverRatio, traffic arriving at the load-balanced IP will be directed + to the backup pool.' + - In case where failoverRatio and backupPool are not set, or all the instances in + the backup pool are unhealthy, the traffic will be directed back to the primary + pool in the "force" mode, where traffic will be spread to the healthy instances + with the best effort, or to all instances when no instance is healthy. + returned: success + type: dict +creationTimestamp: + description: + - Creation timestamp in RFC3339 text format. + returned: success + type: str +description: + description: + - An optional description of this resource. + returned: success + type: str +failoverRatio: + description: + - This field is applicable only when the containing target pool is serving a forwarding + rule as the primary pool (i.e., not as a backup pool to some other target pool). + The value of the field must be in [0, 1]. + - 'If set, backupPool must also be set. They together define the fallback behavior + of the primary target pool: if the ratio of the healthy instances in the primary + pool is at or below this number, traffic arriving at the load-balanced IP will + be directed to the backup pool.' + - In case where failoverRatio is not set or all the instances in the backup pool + are unhealthy, the traffic will be directed back to the primary pool in the "force" + mode, where traffic will be spread to the healthy instances with the best effort, + or to all instances when no instance is healthy. + returned: success + type: str +healthCheck: + description: + - A reference to a HttpHealthCheck resource. + - A member instance in this pool is considered healthy if and only if the health + checks pass. If not specified it means all member instances will be considered + healthy at all times. + returned: success + type: dict +id: + description: + - The unique identifier for the resource. + returned: success + type: int +instances: + description: + - A list of virtual machine instances serving this pool. + - They must live in zones contained in the same region as this pool. + returned: success + type: list +name: + description: + - Name of the resource. Provided by the client when the resource is created. The + name must be 1-63 characters long, and comply with RFC1035. Specifically, the + name must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` + which means the first character must be a lowercase letter, and all following + characters must be a dash, lowercase letter, or digit, except the last character, + which cannot be a dash. + returned: success + type: str +sessionAffinity: + description: + - 'Session affinity option. Must be one of these values: - NONE: Connections from + the same client IP may go to any instance in the pool.' + - "- CLIENT_IP: Connections from the same client IP will go to the same instance + in the pool while that instance remains healthy." + - "- CLIENT_IP_PROTO: Connections from the same client IP with the same IP protocol + will go to the same instance in the pool while that instance remains healthy." + returned: success + type: str +region: + description: + - The region where the target pool resides. + returned: success + type: str ''' ################################################################################ diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_pool_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_target_pool_facts.py index a7383290418309..84e7b30be35bc3 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_pool_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_pool_facts.py @@ -32,25 +32,24 @@ --- module: gcp_compute_target_pool_facts description: - - Gather facts for GCP TargetPool +- Gather facts for GCP TargetPool short_description: Gather facts for GCP TargetPool version_added: 2.7 author: Google Inc. (@googlecloudplatform) requirements: - - python >= 2.6 - - requests >= 2.18.4 - - google-auth >= 1.3.0 +- python >= 2.6 +- requests >= 2.18.4 +- google-auth >= 1.3.0 options: - filters: - description: - A list of filter value pairs. Available filters are listed here - U(https://cloud.google.com/sdk/gcloud/reference/topic/filters). - Each additional filter in the list will act be added as an AND condition - (filter1 and filter2) - region: - description: - - The region where the target pool resides. - required: true + filters: + description: + - A list of filter value pairs. Available filters are listed here U(U(https://cloud.google.com/sdk/gcloud/reference/topic/filters).) + - Each additional filter in the list will act be added as an AND condition (filter1 + and filter2) . + region: + description: + - The region where the target pool resides. + required: true extends_documentation_fragment: gcp ''' @@ -67,94 +66,94 @@ RETURN = ''' items: - description: List of items - returned: always - type: complex - contains: - backupPool: - description: - - This field is applicable only when the containing target pool is serving a forwarding - rule as the primary pool, and its failoverRatio field is properly set to a value - between [0, 1]. - - 'backupPool and failoverRatio together define the fallback behavior of the primary - target pool: if the ratio of the healthy instances in the primary pool is at or - below failoverRatio, traffic arriving at the load-balanced IP will be directed to - the backup pool.' - - In case where failoverRatio and backupPool are not set, or all the instances in - the backup pool are unhealthy, the traffic will be directed back to the primary - pool in the "force" mode, where traffic will be spread to the healthy instances - with the best effort, or to all instances when no instance is healthy. - returned: success - type: dict - creationTimestamp: - description: - - Creation timestamp in RFC3339 text format. - returned: success - type: str - description: - description: - - An optional description of this resource. - returned: success - type: str - failoverRatio: - description: - - This field is applicable only when the containing target pool is serving a forwarding - rule as the primary pool (i.e., not as a backup pool to some other target pool). - The value of the field must be in [0, 1]. - - 'If set, backupPool must also be set. They together define the fallback behavior - of the primary target pool: if the ratio of the healthy instances in the primary - pool is at or below this number, traffic arriving at the load-balanced IP will be - directed to the backup pool.' - - In case where failoverRatio is not set or all the instances in the backup pool are - unhealthy, the traffic will be directed back to the primary pool in the "force" - mode, where traffic will be spread to the healthy instances with the best effort, - or to all instances when no instance is healthy. - returned: success - type: str - healthCheck: - description: - - A reference to a HttpHealthCheck resource. - - A member instance in this pool is considered healthy if and only if the health checks - pass. If not specified it means all member instances will be considered healthy - at all times. - returned: success - type: dict - id: - description: - - The unique identifier for the resource. - returned: success - type: int - instances: - description: - - A list of virtual machine instances serving this pool. - - They must live in zones contained in the same region as this pool. - returned: success - type: list - name: - description: - - Name of the resource. Provided by the client when the resource is created. The name - must be 1-63 characters long, and comply with RFC1035. Specifically, the name must - be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` - which means the first character must be a lowercase letter, and all following characters - must be a dash, lowercase letter, or digit, except the last character, which cannot - be a dash. - returned: success - type: str - sessionAffinity: - description: - - 'Session affinity option. Must be one of these values: - NONE: Connections from - the same client IP may go to any instance in the pool.' - - "- CLIENT_IP: Connections from the same client IP will go to the same instance - in the pool while that instance remains healthy." - - "- CLIENT_IP_PROTO: Connections from the same client IP with the same IP protocol - will go to the same instance in the pool while that instance remains healthy." - returned: success - type: str - region: - description: - - The region where the target pool resides. - returned: success - type: str + description: List of items + returned: always + type: complex + contains: + backupPool: + description: + - This field is applicable only when the containing target pool is serving a + forwarding rule as the primary pool, and its failoverRatio field is properly + set to a value between [0, 1]. + - 'backupPool and failoverRatio together define the fallback behavior of the + primary target pool: if the ratio of the healthy instances in the primary + pool is at or below failoverRatio, traffic arriving at the load-balanced IP + will be directed to the backup pool.' + - In case where failoverRatio and backupPool are not set, or all the instances + in the backup pool are unhealthy, the traffic will be directed back to the + primary pool in the "force" mode, where traffic will be spread to the healthy + instances with the best effort, or to all instances when no instance is healthy. + returned: success + type: dict + creationTimestamp: + description: + - Creation timestamp in RFC3339 text format. + returned: success + type: str + description: + description: + - An optional description of this resource. + returned: success + type: str + failoverRatio: + description: + - This field is applicable only when the containing target pool is serving a + forwarding rule as the primary pool (i.e., not as a backup pool to some other + target pool). The value of the field must be in [0, 1]. + - 'If set, backupPool must also be set. They together define the fallback behavior + of the primary target pool: if the ratio of the healthy instances in the primary + pool is at or below this number, traffic arriving at the load-balanced IP + will be directed to the backup pool.' + - In case where failoverRatio is not set or all the instances in the backup + pool are unhealthy, the traffic will be directed back to the primary pool + in the "force" mode, where traffic will be spread to the healthy instances + with the best effort, or to all instances when no instance is healthy. + returned: success + type: str + healthCheck: + description: + - A reference to a HttpHealthCheck resource. + - A member instance in this pool is considered healthy if and only if the health + checks pass. If not specified it means all member instances will be considered + healthy at all times. + returned: success + type: dict + id: + description: + - The unique identifier for the resource. + returned: success + type: int + instances: + description: + - A list of virtual machine instances serving this pool. + - They must live in zones contained in the same region as this pool. + returned: success + type: list + name: + description: + - Name of the resource. Provided by the client when the resource is created. + The name must be 1-63 characters long, and comply with RFC1035. Specifically, + the name must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` + which means the first character must be a lowercase letter, and all following + characters must be a dash, lowercase letter, or digit, except the last character, + which cannot be a dash. + returned: success + type: str + sessionAffinity: + description: + - 'Session affinity option. Must be one of these values: - NONE: Connections + from the same client IP may go to any instance in the pool.' + - "- CLIENT_IP: Connections from the same client IP will go to the same instance + in the pool while that instance remains healthy." + - "- CLIENT_IP_PROTO: Connections from the same client IP with the same IP protocol + will go to the same instance in the pool while that instance remains healthy." + returned: success + type: str + region: + description: + - The region where the target pool resides. + returned: success + type: str ''' ################################################################################ diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_ssl_proxy.py b/lib/ansible/modules/cloud/google/gcp_compute_target_ssl_proxy.py index 8f6b10d91aa8d8..d58f9d54cf7014 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_ssl_proxy.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_ssl_proxy.py @@ -32,58 +32,63 @@ --- module: gcp_compute_target_ssl_proxy description: - - Represents a TargetSslProxy resource, which is used by one or more global forwarding - rule to route incoming SSL requests to a backend service. +- Represents a TargetSslProxy resource, which is used by one or more global forwarding + rule to route incoming SSL requests to a backend service. short_description: Creates a GCP TargetSslProxy version_added: 2.6 author: Google Inc. (@googlecloudplatform) requirements: - - python >= 2.6 - - requests >= 2.18.4 - - google-auth >= 1.3.0 +- python >= 2.6 +- requests >= 2.18.4 +- google-auth >= 1.3.0 options: - state: - description: - - Whether the given object should exist in GCP - choices: ['present', 'absent'] - default: 'present' + state: description: - description: - - An optional description of this resource. - required: false - name: - description: - - Name of the resource. Provided by the client when the resource is created. The name - must be 1-63 characters long, and comply with RFC1035. Specifically, the name must - be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` - which means the first character must be a lowercase letter, and all following characters - must be a dash, lowercase letter, or digit, except the last character, which cannot - be a dash. - required: true - proxy_header: - description: - - Specifies the type of proxy header to append before sending data to the backend, - either NONE or PROXY_V1. The default is NONE. - required: false - choices: ['NONE', 'PROXY_V1'] - service: - description: - - A reference to the BackendService resource. - - 'This field represents a link to a BackendService resource in GCP. It can be specified - in two ways. You can add `register: name-of-resource` to a gcp_compute_backend_service - task and then set this service field to "{{ name-of-resource }}" Alternatively, - you can set this service to a dictionary with the selfLink key where the value is - the selfLink of your BackendService.' - required: true - ssl_certificates: - description: - - A list of SslCertificate resources that are used to authenticate connections between - users and the load balancer. Currently, exactly one SSL certificate must be specified. - required: true + - Whether the given object should exist in GCP + choices: + - present + - absent + default: present + description: + description: + - An optional description of this resource. + required: false + name: + description: + - Name of the resource. Provided by the client when the resource is created. The + name must be 1-63 characters long, and comply with RFC1035. Specifically, the + name must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` + which means the first character must be a lowercase letter, and all following + characters must be a dash, lowercase letter, or digit, except the last character, + which cannot be a dash. + required: true + proxy_header: + description: + - Specifies the type of proxy header to append before sending data to the backend, + either NONE or PROXY_V1. The default is NONE. + required: false + choices: + - NONE + - PROXY_V1 + service: + description: + - A reference to the BackendService resource. + - 'This field represents a link to a BackendService resource in GCP. It can be + specified in two ways. You can add `register: name-of-resource` to a gcp_compute_backend_service + task and then set this service field to "{{ name-of-resource }}" Alternatively, + you can set this service to a dictionary with the selfLink key where the value + is the selfLink of your BackendService' + required: true + ssl_certificates: + description: + - A list of SslCertificate resources that are used to authenticate connections + between users and the load balancer. Currently, exactly one SSL certificate + must be specified. + required: true extends_documentation_fragment: gcp notes: - - "API Reference: U(https://cloud.google.com/compute/docs/reference/latest/targetSslProxies)" - - "Setting Up SSL proxy for Google Cloud Load Balancing: U(https://cloud.google.com/compute/docs/load-balancing/tcp-ssl/)" +- 'API Reference: U(https://cloud.google.com/compute/docs/reference/latest/targetSslProxies)' +- 'Setting Up SSL proxy for Google Cloud Load Balancing: U(https://cloud.google.com/compute/docs/load-balancing/tcp-ssl/)' ''' EXAMPLES = ''' @@ -175,48 +180,48 @@ ''' RETURN = ''' - creationTimestamp: - description: - - Creation timestamp in RFC3339 text format. - returned: success - type: str - description: - description: - - An optional description of this resource. - returned: success - type: str - id: - description: - - The unique identifier for the resource. - returned: success - type: int - name: - description: - - Name of the resource. Provided by the client when the resource is created. The name - must be 1-63 characters long, and comply with RFC1035. Specifically, the name must - be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` - which means the first character must be a lowercase letter, and all following characters - must be a dash, lowercase letter, or digit, except the last character, which cannot - be a dash. - returned: success - type: str - proxyHeader: - description: - - Specifies the type of proxy header to append before sending data to the backend, - either NONE or PROXY_V1. The default is NONE. - returned: success - type: str - service: - description: - - A reference to the BackendService resource. - returned: success - type: dict - sslCertificates: - description: - - A list of SslCertificate resources that are used to authenticate connections between - users and the load balancer. Currently, exactly one SSL certificate must be specified. - returned: success - type: list +creationTimestamp: + description: + - Creation timestamp in RFC3339 text format. + returned: success + type: str +description: + description: + - An optional description of this resource. + returned: success + type: str +id: + description: + - The unique identifier for the resource. + returned: success + type: int +name: + description: + - Name of the resource. Provided by the client when the resource is created. The + name must be 1-63 characters long, and comply with RFC1035. Specifically, the + name must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` + which means the first character must be a lowercase letter, and all following + characters must be a dash, lowercase letter, or digit, except the last character, + which cannot be a dash. + returned: success + type: str +proxyHeader: + description: + - Specifies the type of proxy header to append before sending data to the backend, + either NONE or PROXY_V1. The default is NONE. + returned: success + type: str +service: + description: + - A reference to the BackendService resource. + returned: success + type: dict +sslCertificates: + description: + - A list of SslCertificate resources that are used to authenticate connections between + users and the load balancer. Currently, exactly one SSL certificate must be specified. + returned: success + type: list ''' ################################################################################ diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_ssl_proxy_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_target_ssl_proxy_facts.py index 47c4a707ff4300..cd80be52fdef4b 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_ssl_proxy_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_ssl_proxy_facts.py @@ -32,21 +32,20 @@ --- module: gcp_compute_target_ssl_proxy_facts description: - - Gather facts for GCP TargetSslProxy +- Gather facts for GCP TargetSslProxy short_description: Gather facts for GCP TargetSslProxy version_added: 2.7 author: Google Inc. (@googlecloudplatform) requirements: - - python >= 2.6 - - requests >= 2.18.4 - - google-auth >= 1.3.0 +- python >= 2.6 +- requests >= 2.18.4 +- google-auth >= 1.3.0 options: - filters: - description: - A list of filter value pairs. Available filters are listed here - U(https://cloud.google.com/sdk/gcloud/reference/topic/filters). - Each additional filter in the list will act be added as an AND condition - (filter1 and filter2) + filters: + description: + - A list of filter value pairs. Available filters are listed here U(U(https://cloud.google.com/sdk/gcloud/reference/topic/filters).) + - Each additional filter in the list will act be added as an AND condition (filter1 + and filter2) . extends_documentation_fragment: gcp ''' @@ -62,52 +61,53 @@ RETURN = ''' items: - description: List of items - returned: always - type: complex - contains: - creationTimestamp: - description: - - Creation timestamp in RFC3339 text format. - returned: success - type: str - description: - description: - - An optional description of this resource. - returned: success - type: str - id: - description: - - The unique identifier for the resource. - returned: success - type: int - name: - description: - - Name of the resource. Provided by the client when the resource is created. The name - must be 1-63 characters long, and comply with RFC1035. Specifically, the name must - be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` - which means the first character must be a lowercase letter, and all following characters - must be a dash, lowercase letter, or digit, except the last character, which cannot - be a dash. - returned: success - type: str - proxyHeader: - description: - - Specifies the type of proxy header to append before sending data to the backend, - either NONE or PROXY_V1. The default is NONE. - returned: success - type: str - service: - description: - - A reference to the BackendService resource. - returned: success - type: dict - sslCertificates: - description: - - A list of SslCertificate resources that are used to authenticate connections between - users and the load balancer. Currently, exactly one SSL certificate must be specified. - returned: success - type: list + description: List of items + returned: always + type: complex + contains: + creationTimestamp: + description: + - Creation timestamp in RFC3339 text format. + returned: success + type: str + description: + description: + - An optional description of this resource. + returned: success + type: str + id: + description: + - The unique identifier for the resource. + returned: success + type: int + name: + description: + - Name of the resource. Provided by the client when the resource is created. + The name must be 1-63 characters long, and comply with RFC1035. Specifically, + the name must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` + which means the first character must be a lowercase letter, and all following + characters must be a dash, lowercase letter, or digit, except the last character, + which cannot be a dash. + returned: success + type: str + proxyHeader: + description: + - Specifies the type of proxy header to append before sending data to the backend, + either NONE or PROXY_V1. The default is NONE. + returned: success + type: str + service: + description: + - A reference to the BackendService resource. + returned: success + type: dict + sslCertificates: + description: + - A list of SslCertificate resources that are used to authenticate connections + between users and the load balancer. Currently, exactly one SSL certificate + must be specified. + returned: success + type: list ''' ################################################################################ diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_tcp_proxy.py b/lib/ansible/modules/cloud/google/gcp_compute_target_tcp_proxy.py index fe805985a9a3ec..e198b600c97493 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_tcp_proxy.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_tcp_proxy.py @@ -32,53 +32,57 @@ --- module: gcp_compute_target_tcp_proxy description: - - Represents a TargetTcpProxy resource, which is used by one or more global forwarding - rule to route incoming TCP requests to a Backend service. +- Represents a TargetTcpProxy resource, which is used by one or more global forwarding + rule to route incoming TCP requests to a Backend service. short_description: Creates a GCP TargetTcpProxy version_added: 2.6 author: Google Inc. (@googlecloudplatform) requirements: - - python >= 2.6 - - requests >= 2.18.4 - - google-auth >= 1.3.0 +- python >= 2.6 +- requests >= 2.18.4 +- google-auth >= 1.3.0 options: - state: - description: - - Whether the given object should exist in GCP - choices: ['present', 'absent'] - default: 'present' + state: description: - description: - - An optional description of this resource. - required: false - name: - description: - - Name of the resource. Provided by the client when the resource is created. The name - must be 1-63 characters long, and comply with RFC1035. Specifically, the name must - be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` - which means the first character must be a lowercase letter, and all following characters - must be a dash, lowercase letter, or digit, except the last character, which cannot - be a dash. - required: true - proxy_header: - description: - - Specifies the type of proxy header to append before sending data to the backend, - either NONE or PROXY_V1. The default is NONE. - required: false - choices: ['NONE', 'PROXY_V1'] - service: - description: - - A reference to the BackendService resource. - - 'This field represents a link to a BackendService resource in GCP. It can be specified - in two ways. You can add `register: name-of-resource` to a gcp_compute_backend_service - task and then set this service field to "{{ name-of-resource }}" Alternatively, - you can set this service to a dictionary with the selfLink key where the value is - the selfLink of your BackendService.' - required: true + - Whether the given object should exist in GCP + choices: + - present + - absent + default: present + description: + description: + - An optional description of this resource. + required: false + name: + description: + - Name of the resource. Provided by the client when the resource is created. The + name must be 1-63 characters long, and comply with RFC1035. Specifically, the + name must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` + which means the first character must be a lowercase letter, and all following + characters must be a dash, lowercase letter, or digit, except the last character, + which cannot be a dash. + required: true + proxy_header: + description: + - Specifies the type of proxy header to append before sending data to the backend, + either NONE or PROXY_V1. The default is NONE. + required: false + choices: + - NONE + - PROXY_V1 + service: + description: + - A reference to the BackendService resource. + - 'This field represents a link to a BackendService resource in GCP. It can be + specified in two ways. You can add `register: name-of-resource` to a gcp_compute_backend_service + task and then set this service field to "{{ name-of-resource }}" Alternatively, + you can set this service to a dictionary with the selfLink key where the value + is the selfLink of your BackendService' + required: true extends_documentation_fragment: gcp notes: - - "API Reference: U(https://cloud.google.com/compute/docs/reference/latest/targetTcpProxies)" - - "Setting Up TCP proxy for Google Cloud Load Balancing: U(https://cloud.google.com/compute/docs/load-balancing/tcp-ssl/tcp-proxy)" +- 'API Reference: U(https://cloud.google.com/compute/docs/reference/latest/targetTcpProxies)' +- 'Setting Up TCP proxy for Google Cloud Load Balancing: U(https://cloud.google.com/compute/docs/load-balancing/tcp-ssl/tcp-proxy)' ''' EXAMPLES = ''' @@ -135,42 +139,42 @@ ''' RETURN = ''' - creationTimestamp: - description: - - Creation timestamp in RFC3339 text format. - returned: success - type: str - description: - description: - - An optional description of this resource. - returned: success - type: str - id: - description: - - The unique identifier for the resource. - returned: success - type: int - name: - description: - - Name of the resource. Provided by the client when the resource is created. The name - must be 1-63 characters long, and comply with RFC1035. Specifically, the name must - be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` - which means the first character must be a lowercase letter, and all following characters - must be a dash, lowercase letter, or digit, except the last character, which cannot - be a dash. - returned: success - type: str - proxyHeader: - description: - - Specifies the type of proxy header to append before sending data to the backend, - either NONE or PROXY_V1. The default is NONE. - returned: success - type: str - service: - description: - - A reference to the BackendService resource. - returned: success - type: dict +creationTimestamp: + description: + - Creation timestamp in RFC3339 text format. + returned: success + type: str +description: + description: + - An optional description of this resource. + returned: success + type: str +id: + description: + - The unique identifier for the resource. + returned: success + type: int +name: + description: + - Name of the resource. Provided by the client when the resource is created. The + name must be 1-63 characters long, and comply with RFC1035. Specifically, the + name must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` + which means the first character must be a lowercase letter, and all following + characters must be a dash, lowercase letter, or digit, except the last character, + which cannot be a dash. + returned: success + type: str +proxyHeader: + description: + - Specifies the type of proxy header to append before sending data to the backend, + either NONE or PROXY_V1. The default is NONE. + returned: success + type: str +service: + description: + - A reference to the BackendService resource. + returned: success + type: dict ''' ################################################################################ diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_tcp_proxy_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_target_tcp_proxy_facts.py index 158198ced71297..af46f9dfae65c5 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_tcp_proxy_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_tcp_proxy_facts.py @@ -32,21 +32,20 @@ --- module: gcp_compute_target_tcp_proxy_facts description: - - Gather facts for GCP TargetTcpProxy +- Gather facts for GCP TargetTcpProxy short_description: Gather facts for GCP TargetTcpProxy version_added: 2.7 author: Google Inc. (@googlecloudplatform) requirements: - - python >= 2.6 - - requests >= 2.18.4 - - google-auth >= 1.3.0 +- python >= 2.6 +- requests >= 2.18.4 +- google-auth >= 1.3.0 options: - filters: - description: - A list of filter value pairs. Available filters are listed here - U(https://cloud.google.com/sdk/gcloud/reference/topic/filters). - Each additional filter in the list will act be added as an AND condition - (filter1 and filter2) + filters: + description: + - A list of filter value pairs. Available filters are listed here U(U(https://cloud.google.com/sdk/gcloud/reference/topic/filters).) + - Each additional filter in the list will act be added as an AND condition (filter1 + and filter2) . extends_documentation_fragment: gcp ''' @@ -62,46 +61,46 @@ RETURN = ''' items: - description: List of items - returned: always - type: complex - contains: - creationTimestamp: - description: - - Creation timestamp in RFC3339 text format. - returned: success - type: str - description: - description: - - An optional description of this resource. - returned: success - type: str - id: - description: - - The unique identifier for the resource. - returned: success - type: int - name: - description: - - Name of the resource. Provided by the client when the resource is created. The name - must be 1-63 characters long, and comply with RFC1035. Specifically, the name must - be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` - which means the first character must be a lowercase letter, and all following characters - must be a dash, lowercase letter, or digit, except the last character, which cannot - be a dash. - returned: success - type: str - proxyHeader: - description: - - Specifies the type of proxy header to append before sending data to the backend, - either NONE or PROXY_V1. The default is NONE. - returned: success - type: str - service: - description: - - A reference to the BackendService resource. - returned: success - type: dict + description: List of items + returned: always + type: complex + contains: + creationTimestamp: + description: + - Creation timestamp in RFC3339 text format. + returned: success + type: str + description: + description: + - An optional description of this resource. + returned: success + type: str + id: + description: + - The unique identifier for the resource. + returned: success + type: int + name: + description: + - Name of the resource. Provided by the client when the resource is created. + The name must be 1-63 characters long, and comply with RFC1035. Specifically, + the name must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` + which means the first character must be a lowercase letter, and all following + characters must be a dash, lowercase letter, or digit, except the last character, + which cannot be a dash. + returned: success + type: str + proxyHeader: + description: + - Specifies the type of proxy header to append before sending data to the backend, + either NONE or PROXY_V1. The default is NONE. + returned: success + type: str + service: + description: + - A reference to the BackendService resource. + returned: success + type: dict ''' ################################################################################ diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_vpn_gateway.py b/lib/ansible/modules/cloud/google/gcp_compute_target_vpn_gateway.py index 480c2f02ed4c4c..fa8959f0033854 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_vpn_gateway.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_vpn_gateway.py @@ -32,50 +32,52 @@ --- module: gcp_compute_target_vpn_gateway description: - - Represents a VPN gateway running in GCP. This virtual device is managed by Google, - but used only by you. +- Represents a VPN gateway running in GCP. This virtual device is managed by Google, + but used only by you. short_description: Creates a GCP TargetVpnGateway version_added: 2.7 author: Google Inc. (@googlecloudplatform) requirements: - - python >= 2.6 - - requests >= 2.18.4 - - google-auth >= 1.3.0 +- python >= 2.6 +- requests >= 2.18.4 +- google-auth >= 1.3.0 options: - state: - description: - - Whether the given object should exist in GCP - choices: ['present', 'absent'] - default: 'present' + state: description: - description: - - An optional description of this resource. - required: false - name: - description: - - Name of the resource. Provided by the client when the resource is created. The name - must be 1-63 characters long, and comply with RFC1035. Specifically, the name must - be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` - which means the first character must be a lowercase letter, and all following characters - must be a dash, lowercase letter, or digit, except the last character, which cannot - be a dash. - required: true - network: - description: - - The network this VPN gateway is accepting traffic for. - - 'This field represents a link to a Network resource in GCP. It can be specified - in two ways. You can add `register: name-of-resource` to a gcp_compute_network task - and then set this network field to "{{ name-of-resource }}" Alternatively, you can - set this network to a dictionary with the selfLink key where the value is the selfLink - of your Network.' - required: true - region: - description: - - The region this gateway should sit in. - required: true + - Whether the given object should exist in GCP + choices: + - present + - absent + default: present + description: + description: + - An optional description of this resource. + required: false + name: + description: + - Name of the resource. Provided by the client when the resource is created. The + name must be 1-63 characters long, and comply with RFC1035. Specifically, the + name must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` + which means the first character must be a lowercase letter, and all following + characters must be a dash, lowercase letter, or digit, except the last character, + which cannot be a dash. + required: true + network: + description: + - The network this VPN gateway is accepting traffic for. + - 'This field represents a link to a Network resource in GCP. It can be specified + in two ways. You can add `register: name-of-resource` to a gcp_compute_network + task and then set this network field to "{{ name-of-resource }}" Alternatively, + you can set this network to a dictionary with the selfLink key where the value + is the selfLink of your Network' + required: true + region: + description: + - The region this gateway should sit in. + required: true extends_documentation_fragment: gcp notes: - - "API Reference: U(https://cloud.google.com/compute/docs/reference/rest/v1/targetVpnGateways)" +- 'API Reference: U(https://cloud.google.com/compute/docs/reference/rest/v1/targetVpnGateways)' ''' EXAMPLES = ''' @@ -110,51 +112,51 @@ ''' RETURN = ''' - creationTimestamp: - description: - - Creation timestamp in RFC3339 text format. - returned: success - type: str - description: - description: - - An optional description of this resource. - returned: success - type: str - name: - description: - - Name of the resource. Provided by the client when the resource is created. The name - must be 1-63 characters long, and comply with RFC1035. Specifically, the name must - be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` - which means the first character must be a lowercase letter, and all following characters - must be a dash, lowercase letter, or digit, except the last character, which cannot - be a dash. - returned: success - type: str - id: - description: - - The unique identifier for the resource. - returned: success - type: int - network: - description: - - The network this VPN gateway is accepting traffic for. - returned: success - type: dict - tunnels: - description: - - A list of references to VpnTunnel resources associated to this VPN gateway. - returned: success - type: list - forwardingRules: - description: - - A list of references to the ForwardingRule resources associated to this VPN gateway. - returned: success - type: list - region: - description: - - The region this gateway should sit in. - returned: success - type: str +creationTimestamp: + description: + - Creation timestamp in RFC3339 text format. + returned: success + type: str +description: + description: + - An optional description of this resource. + returned: success + type: str +name: + description: + - Name of the resource. Provided by the client when the resource is created. The + name must be 1-63 characters long, and comply with RFC1035. Specifically, the + name must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` + which means the first character must be a lowercase letter, and all following + characters must be a dash, lowercase letter, or digit, except the last character, + which cannot be a dash. + returned: success + type: str +id: + description: + - The unique identifier for the resource. + returned: success + type: int +network: + description: + - The network this VPN gateway is accepting traffic for. + returned: success + type: dict +tunnels: + description: + - A list of references to VpnTunnel resources associated to this VPN gateway. + returned: success + type: list +forwardingRules: + description: + - A list of references to the ForwardingRule resources associated to this VPN gateway. + returned: success + type: list +region: + description: + - The region this gateway should sit in. + returned: success + type: str ''' ################################################################################ diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_vpn_gateway_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_target_vpn_gateway_facts.py index f2d65dca94f2a5..a9c87095fa533e 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_vpn_gateway_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_vpn_gateway_facts.py @@ -32,25 +32,24 @@ --- module: gcp_compute_target_vpn_gateway_facts description: - - Gather facts for GCP TargetVpnGateway +- Gather facts for GCP TargetVpnGateway short_description: Gather facts for GCP TargetVpnGateway version_added: 2.7 author: Google Inc. (@googlecloudplatform) requirements: - - python >= 2.6 - - requests >= 2.18.4 - - google-auth >= 1.3.0 +- python >= 2.6 +- requests >= 2.18.4 +- google-auth >= 1.3.0 options: - filters: - description: - A list of filter value pairs. Available filters are listed here - U(https://cloud.google.com/sdk/gcloud/reference/topic/filters). - Each additional filter in the list will act be added as an AND condition - (filter1 and filter2) - region: - description: - - The region this gateway should sit in. - required: true + filters: + description: + - A list of filter value pairs. Available filters are listed here U(U(https://cloud.google.com/sdk/gcloud/reference/topic/filters).) + - Each additional filter in the list will act be added as an AND condition (filter1 + and filter2) . + region: + description: + - The region this gateway should sit in. + required: true extends_documentation_fragment: gcp ''' @@ -67,55 +66,56 @@ RETURN = ''' items: - description: List of items - returned: always - type: complex - contains: - creationTimestamp: - description: - - Creation timestamp in RFC3339 text format. - returned: success - type: str - description: - description: - - An optional description of this resource. - returned: success - type: str - name: - description: - - Name of the resource. Provided by the client when the resource is created. The name - must be 1-63 characters long, and comply with RFC1035. Specifically, the name must - be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` - which means the first character must be a lowercase letter, and all following characters - must be a dash, lowercase letter, or digit, except the last character, which cannot - be a dash. - returned: success - type: str - id: - description: - - The unique identifier for the resource. - returned: success - type: int - network: - description: - - The network this VPN gateway is accepting traffic for. - returned: success - type: dict - tunnels: - description: - - A list of references to VpnTunnel resources associated to this VPN gateway. - returned: success - type: list - forwardingRules: - description: - - A list of references to the ForwardingRule resources associated to this VPN gateway. - returned: success - type: list - region: - description: - - The region this gateway should sit in. - returned: success - type: str + description: List of items + returned: always + type: complex + contains: + creationTimestamp: + description: + - Creation timestamp in RFC3339 text format. + returned: success + type: str + description: + description: + - An optional description of this resource. + returned: success + type: str + name: + description: + - Name of the resource. Provided by the client when the resource is created. + The name must be 1-63 characters long, and comply with RFC1035. Specifically, + the name must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` + which means the first character must be a lowercase letter, and all following + characters must be a dash, lowercase letter, or digit, except the last character, + which cannot be a dash. + returned: success + type: str + id: + description: + - The unique identifier for the resource. + returned: success + type: int + network: + description: + - The network this VPN gateway is accepting traffic for. + returned: success + type: dict + tunnels: + description: + - A list of references to VpnTunnel resources associated to this VPN gateway. + returned: success + type: list + forwardingRules: + description: + - A list of references to the ForwardingRule resources associated to this VPN + gateway. + returned: success + type: list + region: + description: + - The region this gateway should sit in. + returned: success + type: str ''' ################################################################################ diff --git a/lib/ansible/modules/cloud/google/gcp_compute_url_map.py b/lib/ansible/modules/cloud/google/gcp_compute_url_map.py index 6a3d8e5ae6b930..a321b5ad5c9349 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_url_map.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_url_map.py @@ -32,135 +32,141 @@ --- module: gcp_compute_url_map description: - - UrlMaps are used to route requests to a backend service based on rules that you - define for the host and path of an incoming URL. +- UrlMaps are used to route requests to a backend service based on rules that you + define for the host and path of an incoming URL. short_description: Creates a GCP UrlMap version_added: 2.6 author: Google Inc. (@googlecloudplatform) requirements: - - python >= 2.6 - - requests >= 2.18.4 - - google-auth >= 1.3.0 +- python >= 2.6 +- requests >= 2.18.4 +- google-auth >= 1.3.0 options: - state: + state: + description: + - Whether the given object should exist in GCP + choices: + - present + - absent + default: present + default_service: + description: + - A reference to BackendService resource if none of the hostRules match. + - 'This field represents a link to a BackendService resource in GCP. It can be + specified in two ways. You can add `register: name-of-resource` to a gcp_compute_backend_service + task and then set this default_service field to "{{ name-of-resource }}" Alternatively, + you can set this default_service to a dictionary with the selfLink key where + the value is the selfLink of your BackendService' + required: true + description: + description: + - An optional description of this resource. Provide this property when you create + the resource. + required: false + host_rules: + description: + - The list of HostRules to use against the URL. + required: false + suboptions: + description: + description: + - An optional description of this HostRule. Provide this property when you + create the resource. + required: false + hosts: description: - - Whether the given object should exist in GCP - choices: ['present', 'absent'] - default: 'present' - default_service: + - The list of host patterns to match. They must be valid hostnames, except + * will match any string of ([a-z0-9-.]*). In that case, * must be the first + character and must be followed in the pattern by either - or . + required: true + path_matcher: description: - - A reference to BackendService resource if none of the hostRules match. - - 'This field represents a link to a BackendService resource in GCP. It can be specified - in two ways. You can add `register: name-of-resource` to a gcp_compute_backend_service - task and then set this default_service field to "{{ name-of-resource }}" Alternatively, - you can set this default_service to a dictionary with the selfLink key where the - value is the selfLink of your BackendService.' + - The name of the PathMatcher to use to match the path portion of the URL + if the hostRule matches the URL's host portion. required: true + name: + description: + - Name of the resource. Provided by the client when the resource is created. The + name must be 1-63 characters long, and comply with RFC1035. Specifically, the + name must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` + which means the first character must be a lowercase letter, and all following + characters must be a dash, lowercase letter, or digit, except the last character, + which cannot be a dash. + required: true + path_matchers: description: + - The list of named PathMatchers to use against the URL. + required: false + suboptions: + default_service: description: - - An optional description of this resource. Provide this property when you create - the resource. - required: false - host_rules: + - A reference to a BackendService resource. This will be used if none of the + pathRules defined by this PathMatcher is matched by the URL's path portion. + - 'This field represents a link to a BackendService resource in GCP. It can + be specified in two ways. You can add `register: name-of-resource` to a + gcp_compute_backend_service task and then set this default_service field + to "{{ name-of-resource }}" Alternatively, you can set this default_service + to a dictionary with the selfLink key where the value is the selfLink of + your BackendService' + required: true + description: description: - - The list of HostRules to use against the URL. + - An optional description of this resource. required: false - suboptions: - description: - description: - - An optional description of this HostRule. Provide this property when you create - the resource. - required: false - hosts: - description: - - The list of host patterns to match. They must be valid hostnames, except * will - match any string of ([a-z0-9-.]*). In that case, * must be the first character and - must be followed in the pattern by either - or . - required: true - path_matcher: - description: - - The name of the PathMatcher to use to match the path portion of the URL if the hostRule - matches the URL's host portion. - required: true - name: + name: description: - - Name of the resource. Provided by the client when the resource is created. The name - must be 1-63 characters long, and comply with RFC1035. Specifically, the name must - be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` - which means the first character must be a lowercase letter, and all following characters - must be a dash, lowercase letter, or digit, except the last character, which cannot - be a dash. + - The name to which this PathMatcher is referred by the HostRule. required: true - path_matchers: + path_rules: description: - - The list of named PathMatchers to use against the URL. + - The list of path rules. required: false suboptions: - default_service: - description: - - A reference to a BackendService resource. This will be used if none of the pathRules - defined by this PathMatcher is matched by the URL's path portion. - - 'This field represents a link to a BackendService resource in GCP. It can be specified - in two ways. You can add `register: name-of-resource` to a gcp_compute_backend_service - task and then set this default_service field to "{{ name-of-resource }}" Alternatively, - you can set this default_service to a dictionary with the selfLink key where the - value is the selfLink of your BackendService.' - required: true + paths: description: - description: - - An optional description of this resource. - required: false - name: - description: - - The name to which this PathMatcher is referred by the HostRule. - required: true - path_rules: - description: - - The list of path rules. - required: false - suboptions: - paths: - description: - - 'The list of path patterns to match. Each must start with / and the only place a - * is allowed is at the end following a /. The string fed to the path matcher does - not include any text after the first ? or #, and those chars are not allowed here.' - required: true - service: - description: - - A reference to the BackendService resource if this rule is matched. - - 'This field represents a link to a BackendService resource in GCP. It can be specified - in two ways. You can add `register: name-of-resource` to a gcp_compute_backend_service - task and then set this service field to "{{ name-of-resource }}" Alternatively, - you can set this service to a dictionary with the selfLink key where the value is - the selfLink of your BackendService.' - required: true - tests: + - 'The list of path patterns to match. Each must start with / and the + only place a * is allowed is at the end following a /. The string fed + to the path matcher does not include any text after the first ? or #, + and those chars are not allowed here.' + required: true + service: + description: + - A reference to the BackendService resource if this rule is matched. + - 'This field represents a link to a BackendService resource in GCP. It + can be specified in two ways. You can add `register: name-of-resource` + to a gcp_compute_backend_service task and then set this service field + to "{{ name-of-resource }}" Alternatively, you can set this service + to a dictionary with the selfLink key where the value is the selfLink + of your BackendService' + required: true + tests: + description: + - The list of expected URL mappings. Requests to update this UrlMap will succeed + only if all of the test cases pass. + required: false + suboptions: + description: description: - - The list of expected URL mappings. Requests to update this UrlMap will succeed only - if all of the test cases pass. + - Description of this test case. required: false - suboptions: - description: - description: - - Description of this test case. - required: false - host: - description: - - Host portion of the URL. - required: true - path: - description: - - Path portion of the URL. - required: true - service: - description: - - A reference to expected BackendService resource the given URL should be mapped to. - - 'This field represents a link to a BackendService resource in GCP. It can be specified - in two ways. You can add `register: name-of-resource` to a gcp_compute_backend_service - task and then set this service field to "{{ name-of-resource }}" Alternatively, - you can set this service to a dictionary with the selfLink key where the value is - the selfLink of your BackendService.' - required: true + host: + description: + - Host portion of the URL. + required: true + path: + description: + - Path portion of the URL. + required: true + service: + description: + - A reference to expected BackendService resource the given URL should be + mapped to. + - 'This field represents a link to a BackendService resource in GCP. It can + be specified in two ways. You can add `register: name-of-resource` to a + gcp_compute_backend_service task and then set this service field to "{{ + name-of-resource }}" Alternatively, you can set this service to a dictionary + with the selfLink key where the value is the selfLink of your BackendService' + required: true extends_documentation_fragment: gcp ''' @@ -213,135 +219,137 @@ ''' RETURN = ''' - creationTimestamp: - description: - - Creation timestamp in RFC3339 text format. - returned: success - type: str +creationTimestamp: + description: + - Creation timestamp in RFC3339 text format. + returned: success + type: str +defaultService: + description: + - A reference to BackendService resource if none of the hostRules match. + returned: success + type: dict +description: + description: + - An optional description of this resource. Provide this property when you create + the resource. + returned: success + type: str +hostRules: + description: + - The list of HostRules to use against the URL. + returned: success + type: complex + contains: + description: + description: + - An optional description of this HostRule. Provide this property when you create + the resource. + returned: success + type: str + hosts: + description: + - The list of host patterns to match. They must be valid hostnames, except * + will match any string of ([a-z0-9-.]*). In that case, * must be the first + character and must be followed in the pattern by either - or . + returned: success + type: list + pathMatcher: + description: + - The name of the PathMatcher to use to match the path portion of the URL if + the hostRule matches the URL's host portion. + returned: success + type: str +id: + description: + - The unique identifier for the resource. + returned: success + type: int +fingerprint: + description: + - Fingerprint of this resource. This field is used internally during updates of + this resource. + returned: success + type: str +name: + description: + - Name of the resource. Provided by the client when the resource is created. The + name must be 1-63 characters long, and comply with RFC1035. Specifically, the + name must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` + which means the first character must be a lowercase letter, and all following + characters must be a dash, lowercase letter, or digit, except the last character, + which cannot be a dash. + returned: success + type: str +pathMatchers: + description: + - The list of named PathMatchers to use against the URL. + returned: success + type: complex + contains: defaultService: - description: - - A reference to BackendService resource if none of the hostRules match. - returned: success - type: dict + description: + - A reference to a BackendService resource. This will be used if none of the + pathRules defined by this PathMatcher is matched by the URL's path portion. + returned: success + type: dict description: - description: - - An optional description of this resource. Provide this property when you create - the resource. - returned: success - type: str - hostRules: - description: - - The list of HostRules to use against the URL. - returned: success - type: complex - contains: - description: - description: - - An optional description of this HostRule. Provide this property when you create - the resource. - returned: success - type: str - hosts: - description: - - The list of host patterns to match. They must be valid hostnames, except * will - match any string of ([a-z0-9-.]*). In that case, * must be the first character and - must be followed in the pattern by either - or . - returned: success - type: list - pathMatcher: - description: - - The name of the PathMatcher to use to match the path portion of the URL if the hostRule - matches the URL's host portion. - returned: success - type: str - id: - description: - - The unique identifier for the resource. - returned: success - type: int - fingerprint: - description: - - Fingerprint of this resource. This field is used internally during updates of this - resource. - returned: success - type: str + description: + - An optional description of this resource. + returned: success + type: str name: - description: - - Name of the resource. Provided by the client when the resource is created. The name - must be 1-63 characters long, and comply with RFC1035. Specifically, the name must - be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` - which means the first character must be a lowercase letter, and all following characters - must be a dash, lowercase letter, or digit, except the last character, which cannot - be a dash. - returned: success - type: str - pathMatchers: - description: - - The list of named PathMatchers to use against the URL. - returned: success - type: complex - contains: - defaultService: - description: - - A reference to a BackendService resource. This will be used if none of the pathRules - defined by this PathMatcher is matched by the URL's path portion. - returned: success - type: dict - description: - description: - - An optional description of this resource. - returned: success - type: str - name: - description: - - The name to which this PathMatcher is referred by the HostRule. - returned: success - type: str - pathRules: - description: - - The list of path rules. - returned: success - type: complex - contains: - paths: - description: - - 'The list of path patterns to match. Each must start with / and the only place a - * is allowed is at the end following a /. The string fed to the path matcher does - not include any text after the first ? or #, and those chars are not allowed here.' - returned: success - type: list - service: - description: - - A reference to the BackendService resource if this rule is matched. - returned: success - type: dict - tests: - description: - - The list of expected URL mappings. Requests to update this UrlMap will succeed only - if all of the test cases pass. - returned: success - type: complex - contains: - description: - description: - - Description of this test case. - returned: success - type: str - host: - description: - - Host portion of the URL. - returned: success - type: str - path: - description: - - Path portion of the URL. - returned: success - type: str - service: - description: - - A reference to expected BackendService resource the given URL should be mapped to. - returned: success - type: dict + description: + - The name to which this PathMatcher is referred by the HostRule. + returned: success + type: str + pathRules: + description: + - The list of path rules. + returned: success + type: complex + contains: + paths: + description: + - 'The list of path patterns to match. Each must start with / and the only + place a * is allowed is at the end following a /. The string fed to the + path matcher does not include any text after the first ? or #, and those + chars are not allowed here.' + returned: success + type: list + service: + description: + - A reference to the BackendService resource if this rule is matched. + returned: success + type: dict +tests: + description: + - The list of expected URL mappings. Requests to update this UrlMap will succeed + only if all of the test cases pass. + returned: success + type: complex + contains: + description: + description: + - Description of this test case. + returned: success + type: str + host: + description: + - Host portion of the URL. + returned: success + type: str + path: + description: + - Path portion of the URL. + returned: success + type: str + service: + description: + - A reference to expected BackendService resource the given URL should be mapped + to. + returned: success + type: dict ''' ################################################################################ diff --git a/lib/ansible/modules/cloud/google/gcp_compute_url_map_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_url_map_facts.py index b79a0502c1a1bc..dce4404655230c 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_url_map_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_url_map_facts.py @@ -32,21 +32,20 @@ --- module: gcp_compute_url_map_facts description: - - Gather facts for GCP UrlMap +- Gather facts for GCP UrlMap short_description: Gather facts for GCP UrlMap version_added: 2.7 author: Google Inc. (@googlecloudplatform) requirements: - - python >= 2.6 - - requests >= 2.18.4 - - google-auth >= 1.3.0 +- python >= 2.6 +- requests >= 2.18.4 +- google-auth >= 1.3.0 options: - filters: - description: - A list of filter value pairs. Available filters are listed here - U(https://cloud.google.com/sdk/gcloud/reference/topic/filters). - Each additional filter in the list will act be added as an AND condition - (filter1 and filter2) + filters: + description: + - A list of filter value pairs. Available filters are listed here U(U(https://cloud.google.com/sdk/gcloud/reference/topic/filters).) + - Each additional filter in the list will act be added as an AND condition (filter1 + and filter2) . extends_documentation_fragment: gcp ''' @@ -62,139 +61,142 @@ RETURN = ''' items: - description: List of items - returned: always - type: complex - contains: - creationTimestamp: - description: - - Creation timestamp in RFC3339 text format. - returned: success - type: str + description: List of items + returned: always + type: complex + contains: + creationTimestamp: + description: + - Creation timestamp in RFC3339 text format. + returned: success + type: str + defaultService: + description: + - A reference to BackendService resource if none of the hostRules match. + returned: success + type: dict + description: + description: + - An optional description of this resource. Provide this property when you create + the resource. + returned: success + type: str + hostRules: + description: + - The list of HostRules to use against the URL. + returned: success + type: complex + contains: + description: + description: + - An optional description of this HostRule. Provide this property when you + create the resource. + returned: success + type: str + hosts: + description: + - The list of host patterns to match. They must be valid hostnames, except + * will match any string of ([a-z0-9-.]*). In that case, * must be the + first character and must be followed in the pattern by either - or . + returned: success + type: list + pathMatcher: + description: + - The name of the PathMatcher to use to match the path portion of the URL + if the hostRule matches the URL's host portion. + returned: success + type: str + id: + description: + - The unique identifier for the resource. + returned: success + type: int + fingerprint: + description: + - Fingerprint of this resource. This field is used internally during updates + of this resource. + returned: success + type: str + name: + description: + - Name of the resource. Provided by the client when the resource is created. + The name must be 1-63 characters long, and comply with RFC1035. Specifically, + the name must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` + which means the first character must be a lowercase letter, and all following + characters must be a dash, lowercase letter, or digit, except the last character, + which cannot be a dash. + returned: success + type: str + pathMatchers: + description: + - The list of named PathMatchers to use against the URL. + returned: success + type: complex + contains: defaultService: - description: - - A reference to BackendService resource if none of the hostRules match. - returned: success - type: dict + description: + - A reference to a BackendService resource. This will be used if none of + the pathRules defined by this PathMatcher is matched by the URL's path + portion. + returned: success + type: dict description: - description: - - An optional description of this resource. Provide this property when you create - the resource. - returned: success - type: str - hostRules: - description: - - The list of HostRules to use against the URL. - returned: success - type: complex - contains: - description: - description: - - An optional description of this HostRule. Provide this property when you create - the resource. - returned: success - type: str - hosts: - description: - - The list of host patterns to match. They must be valid hostnames, except * will - match any string of ([a-z0-9-.]*). In that case, * must be the first character and - must be followed in the pattern by either - or . - returned: success - type: list - pathMatcher: - description: - - The name of the PathMatcher to use to match the path portion of the URL if the hostRule - matches the URL's host portion. - returned: success - type: str - id: - description: - - The unique identifier for the resource. - returned: success - type: int - fingerprint: - description: - - Fingerprint of this resource. This field is used internally during updates of this - resource. - returned: success - type: str + description: + - An optional description of this resource. + returned: success + type: str name: - description: - - Name of the resource. Provided by the client when the resource is created. The name - must be 1-63 characters long, and comply with RFC1035. Specifically, the name must - be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` - which means the first character must be a lowercase letter, and all following characters - must be a dash, lowercase letter, or digit, except the last character, which cannot - be a dash. - returned: success - type: str - pathMatchers: - description: - - The list of named PathMatchers to use against the URL. - returned: success - type: complex - contains: - defaultService: - description: - - A reference to a BackendService resource. This will be used if none of the pathRules - defined by this PathMatcher is matched by the URL's path portion. - returned: success - type: dict - description: - description: - - An optional description of this resource. - returned: success - type: str - name: - description: - - The name to which this PathMatcher is referred by the HostRule. - returned: success - type: str - pathRules: - description: - - The list of path rules. - returned: success - type: complex - contains: - paths: - description: - - 'The list of path patterns to match. Each must start with / and the only place a - * is allowed is at the end following a /. The string fed to the path matcher does - not include any text after the first ? or #, and those chars are not allowed here.' - returned: success - type: list - service: - description: - - A reference to the BackendService resource if this rule is matched. - returned: success - type: dict - tests: - description: - - The list of expected URL mappings. Requests to update this UrlMap will succeed only - if all of the test cases pass. - returned: success - type: complex - contains: - description: - description: - - Description of this test case. - returned: success - type: str - host: - description: - - Host portion of the URL. - returned: success - type: str - path: - description: - - Path portion of the URL. - returned: success - type: str - service: - description: - - A reference to expected BackendService resource the given URL should be mapped to. - returned: success - type: dict + description: + - The name to which this PathMatcher is referred by the HostRule. + returned: success + type: str + pathRules: + description: + - The list of path rules. + returned: success + type: complex + contains: + paths: + description: + - 'The list of path patterns to match. Each must start with / and the + only place a * is allowed is at the end following a /. The string + fed to the path matcher does not include any text after the first + ? or #, and those chars are not allowed here.' + returned: success + type: list + service: + description: + - A reference to the BackendService resource if this rule is matched. + returned: success + type: dict + tests: + description: + - The list of expected URL mappings. Requests to update this UrlMap will succeed + only if all of the test cases pass. + returned: success + type: complex + contains: + description: + description: + - Description of this test case. + returned: success + type: str + host: + description: + - Host portion of the URL. + returned: success + type: str + path: + description: + - Path portion of the URL. + returned: success + type: str + service: + description: + - A reference to expected BackendService resource the given URL should be + mapped to. + returned: success + type: dict ''' ################################################################################ diff --git a/lib/ansible/modules/cloud/google/gcp_compute_vpn_tunnel.py b/lib/ansible/modules/cloud/google/gcp_compute_vpn_tunnel.py index 1a5ea665d0ed6d..1d9016c2384855 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_vpn_tunnel.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_vpn_tunnel.py @@ -32,92 +32,94 @@ --- module: gcp_compute_vpn_tunnel description: - - VPN tunnel resource. +- VPN tunnel resource. short_description: Creates a GCP VpnTunnel version_added: 2.7 author: Google Inc. (@googlecloudplatform) requirements: - - python >= 2.6 - - requests >= 2.18.4 - - google-auth >= 1.3.0 +- python >= 2.6 +- requests >= 2.18.4 +- google-auth >= 1.3.0 options: - state: - description: - - Whether the given object should exist in GCP - choices: ['present', 'absent'] - default: 'present' - name: - description: - - Name of the resource. The name must be 1-63 characters long, and comply with RFC1035. - Specifically, the name must be 1-63 characters long and match the regular expression - `[a-z]([-a-z0-9]*[a-z0-9])?` which means the first character must be a lowercase - letter, and all following characters must be a dash, lowercase letter, or digit, - except the last character, which cannot be a dash. - required: true + state: description: - description: - - An optional description of this resource. - required: false - target_vpn_gateway: - description: - - URL of the Target VPN gateway with which this VPN tunnel is associated. - - 'This field represents a link to a TargetVpnGateway resource in GCP. It can be specified - in two ways. You can add `register: name-of-resource` to a gcp_compute_target_vpn_gateway - task and then set this target_vpn_gateway field to "{{ name-of-resource }}" Alternatively, - you can set this target_vpn_gateway to a dictionary with the selfLink key where - the value is the selfLink of your TargetVpnGateway.' - required: true - router: - description: - - URL of router resource to be used for dynamic routing. - - 'This field represents a link to a Router resource in GCP. It can be specified in - two ways. You can add `register: name-of-resource` to a gcp_compute_router task - and then set this router field to "{{ name-of-resource }}" Alternatively, you can - set this router to a dictionary with the selfLink key where the value is the selfLink - of your Router.' - required: false - peer_ip: - description: - - IP address of the peer VPN gateway. Only IPv4 is supported. - required: true - shared_secret: - description: - - Shared secret used to set the secure session between the Cloud VPN gateway and the - peer VPN gateway. - required: true - ike_version: - description: - - IKE protocol version to use when establishing the VPN tunnel with peer VPN gateway. - - Acceptable IKE versions are 1 or 2. Default version is 2. - required: false - default: 2 - local_traffic_selector: - description: - - Local traffic selector to use when establishing the VPN tunnel with peer VPN gateway. - The value should be a CIDR formatted string, for example `192.168.0.0/16`. The ranges - should be disjoint. - - Only IPv4 is supported. - required: false - remote_traffic_selector: - description: - - Remote traffic selector to use when establishing the VPN tunnel with peer VPN gateway. - The value should be a CIDR formatted string, for example `192.168.0.0/16`. The ranges - should be disjoint. - - Only IPv4 is supported. - required: false - labels: - description: - - Labels to apply to this VpnTunnel. - required: false - region: - description: - - The region where the tunnel is located. - required: true + - Whether the given object should exist in GCP + choices: + - present + - absent + default: present + name: + description: + - Name of the resource. The name must be 1-63 characters long, and comply with + RFC1035. Specifically, the name must be 1-63 characters long and match the regular + expression `[a-z]([-a-z0-9]*[a-z0-9])?` which means the first character must + be a lowercase letter, and all following characters must be a dash, lowercase + letter, or digit, except the last character, which cannot be a dash. + required: true + description: + description: + - An optional description of this resource. + required: false + target_vpn_gateway: + description: + - URL of the Target VPN gateway with which this VPN tunnel is associated. + - 'This field represents a link to a TargetVpnGateway resource in GCP. It can + be specified in two ways. You can add `register: name-of-resource` to a gcp_compute_target_vpn_gateway + task and then set this target_vpn_gateway field to "{{ name-of-resource }}" + Alternatively, you can set this target_vpn_gateway to a dictionary with the + selfLink key where the value is the selfLink of your TargetVpnGateway' + required: true + router: + description: + - URL of router resource to be used for dynamic routing. + - 'This field represents a link to a Router resource in GCP. It can be specified + in two ways. You can add `register: name-of-resource` to a gcp_compute_router + task and then set this router field to "{{ name-of-resource }}" Alternatively, + you can set this router to a dictionary with the selfLink key where the value + is the selfLink of your Router' + required: false + peer_ip: + description: + - IP address of the peer VPN gateway. Only IPv4 is supported. + required: true + shared_secret: + description: + - Shared secret used to set the secure session between the Cloud VPN gateway and + the peer VPN gateway. + required: true + ike_version: + description: + - IKE protocol version to use when establishing the VPN tunnel with peer VPN gateway. + - Acceptable IKE versions are 1 or 2. Default version is 2. + required: false + default: '2' + local_traffic_selector: + description: + - Local traffic selector to use when establishing the VPN tunnel with peer VPN + gateway. The value should be a CIDR formatted string, for example `192.168.0.0/16`. + The ranges should be disjoint. + - Only IPv4 is supported. + required: false + remote_traffic_selector: + description: + - Remote traffic selector to use when establishing the VPN tunnel with peer VPN + gateway. The value should be a CIDR formatted string, for example `192.168.0.0/16`. + The ranges should be disjoint. + - Only IPv4 is supported. + required: false + labels: + description: + - Labels to apply to this VpnTunnel. + required: false + region: + description: + - The region where the tunnel is located. + required: true extends_documentation_fragment: gcp notes: - - "API Reference: U(https://cloud.google.com/compute/docs/reference/rest/v1/vpnTunnels)" - - "Cloud VPN Overview: U(https://cloud.google.com/vpn/docs/concepts/overview)" - - "Networks and Tunnel Routing: U(https://cloud.google.com/vpn/docs/concepts/choosing-networks-routing)" +- 'API Reference: U(https://cloud.google.com/compute/docs/reference/rest/v1/vpnTunnels)' +- 'Cloud VPN Overview: U(https://cloud.google.com/vpn/docs/concepts/overview)' +- 'Networks and Tunnel Routing: U(https://cloud.google.com/vpn/docs/concepts/choosing-networks-routing)' ''' EXAMPLES = ''' @@ -174,89 +176,89 @@ ''' RETURN = ''' - creationTimestamp: - description: - - Creation timestamp in RFC3339 text format. - returned: success - type: str - name: - description: - - Name of the resource. The name must be 1-63 characters long, and comply with RFC1035. - Specifically, the name must be 1-63 characters long and match the regular expression - `[a-z]([-a-z0-9]*[a-z0-9])?` which means the first character must be a lowercase - letter, and all following characters must be a dash, lowercase letter, or digit, - except the last character, which cannot be a dash. - returned: success - type: str - description: - description: - - An optional description of this resource. - returned: success - type: str - targetVpnGateway: - description: - - URL of the Target VPN gateway with which this VPN tunnel is associated. - returned: success - type: dict - router: - description: - - URL of router resource to be used for dynamic routing. - returned: success - type: dict - peerIp: - description: - - IP address of the peer VPN gateway. Only IPv4 is supported. - returned: success - type: str - sharedSecret: - description: - - Shared secret used to set the secure session between the Cloud VPN gateway and the - peer VPN gateway. - returned: success - type: str - sharedSecretHash: - description: - - Hash of the shared secret. - returned: success - type: str - ikeVersion: - description: - - IKE protocol version to use when establishing the VPN tunnel with peer VPN gateway. - - Acceptable IKE versions are 1 or 2. Default version is 2. - returned: success - type: int - localTrafficSelector: - description: - - Local traffic selector to use when establishing the VPN tunnel with peer VPN gateway. - The value should be a CIDR formatted string, for example `192.168.0.0/16`. The ranges - should be disjoint. - - Only IPv4 is supported. - returned: success - type: list - remoteTrafficSelector: - description: - - Remote traffic selector to use when establishing the VPN tunnel with peer VPN gateway. - The value should be a CIDR formatted string, for example `192.168.0.0/16`. The ranges - should be disjoint. - - Only IPv4 is supported. - returned: success - type: list - labels: - description: - - Labels to apply to this VpnTunnel. - returned: success - type: dict - labelFingerprint: - description: - - The fingerprint used for optimistic locking of this resource. Used internally during - updates. - returned: success - type: str - region: - description: - - The region where the tunnel is located. - returned: success - type: str +creationTimestamp: + description: + - Creation timestamp in RFC3339 text format. + returned: success + type: str +name: + description: + - Name of the resource. The name must be 1-63 characters long, and comply with RFC1035. + Specifically, the name must be 1-63 characters long and match the regular expression + `[a-z]([-a-z0-9]*[a-z0-9])?` which means the first character must be a lowercase + letter, and all following characters must be a dash, lowercase letter, or digit, + except the last character, which cannot be a dash. + returned: success + type: str +description: + description: + - An optional description of this resource. + returned: success + type: str +targetVpnGateway: + description: + - URL of the Target VPN gateway with which this VPN tunnel is associated. + returned: success + type: dict +router: + description: + - URL of router resource to be used for dynamic routing. + returned: success + type: dict +peerIp: + description: + - IP address of the peer VPN gateway. Only IPv4 is supported. + returned: success + type: str +sharedSecret: + description: + - Shared secret used to set the secure session between the Cloud VPN gateway and + the peer VPN gateway. + returned: success + type: str +sharedSecretHash: + description: + - Hash of the shared secret. + returned: success + type: str +ikeVersion: + description: + - IKE protocol version to use when establishing the VPN tunnel with peer VPN gateway. + - Acceptable IKE versions are 1 or 2. Default version is 2. + returned: success + type: int +localTrafficSelector: + description: + - Local traffic selector to use when establishing the VPN tunnel with peer VPN gateway. + The value should be a CIDR formatted string, for example `192.168.0.0/16`. The + ranges should be disjoint. + - Only IPv4 is supported. + returned: success + type: list +remoteTrafficSelector: + description: + - Remote traffic selector to use when establishing the VPN tunnel with peer VPN + gateway. The value should be a CIDR formatted string, for example `192.168.0.0/16`. + The ranges should be disjoint. + - Only IPv4 is supported. + returned: success + type: list +labels: + description: + - Labels to apply to this VpnTunnel. + returned: success + type: dict +labelFingerprint: + description: + - The fingerprint used for optimistic locking of this resource. Used internally + during updates. + returned: success + type: str +region: + description: + - The region where the tunnel is located. + returned: success + type: str ''' ################################################################################ diff --git a/lib/ansible/modules/cloud/google/gcp_compute_vpn_tunnel_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_vpn_tunnel_facts.py index f1f479205da84e..79ab37fd4fbcc6 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_vpn_tunnel_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_vpn_tunnel_facts.py @@ -32,25 +32,24 @@ --- module: gcp_compute_vpn_tunnel_facts description: - - Gather facts for GCP VpnTunnel +- Gather facts for GCP VpnTunnel short_description: Gather facts for GCP VpnTunnel version_added: 2.7 author: Google Inc. (@googlecloudplatform) requirements: - - python >= 2.6 - - requests >= 2.18.4 - - google-auth >= 1.3.0 +- python >= 2.6 +- requests >= 2.18.4 +- google-auth >= 1.3.0 options: - filters: - description: - A list of filter value pairs. Available filters are listed here - U(https://cloud.google.com/sdk/gcloud/reference/topic/filters). - Each additional filter in the list will act be added as an AND condition - (filter1 and filter2) - region: - description: - - The region where the tunnel is located. - required: true + filters: + description: + - A list of filter value pairs. Available filters are listed here U(U(https://cloud.google.com/sdk/gcloud/reference/topic/filters).) + - Each additional filter in the list will act be added as an AND condition (filter1 + and filter2) . + region: + description: + - The region where the tunnel is located. + required: true extends_documentation_fragment: gcp ''' @@ -67,93 +66,94 @@ RETURN = ''' items: - description: List of items - returned: always - type: complex - contains: - creationTimestamp: - description: - - Creation timestamp in RFC3339 text format. - returned: success - type: str - name: - description: - - Name of the resource. The name must be 1-63 characters long, and comply with RFC1035. - Specifically, the name must be 1-63 characters long and match the regular expression - `[a-z]([-a-z0-9]*[a-z0-9])?` which means the first character must be a lowercase - letter, and all following characters must be a dash, lowercase letter, or digit, - except the last character, which cannot be a dash. - returned: success - type: str - description: - description: - - An optional description of this resource. - returned: success - type: str - targetVpnGateway: - description: - - URL of the Target VPN gateway with which this VPN tunnel is associated. - returned: success - type: dict - router: - description: - - URL of router resource to be used for dynamic routing. - returned: success - type: dict - peerIp: - description: - - IP address of the peer VPN gateway. Only IPv4 is supported. - returned: success - type: str - sharedSecret: - description: - - Shared secret used to set the secure session between the Cloud VPN gateway and the - peer VPN gateway. - returned: success - type: str - sharedSecretHash: - description: - - Hash of the shared secret. - returned: success - type: str - ikeVersion: - description: - - IKE protocol version to use when establishing the VPN tunnel with peer VPN gateway. - - Acceptable IKE versions are 1 or 2. Default version is 2. - returned: success - type: int - localTrafficSelector: - description: - - Local traffic selector to use when establishing the VPN tunnel with peer VPN gateway. - The value should be a CIDR formatted string, for example `192.168.0.0/16`. The ranges - should be disjoint. - - Only IPv4 is supported. - returned: success - type: list - remoteTrafficSelector: - description: - - Remote traffic selector to use when establishing the VPN tunnel with peer VPN gateway. - The value should be a CIDR formatted string, for example `192.168.0.0/16`. The ranges - should be disjoint. - - Only IPv4 is supported. - returned: success - type: list - labels: - description: - - Labels to apply to this VpnTunnel. - returned: success - type: dict - labelFingerprint: - description: - - The fingerprint used for optimistic locking of this resource. Used internally during - updates. - returned: success - type: str - region: - description: - - The region where the tunnel is located. - returned: success - type: str + description: List of items + returned: always + type: complex + contains: + creationTimestamp: + description: + - Creation timestamp in RFC3339 text format. + returned: success + type: str + name: + description: + - Name of the resource. The name must be 1-63 characters long, and comply with + RFC1035. Specifically, the name must be 1-63 characters long and match the + regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` which means the first character + must be a lowercase letter, and all following characters must be a dash, lowercase + letter, or digit, except the last character, which cannot be a dash. + returned: success + type: str + description: + description: + - An optional description of this resource. + returned: success + type: str + targetVpnGateway: + description: + - URL of the Target VPN gateway with which this VPN tunnel is associated. + returned: success + type: dict + router: + description: + - URL of router resource to be used for dynamic routing. + returned: success + type: dict + peerIp: + description: + - IP address of the peer VPN gateway. Only IPv4 is supported. + returned: success + type: str + sharedSecret: + description: + - Shared secret used to set the secure session between the Cloud VPN gateway + and the peer VPN gateway. + returned: success + type: str + sharedSecretHash: + description: + - Hash of the shared secret. + returned: success + type: str + ikeVersion: + description: + - IKE protocol version to use when establishing the VPN tunnel with peer VPN + gateway. + - Acceptable IKE versions are 1 or 2. Default version is 2. + returned: success + type: int + localTrafficSelector: + description: + - Local traffic selector to use when establishing the VPN tunnel with peer VPN + gateway. The value should be a CIDR formatted string, for example `192.168.0.0/16`. + The ranges should be disjoint. + - Only IPv4 is supported. + returned: success + type: list + remoteTrafficSelector: + description: + - Remote traffic selector to use when establishing the VPN tunnel with peer + VPN gateway. The value should be a CIDR formatted string, for example `192.168.0.0/16`. + The ranges should be disjoint. + - Only IPv4 is supported. + returned: success + type: list + labels: + description: + - Labels to apply to this VpnTunnel. + returned: success + type: dict + labelFingerprint: + description: + - The fingerprint used for optimistic locking of this resource. Used internally + during updates. + returned: success + type: str + region: + description: + - The region where the tunnel is located. + returned: success + type: str ''' ################################################################################ diff --git a/lib/ansible/modules/cloud/google/gcp_container_cluster.py b/lib/ansible/modules/cloud/google/gcp_container_cluster.py index b0e642566b0cab..be699447f0e2e3 100644 --- a/lib/ansible/modules/cloud/google/gcp_container_cluster.py +++ b/lib/ansible/modules/cloud/google/gcp_container_cluster.py @@ -32,226 +32,238 @@ --- module: gcp_container_cluster description: - - A Google Container Engine cluster. +- A Google Container Engine cluster. short_description: Creates a GCP Cluster version_added: 2.6 author: Google Inc. (@googlecloudplatform) requirements: - - python >= 2.6 - - requests >= 2.18.4 - - google-auth >= 1.3.0 +- python >= 2.6 +- requests >= 2.18.4 +- google-auth >= 1.3.0 options: - state: - description: - - Whether the given object should exist in GCP - choices: ['present', 'absent'] - default: 'present' - name: - description: - - The name of this cluster. The name must be unique within this project and zone, - and can be up to 40 characters. Must be Lowercase letters, numbers, and hyphens - only. Must start with a letter. Must end with a number or a letter. - required: false + state: + description: + - Whether the given object should exist in GCP + choices: + - present + - absent + default: present + name: + description: + - The name of this cluster. The name must be unique within this project and zone, + and can be up to 40 characters. Must be Lowercase letters, numbers, and hyphens + only. Must start with a letter. Must end with a number or a letter. + required: false + description: + description: + - An optional description of this cluster. + required: false + initial_node_count: + description: + - The number of nodes to create in this cluster. You must ensure that your Compute + Engine resource quota is sufficient for this number of instances. You must also + have available firewall and routes quota. For requests, this field should only + be used in lieu of a "nodePool" object, since this configuration (along with + the "nodeConfig") will be used to create a "NodePool" object with an auto-generated + name. Do not use this and a nodePool at the same time. + required: true + node_config: description: + - Parameters used in creating the cluster's nodes. + - For requests, this field should only be used in lieu of a "nodePool" object, + since this configuration (along with the "initialNodeCount") will be used to + create a "NodePool" object with an auto-generated name. Do not use this and + a nodePool at the same time. For responses, this field will be populated with + the node configuration of the first node pool. If unspecified, the defaults + are used. + required: false + suboptions: + machine_type: + description: + - The name of a Google Compute Engine machine type (e.g. + - n1-standard-1). If unspecified, the default machine type is n1-standard-1. + required: false + disk_size_gb: description: - - An optional description of this cluster. + - Size of the disk attached to each node, specified in GB. The smallest allowed + disk size is 10GB. If unspecified, the default disk size is 100GB. + required: false + oauth_scopes: + description: + - The set of Google API scopes to be made available on all of the node VMs + under the "default" service account. + - 'The following scopes are recommended, but not required, and by default + are not included: U(https://www.googleapis.com/auth/compute) is required + for mounting persistent storage on your nodes.' + - U(https://www.googleapis.com/auth/devstorage.read_only) is required for + communicating with gcr.io (the Google Container Registry). + - If unspecified, no scopes are added, unless Cloud Logging or Cloud Monitoring + are enabled, in which case their required scopes will be added. required: false - initial_node_count: + service_account: description: - - The number of nodes to create in this cluster. You must ensure that your Compute - Engine resource quota is sufficient for this number of instances. You must also - have available firewall and routes quota. For requests, this field should only be - used in lieu of a "nodePool" object, since this configuration (along with the "nodeConfig") - will be used to create a "NodePool" object with an auto-generated name. Do not use - this and a nodePool at the same time. - required: true - node_config: + - The Google Cloud Platform Service Account to be used by the node VMs. If + no Service Account is specified, the "default" service account is used. + required: false + metadata: + description: + - The metadata key/value pairs assigned to instances in the cluster. + - 'Keys must conform to the regexp [a-zA-Z0-9-_]+ and be less than 128 bytes + in length. These are reflected as part of a URL in the metadata server. + Additionally, to avoid ambiguity, keys must not conflict with any other + metadata keys for the project or be one of the four reserved keys: "instance-template", + "kube-env", "startup-script", and "user-data" Values are free-form strings, + and only have meaning as interpreted by the image running in the instance. + The only restriction placed on them is that each value''s size must be less + than or equal to 32 KB.' + - The total size of all keys and values must be less than 512 KB. + - 'An object containing a list of "key": value pairs.' + - 'Example: { "name": "wrench", "mass": "1.3kg", "count": "3" }.' + required: false + image_type: description: - - Parameters used in creating the cluster's nodes. - - For requests, this field should only be used in lieu of a "nodePool" object, since - this configuration (along with the "initialNodeCount") will be used to create a - "NodePool" object with an auto-generated name. Do not use this and a nodePool at - the same time. For responses, this field will be populated with the node configuration - of the first node pool. If unspecified, the defaults are used. + - The image type to use for this node. Note that for a given image type, the + latest version of it will be used. required: false - suboptions: - machine_type: - description: - - The name of a Google Compute Engine machine type (e.g. - - n1-standard-1). If unspecified, the default machine type is n1-standard-1. - required: false - disk_size_gb: - description: - - Size of the disk attached to each node, specified in GB. The smallest allowed disk - size is 10GB. If unspecified, the default disk size is 100GB. - required: false - oauth_scopes: - description: - - The set of Google API scopes to be made available on all of the node VMs under the - "default" service account. - - 'The following scopes are recommended, but not required, and by default are not - included: U(https://www.googleapis.com/auth/compute) is required for mounting persistent - storage on your nodes.' - - U(https://www.googleapis.com/auth/devstorage.read_only) is required for communicating - with gcr.io (the Google Container Registry). - - If unspecified, no scopes are added, unless Cloud Logging or Cloud Monitoring are - enabled, in which case their required scopes will be added. - required: false - service_account: - description: - - The Google Cloud Platform Service Account to be used by the node VMs. If no Service - Account is specified, the "default" service account is used. - required: false - metadata: - description: - - The metadata key/value pairs assigned to instances in the cluster. - - 'Keys must conform to the regexp [a-zA-Z0-9-_]+ and be less than 128 bytes in length. - These are reflected as part of a URL in the metadata server. Additionally, to avoid - ambiguity, keys must not conflict with any other metadata keys for the project or - be one of the four reserved keys: "instance-template", "kube-env", "startup-script", - and "user-data" Values are free-form strings, and only have meaning as interpreted - by the image running in the instance. The only restriction placed on them is that - each value''s size must be less than or equal to 32 KB.' - - The total size of all keys and values must be less than 512 KB. - - 'An object containing a list of "key": value pairs.' - - 'Example: { "name": "wrench", "mass": "1.3kg", "count": "3" }.' - required: false - image_type: - description: - - The image type to use for this node. Note that for a given image type, the latest - version of it will be used. - required: false - labels: - description: - - 'The map of Kubernetes labels (key/value pairs) to be applied to each node. - These will added in addition to any default label(s) that Kubernetes may apply to - the node. In case of conflict in label keys, the applied set may differ depending - on the Kubernetes version -- it''s best to assume the behavior is undefined and - conflicts should be avoided. For more information, including usage and the valid - values, see: U(http://kubernetes.io/v1.1/docs/user-guide/labels.html) An object - containing a list of "key": value pairs.' - - 'Example: { "name": "wrench", "mass": "1.3kg", "count": "3" }.' - required: false - local_ssd_count: - description: - - The number of local SSD disks to be attached to the node. - - 'The limit for this value is dependant upon the maximum number of disks available - on a machine per zone. See: U(https://cloud.google.com/compute/docs/disks/local-ssd#local_ssd_limits) for - more information.' - required: false - tags: - description: - - The list of instance tags applied to all nodes. Tags are used to identify valid - sources or targets for network firewalls and are specified by the client during - cluster or node pool creation. Each tag within the list must comply with RFC1035. - required: false - preemptible: - description: - - 'Whether the nodes are created as preemptible VM instances. See: U(https://cloud.google.com/compute/docs/instances/preemptible) - for more inforamtion about preemptible VM instances.' - required: false - type: bool - master_auth: + labels: + description: + - 'The map of Kubernetes labels (key/value pairs) to be applied to each node. + These will added in addition to any default label(s) that Kubernetes may + apply to the node. In case of conflict in label keys, the applied set may + differ depending on the Kubernetes version -- it''s best to assume the behavior + is undefined and conflicts should be avoided. For more information, including + usage and the valid values, see: U(http://kubernetes.io/v1.1/docs/user-guide/labels.html) + An object containing a list of "key": value pairs.' + - 'Example: { "name": "wrench", "mass": "1.3kg", "count": "3" }.' + required: false + local_ssd_count: description: - - The authentication information for accessing the master endpoint. + - The number of local SSD disks to be attached to the node. + - 'The limit for this value is dependant upon the maximum number of disks + available on a machine per zone. See: U(https://cloud.google.com/compute/docs/disks/local-ssd#local_ssd_limits) + for more information.' required: false - suboptions: - username: - description: - - The username to use for HTTP basic authentication to the master endpoint. - required: false - password: - description: - - The password to use for HTTP basic authentication to the master endpoint. Because - the master endpoint is open to the Internet, you should create a strong password. - required: false - cluster_ca_certificate: - description: - - Base64-encoded public certificate that is the root of trust for the cluster. - required: false - client_certificate: - description: - - Base64-encoded public certificate used by clients to authenticate to the cluster - endpoint. - required: false - client_key: - description: - - Base64-encoded private key used by clients to authenticate to the cluster endpoint. - required: false - logging_service: + tags: description: - - 'The logging service the cluster should use to write logs. Currently available options: logging.googleapis.com - - the Google Cloud Logging service.' - - none - no logs will be exported from the cluster. - - if left as an empty string,logging.googleapis.com will be used. + - The list of instance tags applied to all nodes. Tags are used to identify + valid sources or targets for network firewalls and are specified by the + client during cluster or node pool creation. Each tag within the list must + comply with RFC1035. required: false - choices: ['logging.googleapis.com', 'none'] - monitoring_service: + preemptible: description: - - The monitoring service the cluster should use to write metrics. - - 'Currently available options: monitoring.googleapis.com - the Google Cloud Monitoring - service.' - - none - no metrics will be exported from the cluster. - - if left as an empty string, monitoring.googleapis.com will be used. + - 'Whether the nodes are created as preemptible VM instances. See: U(https://cloud.google.com/compute/docs/instances/preemptible) + for more inforamtion about preemptible VM instances.' required: false - choices: ['monitoring.googleapis.com', 'none'] - network: + type: bool + master_auth: + description: + - The authentication information for accessing the master endpoint. + required: false + suboptions: + username: description: - - The name of the Google Compute Engine network to which the cluster is connected. - If left unspecified, the default network will be used. - - To ensure it exists and it is operations, configure the network using 'gcompute_network' - resource. + - The username to use for HTTP basic authentication to the master endpoint. required: false - cluster_ipv4_cidr: + password: description: - - The IP address range of the container pods in this cluster, in CIDR notation (e.g. - 10.96.0.0/14). Leave blank to have one automatically chosen or specify a /14 block - in 10.0.0.0/8. + - The password to use for HTTP basic authentication to the master endpoint. + Because the master endpoint is open to the Internet, you should create a + strong password. required: false - addons_config: + cluster_ca_certificate: description: - - Configurations for the various addons available to run in the cluster. + - Base64-encoded public certificate that is the root of trust for the cluster. required: false - suboptions: - http_load_balancing: - description: - - Configuration for the HTTP (L7) load balancing controller addon, which makes it - easy to set up HTTP load balancers for services in a cluster. - required: false - suboptions: - disabled: - description: - - Whether the HTTP Load Balancing controller is enabled in the cluster. When enabled, - it runs a small pod in the cluster that manages the load balancers. - required: false - type: bool - horizontal_pod_autoscaling: - description: - - Configuration for the horizontal pod autoscaling feature, which increases or decreases - the number of replica pods a replication controller has based on the resource usage - of the existing pods. - required: false - suboptions: - disabled: - description: - - Whether the Horizontal Pod Autoscaling feature is enabled in the cluster. When enabled, - it ensures that a Heapster pod is running in the cluster, which is also used by - the Cloud Monitoring service. - required: false - type: bool - subnetwork: + client_certificate: description: - - The name of the Google Compute Engine subnetwork to which the cluster is connected. + - Base64-encoded public certificate used by clients to authenticate to the + cluster endpoint. required: false - location: + client_key: description: - - The list of Google Compute Engine locations in which the cluster's nodes should - be located. + - Base64-encoded private key used by clients to authenticate to the cluster + endpoint. required: false - zone: + logging_service: + description: + - 'The logging service the cluster should use to write logs. Currently available + options: logging.googleapis.com - the Google Cloud Logging service.' + - none - no logs will be exported from the cluster. + - if left as an empty string,logging.googleapis.com will be used. + required: false + choices: + - logging.googleapis.com + - none + monitoring_service: + description: + - The monitoring service the cluster should use to write metrics. + - 'Currently available options: monitoring.googleapis.com - the Google Cloud Monitoring + service.' + - none - no metrics will be exported from the cluster. + - if left as an empty string, monitoring.googleapis.com will be used. + required: false + choices: + - monitoring.googleapis.com + - none + network: + description: + - The name of the Google Compute Engine network to which the cluster is connected. + If left unspecified, the default network will be used. + - To ensure it exists and it is operations, configure the network using 'gcompute_network' + resource. + required: false + cluster_ipv4_cidr: + description: + - The IP address range of the container pods in this cluster, in CIDR notation + (e.g. 10.96.0.0/14). Leave blank to have one automatically chosen or specify + a /14 block in 10.0.0.0/8. + required: false + addons_config: + description: + - Configurations for the various addons available to run in the cluster. + required: false + suboptions: + http_load_balancing: description: - - The zone where the cluster is deployed. - required: true + - Configuration for the HTTP (L7) load balancing controller addon, which makes + it easy to set up HTTP load balancers for services in a cluster. + required: false + suboptions: + disabled: + description: + - Whether the HTTP Load Balancing controller is enabled in the cluster. + When enabled, it runs a small pod in the cluster that manages the load + balancers. + required: false + type: bool + horizontal_pod_autoscaling: + description: + - Configuration for the horizontal pod autoscaling feature, which increases + or decreases the number of replica pods a replication controller has based + on the resource usage of the existing pods. + required: false + suboptions: + disabled: + description: + - Whether the Horizontal Pod Autoscaling feature is enabled in the cluster. + When enabled, it ensures that a Heapster pod is running in the cluster, + which is also used by the Cloud Monitoring service. + required: false + type: bool + subnetwork: + description: + - The name of the Google Compute Engine subnetwork to which the cluster is connected. + required: false + location: + description: + - The list of Google Compute Engine locations in which the cluster's nodes should + be located. + required: false + zone: + description: + - The zone where the cluster is deployed. + required: true extends_documentation_fragment: gcp ''' @@ -274,292 +286,297 @@ ''' RETURN = ''' - name: - description: - - The name of this cluster. The name must be unique within this project and zone, - and can be up to 40 characters. Must be Lowercase letters, numbers, and hyphens - only. Must start with a letter. Must end with a number or a letter. - returned: success - type: str - description: - description: - - An optional description of this cluster. - returned: success - type: str - initialNodeCount: - description: - - The number of nodes to create in this cluster. You must ensure that your Compute - Engine resource quota is sufficient for this number of instances. You must also - have available firewall and routes quota. For requests, this field should only be - used in lieu of a "nodePool" object, since this configuration (along with the "nodeConfig") - will be used to create a "NodePool" object with an auto-generated name. Do not use - this and a nodePool at the same time. - returned: success - type: int - nodeConfig: - description: - - Parameters used in creating the cluster's nodes. - - For requests, this field should only be used in lieu of a "nodePool" object, since - this configuration (along with the "initialNodeCount") will be used to create a - "NodePool" object with an auto-generated name. Do not use this and a nodePool at - the same time. For responses, this field will be populated with the node configuration - of the first node pool. If unspecified, the defaults are used. - returned: success - type: complex - contains: - machineType: - description: - - The name of a Google Compute Engine machine type (e.g. - - n1-standard-1). If unspecified, the default machine type is n1-standard-1. - returned: success - type: str - diskSizeGb: - description: - - Size of the disk attached to each node, specified in GB. The smallest allowed disk - size is 10GB. If unspecified, the default disk size is 100GB. - returned: success - type: int - oauthScopes: - description: - - The set of Google API scopes to be made available on all of the node VMs under the - "default" service account. - - 'The following scopes are recommended, but not required, and by default are not - included: U(https://www.googleapis.com/auth/compute) is required for mounting persistent - storage on your nodes.' - - U(https://www.googleapis.com/auth/devstorage.read_only) is required for communicating - with gcr.io (the Google Container Registry). - - If unspecified, no scopes are added, unless Cloud Logging or Cloud Monitoring are - enabled, in which case their required scopes will be added. - returned: success - type: list - serviceAccount: - description: - - The Google Cloud Platform Service Account to be used by the node VMs. If no Service - Account is specified, the "default" service account is used. - returned: success - type: str - metadata: - description: - - The metadata key/value pairs assigned to instances in the cluster. - - 'Keys must conform to the regexp [a-zA-Z0-9-_]+ and be less than 128 bytes in length. - These are reflected as part of a URL in the metadata server. Additionally, to avoid - ambiguity, keys must not conflict with any other metadata keys for the project or - be one of the four reserved keys: "instance-template", "kube-env", "startup-script", - and "user-data" Values are free-form strings, and only have meaning as interpreted - by the image running in the instance. The only restriction placed on them is that - each value''s size must be less than or equal to 32 KB.' - - The total size of all keys and values must be less than 512 KB. - - 'An object containing a list of "key": value pairs.' - - 'Example: { "name": "wrench", "mass": "1.3kg", "count": "3" }.' - returned: success - type: dict - imageType: - description: - - The image type to use for this node. Note that for a given image type, the latest - version of it will be used. - returned: success - type: str - labels: - description: - - 'The map of Kubernetes labels (key/value pairs) to be applied to each node. - These will added in addition to any default label(s) that Kubernetes may apply to - the node. In case of conflict in label keys, the applied set may differ depending - on the Kubernetes version -- it''s best to assume the behavior is undefined and - conflicts should be avoided. For more information, including usage and the valid - values, see: U(http://kubernetes.io/v1.1/docs/user-guide/labels.html) An object - containing a list of "key": value pairs.' - - 'Example: { "name": "wrench", "mass": "1.3kg", "count": "3" }.' - returned: success - type: dict - localSsdCount: - description: - - The number of local SSD disks to be attached to the node. - - 'The limit for this value is dependant upon the maximum number of disks available - on a machine per zone. See: U(https://cloud.google.com/compute/docs/disks/local-ssd#local_ssd_limits) for - more information.' - returned: success - type: int - tags: - description: - - The list of instance tags applied to all nodes. Tags are used to identify valid - sources or targets for network firewalls and are specified by the client during - cluster or node pool creation. Each tag within the list must comply with RFC1035. - returned: success - type: list - preemptible: - description: - - 'Whether the nodes are created as preemptible VM instances. See: U(https://cloud.google.com/compute/docs/instances/preemptible) - for more inforamtion about preemptible VM instances.' - returned: success - type: bool - masterAuth: - description: - - The authentication information for accessing the master endpoint. - returned: success - type: complex - contains: - username: - description: - - The username to use for HTTP basic authentication to the master endpoint. - returned: success - type: str - password: - description: - - The password to use for HTTP basic authentication to the master endpoint. Because - the master endpoint is open to the Internet, you should create a strong password. - returned: success - type: str - clusterCaCertificate: - description: - - Base64-encoded public certificate that is the root of trust for the cluster. - returned: success - type: str - clientCertificate: - description: - - Base64-encoded public certificate used by clients to authenticate to the cluster - endpoint. - returned: success - type: str - clientKey: - description: - - Base64-encoded private key used by clients to authenticate to the cluster endpoint. - returned: success - type: str - loggingService: - description: - - 'The logging service the cluster should use to write logs. Currently available options: logging.googleapis.com - - the Google Cloud Logging service.' - - none - no logs will be exported from the cluster. - - if left as an empty string,logging.googleapis.com will be used. - returned: success - type: str - monitoringService: - description: - - The monitoring service the cluster should use to write metrics. - - 'Currently available options: monitoring.googleapis.com - the Google Cloud Monitoring - service.' - - none - no metrics will be exported from the cluster. - - if left as an empty string, monitoring.googleapis.com will be used. - returned: success - type: str - network: - description: - - The name of the Google Compute Engine network to which the cluster is connected. - If left unspecified, the default network will be used. - - To ensure it exists and it is operations, configure the network using 'gcompute_network' - resource. - returned: success - type: str - clusterIpv4Cidr: - description: - - The IP address range of the container pods in this cluster, in CIDR notation (e.g. - 10.96.0.0/14). Leave blank to have one automatically chosen or specify a /14 block - in 10.0.0.0/8. - returned: success - type: str - addonsConfig: - description: - - Configurations for the various addons available to run in the cluster. - returned: success - type: complex - contains: - httpLoadBalancing: - description: - - Configuration for the HTTP (L7) load balancing controller addon, which makes it - easy to set up HTTP load balancers for services in a cluster. - returned: success - type: complex - contains: - disabled: - description: - - Whether the HTTP Load Balancing controller is enabled in the cluster. When enabled, - it runs a small pod in the cluster that manages the load balancers. - returned: success - type: bool - horizontalPodAutoscaling: - description: - - Configuration for the horizontal pod autoscaling feature, which increases or decreases - the number of replica pods a replication controller has based on the resource usage - of the existing pods. - returned: success - type: complex - contains: - disabled: - description: - - Whether the Horizontal Pod Autoscaling feature is enabled in the cluster. When enabled, - it ensures that a Heapster pod is running in the cluster, which is also used by - the Cloud Monitoring service. - returned: success - type: bool - subnetwork: - description: - - The name of the Google Compute Engine subnetwork to which the cluster is connected. - returned: success - type: str - location: - description: - - The list of Google Compute Engine locations in which the cluster's nodes should - be located. - returned: success - type: list - endpoint: - description: - - The IP address of this cluster's master endpoint. - - The endpoint can be accessed from the internet at https://username:password@endpoint/ See - the masterAuth property of this resource for username and password information. - returned: success - type: str - initialClusterVersion: - description: - - The software version of the master endpoint and kubelets used in the cluster when - it was first created. The version can be upgraded over time. - returned: success - type: str - currentMasterVersion: - description: - - The current software version of the master endpoint. - returned: success - type: str - currentNodeVersion: - description: - - The current version of the node software components. If they are currently at multiple - versions because they're in the process of being upgraded, this reflects the minimum - version of all nodes. - returned: success - type: str - createTime: - description: - - The time the cluster was created, in RFC3339 text format. - returned: success - type: str - nodeIpv4CidrSize: - description: - - The size of the address space on each node for hosting containers. - - This is provisioned from within the container_ipv4_cidr range. - returned: success - type: int - servicesIpv4Cidr: - description: - - The IP address range of the Kubernetes services in this cluster, in CIDR notation - (e.g. 1.2.3.4/29). Service addresses are typically put in the last /16 from the - container CIDR. - returned: success - type: str - currentNodeCount: - description: - - The number of nodes currently in the cluster. - returned: success - type: int - expireTime: - description: - - The time the cluster will be automatically deleted in RFC3339 text format. - returned: success - type: str - zone: - description: - - The zone where the cluster is deployed. - returned: success - type: str +name: + description: + - The name of this cluster. The name must be unique within this project and zone, + and can be up to 40 characters. Must be Lowercase letters, numbers, and hyphens + only. Must start with a letter. Must end with a number or a letter. + returned: success + type: str +description: + description: + - An optional description of this cluster. + returned: success + type: str +initialNodeCount: + description: + - The number of nodes to create in this cluster. You must ensure that your Compute + Engine resource quota is sufficient for this number of instances. You must also + have available firewall and routes quota. For requests, this field should only + be used in lieu of a "nodePool" object, since this configuration (along with the + "nodeConfig") will be used to create a "NodePool" object with an auto-generated + name. Do not use this and a nodePool at the same time. + returned: success + type: int +nodeConfig: + description: + - Parameters used in creating the cluster's nodes. + - For requests, this field should only be used in lieu of a "nodePool" object, since + this configuration (along with the "initialNodeCount") will be used to create + a "NodePool" object with an auto-generated name. Do not use this and a nodePool + at the same time. For responses, this field will be populated with the node configuration + of the first node pool. If unspecified, the defaults are used. + returned: success + type: complex + contains: + machineType: + description: + - The name of a Google Compute Engine machine type (e.g. + - n1-standard-1). If unspecified, the default machine type is n1-standard-1. + returned: success + type: str + diskSizeGb: + description: + - Size of the disk attached to each node, specified in GB. The smallest allowed + disk size is 10GB. If unspecified, the default disk size is 100GB. + returned: success + type: int + oauthScopes: + description: + - The set of Google API scopes to be made available on all of the node VMs under + the "default" service account. + - 'The following scopes are recommended, but not required, and by default are + not included: U(https://www.googleapis.com/auth/compute) is required for mounting + persistent storage on your nodes.' + - U(https://www.googleapis.com/auth/devstorage.read_only) is required for communicating + with gcr.io (the Google Container Registry). + - If unspecified, no scopes are added, unless Cloud Logging or Cloud Monitoring + are enabled, in which case their required scopes will be added. + returned: success + type: list + serviceAccount: + description: + - The Google Cloud Platform Service Account to be used by the node VMs. If no + Service Account is specified, the "default" service account is used. + returned: success + type: str + metadata: + description: + - The metadata key/value pairs assigned to instances in the cluster. + - 'Keys must conform to the regexp [a-zA-Z0-9-_]+ and be less than 128 bytes + in length. These are reflected as part of a URL in the metadata server. Additionally, + to avoid ambiguity, keys must not conflict with any other metadata keys for + the project or be one of the four reserved keys: "instance-template", "kube-env", + "startup-script", and "user-data" Values are free-form strings, and only have + meaning as interpreted by the image running in the instance. The only restriction + placed on them is that each value''s size must be less than or equal to 32 + KB.' + - The total size of all keys and values must be less than 512 KB. + - 'An object containing a list of "key": value pairs.' + - 'Example: { "name": "wrench", "mass": "1.3kg", "count": "3" }.' + returned: success + type: dict + imageType: + description: + - The image type to use for this node. Note that for a given image type, the + latest version of it will be used. + returned: success + type: str + labels: + description: + - 'The map of Kubernetes labels (key/value pairs) to be applied to each node. + These will added in addition to any default label(s) that Kubernetes may apply + to the node. In case of conflict in label keys, the applied set may differ + depending on the Kubernetes version -- it''s best to assume the behavior is + undefined and conflicts should be avoided. For more information, including + usage and the valid values, see: U(http://kubernetes.io/v1.1/docs/user-guide/labels.html) + An object containing a list of "key": value pairs.' + - 'Example: { "name": "wrench", "mass": "1.3kg", "count": "3" }.' + returned: success + type: dict + localSsdCount: + description: + - The number of local SSD disks to be attached to the node. + - 'The limit for this value is dependant upon the maximum number of disks available + on a machine per zone. See: U(https://cloud.google.com/compute/docs/disks/local-ssd#local_ssd_limits) + for more information.' + returned: success + type: int + tags: + description: + - The list of instance tags applied to all nodes. Tags are used to identify + valid sources or targets for network firewalls and are specified by the client + during cluster or node pool creation. Each tag within the list must comply + with RFC1035. + returned: success + type: list + preemptible: + description: + - 'Whether the nodes are created as preemptible VM instances. See: U(https://cloud.google.com/compute/docs/instances/preemptible) + for more inforamtion about preemptible VM instances.' + returned: success + type: bool +masterAuth: + description: + - The authentication information for accessing the master endpoint. + returned: success + type: complex + contains: + username: + description: + - The username to use for HTTP basic authentication to the master endpoint. + returned: success + type: str + password: + description: + - The password to use for HTTP basic authentication to the master endpoint. + Because the master endpoint is open to the Internet, you should create a strong + password. + returned: success + type: str + clusterCaCertificate: + description: + - Base64-encoded public certificate that is the root of trust for the cluster. + returned: success + type: str + clientCertificate: + description: + - Base64-encoded public certificate used by clients to authenticate to the cluster + endpoint. + returned: success + type: str + clientKey: + description: + - Base64-encoded private key used by clients to authenticate to the cluster + endpoint. + returned: success + type: str +loggingService: + description: + - 'The logging service the cluster should use to write logs. Currently available + options: logging.googleapis.com - the Google Cloud Logging service.' + - none - no logs will be exported from the cluster. + - if left as an empty string,logging.googleapis.com will be used. + returned: success + type: str +monitoringService: + description: + - The monitoring service the cluster should use to write metrics. + - 'Currently available options: monitoring.googleapis.com - the Google Cloud Monitoring + service.' + - none - no metrics will be exported from the cluster. + - if left as an empty string, monitoring.googleapis.com will be used. + returned: success + type: str +network: + description: + - The name of the Google Compute Engine network to which the cluster is connected. + If left unspecified, the default network will be used. + - To ensure it exists and it is operations, configure the network using 'gcompute_network' + resource. + returned: success + type: str +clusterIpv4Cidr: + description: + - The IP address range of the container pods in this cluster, in CIDR notation (e.g. + 10.96.0.0/14). Leave blank to have one automatically chosen or specify a /14 block + in 10.0.0.0/8. + returned: success + type: str +addonsConfig: + description: + - Configurations for the various addons available to run in the cluster. + returned: success + type: complex + contains: + httpLoadBalancing: + description: + - Configuration for the HTTP (L7) load balancing controller addon, which makes + it easy to set up HTTP load balancers for services in a cluster. + returned: success + type: complex + contains: + disabled: + description: + - Whether the HTTP Load Balancing controller is enabled in the cluster. + When enabled, it runs a small pod in the cluster that manages the load + balancers. + returned: success + type: bool + horizontalPodAutoscaling: + description: + - Configuration for the horizontal pod autoscaling feature, which increases + or decreases the number of replica pods a replication controller has based + on the resource usage of the existing pods. + returned: success + type: complex + contains: + disabled: + description: + - Whether the Horizontal Pod Autoscaling feature is enabled in the cluster. + When enabled, it ensures that a Heapster pod is running in the cluster, + which is also used by the Cloud Monitoring service. + returned: success + type: bool +subnetwork: + description: + - The name of the Google Compute Engine subnetwork to which the cluster is connected. + returned: success + type: str +location: + description: + - The list of Google Compute Engine locations in which the cluster's nodes should + be located. + returned: success + type: list +endpoint: + description: + - The IP address of this cluster's master endpoint. + - The endpoint can be accessed from the internet at https://username:password@endpoint/ + See the masterAuth property of this resource for username and password information. + returned: success + type: str +initialClusterVersion: + description: + - The software version of the master endpoint and kubelets used in the cluster when + it was first created. The version can be upgraded over time. + returned: success + type: str +currentMasterVersion: + description: + - The current software version of the master endpoint. + returned: success + type: str +currentNodeVersion: + description: + - The current version of the node software components. If they are currently at + multiple versions because they're in the process of being upgraded, this reflects + the minimum version of all nodes. + returned: success + type: str +createTime: + description: + - The time the cluster was created, in RFC3339 text format. + returned: success + type: str +nodeIpv4CidrSize: + description: + - The size of the address space on each node for hosting containers. + - This is provisioned from within the container_ipv4_cidr range. + returned: success + type: int +servicesIpv4Cidr: + description: + - The IP address range of the Kubernetes services in this cluster, in CIDR notation + (e.g. 1.2.3.4/29). Service addresses are typically put in the last /16 from the + container CIDR. + returned: success + type: str +currentNodeCount: + description: + - The number of nodes currently in the cluster. + returned: success + type: int +expireTime: + description: + - The time the cluster will be automatically deleted in RFC3339 text format. + returned: success + type: str +zone: + description: + - The zone where the cluster is deployed. + returned: success + type: str ''' ################################################################################ diff --git a/lib/ansible/modules/cloud/google/gcp_container_cluster_facts.py b/lib/ansible/modules/cloud/google/gcp_container_cluster_facts.py index 9fe28fab5cc968..f04e9d22cbd857 100644 --- a/lib/ansible/modules/cloud/google/gcp_container_cluster_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_container_cluster_facts.py @@ -32,19 +32,19 @@ --- module: gcp_container_cluster_facts description: - - Gather facts for GCP Cluster +- Gather facts for GCP Cluster short_description: Gather facts for GCP Cluster version_added: 2.8 author: Google Inc. (@googlecloudplatform) requirements: - - python >= 2.6 - - requests >= 2.18.4 - - google-auth >= 1.3.0 +- python >= 2.6 +- requests >= 2.18.4 +- google-auth >= 1.3.0 options: - zone: - description: - - The zone where the cluster is deployed. - required: true + zone: + description: + - The zone where the cluster is deployed. + required: true extends_documentation_fragment: gcp ''' @@ -59,297 +59,302 @@ RETURN = ''' items: - description: List of items - returned: always - type: complex - contains: - name: - description: - - The name of this cluster. The name must be unique within this project and zone, - and can be up to 40 characters. Must be Lowercase letters, numbers, and hyphens - only. Must start with a letter. Must end with a number or a letter. - returned: success - type: str - description: - description: - - An optional description of this cluster. - returned: success - type: str - initialNodeCount: - description: - - The number of nodes to create in this cluster. You must ensure that your Compute - Engine resource quota is sufficient for this number of instances. You must also - have available firewall and routes quota. For requests, this field should only be - used in lieu of a "nodePool" object, since this configuration (along with the "nodeConfig") - will be used to create a "NodePool" object with an auto-generated name. Do not use - this and a nodePool at the same time. - returned: success - type: int - nodeConfig: - description: - - Parameters used in creating the cluster's nodes. - - For requests, this field should only be used in lieu of a "nodePool" object, since - this configuration (along with the "initialNodeCount") will be used to create a - "NodePool" object with an auto-generated name. Do not use this and a nodePool at - the same time. For responses, this field will be populated with the node configuration - of the first node pool. If unspecified, the defaults are used. - returned: success - type: complex - contains: - machineType: - description: - - The name of a Google Compute Engine machine type (e.g. - - n1-standard-1). If unspecified, the default machine type is n1-standard-1. - returned: success - type: str - diskSizeGb: - description: - - Size of the disk attached to each node, specified in GB. The smallest allowed disk - size is 10GB. If unspecified, the default disk size is 100GB. - returned: success - type: int - oauthScopes: - description: - - The set of Google API scopes to be made available on all of the node VMs under the - "default" service account. - - 'The following scopes are recommended, but not required, and by default are not - included: U(https://www.googleapis.com/auth/compute) is required for mounting persistent - storage on your nodes.' - - U(https://www.googleapis.com/auth/devstorage.read_only) is required for communicating - with gcr.io (the Google Container Registry). - - If unspecified, no scopes are added, unless Cloud Logging or Cloud Monitoring are - enabled, in which case their required scopes will be added. - returned: success - type: list - serviceAccount: - description: - - The Google Cloud Platform Service Account to be used by the node VMs. If no Service - Account is specified, the "default" service account is used. - returned: success - type: str - metadata: - description: - - The metadata key/value pairs assigned to instances in the cluster. - - 'Keys must conform to the regexp [a-zA-Z0-9-_]+ and be less than 128 bytes in length. - These are reflected as part of a URL in the metadata server. Additionally, to avoid - ambiguity, keys must not conflict with any other metadata keys for the project or - be one of the four reserved keys: "instance-template", "kube-env", "startup-script", - and "user-data" Values are free-form strings, and only have meaning as interpreted - by the image running in the instance. The only restriction placed on them is that - each value''s size must be less than or equal to 32 KB.' - - The total size of all keys and values must be less than 512 KB. - - 'An object containing a list of "key": value pairs.' - - 'Example: { "name": "wrench", "mass": "1.3kg", "count": "3" }.' - returned: success - type: dict - imageType: - description: - - The image type to use for this node. Note that for a given image type, the latest - version of it will be used. - returned: success - type: str - labels: - description: - - 'The map of Kubernetes labels (key/value pairs) to be applied to each node. - These will added in addition to any default label(s) that Kubernetes may apply - to the node. In case of conflict in label keys, the applied set may differ - depending on the Kubernetes version -- it''s best to assume the behavior is - undefined and conflicts should be avoided. For more information, including - usage and the valid values, see: - U(http://kubernetes.io/v1.1/docs/user-guide/labels.html) An object containing - a list of "key": value pairs.' - - 'Example: { "name": "wrench", "mass": "1.3kg", "count": "3" }.' - returned: success - type: dict - localSsdCount: - description: - - The number of local SSD disks to be attached to the node. - - 'The limit for this value is dependant upon the maximum number of disks available - on a machine per zone. See: U(https://cloud.google.com/compute/docs/disks/local-ssd#local_ssd_limits) for - more information.' - returned: success - type: int - tags: - description: - - The list of instance tags applied to all nodes. Tags are used to identify valid - sources or targets for network firewalls and are specified by the client during - cluster or node pool creation. Each tag within the list must comply with RFC1035. - returned: success - type: list - preemptible: - description: - - 'Whether the nodes are created as preemptible VM instances. See: U(https://cloud.google.com/compute/docs/instances/preemptible) - for more inforamtion about preemptible VM instances.' - returned: success - type: bool - masterAuth: - description: - - The authentication information for accessing the master endpoint. - returned: success - type: complex - contains: - username: - description: - - The username to use for HTTP basic authentication to the master endpoint. - returned: success - type: str - password: - description: - - The password to use for HTTP basic authentication to the master endpoint. Because - the master endpoint is open to the Internet, you should create a strong password. - returned: success - type: str - clusterCaCertificate: - description: - - Base64-encoded public certificate that is the root of trust for the cluster. - returned: success - type: str - clientCertificate: - description: - - Base64-encoded public certificate used by clients to authenticate to the cluster - endpoint. - returned: success - type: str - clientKey: - description: - - Base64-encoded private key used by clients to authenticate to the cluster endpoint. - returned: success - type: str - loggingService: - description: - - 'The logging service the cluster should use to write logs. Currently available options: logging.googleapis.com - - the Google Cloud Logging service.' - - none - no logs will be exported from the cluster. - - if left as an empty string,logging.googleapis.com will be used. - returned: success - type: str - monitoringService: - description: - - The monitoring service the cluster should use to write metrics. - - 'Currently available options: monitoring.googleapis.com - the Google Cloud Monitoring - service.' - - none - no metrics will be exported from the cluster. - - if left as an empty string, monitoring.googleapis.com will be used. - returned: success - type: str - network: - description: - - The name of the Google Compute Engine network to which the cluster is connected. - If left unspecified, the default network will be used. - - To ensure it exists and it is operations, configure the network using 'gcompute_network' - resource. - returned: success - type: str - clusterIpv4Cidr: - description: - - The IP address range of the container pods in this cluster, in CIDR notation (e.g. - 10.96.0.0/14). Leave blank to have one automatically chosen or specify a /14 block - in 10.0.0.0/8. - returned: success - type: str - addonsConfig: - description: - - Configurations for the various addons available to run in the cluster. - returned: success - type: complex - contains: - httpLoadBalancing: - description: - - Configuration for the HTTP (L7) load balancing controller addon, which makes it - easy to set up HTTP load balancers for services in a cluster. - returned: success - type: complex - contains: - disabled: - description: - - Whether the HTTP Load Balancing controller is enabled in the cluster. When enabled, - it runs a small pod in the cluster that manages the load balancers. - returned: success - type: bool - horizontalPodAutoscaling: - description: - - Configuration for the horizontal pod autoscaling feature, which increases or decreases - the number of replica pods a replication controller has based on the resource usage - of the existing pods. - returned: success - type: complex - contains: - disabled: - description: - - Whether the Horizontal Pod Autoscaling feature is enabled in the cluster. When enabled, - it ensures that a Heapster pod is running in the cluster, which is also used by - the Cloud Monitoring service. - returned: success - type: bool - subnetwork: - description: - - The name of the Google Compute Engine subnetwork to which the cluster is connected. - returned: success - type: str - location: - description: - - The list of Google Compute Engine locations in which the cluster's nodes should - be located. - returned: success - type: list - endpoint: - description: - - The IP address of this cluster's master endpoint. - - The endpoint can be accessed from the internet at https://username:password@endpoint/ See - the masterAuth property of this resource for username and password information. - returned: success - type: str - initialClusterVersion: - description: - - The software version of the master endpoint and kubelets used in the cluster when - it was first created. The version can be upgraded over time. - returned: success - type: str - currentMasterVersion: - description: - - The current software version of the master endpoint. - returned: success - type: str - currentNodeVersion: - description: - - The current version of the node software components. If they are currently at multiple - versions because they're in the process of being upgraded, this reflects the minimum - version of all nodes. - returned: success - type: str - createTime: - description: - - The time the cluster was created, in RFC3339 text format. - returned: success - type: str - nodeIpv4CidrSize: - description: - - The size of the address space on each node for hosting containers. - - This is provisioned from within the container_ipv4_cidr range. - returned: success - type: int - servicesIpv4Cidr: - description: - - The IP address range of the Kubernetes services in this cluster, in CIDR notation - (e.g. 1.2.3.4/29). Service addresses are typically put in the last /16 from the - container CIDR. - returned: success - type: str - currentNodeCount: - description: - - The number of nodes currently in the cluster. - returned: success - type: int - expireTime: - description: - - The time the cluster will be automatically deleted in RFC3339 text format. - returned: success - type: str - zone: - description: - - The zone where the cluster is deployed. - returned: success - type: str + description: List of items + returned: always + type: complex + contains: + name: + description: + - The name of this cluster. The name must be unique within this project and + zone, and can be up to 40 characters. Must be Lowercase letters, numbers, + and hyphens only. Must start with a letter. Must end with a number or a letter. + returned: success + type: str + description: + description: + - An optional description of this cluster. + returned: success + type: str + initialNodeCount: + description: + - The number of nodes to create in this cluster. You must ensure that your Compute + Engine resource quota is sufficient for this number of instances. You must + also have available firewall and routes quota. For requests, this field should + only be used in lieu of a "nodePool" object, since this configuration (along + with the "nodeConfig") will be used to create a "NodePool" object with an + auto-generated name. Do not use this and a nodePool at the same time. + returned: success + type: int + nodeConfig: + description: + - Parameters used in creating the cluster's nodes. + - For requests, this field should only be used in lieu of a "nodePool" object, + since this configuration (along with the "initialNodeCount") will be used + to create a "NodePool" object with an auto-generated name. Do not use this + and a nodePool at the same time. For responses, this field will be populated + with the node configuration of the first node pool. If unspecified, the defaults + are used. + returned: success + type: complex + contains: + machineType: + description: + - The name of a Google Compute Engine machine type (e.g. + - n1-standard-1). If unspecified, the default machine type is n1-standard-1. + returned: success + type: str + diskSizeGb: + description: + - Size of the disk attached to each node, specified in GB. The smallest + allowed disk size is 10GB. If unspecified, the default disk size is 100GB. + returned: success + type: int + oauthScopes: + description: + - The set of Google API scopes to be made available on all of the node VMs + under the "default" service account. + - 'The following scopes are recommended, but not required, and by default + are not included: U(https://www.googleapis.com/auth/compute) is required + for mounting persistent storage on your nodes.' + - U(https://www.googleapis.com/auth/devstorage.read_only) is required for + communicating with gcr.io (the Google Container Registry). + - If unspecified, no scopes are added, unless Cloud Logging or Cloud Monitoring + are enabled, in which case their required scopes will be added. + returned: success + type: list + serviceAccount: + description: + - The Google Cloud Platform Service Account to be used by the node VMs. + If no Service Account is specified, the "default" service account is used. + returned: success + type: str + metadata: + description: + - The metadata key/value pairs assigned to instances in the cluster. + - 'Keys must conform to the regexp [a-zA-Z0-9-_]+ and be less than 128 bytes + in length. These are reflected as part of a URL in the metadata server. + Additionally, to avoid ambiguity, keys must not conflict with any other + metadata keys for the project or be one of the four reserved keys: "instance-template", + "kube-env", "startup-script", and "user-data" Values are free-form strings, + and only have meaning as interpreted by the image running in the instance. + The only restriction placed on them is that each value''s size must be + less than or equal to 32 KB.' + - The total size of all keys and values must be less than 512 KB. + - 'An object containing a list of "key": value pairs.' + - 'Example: { "name": "wrench", "mass": "1.3kg", "count": "3" }.' + returned: success + type: dict + imageType: + description: + - The image type to use for this node. Note that for a given image type, + the latest version of it will be used. + returned: success + type: str + labels: + description: + - 'The map of Kubernetes labels (key/value pairs) to be applied to each + node. These will added in addition to any default label(s) that Kubernetes + may apply to the node. In case of conflict in label keys, the applied + set may differ depending on the Kubernetes version -- it''s best to assume + the behavior is undefined and conflicts should be avoided. For more information, + including usage and the valid values, see: U(http://kubernetes.io/v1.1/docs/user-guide/labels.html) + An object containing a list of "key": value pairs.' + - 'Example: { "name": "wrench", "mass": "1.3kg", "count": "3" }.' + returned: success + type: dict + localSsdCount: + description: + - The number of local SSD disks to be attached to the node. + - 'The limit for this value is dependant upon the maximum number of disks + available on a machine per zone. See: U(https://cloud.google.com/compute/docs/disks/local-ssd#local_ssd_limits) + for more information.' + returned: success + type: int + tags: + description: + - The list of instance tags applied to all nodes. Tags are used to identify + valid sources or targets for network firewalls and are specified by the + client during cluster or node pool creation. Each tag within the list + must comply with RFC1035. + returned: success + type: list + preemptible: + description: + - 'Whether the nodes are created as preemptible VM instances. See: U(https://cloud.google.com/compute/docs/instances/preemptible) + for more inforamtion about preemptible VM instances.' + returned: success + type: bool + masterAuth: + description: + - The authentication information for accessing the master endpoint. + returned: success + type: complex + contains: + username: + description: + - The username to use for HTTP basic authentication to the master endpoint. + returned: success + type: str + password: + description: + - The password to use for HTTP basic authentication to the master endpoint. + Because the master endpoint is open to the Internet, you should create + a strong password. + returned: success + type: str + clusterCaCertificate: + description: + - Base64-encoded public certificate that is the root of trust for the cluster. + returned: success + type: str + clientCertificate: + description: + - Base64-encoded public certificate used by clients to authenticate to the + cluster endpoint. + returned: success + type: str + clientKey: + description: + - Base64-encoded private key used by clients to authenticate to the cluster + endpoint. + returned: success + type: str + loggingService: + description: + - 'The logging service the cluster should use to write logs. Currently available + options: logging.googleapis.com - the Google Cloud Logging service.' + - none - no logs will be exported from the cluster. + - if left as an empty string,logging.googleapis.com will be used. + returned: success + type: str + monitoringService: + description: + - The monitoring service the cluster should use to write metrics. + - 'Currently available options: monitoring.googleapis.com - the Google Cloud + Monitoring service.' + - none - no metrics will be exported from the cluster. + - if left as an empty string, monitoring.googleapis.com will be used. + returned: success + type: str + network: + description: + - The name of the Google Compute Engine network to which the cluster is connected. + If left unspecified, the default network will be used. + - To ensure it exists and it is operations, configure the network using 'gcompute_network' + resource. + returned: success + type: str + clusterIpv4Cidr: + description: + - The IP address range of the container pods in this cluster, in CIDR notation + (e.g. 10.96.0.0/14). Leave blank to have one automatically chosen or specify + a /14 block in 10.0.0.0/8. + returned: success + type: str + addonsConfig: + description: + - Configurations for the various addons available to run in the cluster. + returned: success + type: complex + contains: + httpLoadBalancing: + description: + - Configuration for the HTTP (L7) load balancing controller addon, which + makes it easy to set up HTTP load balancers for services in a cluster. + returned: success + type: complex + contains: + disabled: + description: + - Whether the HTTP Load Balancing controller is enabled in the cluster. + When enabled, it runs a small pod in the cluster that manages the + load balancers. + returned: success + type: bool + horizontalPodAutoscaling: + description: + - Configuration for the horizontal pod autoscaling feature, which increases + or decreases the number of replica pods a replication controller has based + on the resource usage of the existing pods. + returned: success + type: complex + contains: + disabled: + description: + - Whether the Horizontal Pod Autoscaling feature is enabled in the cluster. + When enabled, it ensures that a Heapster pod is running in the cluster, + which is also used by the Cloud Monitoring service. + returned: success + type: bool + subnetwork: + description: + - The name of the Google Compute Engine subnetwork to which the cluster is connected. + returned: success + type: str + location: + description: + - The list of Google Compute Engine locations in which the cluster's nodes should + be located. + returned: success + type: list + endpoint: + description: + - The IP address of this cluster's master endpoint. + - The endpoint can be accessed from the internet at https://username:password@endpoint/ + See the masterAuth property of this resource for username and password information. + returned: success + type: str + initialClusterVersion: + description: + - The software version of the master endpoint and kubelets used in the cluster + when it was first created. The version can be upgraded over time. + returned: success + type: str + currentMasterVersion: + description: + - The current software version of the master endpoint. + returned: success + type: str + currentNodeVersion: + description: + - The current version of the node software components. If they are currently + at multiple versions because they're in the process of being upgraded, this + reflects the minimum version of all nodes. + returned: success + type: str + createTime: + description: + - The time the cluster was created, in RFC3339 text format. + returned: success + type: str + nodeIpv4CidrSize: + description: + - The size of the address space on each node for hosting containers. + - This is provisioned from within the container_ipv4_cidr range. + returned: success + type: int + servicesIpv4Cidr: + description: + - The IP address range of the Kubernetes services in this cluster, in CIDR notation + (e.g. 1.2.3.4/29). Service addresses are typically put in the last /16 from + the container CIDR. + returned: success + type: str + currentNodeCount: + description: + - The number of nodes currently in the cluster. + returned: success + type: int + expireTime: + description: + - The time the cluster will be automatically deleted in RFC3339 text format. + returned: success + type: str + zone: + description: + - The zone where the cluster is deployed. + returned: success + type: str ''' ################################################################################ diff --git a/lib/ansible/modules/cloud/google/gcp_container_node_pool.py b/lib/ansible/modules/cloud/google/gcp_container_node_pool.py index 5ad1a86d93b662..3c999f25acb9a4 100644 --- a/lib/ansible/modules/cloud/google/gcp_container_node_pool.py +++ b/lib/ansible/modules/cloud/google/gcp_container_node_pool.py @@ -32,182 +32,187 @@ --- module: gcp_container_node_pool description: - - NodePool contains the name and configuration for a cluster's node pool. - - Node pools are a set of nodes (i.e. VM's), with a common configuration and specification, - under the control of the cluster master. They may have a set of Kubernetes labels - applied to them, which may be used to reference them during pod scheduling. They - may also be resized up or down, to accommodate the workload. +- NodePool contains the name and configuration for a cluster's node pool. +- Node pools are a set of nodes (i.e. VM's), with a common configuration and specification, + under the control of the cluster master. They may have a set of Kubernetes labels + applied to them, which may be used to reference them during pod scheduling. They + may also be resized up or down, to accommodate the workload. short_description: Creates a GCP NodePool version_added: 2.6 author: Google Inc. (@googlecloudplatform) requirements: - - python >= 2.6 - - requests >= 2.18.4 - - google-auth >= 1.3.0 +- python >= 2.6 +- requests >= 2.18.4 +- google-auth >= 1.3.0 options: - state: + state: + description: + - Whether the given object should exist in GCP + choices: + - present + - absent + default: present + name: + description: + - The name of the node pool. + required: false + config: + description: + - The node configuration of the pool. + required: false + suboptions: + machine_type: description: - - Whether the given object should exist in GCP - choices: ['present', 'absent'] - default: 'present' - name: + - The name of a Google Compute Engine machine type (e.g. + - n1-standard-1). If unspecified, the default machine type is n1-standard-1. + required: false + disk_size_gb: description: - - The name of the node pool. + - Size of the disk attached to each node, specified in GB. The smallest allowed + disk size is 10GB. If unspecified, the default disk size is 100GB. required: false - config: + oauth_scopes: description: - - The node configuration of the pool. + - The set of Google API scopes to be made available on all of the node VMs + under the "default" service account. + - 'The following scopes are recommended, but not required, and by default + are not included: U(https://www.googleapis.com/auth/compute) is required + for mounting persistent storage on your nodes.' + - U(https://www.googleapis.com/auth/devstorage.read_only) is required for + communicating with gcr.io (the Google Container Registry). + - If unspecified, no scopes are added, unless Cloud Logging or Cloud Monitoring + are enabled, in which case their required scopes will be added. required: false - suboptions: - machine_type: - description: - - The name of a Google Compute Engine machine type (e.g. - - n1-standard-1). If unspecified, the default machine type is n1-standard-1. - required: false - disk_size_gb: - description: - - Size of the disk attached to each node, specified in GB. The smallest allowed disk - size is 10GB. If unspecified, the default disk size is 100GB. - required: false - oauth_scopes: - description: - - The set of Google API scopes to be made available on all of the node VMs under the - "default" service account. - - 'The following scopes are recommended, but not required, and by default are not - included: U(https://www.googleapis.com/auth/compute) is required for mounting persistent - storage on your nodes.' - - U(https://www.googleapis.com/auth/devstorage.read_only) is required for communicating - with gcr.io (the Google Container Registry). - - If unspecified, no scopes are added, unless Cloud Logging or Cloud Monitoring are - enabled, in which case their required scopes will be added. - required: false - service_account: - description: - - The Google Cloud Platform Service Account to be used by the node VMs. If no Service - Account is specified, the "default" service account is used. - required: false - metadata: - description: - - The metadata key/value pairs assigned to instances in the cluster. - - 'Keys must conform to the regexp [a-zA-Z0-9-_]+ and be less than 128 bytes in length. - These are reflected as part of a URL in the metadata server. Additionally, to avoid - ambiguity, keys must not conflict with any other metadata keys for the project or - be one of the four reserved keys: "instance-template", "kube-env", "startup-script", - and "user-data" Values are free-form strings, and only have meaning as interpreted - by the image running in the instance. The only restriction placed on them is that - each value''s size must be less than or equal to 32 KB.' - - The total size of all keys and values must be less than 512 KB. - - 'An object containing a list of "key": value pairs.' - - 'Example: { "name": "wrench", "mass": "1.3kg", "count": "3" }.' - required: false - image_type: - description: - - The image type to use for this node. Note that for a given image type, the latest - version of it will be used. - required: false - labels: - description: - - 'The map of Kubernetes labels (key/value pairs) to be applied to each node. - These will added in addition to any default label(s) that Kubernetes may apply to - the node. In case of conflict in label keys, the applied set may differ depending - on the Kubernetes version -- it''s best to assume the behavior is undefined and - conflicts should be avoided. For more information, including usage and the valid - values, see: U(http://kubernetes.io/v1.1/docs/user-guide/labels.html) An object - containing a list of "key": value pairs.' - - 'Example: { "name": "wrench", "mass": "1.3kg", "count": "3" }.' - required: false - local_ssd_count: - description: - - The number of local SSD disks to be attached to the node. - - 'The limit for this value is dependant upon the maximum number of disks available - on a machine per zone. See: U(https://cloud.google.com/compute/docs/disks/local-ssd#local_ssd_limits) for - more information.' - required: false - tags: - description: - - The list of instance tags applied to all nodes. Tags are used to identify valid - sources or targets for network firewalls and are specified by the client during - cluster or node pool creation. Each tag within the list must comply with RFC1035. - required: false - preemptible: - description: - - 'Whether the nodes are created as preemptible VM instances. See: U(https://cloud.google.com/compute/docs/instances/preemptible) - for more inforamtion about preemptible VM instances.' - required: false - type: bool - initial_node_count: + service_account: description: - - The initial node count for the pool. You must ensure that your Compute Engine resource - quota is sufficient for this number of instances. You must also have available firewall - and routes quota. - required: true - autoscaling: + - The Google Cloud Platform Service Account to be used by the node VMs. If + no Service Account is specified, the "default" service account is used. + required: false + metadata: description: - - Autoscaler configuration for this NodePool. Autoscaler is enabled only if a valid - configuration is present. + - The metadata key/value pairs assigned to instances in the cluster. + - 'Keys must conform to the regexp [a-zA-Z0-9-_]+ and be less than 128 bytes + in length. These are reflected as part of a URL in the metadata server. + Additionally, to avoid ambiguity, keys must not conflict with any other + metadata keys for the project or be one of the four reserved keys: "instance-template", + "kube-env", "startup-script", and "user-data" Values are free-form strings, + and only have meaning as interpreted by the image running in the instance. + The only restriction placed on them is that each value''s size must be less + than or equal to 32 KB.' + - The total size of all keys and values must be less than 512 KB. + - 'An object containing a list of "key": value pairs.' + - 'Example: { "name": "wrench", "mass": "1.3kg", "count": "3" }.' required: false - suboptions: - enabled: - description: - - Is autoscaling enabled for this node pool. - required: false - type: bool - min_node_count: - description: - - Minimum number of nodes in the NodePool. Must be >= 1 and <= maxNodeCount. - required: false - max_node_count: - description: - - Maximum number of nodes in the NodePool. Must be >= minNodeCount. - - There has to enough quota to scale up the cluster. - required: false - management: + image_type: description: - - Management configuration for this NodePool. + - The image type to use for this node. Note that for a given image type, the + latest version of it will be used. required: false - suboptions: - auto_upgrade: - description: - - A flag that specifies whether node auto-upgrade is enabled for the node pool. If - enabled, node auto-upgrade helps keep the nodes in your node pool up to date with - the latest release version of Kubernetes. - required: false - type: bool - auto_repair: - description: - - A flag that specifies whether the node auto-repair is enabled for the node pool. - If enabled, the nodes in this node pool will be monitored and, if they fail health - checks too many times, an automatic repair action will be triggered. - required: false - type: bool - upgrade_options: - description: - - Specifies the Auto Upgrade knobs for the node pool. - required: false - suboptions: - auto_upgrade_start_time: - description: - - This field is set when upgrades are about to commence with the approximate start - time for the upgrades, in RFC3339 text format. - required: false - description: - description: - - This field is set when upgrades are about to commence with the description of the - upgrade. - required: false - cluster: + labels: + description: + - 'The map of Kubernetes labels (key/value pairs) to be applied to each node. + These will added in addition to any default label(s) that Kubernetes may + apply to the node. In case of conflict in label keys, the applied set may + differ depending on the Kubernetes version -- it''s best to assume the behavior + is undefined and conflicts should be avoided. For more information, including + usage and the valid values, see: U(http://kubernetes.io/v1.1/docs/user-guide/labels.html) + An object containing a list of "key": value pairs.' + - 'Example: { "name": "wrench", "mass": "1.3kg", "count": "3" }.' + required: false + local_ssd_count: + description: + - The number of local SSD disks to be attached to the node. + - 'The limit for this value is dependant upon the maximum number of disks + available on a machine per zone. See: U(https://cloud.google.com/compute/docs/disks/local-ssd#local_ssd_limits) + for more information.' + required: false + tags: + description: + - The list of instance tags applied to all nodes. Tags are used to identify + valid sources or targets for network firewalls and are specified by the + client during cluster or node pool creation. Each tag within the list must + comply with RFC1035. + required: false + preemptible: + description: + - 'Whether the nodes are created as preemptible VM instances. See: U(https://cloud.google.com/compute/docs/instances/preemptible) + for more inforamtion about preemptible VM instances.' + required: false + type: bool + initial_node_count: + description: + - The initial node count for the pool. You must ensure that your Compute Engine + resource quota is sufficient for this number of instances. You must also have + available firewall and routes quota. + required: true + autoscaling: + description: + - Autoscaler configuration for this NodePool. Autoscaler is enabled only if a + valid configuration is present. + required: false + suboptions: + enabled: + description: + - Is autoscaling enabled for this node pool. + required: false + type: bool + min_node_count: description: - - The cluster this node pool belongs to. - - 'This field represents a link to a Cluster resource in GCP. It can be specified - in two ways. You can add `register: name-of-resource` to a gcp_container_cluster - task and then set this cluster field to "{{ name-of-resource }}" Alternatively, - you can set this cluster to a dictionary with the name key where the value is the - name of your Cluster.' - required: true - zone: + - Minimum number of nodes in the NodePool. Must be >= 1 and <= maxNodeCount. + required: false + max_node_count: description: - - The zone where the node pool is deployed. - required: true + - Maximum number of nodes in the NodePool. Must be >= minNodeCount. + - There has to enough quota to scale up the cluster. + required: false + management: + description: + - Management configuration for this NodePool. + required: false + suboptions: + auto_upgrade: + description: + - A flag that specifies whether node auto-upgrade is enabled for the node + pool. If enabled, node auto-upgrade helps keep the nodes in your node pool + up to date with the latest release version of Kubernetes. + required: false + type: bool + auto_repair: + description: + - A flag that specifies whether the node auto-repair is enabled for the node + pool. If enabled, the nodes in this node pool will be monitored and, if + they fail health checks too many times, an automatic repair action will + be triggered. + required: false + type: bool + upgrade_options: + description: + - Specifies the Auto Upgrade knobs for the node pool. + required: false + suboptions: + auto_upgrade_start_time: + description: + - This field is set when upgrades are about to commence with the approximate + start time for the upgrades, in RFC3339 text format. + required: false + description: + description: + - This field is set when upgrades are about to commence with the description + of the upgrade. + required: false + cluster: + description: + - The cluster this node pool belongs to. + - 'This field represents a link to a Cluster resource in GCP. It can be specified + in two ways. You can add `register: name-of-resource` to a gcp_container_cluster + task and then set this cluster field to "{{ name-of-resource }}" Alternatively, + you can set this cluster to a dictionary with the name key where the value is + the name of your Cluster' + required: true + zone: + description: + - The zone where the node pool is deployed. + required: true extends_documentation_fragment: gcp ''' @@ -236,185 +241,187 @@ ''' RETURN = ''' - name: - description: - - The name of the node pool. - returned: success - type: str - config: - description: - - The node configuration of the pool. - returned: success - type: complex - contains: - machineType: - description: - - The name of a Google Compute Engine machine type (e.g. - - n1-standard-1). If unspecified, the default machine type is n1-standard-1. - returned: success - type: str - diskSizeGb: - description: - - Size of the disk attached to each node, specified in GB. The smallest allowed disk - size is 10GB. If unspecified, the default disk size is 100GB. - returned: success - type: int - oauthScopes: - description: - - The set of Google API scopes to be made available on all of the node VMs under the - "default" service account. - - 'The following scopes are recommended, but not required, and by default are not - included: U(https://www.googleapis.com/auth/compute) is required for mounting persistent - storage on your nodes.' - - U(https://www.googleapis.com/auth/devstorage.read_only) is required for communicating - with gcr.io (the Google Container Registry). - - If unspecified, no scopes are added, unless Cloud Logging or Cloud Monitoring are - enabled, in which case their required scopes will be added. - returned: success - type: list - serviceAccount: - description: - - The Google Cloud Platform Service Account to be used by the node VMs. If no Service - Account is specified, the "default" service account is used. - returned: success - type: str - metadata: - description: - - The metadata key/value pairs assigned to instances in the cluster. - - 'Keys must conform to the regexp [a-zA-Z0-9-_]+ and be less than 128 bytes in length. - These are reflected as part of a URL in the metadata server. Additionally, to avoid - ambiguity, keys must not conflict with any other metadata keys for the project or - be one of the four reserved keys: "instance-template", "kube-env", "startup-script", - and "user-data" Values are free-form strings, and only have meaning as interpreted - by the image running in the instance. The only restriction placed on them is that - each value''s size must be less than or equal to 32 KB.' - - The total size of all keys and values must be less than 512 KB. - - 'An object containing a list of "key": value pairs.' - - 'Example: { "name": "wrench", "mass": "1.3kg", "count": "3" }.' - returned: success - type: dict - imageType: - description: - - The image type to use for this node. Note that for a given image type, the latest - version of it will be used. - returned: success - type: str - labels: - description: - - 'The map of Kubernetes labels (key/value pairs) to be applied to each node. - These will added in addition to any default label(s) that Kubernetes may apply to - the node. In case of conflict in label keys, the applied set may differ depending - on the Kubernetes version -- it''s best to assume the behavior is undefined and - conflicts should be avoided. For more information, including usage and the valid - values, see: U(http://kubernetes.io/v1.1/docs/user-guide/labels.html) An object - containing a list of "key": value pairs.' - - 'Example: { "name": "wrench", "mass": "1.3kg", "count": "3" }.' - returned: success - type: dict - localSsdCount: - description: - - The number of local SSD disks to be attached to the node. - - 'The limit for this value is dependant upon the maximum number of disks available - on a machine per zone. See: U(https://cloud.google.com/compute/docs/disks/local-ssd#local_ssd_limits) for - more information.' - returned: success - type: int - tags: - description: - - The list of instance tags applied to all nodes. Tags are used to identify valid - sources or targets for network firewalls and are specified by the client during - cluster or node pool creation. Each tag within the list must comply with RFC1035. - returned: success - type: list - preemptible: - description: - - 'Whether the nodes are created as preemptible VM instances. See: U(https://cloud.google.com/compute/docs/instances/preemptible) - for more inforamtion about preemptible VM instances.' - returned: success - type: bool - initialNodeCount: - description: - - The initial node count for the pool. You must ensure that your Compute Engine resource - quota is sufficient for this number of instances. You must also have available firewall - and routes quota. - returned: success - type: int - version: - description: - - The version of the Kubernetes of this node. - returned: success - type: str - autoscaling: - description: - - Autoscaler configuration for this NodePool. Autoscaler is enabled only if a valid - configuration is present. - returned: success - type: complex - contains: - enabled: - description: - - Is autoscaling enabled for this node pool. - returned: success - type: bool - minNodeCount: - description: - - Minimum number of nodes in the NodePool. Must be >= 1 and <= maxNodeCount. - returned: success - type: int - maxNodeCount: - description: - - Maximum number of nodes in the NodePool. Must be >= minNodeCount. - - There has to enough quota to scale up the cluster. - returned: success - type: int - management: - description: - - Management configuration for this NodePool. - returned: success - type: complex - contains: - autoUpgrade: - description: - - A flag that specifies whether node auto-upgrade is enabled for the node pool. If - enabled, node auto-upgrade helps keep the nodes in your node pool up to date with - the latest release version of Kubernetes. - returned: success - type: bool - autoRepair: - description: - - A flag that specifies whether the node auto-repair is enabled for the node pool. - If enabled, the nodes in this node pool will be monitored and, if they fail health - checks too many times, an automatic repair action will be triggered. - returned: success - type: bool - upgradeOptions: - description: - - Specifies the Auto Upgrade knobs for the node pool. - returned: success - type: complex - contains: - autoUpgradeStartTime: - description: - - This field is set when upgrades are about to commence with the approximate start - time for the upgrades, in RFC3339 text format. - returned: success - type: str - description: - description: - - This field is set when upgrades are about to commence with the description of the - upgrade. - returned: success - type: str - cluster: - description: - - The cluster this node pool belongs to. - returned: success - type: dict - zone: +name: + description: + - The name of the node pool. + returned: success + type: str +config: + description: + - The node configuration of the pool. + returned: success + type: complex + contains: + machineType: + description: + - The name of a Google Compute Engine machine type (e.g. + - n1-standard-1). If unspecified, the default machine type is n1-standard-1. + returned: success + type: str + diskSizeGb: + description: + - Size of the disk attached to each node, specified in GB. The smallest allowed + disk size is 10GB. If unspecified, the default disk size is 100GB. + returned: success + type: int + oauthScopes: + description: + - The set of Google API scopes to be made available on all of the node VMs under + the "default" service account. + - 'The following scopes are recommended, but not required, and by default are + not included: U(https://www.googleapis.com/auth/compute) is required for mounting + persistent storage on your nodes.' + - U(https://www.googleapis.com/auth/devstorage.read_only) is required for communicating + with gcr.io (the Google Container Registry). + - If unspecified, no scopes are added, unless Cloud Logging or Cloud Monitoring + are enabled, in which case their required scopes will be added. + returned: success + type: list + serviceAccount: + description: + - The Google Cloud Platform Service Account to be used by the node VMs. If no + Service Account is specified, the "default" service account is used. + returned: success + type: str + metadata: + description: + - The metadata key/value pairs assigned to instances in the cluster. + - 'Keys must conform to the regexp [a-zA-Z0-9-_]+ and be less than 128 bytes + in length. These are reflected as part of a URL in the metadata server. Additionally, + to avoid ambiguity, keys must not conflict with any other metadata keys for + the project or be one of the four reserved keys: "instance-template", "kube-env", + "startup-script", and "user-data" Values are free-form strings, and only have + meaning as interpreted by the image running in the instance. The only restriction + placed on them is that each value''s size must be less than or equal to 32 + KB.' + - The total size of all keys and values must be less than 512 KB. + - 'An object containing a list of "key": value pairs.' + - 'Example: { "name": "wrench", "mass": "1.3kg", "count": "3" }.' + returned: success + type: dict + imageType: + description: + - The image type to use for this node. Note that for a given image type, the + latest version of it will be used. + returned: success + type: str + labels: + description: + - 'The map of Kubernetes labels (key/value pairs) to be applied to each node. + These will added in addition to any default label(s) that Kubernetes may apply + to the node. In case of conflict in label keys, the applied set may differ + depending on the Kubernetes version -- it''s best to assume the behavior is + undefined and conflicts should be avoided. For more information, including + usage and the valid values, see: U(http://kubernetes.io/v1.1/docs/user-guide/labels.html) + An object containing a list of "key": value pairs.' + - 'Example: { "name": "wrench", "mass": "1.3kg", "count": "3" }.' + returned: success + type: dict + localSsdCount: + description: + - The number of local SSD disks to be attached to the node. + - 'The limit for this value is dependant upon the maximum number of disks available + on a machine per zone. See: U(https://cloud.google.com/compute/docs/disks/local-ssd#local_ssd_limits) + for more information.' + returned: success + type: int + tags: + description: + - The list of instance tags applied to all nodes. Tags are used to identify + valid sources or targets for network firewalls and are specified by the client + during cluster or node pool creation. Each tag within the list must comply + with RFC1035. + returned: success + type: list + preemptible: + description: + - 'Whether the nodes are created as preemptible VM instances. See: U(https://cloud.google.com/compute/docs/instances/preemptible) + for more inforamtion about preemptible VM instances.' + returned: success + type: bool +initialNodeCount: + description: + - The initial node count for the pool. You must ensure that your Compute Engine + resource quota is sufficient for this number of instances. You must also have + available firewall and routes quota. + returned: success + type: int +version: + description: + - The version of the Kubernetes of this node. + returned: success + type: str +autoscaling: + description: + - Autoscaler configuration for this NodePool. Autoscaler is enabled only if a valid + configuration is present. + returned: success + type: complex + contains: + enabled: + description: + - Is autoscaling enabled for this node pool. + returned: success + type: bool + minNodeCount: + description: + - Minimum number of nodes in the NodePool. Must be >= 1 and <= maxNodeCount. + returned: success + type: int + maxNodeCount: + description: + - Maximum number of nodes in the NodePool. Must be >= minNodeCount. + - There has to enough quota to scale up the cluster. + returned: success + type: int +management: + description: + - Management configuration for this NodePool. + returned: success + type: complex + contains: + autoUpgrade: + description: + - A flag that specifies whether node auto-upgrade is enabled for the node pool. + If enabled, node auto-upgrade helps keep the nodes in your node pool up to + date with the latest release version of Kubernetes. + returned: success + type: bool + autoRepair: + description: + - A flag that specifies whether the node auto-repair is enabled for the node + pool. If enabled, the nodes in this node pool will be monitored and, if they + fail health checks too many times, an automatic repair action will be triggered. + returned: success + type: bool + upgradeOptions: + description: + - Specifies the Auto Upgrade knobs for the node pool. + returned: success + type: complex + contains: + autoUpgradeStartTime: + description: + - This field is set when upgrades are about to commence with the approximate + start time for the upgrades, in RFC3339 text format. + returned: success + type: str description: - - The zone where the node pool is deployed. - returned: success - type: str + description: + - This field is set when upgrades are about to commence with the description + of the upgrade. + returned: success + type: str +cluster: + description: + - The cluster this node pool belongs to. + returned: success + type: dict +zone: + description: + - The zone where the node pool is deployed. + returned: success + type: str ''' ################################################################################ diff --git a/lib/ansible/modules/cloud/google/gcp_container_node_pool_facts.py b/lib/ansible/modules/cloud/google/gcp_container_node_pool_facts.py index 98b8c30599e6d3..f43989d8b3073c 100644 --- a/lib/ansible/modules/cloud/google/gcp_container_node_pool_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_container_node_pool_facts.py @@ -32,28 +32,28 @@ --- module: gcp_container_node_pool_facts description: - - Gather facts for GCP NodePool +- Gather facts for GCP NodePool short_description: Gather facts for GCP NodePool version_added: 2.8 author: Google Inc. (@googlecloudplatform) requirements: - - python >= 2.6 - - requests >= 2.18.4 - - google-auth >= 1.3.0 +- python >= 2.6 +- requests >= 2.18.4 +- google-auth >= 1.3.0 options: - zone: - description: - - The zone where the node pool is deployed. - required: true - cluster: - description: - - The cluster this node pool belongs to. - - 'This field represents a link to a Cluster resource in GCP. It can be specified - in two ways. You can add `register: name-of-resource` to a gcp_container_cluster - task and then set this cluster field to "{{ name-of-resource }}" Alternatively, - you can set this cluster to a dictionary with the name key where the value is the - name of your Cluster.' - required: true + zone: + description: + - The zone where the node pool is deployed. + required: true + cluster: + description: + - The cluster this node pool belongs to. + - 'This field represents a link to a Cluster resource in GCP. It can be specified + in two ways. You can add `register: name-of-resource` to a gcp_container_cluster + task and then set this cluster field to "{{ name-of-resource }}" Alternatively, + you can set this cluster to a dictionary with the name key where the value is + the name of your Cluster' + required: true extends_documentation_fragment: gcp ''' @@ -69,190 +69,192 @@ RETURN = ''' items: - description: List of items - returned: always - type: complex - contains: - name: - description: - - The name of the node pool. - returned: success - type: str - config: - description: - - The node configuration of the pool. - returned: success - type: complex - contains: - machineType: - description: - - The name of a Google Compute Engine machine type (e.g. - - n1-standard-1). If unspecified, the default machine type is n1-standard-1. - returned: success - type: str - diskSizeGb: - description: - - Size of the disk attached to each node, specified in GB. The smallest allowed disk - size is 10GB. If unspecified, the default disk size is 100GB. - returned: success - type: int - oauthScopes: - description: - - The set of Google API scopes to be made available on all of the node VMs under the - "default" service account. - - 'The following scopes are recommended, but not required, and by default are not - included: U(https://www.googleapis.com/auth/compute) is required for mounting persistent - storage on your nodes.' - - U(https://www.googleapis.com/auth/devstorage.read_only) is required for communicating - with gcr.io (the Google Container Registry). - - If unspecified, no scopes are added, unless Cloud Logging or Cloud Monitoring are - enabled, in which case their required scopes will be added. - returned: success - type: list - serviceAccount: - description: - - The Google Cloud Platform Service Account to be used by the node VMs. If no Service - Account is specified, the "default" service account is used. - returned: success - type: str - metadata: - description: - - The metadata key/value pairs assigned to instances in the cluster. - - 'Keys must conform to the regexp [a-zA-Z0-9-_]+ and be less than 128 bytes in length. - These are reflected as part of a URL in the metadata server. Additionally, to avoid - ambiguity, keys must not conflict with any other metadata keys for the project or - be one of the four reserved keys: "instance-template", "kube-env", "startup-script", - and "user-data" Values are free-form strings, and only have meaning as interpreted - by the image running in the instance. The only restriction placed on them is that - each value''s size must be less than or equal to 32 KB.' - - The total size of all keys and values must be less than 512 KB. - - 'An object containing a list of "key": value pairs.' - - 'Example: { "name": "wrench", "mass": "1.3kg", "count": "3" }.' - returned: success - type: dict - imageType: - description: - - The image type to use for this node. Note that for a given image type, the latest - version of it will be used. - returned: success - type: str - labels: - description: - - 'The map of Kubernetes labels (key/value pairs) to be applied to each node. - These will added in addition to any default label(s) that Kubernetes may apply - to the node. In case of conflict in label keys, the applied set may differ - depending on the Kubernetes version -- it''s best to assume the behavior is - undefined and conflicts should be avoided. For more information, including - usage and the valid values, see: - U(http://kubernetes.io/v1.1/docs/user-guide/labels.html) An object containing - a list of "key": value pairs.' - - 'Example: { "name": "wrench", "mass": "1.3kg", "count": "3" }.' - returned: success - type: dict - localSsdCount: - description: - - The number of local SSD disks to be attached to the node. - - 'The limit for this value is dependant upon the maximum number of disks available - on a machine per zone. See: U(https://cloud.google.com/compute/docs/disks/local-ssd#local_ssd_limits) for - more information.' - returned: success - type: int - tags: - description: - - The list of instance tags applied to all nodes. Tags are used to identify valid - sources or targets for network firewalls and are specified by the client during - cluster or node pool creation. Each tag within the list must comply with RFC1035. - returned: success - type: list - preemptible: - description: - - 'Whether the nodes are created as preemptible VM instances. See: U(https://cloud.google.com/compute/docs/instances/preemptible) - for more inforamtion about preemptible VM instances.' - returned: success - type: bool - initialNodeCount: - description: - - The initial node count for the pool. You must ensure that your Compute Engine resource - quota is sufficient for this number of instances. You must also have available firewall - and routes quota. - returned: success - type: int - version: - description: - - The version of the Kubernetes of this node. - returned: success - type: str - autoscaling: + description: List of items + returned: always + type: complex + contains: + name: + description: + - The name of the node pool. + returned: success + type: str + config: + description: + - The node configuration of the pool. + returned: success + type: complex + contains: + machineType: + description: + - The name of a Google Compute Engine machine type (e.g. + - n1-standard-1). If unspecified, the default machine type is n1-standard-1. + returned: success + type: str + diskSizeGb: + description: + - Size of the disk attached to each node, specified in GB. The smallest + allowed disk size is 10GB. If unspecified, the default disk size is 100GB. + returned: success + type: int + oauthScopes: + description: + - The set of Google API scopes to be made available on all of the node VMs + under the "default" service account. + - 'The following scopes are recommended, but not required, and by default + are not included: U(https://www.googleapis.com/auth/compute) is required + for mounting persistent storage on your nodes.' + - U(https://www.googleapis.com/auth/devstorage.read_only) is required for + communicating with gcr.io (the Google Container Registry). + - If unspecified, no scopes are added, unless Cloud Logging or Cloud Monitoring + are enabled, in which case their required scopes will be added. + returned: success + type: list + serviceAccount: + description: + - The Google Cloud Platform Service Account to be used by the node VMs. + If no Service Account is specified, the "default" service account is used. + returned: success + type: str + metadata: + description: + - The metadata key/value pairs assigned to instances in the cluster. + - 'Keys must conform to the regexp [a-zA-Z0-9-_]+ and be less than 128 bytes + in length. These are reflected as part of a URL in the metadata server. + Additionally, to avoid ambiguity, keys must not conflict with any other + metadata keys for the project or be one of the four reserved keys: "instance-template", + "kube-env", "startup-script", and "user-data" Values are free-form strings, + and only have meaning as interpreted by the image running in the instance. + The only restriction placed on them is that each value''s size must be + less than or equal to 32 KB.' + - The total size of all keys and values must be less than 512 KB. + - 'An object containing a list of "key": value pairs.' + - 'Example: { "name": "wrench", "mass": "1.3kg", "count": "3" }.' + returned: success + type: dict + imageType: + description: + - The image type to use for this node. Note that for a given image type, + the latest version of it will be used. + returned: success + type: str + labels: + description: + - 'The map of Kubernetes labels (key/value pairs) to be applied to each + node. These will added in addition to any default label(s) that Kubernetes + may apply to the node. In case of conflict in label keys, the applied + set may differ depending on the Kubernetes version -- it''s best to assume + the behavior is undefined and conflicts should be avoided. For more information, + including usage and the valid values, see: U(http://kubernetes.io/v1.1/docs/user-guide/labels.html) + An object containing a list of "key": value pairs.' + - 'Example: { "name": "wrench", "mass": "1.3kg", "count": "3" }.' + returned: success + type: dict + localSsdCount: + description: + - The number of local SSD disks to be attached to the node. + - 'The limit for this value is dependant upon the maximum number of disks + available on a machine per zone. See: U(https://cloud.google.com/compute/docs/disks/local-ssd#local_ssd_limits) + for more information.' + returned: success + type: int + tags: + description: + - The list of instance tags applied to all nodes. Tags are used to identify + valid sources or targets for network firewalls and are specified by the + client during cluster or node pool creation. Each tag within the list + must comply with RFC1035. + returned: success + type: list + preemptible: + description: + - 'Whether the nodes are created as preemptible VM instances. See: U(https://cloud.google.com/compute/docs/instances/preemptible) + for more inforamtion about preemptible VM instances.' + returned: success + type: bool + initialNodeCount: + description: + - The initial node count for the pool. You must ensure that your Compute Engine + resource quota is sufficient for this number of instances. You must also have + available firewall and routes quota. + returned: success + type: int + version: + description: + - The version of the Kubernetes of this node. + returned: success + type: str + autoscaling: + description: + - Autoscaler configuration for this NodePool. Autoscaler is enabled only if + a valid configuration is present. + returned: success + type: complex + contains: + enabled: + description: + - Is autoscaling enabled for this node pool. + returned: success + type: bool + minNodeCount: + description: + - Minimum number of nodes in the NodePool. Must be >= 1 and <= maxNodeCount. + returned: success + type: int + maxNodeCount: + description: + - Maximum number of nodes in the NodePool. Must be >= minNodeCount. + - There has to enough quota to scale up the cluster. + returned: success + type: int + management: + description: + - Management configuration for this NodePool. + returned: success + type: complex + contains: + autoUpgrade: + description: + - A flag that specifies whether node auto-upgrade is enabled for the node + pool. If enabled, node auto-upgrade helps keep the nodes in your node + pool up to date with the latest release version of Kubernetes. + returned: success + type: bool + autoRepair: + description: + - A flag that specifies whether the node auto-repair is enabled for the + node pool. If enabled, the nodes in this node pool will be monitored and, + if they fail health checks too many times, an automatic repair action + will be triggered. + returned: success + type: bool + upgradeOptions: + description: + - Specifies the Auto Upgrade knobs for the node pool. + returned: success + type: complex + contains: + autoUpgradeStartTime: + description: + - This field is set when upgrades are about to commence with the approximate + start time for the upgrades, in RFC3339 text format. + returned: success + type: str description: - - Autoscaler configuration for this NodePool. Autoscaler is enabled only if a valid - configuration is present. - returned: success - type: complex - contains: - enabled: - description: - - Is autoscaling enabled for this node pool. - returned: success - type: bool - minNodeCount: - description: - - Minimum number of nodes in the NodePool. Must be >= 1 and <= maxNodeCount. - returned: success - type: int - maxNodeCount: - description: - - Maximum number of nodes in the NodePool. Must be >= minNodeCount. - - There has to enough quota to scale up the cluster. - returned: success - type: int - management: - description: - - Management configuration for this NodePool. - returned: success - type: complex - contains: - autoUpgrade: - description: - - A flag that specifies whether node auto-upgrade is enabled for the node pool. If - enabled, node auto-upgrade helps keep the nodes in your node pool up to date with - the latest release version of Kubernetes. - returned: success - type: bool - autoRepair: - description: - - A flag that specifies whether the node auto-repair is enabled for the node pool. - If enabled, the nodes in this node pool will be monitored and, if they fail health - checks too many times, an automatic repair action will be triggered. - returned: success - type: bool - upgradeOptions: - description: - - Specifies the Auto Upgrade knobs for the node pool. - returned: success - type: complex - contains: - autoUpgradeStartTime: - description: - - This field is set when upgrades are about to commence with the approximate start - time for the upgrades, in RFC3339 text format. - returned: success - type: str - description: - description: - - This field is set when upgrades are about to commence with the description of the - upgrade. - returned: success - type: str - cluster: - description: - - The cluster this node pool belongs to. - returned: success - type: dict - zone: - description: - - The zone where the node pool is deployed. - returned: success - type: str + description: + - This field is set when upgrades are about to commence with the description + of the upgrade. + returned: success + type: str + cluster: + description: + - The cluster this node pool belongs to. + returned: success + type: dict + zone: + description: + - The zone where the node pool is deployed. + returned: success + type: str ''' ################################################################################ diff --git a/lib/ansible/modules/cloud/google/gcp_dns_managed_zone.py b/lib/ansible/modules/cloud/google/gcp_dns_managed_zone.py index 08fdc31eada6bb..6a8ed21bf35e6a 100644 --- a/lib/ansible/modules/cloud/google/gcp_dns_managed_zone.py +++ b/lib/ansible/modules/cloud/google/gcp_dns_managed_zone.py @@ -32,41 +32,43 @@ --- module: gcp_dns_managed_zone description: - - A zone is a subtree of the DNS namespace under one administrative responsibility. - A ManagedZone is a resource that represents a DNS zone hosted by the Cloud DNS service. +- A zone is a subtree of the DNS namespace under one administrative responsibility. + A ManagedZone is a resource that represents a DNS zone hosted by the Cloud DNS service. short_description: Creates a GCP ManagedZone version_added: 2.5 author: Google Inc. (@googlecloudplatform) requirements: - - python >= 2.6 - - requests >= 2.18.4 - - google-auth >= 1.3.0 +- python >= 2.6 +- requests >= 2.18.4 +- google-auth >= 1.3.0 options: - state: - description: - - Whether the given object should exist in GCP - choices: ['present', 'absent'] - default: 'present' + state: description: - description: - - A mutable string of at most 1024 characters associated with this resource for the - user's convenience. Has no effect on the managed zone's function. - required: false - dns_name: - description: - - The DNS name of this managed zone, for instance "example.com.". - required: false - name: - description: - - User assigned name for this resource. - - Must be unique within the project. - required: true - name_server_set: - description: - - Optionally specifies the NameServerSet for this ManagedZone. A NameServerSet is - a set of DNS name servers that all host the same ManagedZones. Most users will leave - this field unset. - required: false + - Whether the given object should exist in GCP + choices: + - present + - absent + default: present + description: + description: + - A mutable string of at most 1024 characters associated with this resource for + the user's convenience. Has no effect on the managed zone's function. + required: false + dns_name: + description: + - The DNS name of this managed zone, for instance "example.com.". + required: false + name: + description: + - User assigned name for this resource. + - Must be unique within the project. + required: true + name_server_set: + description: + - Optionally specifies the NameServerSet for this ManagedZone. A NameServerSet + is a set of DNS name servers that all host the same ManagedZones. Most users + will leave this field unset. + required: false extends_documentation_fragment: gcp ''' @@ -83,47 +85,47 @@ ''' RETURN = ''' - description: - description: - - A mutable string of at most 1024 characters associated with this resource for the - user's convenience. Has no effect on the managed zone's function. - returned: success - type: str - dnsName: - description: - - The DNS name of this managed zone, for instance "example.com.". - returned: success - type: str - id: - description: - - Unique identifier for the resource; defined by the server. - returned: success - type: int - name: - description: - - User assigned name for this resource. - - Must be unique within the project. - returned: success - type: str - nameServers: - description: - - Delegate your managed_zone to these virtual name servers; defined by the server - . - returned: success - type: list - nameServerSet: - description: - - Optionally specifies the NameServerSet for this ManagedZone. A NameServerSet is - a set of DNS name servers that all host the same ManagedZones. Most users will leave - this field unset. - returned: success - type: list - creationTime: - description: - - The time that this resource was created on the server. - - This is in RFC3339 text format. - returned: success - type: str +description: + description: + - A mutable string of at most 1024 characters associated with this resource for + the user's convenience. Has no effect on the managed zone's function. + returned: success + type: str +dnsName: + description: + - The DNS name of this managed zone, for instance "example.com.". + returned: success + type: str +id: + description: + - Unique identifier for the resource; defined by the server. + returned: success + type: int +name: + description: + - User assigned name for this resource. + - Must be unique within the project. + returned: success + type: str +nameServers: + description: + - Delegate your managed_zone to these virtual name servers; defined by the server + . + returned: success + type: list +nameServerSet: + description: + - Optionally specifies the NameServerSet for this ManagedZone. A NameServerSet is + a set of DNS name servers that all host the same ManagedZones. Most users will + leave this field unset. + returned: success + type: list +creationTime: + description: + - The time that this resource was created on the server. + - This is in RFC3339 text format. + returned: success + type: str ''' ################################################################################ diff --git a/lib/ansible/modules/cloud/google/gcp_dns_managed_zone_facts.py b/lib/ansible/modules/cloud/google/gcp_dns_managed_zone_facts.py index d795b802165d7c..4206d97901fad6 100644 --- a/lib/ansible/modules/cloud/google/gcp_dns_managed_zone_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_dns_managed_zone_facts.py @@ -32,18 +32,18 @@ --- module: gcp_dns_managed_zone_facts description: - - Gather facts for GCP ManagedZone +- Gather facts for GCP ManagedZone short_description: Gather facts for GCP ManagedZone version_added: 2.8 author: Google Inc. (@googlecloudplatform) requirements: - - python >= 2.6 - - requests >= 2.18.4 - - google-auth >= 1.3.0 +- python >= 2.6 +- requests >= 2.18.4 +- google-auth >= 1.3.0 options: - dns_name: - description: - Restricts the list to return only zones with this domain name. + dns_name: + description: + - Restricts the list to return only zones with this domain name. extends_documentation_fragment: gcp ''' @@ -58,51 +58,51 @@ RETURN = ''' items: - description: List of items - returned: always - type: complex - contains: - description: - description: - - A mutable string of at most 1024 characters associated with this resource for the - user's convenience. Has no effect on the managed zone's function. - returned: success - type: str - dnsName: - description: - - The DNS name of this managed zone, for instance "example.com.". - returned: success - type: str - id: - description: - - Unique identifier for the resource; defined by the server. - returned: success - type: int - name: - description: - - User assigned name for this resource. - - Must be unique within the project. - returned: success - type: str - nameServers: - description: - - Delegate your managed_zone to these virtual name servers; defined by the server - . - returned: success - type: list - nameServerSet: - description: - - Optionally specifies the NameServerSet for this ManagedZone. A NameServerSet is - a set of DNS name servers that all host the same ManagedZones. Most users will leave - this field unset. - returned: success - type: list - creationTime: - description: - - The time that this resource was created on the server. - - This is in RFC3339 text format. - returned: success - type: str + description: List of items + returned: always + type: complex + contains: + description: + description: + - A mutable string of at most 1024 characters associated with this resource + for the user's convenience. Has no effect on the managed zone's function. + returned: success + type: str + dnsName: + description: + - The DNS name of this managed zone, for instance "example.com.". + returned: success + type: str + id: + description: + - Unique identifier for the resource; defined by the server. + returned: success + type: int + name: + description: + - User assigned name for this resource. + - Must be unique within the project. + returned: success + type: str + nameServers: + description: + - Delegate your managed_zone to these virtual name servers; defined by the server + . + returned: success + type: list + nameServerSet: + description: + - Optionally specifies the NameServerSet for this ManagedZone. A NameServerSet + is a set of DNS name servers that all host the same ManagedZones. Most users + will leave this field unset. + returned: success + type: list + creationTime: + description: + - The time that this resource was created on the server. + - This is in RFC3339 text format. + returned: success + type: str ''' ################################################################################ diff --git a/lib/ansible/modules/cloud/google/gcp_dns_resource_record_set.py b/lib/ansible/modules/cloud/google/gcp_dns_resource_record_set.py index 2b0491534b515e..936bbd361d0926 100644 --- a/lib/ansible/modules/cloud/google/gcp_dns_resource_record_set.py +++ b/lib/ansible/modules/cloud/google/gcp_dns_resource_record_set.py @@ -32,51 +32,65 @@ --- module: gcp_dns_resource_record_set description: - - A single DNS record that exists on a domain name (i.e. in a managed zone). - - This record defines the information about the domain and where the domain / subdomains - direct to. - - The record will include the domain/subdomain name, a type (i.e. A, AAA, CAA, MX, - CNAME, NS, etc) . +- A single DNS record that exists on a domain name (i.e. in a managed zone). +- This record defines the information about the domain and where the domain / subdomains + direct to. +- The record will include the domain/subdomain name, a type (i.e. A, AAA, CAA, MX, + CNAME, NS, etc) . short_description: Creates a GCP ResourceRecordSet version_added: 2.6 author: Google Inc. (@googlecloudplatform) requirements: - - python >= 2.6 - - requests >= 2.18.4 - - google-auth >= 1.3.0 +- python >= 2.6 +- requests >= 2.18.4 +- google-auth >= 1.3.0 options: - state: - description: - - Whether the given object should exist in GCP - choices: ['present', 'absent'] - default: 'present' - name: - description: - - For example, U(www.example.com.) - required: true - type: - description: - - One of valid DNS resource types. - required: true - choices: ['A', 'AAAA', 'CAA', 'CNAME', 'MX', 'NAPTR', 'NS', 'PTR', 'SOA', 'SPF', 'SRV', 'TXT'] - ttl: - description: - - Number of seconds that this ResourceRecordSet can be cached by resolvers. - required: false - target: - description: - - As defined in RFC 1035 (section 5) and RFC 1034 (section 3.6.1) . - required: false - managed_zone: - description: - - Identifies the managed zone addressed by this request. - - Can be the managed zone name or id. - - 'This field represents a link to a ManagedZone resource in GCP. It can be specified - in two ways. You can add `register: name-of-resource` to a gcp_dns_managed_zone - task and then set this managed_zone field to "{{ name-of-resource }}" Alternatively, - you can set this managed_zone to a dictionary with the name key where the value - is the name of your ManagedZone.' - required: true + state: + description: + - Whether the given object should exist in GCP + choices: + - present + - absent + default: present + name: + description: + - For example, U(www.example.com.) + required: true + type: + description: + - One of valid DNS resource types. + required: true + choices: + - A + - AAAA + - CAA + - CNAME + - MX + - NAPTR + - NS + - PTR + - SOA + - SPF + - SRV + - TXT + ttl: + description: + - Number of seconds that this ResourceRecordSet can be cached by resolvers. + required: false + target: + description: + - As defined in RFC 1035 (section 5) and RFC 1034 (section 3.6.1) . + required: false + managed_zone: + description: + - Identifies the managed zone addressed by this request. + - Can be the managed zone name or id. + - 'This field represents a link to a ManagedZone resource in GCP. It can be specified + in two ways. You can add `register: name-of-resource` to a gcp_dns_managed_zone + task and then set this managed_zone field to "{{ name-of-resource }}" Alternatively, + you can set this managed_zone to a dictionary with the name key where the value + is the name of your ManagedZone' + required: true extends_documentation_fragment: gcp ''' @@ -108,32 +122,32 @@ ''' RETURN = ''' - name: - description: - - For example, U(www.example.com.) - returned: success - type: str - type: - description: - - One of valid DNS resource types. - returned: success - type: str - ttl: - description: - - Number of seconds that this ResourceRecordSet can be cached by resolvers. - returned: success - type: int - target: - description: - - As defined in RFC 1035 (section 5) and RFC 1034 (section 3.6.1) . - returned: success - type: list - managed_zone: - description: - - Identifies the managed zone addressed by this request. - - Can be the managed zone name or id. - returned: success - type: dict +name: + description: + - For example, U(www.example.com.) + returned: success + type: str +type: + description: + - One of valid DNS resource types. + returned: success + type: str +ttl: + description: + - Number of seconds that this ResourceRecordSet can be cached by resolvers. + returned: success + type: int +target: + description: + - As defined in RFC 1035 (section 5) and RFC 1034 (section 3.6.1) . + returned: success + type: list +managed_zone: + description: + - Identifies the managed zone addressed by this request. + - Can be the managed zone name or id. + returned: success + type: dict ''' ################################################################################ diff --git a/lib/ansible/modules/cloud/google/gcp_dns_resource_record_set_facts.py b/lib/ansible/modules/cloud/google/gcp_dns_resource_record_set_facts.py index edafba4cfc93e4..d75216a522854a 100644 --- a/lib/ansible/modules/cloud/google/gcp_dns_resource_record_set_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_dns_resource_record_set_facts.py @@ -32,25 +32,25 @@ --- module: gcp_dns_resource_record_set_facts description: - - Gather facts for GCP ResourceRecordSet +- Gather facts for GCP ResourceRecordSet short_description: Gather facts for GCP ResourceRecordSet version_added: 2.8 author: Google Inc. (@googlecloudplatform) requirements: - - python >= 2.6 - - requests >= 2.18.4 - - google-auth >= 1.3.0 +- python >= 2.6 +- requests >= 2.18.4 +- google-auth >= 1.3.0 options: - managed_zone: - description: - - Identifies the managed zone addressed by this request. - - Can be the managed zone name or id. - - 'This field represents a link to a ManagedZone resource in GCP. It can be specified - in two ways. You can add `register: name-of-resource` to a gcp_dns_managed_zone - task and then set this managed_zone field to "{{ name-of-resource }}" Alternatively, - you can set this managed_zone to a dictionary with the name key where the value - is the name of your ManagedZone.' - required: true + managed_zone: + description: + - Identifies the managed zone addressed by this request. + - Can be the managed zone name or id. + - 'This field represents a link to a ManagedZone resource in GCP. It can be specified + in two ways. You can add `register: name-of-resource` to a gcp_dns_managed_zone + task and then set this managed_zone field to "{{ name-of-resource }}" Alternatively, + you can set this managed_zone to a dictionary with the name key where the value + is the name of your ManagedZone' + required: true extends_documentation_fragment: gcp ''' @@ -65,36 +65,36 @@ RETURN = ''' items: - description: List of items - returned: always - type: complex - contains: - name: - description: - - For example, U(www.example.com.) - returned: success - type: str - type: - description: - - One of valid DNS resource types. - returned: success - type: str - ttl: - description: - - Number of seconds that this ResourceRecordSet can be cached by resolvers. - returned: success - type: int - target: - description: - - As defined in RFC 1035 (section 5) and RFC 1034 (section 3.6.1) . - returned: success - type: list - managed_zone: - description: - - Identifies the managed zone addressed by this request. - - Can be the managed zone name or id. - returned: success - type: dict + description: List of items + returned: always + type: complex + contains: + name: + description: + - For example, U(www.example.com.) + returned: success + type: str + type: + description: + - One of valid DNS resource types. + returned: success + type: str + ttl: + description: + - Number of seconds that this ResourceRecordSet can be cached by resolvers. + returned: success + type: int + target: + description: + - As defined in RFC 1035 (section 5) and RFC 1034 (section 3.6.1) . + returned: success + type: list + managed_zone: + description: + - Identifies the managed zone addressed by this request. + - Can be the managed zone name or id. + returned: success + type: dict ''' ################################################################################ diff --git a/lib/ansible/modules/cloud/google/gcp_pubsub_subscription.py b/lib/ansible/modules/cloud/google/gcp_pubsub_subscription.py index d5eeeee253598b..38c6cc12abf38b 100644 --- a/lib/ansible/modules/cloud/google/gcp_pubsub_subscription.py +++ b/lib/ansible/modules/cloud/google/gcp_pubsub_subscription.py @@ -32,63 +32,65 @@ --- module: gcp_pubsub_subscription description: - - A named resource representing the stream of messages from a single, specific topic, - to be delivered to the subscribing application. +- A named resource representing the stream of messages from a single, specific topic, + to be delivered to the subscribing application. short_description: Creates a GCP Subscription version_added: 2.6 author: Google Inc. (@googlecloudplatform) requirements: - - python >= 2.6 - - requests >= 2.18.4 - - google-auth >= 1.3.0 +- python >= 2.6 +- requests >= 2.18.4 +- google-auth >= 1.3.0 options: - state: + state: + description: + - Whether the given object should exist in GCP + choices: + - present + - absent + default: present + name: + description: + - Name of the subscription. + required: false + topic: + description: + - A reference to a Topic resource. + - 'This field represents a link to a Topic resource in GCP. It can be specified + in two ways. You can add `register: name-of-resource` to a gcp_pubsub_topic + task and then set this topic field to "{{ name-of-resource }}" Alternatively, + you can set this topic to a dictionary with the name key where the value is + the name of your Topic' + required: false + push_config: + description: + - If push delivery is used with this subscription, this field is used to configure + it. An empty pushConfig signifies that the subscriber will pull and ack messages + using API methods. + required: false + suboptions: + push_endpoint: description: - - Whether the given object should exist in GCP - choices: ['present', 'absent'] - default: 'present' - name: - description: - - Name of the subscription. - required: false - topic: - description: - - A reference to a Topic resource. - - 'This field represents a link to a Topic resource in GCP. It can be specified in - two ways. You can add `register: name-of-resource` to a gcp_pubsub_topic task and - then set this topic field to "{{ name-of-resource }}" Alternatively, you can set - this topic to a dictionary with the name key where the value is the name of your - Topic.' - required: false - push_config: - description: - - If push delivery is used with this subscription, this field is used to configure - it. An empty pushConfig signifies that the subscriber will pull and ack messages - using API methods. - required: false - suboptions: - push_endpoint: - description: - - A URL locating the endpoint to which messages should be pushed. - - For example, a Webhook endpoint might use "U(https://example.com/push".) - required: false - ack_deadline_seconds: - description: - - This value is the maximum time after a subscriber receives a message before the - subscriber should acknowledge the message. After message delivery but before the - ack deadline expires and before the message is acknowledged, it is an outstanding - message and will not be delivered again during that time (on a best-effort basis). - - For pull subscriptions, this value is used as the initial value for the ack deadline. - To override this value for a given message, call subscriptions.modifyAckDeadline - with the corresponding ackId if using pull. The minimum custom deadline you can - specify is 10 seconds. The maximum custom deadline you can specify is 600 seconds - (10 minutes). - - If this parameter is 0, a default value of 10 seconds is used. - - For push delivery, this value is also used to set the request timeout for the call - to the push endpoint. - - If the subscriber never acknowledges the message, the Pub/Sub system will eventually - redeliver the message. + - A URL locating the endpoint to which messages should be pushed. + - For example, a Webhook endpoint might use "U(https://example.com/push".) required: false + ack_deadline_seconds: + description: + - This value is the maximum time after a subscriber receives a message before + the subscriber should acknowledge the message. After message delivery but before + the ack deadline expires and before the message is acknowledged, it is an outstanding + message and will not be delivered again during that time (on a best-effort basis). + - For pull subscriptions, this value is used as the initial value for the ack + deadline. To override this value for a given message, call subscriptions.modifyAckDeadline + with the corresponding ackId if using pull. The minimum custom deadline you + can specify is 10 seconds. The maximum custom deadline you can specify is 600 + seconds (10 minutes). + - If this parameter is 0, a default value of 10 seconds is used. + - For push delivery, this value is also used to set the request timeout for the + call to the push endpoint. + - If the subscriber never acknowledges the message, the Pub/Sub system will eventually + redeliver the message. + required: false extends_documentation_fragment: gcp ''' @@ -116,48 +118,48 @@ ''' RETURN = ''' - name: - description: - - Name of the subscription. - returned: success - type: str - topic: - description: - - A reference to a Topic resource. - returned: success - type: dict - pushConfig: - description: - - If push delivery is used with this subscription, this field is used to configure - it. An empty pushConfig signifies that the subscriber will pull and ack messages - using API methods. - returned: success - type: complex - contains: - pushEndpoint: - description: - - A URL locating the endpoint to which messages should be pushed. - - For example, a Webhook endpoint might use "U(https://example.com/push".) - returned: success - type: str - ackDeadlineSeconds: - description: - - This value is the maximum time after a subscriber receives a message before the - subscriber should acknowledge the message. After message delivery but before the - ack deadline expires and before the message is acknowledged, it is an outstanding - message and will not be delivered again during that time (on a best-effort basis). - - For pull subscriptions, this value is used as the initial value for the ack deadline. - To override this value for a given message, call subscriptions.modifyAckDeadline - with the corresponding ackId if using pull. The minimum custom deadline you can - specify is 10 seconds. The maximum custom deadline you can specify is 600 seconds - (10 minutes). - - If this parameter is 0, a default value of 10 seconds is used. - - For push delivery, this value is also used to set the request timeout for the call - to the push endpoint. - - If the subscriber never acknowledges the message, the Pub/Sub system will eventually - redeliver the message. - returned: success - type: int +name: + description: + - Name of the subscription. + returned: success + type: str +topic: + description: + - A reference to a Topic resource. + returned: success + type: dict +pushConfig: + description: + - If push delivery is used with this subscription, this field is used to configure + it. An empty pushConfig signifies that the subscriber will pull and ack messages + using API methods. + returned: success + type: complex + contains: + pushEndpoint: + description: + - A URL locating the endpoint to which messages should be pushed. + - For example, a Webhook endpoint might use "U(https://example.com/push".) + returned: success + type: str +ackDeadlineSeconds: + description: + - This value is the maximum time after a subscriber receives a message before the + subscriber should acknowledge the message. After message delivery but before the + ack deadline expires and before the message is acknowledged, it is an outstanding + message and will not be delivered again during that time (on a best-effort basis). + - For pull subscriptions, this value is used as the initial value for the ack deadline. + To override this value for a given message, call subscriptions.modifyAckDeadline + with the corresponding ackId if using pull. The minimum custom deadline you can + specify is 10 seconds. The maximum custom deadline you can specify is 600 seconds + (10 minutes). + - If this parameter is 0, a default value of 10 seconds is used. + - For push delivery, this value is also used to set the request timeout for the + call to the push endpoint. + - If the subscriber never acknowledges the message, the Pub/Sub system will eventually + redeliver the message. + returned: success + type: int ''' ################################################################################ diff --git a/lib/ansible/modules/cloud/google/gcp_pubsub_subscription_facts.py b/lib/ansible/modules/cloud/google/gcp_pubsub_subscription_facts.py index 244d6a4fa87beb..6e3710aa1447b3 100644 --- a/lib/ansible/modules/cloud/google/gcp_pubsub_subscription_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_pubsub_subscription_facts.py @@ -32,14 +32,15 @@ --- module: gcp_pubsub_subscription_facts description: - - Gather facts for GCP Subscription +- Gather facts for GCP Subscription short_description: Gather facts for GCP Subscription version_added: 2.8 author: Google Inc. (@googlecloudplatform) requirements: - - python >= 2.6 - - requests >= 2.18.4 - - google-auth >= 1.3.0 +- python >= 2.6 +- requests >= 2.18.4 +- google-auth >= 1.3.0 +options: {} extends_documentation_fragment: gcp ''' @@ -53,52 +54,53 @@ RETURN = ''' items: - description: List of items - returned: always - type: complex - contains: - name: - description: - - Name of the subscription. - returned: success - type: str - topic: - description: - - A reference to a Topic resource. - returned: success - type: dict - pushConfig: - description: - - If push delivery is used with this subscription, this field is used to configure - it. An empty pushConfig signifies that the subscriber will pull and ack messages - using API methods. - returned: success - type: complex - contains: - pushEndpoint: - description: - - A URL locating the endpoint to which messages should be pushed. - - For example, a Webhook endpoint might use "U(https://example.com/push".) - returned: success - type: str - ackDeadlineSeconds: - description: - - This value is the maximum time after a subscriber receives a message before the - subscriber should acknowledge the message. After message delivery but before the - ack deadline expires and before the message is acknowledged, it is an outstanding - message and will not be delivered again during that time (on a best-effort basis). - - For pull subscriptions, this value is used as the initial value for the ack deadline. - To override this value for a given message, call subscriptions.modifyAckDeadline - with the corresponding ackId if using pull. The minimum custom deadline you can - specify is 10 seconds. The maximum custom deadline you can specify is 600 seconds - (10 minutes). - - If this parameter is 0, a default value of 10 seconds is used. - - For push delivery, this value is also used to set the request timeout for the call - to the push endpoint. - - If the subscriber never acknowledges the message, the Pub/Sub system will eventually - redeliver the message. - returned: success - type: int + description: List of items + returned: always + type: complex + contains: + name: + description: + - Name of the subscription. + returned: success + type: str + topic: + description: + - A reference to a Topic resource. + returned: success + type: dict + pushConfig: + description: + - If push delivery is used with this subscription, this field is used to configure + it. An empty pushConfig signifies that the subscriber will pull and ack messages + using API methods. + returned: success + type: complex + contains: + pushEndpoint: + description: + - A URL locating the endpoint to which messages should be pushed. + - For example, a Webhook endpoint might use "U(https://example.com/push".) + returned: success + type: str + ackDeadlineSeconds: + description: + - This value is the maximum time after a subscriber receives a message before + the subscriber should acknowledge the message. After message delivery but + before the ack deadline expires and before the message is acknowledged, it + is an outstanding message and will not be delivered again during that time + (on a best-effort basis). + - For pull subscriptions, this value is used as the initial value for the ack + deadline. To override this value for a given message, call subscriptions.modifyAckDeadline + with the corresponding ackId if using pull. The minimum custom deadline you + can specify is 10 seconds. The maximum custom deadline you can specify is + 600 seconds (10 minutes). + - If this parameter is 0, a default value of 10 seconds is used. + - For push delivery, this value is also used to set the request timeout for + the call to the push endpoint. + - If the subscriber never acknowledges the message, the Pub/Sub system will + eventually redeliver the message. + returned: success + type: int ''' ################################################################################ diff --git a/lib/ansible/modules/cloud/google/gcp_pubsub_topic.py b/lib/ansible/modules/cloud/google/gcp_pubsub_topic.py index 1a266d46ebca68..a5d6027cbfdad1 100644 --- a/lib/ansible/modules/cloud/google/gcp_pubsub_topic.py +++ b/lib/ansible/modules/cloud/google/gcp_pubsub_topic.py @@ -32,24 +32,26 @@ --- module: gcp_pubsub_topic description: - - A named resource to which messages are sent by publishers. +- A named resource to which messages are sent by publishers. short_description: Creates a GCP Topic version_added: 2.6 author: Google Inc. (@googlecloudplatform) requirements: - - python >= 2.6 - - requests >= 2.18.4 - - google-auth >= 1.3.0 +- python >= 2.6 +- requests >= 2.18.4 +- google-auth >= 1.3.0 options: - state: - description: - - Whether the given object should exist in GCP - choices: ['present', 'absent'] - default: 'present' - name: - description: - - Name of the topic. - required: false + state: + description: + - Whether the given object should exist in GCP + choices: + - present + - absent + default: present + name: + description: + - Name of the topic. + required: false extends_documentation_fragment: gcp ''' @@ -64,11 +66,11 @@ ''' RETURN = ''' - name: - description: - - Name of the topic. - returned: success - type: str +name: + description: + - Name of the topic. + returned: success + type: str ''' ################################################################################ diff --git a/lib/ansible/modules/cloud/google/gcp_pubsub_topic_facts.py b/lib/ansible/modules/cloud/google/gcp_pubsub_topic_facts.py index 14e4b0d60ac004..a4a50f1f2d1a96 100644 --- a/lib/ansible/modules/cloud/google/gcp_pubsub_topic_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_pubsub_topic_facts.py @@ -32,14 +32,15 @@ --- module: gcp_pubsub_topic_facts description: - - Gather facts for GCP Topic +- Gather facts for GCP Topic short_description: Gather facts for GCP Topic version_added: 2.8 author: Google Inc. (@googlecloudplatform) requirements: - - python >= 2.6 - - requests >= 2.18.4 - - google-auth >= 1.3.0 +- python >= 2.6 +- requests >= 2.18.4 +- google-auth >= 1.3.0 +options: {} extends_documentation_fragment: gcp ''' @@ -53,15 +54,15 @@ RETURN = ''' items: - description: List of items - returned: always - type: complex - contains: - name: - description: - - Name of the topic. - returned: success - type: str + description: List of items + returned: always + type: complex + contains: + name: + description: + - Name of the topic. + returned: success + type: str ''' ################################################################################ diff --git a/lib/ansible/modules/cloud/google/gcp_spanner_database.py b/lib/ansible/modules/cloud/google/gcp_spanner_database.py index 3b23cef1dc97cf..f3f84f411d22f8 100644 --- a/lib/ansible/modules/cloud/google/gcp_spanner_database.py +++ b/lib/ansible/modules/cloud/google/gcp_spanner_database.py @@ -32,41 +32,44 @@ --- module: gcp_spanner_database description: - - A Cloud Spanner Database which is hosted on a Spanner instance. +- A Cloud Spanner Database which is hosted on a Spanner instance. short_description: Creates a GCP Database version_added: 2.7 author: Google Inc. (@googlecloudplatform) requirements: - - python >= 2.6 - - requests >= 2.18.4 - - google-auth >= 1.3.0 +- python >= 2.6 +- requests >= 2.18.4 +- google-auth >= 1.3.0 options: - state: - description: - - Whether the given object should exist in GCP - choices: ['present', 'absent'] - default: 'present' - name: - description: - - A unique identifier for the database, which cannot be changed after the instance - is created. Values are of the form projects//instances/[a-z][-a-z0-9]*[a-z0-9]. - The final segment of the name must be between 6 and 30 characters in length. - required: false - extra_statements: - description: - - 'An optional list of DDL statements to run inside the newly created database. Statements - can create tables, indexes, etc. These statements execute atomically with the creation - of the database: if there is an error in any statement, the database is not created.' - required: false - instance: - description: - - The instance to create the database on. - - 'This field represents a link to a Instance resource in GCP. It can be specified - in two ways. You can add `register: name-of-resource` to a gcp_spanner_instance - task and then set this instance field to "{{ name-of-resource }}" Alternatively, - you can set this instance to a dictionary with the name key where the value is the - name of your Instance.' - required: true + state: + description: + - Whether the given object should exist in GCP + choices: + - present + - absent + default: present + name: + description: + - A unique identifier for the database, which cannot be changed after the instance + is created. Values are of the form projects//instances/[a-z][-a-z0-9]*[a-z0-9]. + The final segment of the name must be between 6 and 30 characters in length. + required: false + extra_statements: + description: + - 'An optional list of DDL statements to run inside the newly created database. + Statements can create tables, indexes, etc. These statements execute atomically + with the creation of the database: if there is an error in any statement, the + database is not created.' + required: false + instance: + description: + - The instance to create the database on. + - 'This field represents a link to a Instance resource in GCP. It can be specified + in two ways. You can add `register: name-of-resource` to a gcp_spanner_instance + task and then set this instance field to "{{ name-of-resource }}" Alternatively, + you can set this instance to a dictionary with the name key where the value + is the name of your Instance' + required: true extends_documentation_fragment: gcp ''' @@ -96,25 +99,26 @@ ''' RETURN = ''' - name: - description: - - A unique identifier for the database, which cannot be changed after the instance - is created. Values are of the form projects//instances/[a-z][-a-z0-9]*[a-z0-9]. - The final segment of the name must be between 6 and 30 characters in length. - returned: success - type: str - extraStatements: - description: - - 'An optional list of DDL statements to run inside the newly created database. Statements - can create tables, indexes, etc. These statements execute atomically with the creation - of the database: if there is an error in any statement, the database is not created.' - returned: success - type: list - instance: - description: - - The instance to create the database on. - returned: success - type: dict +name: + description: + - A unique identifier for the database, which cannot be changed after the instance + is created. Values are of the form projects//instances/[a-z][-a-z0-9]*[a-z0-9]. + The final segment of the name must be between 6 and 30 characters in length. + returned: success + type: str +extraStatements: + description: + - 'An optional list of DDL statements to run inside the newly created database. + Statements can create tables, indexes, etc. These statements execute atomically + with the creation of the database: if there is an error in any statement, the + database is not created.' + returned: success + type: list +instance: + description: + - The instance to create the database on. + returned: success + type: dict ''' ################################################################################ diff --git a/lib/ansible/modules/cloud/google/gcp_spanner_database_facts.py b/lib/ansible/modules/cloud/google/gcp_spanner_database_facts.py index bece9c797dc9cb..09c45b3663443c 100644 --- a/lib/ansible/modules/cloud/google/gcp_spanner_database_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_spanner_database_facts.py @@ -32,24 +32,24 @@ --- module: gcp_spanner_database_facts description: - - Gather facts for GCP Database +- Gather facts for GCP Database short_description: Gather facts for GCP Database version_added: 2.8 author: Google Inc. (@googlecloudplatform) requirements: - - python >= 2.6 - - requests >= 2.18.4 - - google-auth >= 1.3.0 +- python >= 2.6 +- requests >= 2.18.4 +- google-auth >= 1.3.0 options: - instance: - description: - - The instance to create the database on. - - 'This field represents a link to a Instance resource in GCP. It can be specified - in two ways. You can add `register: name-of-resource` to a gcp_spanner_instance - task and then set this instance field to "{{ name-of-resource }}" Alternatively, - you can set this instance to a dictionary with the name key where the value is the - name of your Instance.' - required: true + instance: + description: + - The instance to create the database on. + - 'This field represents a link to a Instance resource in GCP. It can be specified + in two ways. You can add `register: name-of-resource` to a gcp_spanner_instance + task and then set this instance field to "{{ name-of-resource }}" Alternatively, + you can set this instance to a dictionary with the name key where the value + is the name of your Instance' + required: true extends_documentation_fragment: gcp ''' @@ -64,29 +64,30 @@ RETURN = ''' items: - description: List of items - returned: always - type: complex - contains: - name: - description: - - A unique identifier for the database, which cannot be changed after the instance - is created. Values are of the form projects//instances/[a-z][-a-z0-9]*[a-z0-9]. - The final segment of the name must be between 6 and 30 characters in length. - returned: success - type: str - extraStatements: - description: - - 'An optional list of DDL statements to run inside the newly created database. Statements - can create tables, indexes, etc. These statements execute atomically with the creation - of the database: if there is an error in any statement, the database is not created.' - returned: success - type: list - instance: - description: - - The instance to create the database on. - returned: success - type: dict + description: List of items + returned: always + type: complex + contains: + name: + description: + - A unique identifier for the database, which cannot be changed after the instance + is created. Values are of the form projects//instances/[a-z][-a-z0-9]*[a-z0-9]. + The final segment of the name must be between 6 and 30 characters in length. + returned: success + type: str + extraStatements: + description: + - 'An optional list of DDL statements to run inside the newly created database. + Statements can create tables, indexes, etc. These statements execute atomically + with the creation of the database: if there is an error in any statement, + the database is not created.' + returned: success + type: list + instance: + description: + - The instance to create the database on. + returned: success + type: dict ''' ################################################################################ diff --git a/lib/ansible/modules/cloud/google/gcp_spanner_instance.py b/lib/ansible/modules/cloud/google/gcp_spanner_instance.py index dcac37f969ca21..1d4fe334d78c08 100644 --- a/lib/ansible/modules/cloud/google/gcp_spanner_instance.py +++ b/lib/ansible/modules/cloud/google/gcp_spanner_instance.py @@ -32,60 +32,62 @@ --- module: gcp_spanner_instance description: - - An isolated set of Cloud Spanner resources on which databases can be hosted. +- An isolated set of Cloud Spanner resources on which databases can be hosted. short_description: Creates a GCP Instance version_added: 2.7 author: Google Inc. (@googlecloudplatform) requirements: - - python >= 2.6 - - requests >= 2.18.4 - - google-auth >= 1.3.0 +- python >= 2.6 +- requests >= 2.18.4 +- google-auth >= 1.3.0 options: - state: - description: - - Whether the given object should exist in GCP - choices: ['present', 'absent'] - default: 'present' - name: - description: - - A unique identifier for the instance, which cannot be changed after the instance - is created. Values are of the form projects//instances/[a-z][-a-z0-9]*[a-z0-9]. - The final segment of the name must be between 6 and 30 characters in length. - required: false - config: - description: - - A reference to the instance configuration. - required: false - display_name: - description: - - The descriptive name for this instance as it appears in UIs. Must be unique per - project and between 4 and 30 characters in length. - required: true - node_count: - description: - - The number of nodes allocated to this instance. - required: false - labels: - description: - - Cloud Labels are a flexible and lightweight mechanism for organizing cloud resources - into groups that reflect a customer's organizational needs and deployment strategies. - Cloud Labels can be used to filter collections of resources. They can be used to - control how resource metrics are aggregated. And they can be used as arguments to - policy management rules (e.g. route, firewall, load balancing, etc.). - - 'Label keys must be between 1 and 63 characters long and must conform to the following - regular expression: `[a-z]([-a-z0-9]*[a-z0-9])?`.' - - Label values must be between 0 and 63 characters long and must conform to the regular - expression `([a-z]([-a-z0-9]*[a-z0-9])?)?`. - - No more than 64 labels can be associated with a given resource. - - See U(https://goo.gl/xmQnxf) for more information on and examples of labels. - - 'If you plan to use labels in your own code, please note that additional characters - may be allowed in the future. And so you are advised to use an internal label representation, - such as JSON, which doesn''t rely upon specific characters being disallowed. For - example, representing labels as the string: name + "_" + value would prove problematic - if we were to allow "_" in a future release.' - - 'An object containing a list of "key": value pairs.' - - 'Example: { "name": "wrench", "mass": "1.3kg", "count": "3" }.' - required: false + state: + description: + - Whether the given object should exist in GCP + choices: + - present + - absent + default: present + name: + description: + - A unique identifier for the instance, which cannot be changed after the instance + is created. Values are of the form projects//instances/[a-z][-a-z0-9]*[a-z0-9]. + The final segment of the name must be between 6 and 30 characters in length. + required: false + config: + description: + - A reference to the instance configuration. + required: false + display_name: + description: + - The descriptive name for this instance as it appears in UIs. Must be unique + per project and between 4 and 30 characters in length. + required: true + node_count: + description: + - The number of nodes allocated to this instance. + required: false + labels: + description: + - Cloud Labels are a flexible and lightweight mechanism for organizing cloud resources + into groups that reflect a customer's organizational needs and deployment strategies. + Cloud Labels can be used to filter collections of resources. They can be used + to control how resource metrics are aggregated. And they can be used as arguments + to policy management rules (e.g. route, firewall, load balancing, etc.). + - 'Label keys must be between 1 and 63 characters long and must conform to the + following regular expression: `[a-z]([-a-z0-9]*[a-z0-9])?`.' + - Label values must be between 0 and 63 characters long and must conform to the + regular expression `([a-z]([-a-z0-9]*[a-z0-9])?)?`. + - No more than 64 labels can be associated with a given resource. + - See U(https://goo.gl/xmQnxf) for more information on and examples of labels. + - 'If you plan to use labels in your own code, please note that additional characters + may be allowed in the future. And so you are advised to use an internal label + representation, such as JSON, which doesn''t rely upon specific characters being + disallowed. For example, representing labels as the string: name + "_" + value + would prove problematic if we were to allow "_" in a future release.' + - 'An object containing a list of "key": value pairs.' + - 'Example: { "name": "wrench", "mass": "1.3kg", "count": "3" }.' + required: false extends_documentation_fragment: gcp ''' @@ -105,51 +107,51 @@ ''' RETURN = ''' - name: - description: - - A unique identifier for the instance, which cannot be changed after the instance - is created. Values are of the form projects//instances/[a-z][-a-z0-9]*[a-z0-9]. - The final segment of the name must be between 6 and 30 characters in length. - returned: success - type: str - config: - description: - - A reference to the instance configuration. - returned: success - type: str - displayName: - description: - - The descriptive name for this instance as it appears in UIs. Must be unique per - project and between 4 and 30 characters in length. - returned: success - type: str - nodeCount: - description: - - The number of nodes allocated to this instance. - returned: success - type: int - labels: - description: - - Cloud Labels are a flexible and lightweight mechanism for organizing cloud resources - into groups that reflect a customer's organizational needs and deployment strategies. - Cloud Labels can be used to filter collections of resources. They can be used to - control how resource metrics are aggregated. And they can be used as arguments to - policy management rules (e.g. route, firewall, load balancing, etc.). - - 'Label keys must be between 1 and 63 characters long and must conform to the following - regular expression: `[a-z]([-a-z0-9]*[a-z0-9])?`.' - - Label values must be between 0 and 63 characters long and must conform to the regular - expression `([a-z]([-a-z0-9]*[a-z0-9])?)?`. - - No more than 64 labels can be associated with a given resource. - - See U(https://goo.gl/xmQnxf) for more information on and examples of labels. - - 'If you plan to use labels in your own code, please note that additional characters - may be allowed in the future. And so you are advised to use an internal label representation, - such as JSON, which doesn''t rely upon specific characters being disallowed. For - example, representing labels as the string: name + "_" + value would prove problematic - if we were to allow "_" in a future release.' - - 'An object containing a list of "key": value pairs.' - - 'Example: { "name": "wrench", "mass": "1.3kg", "count": "3" }.' - returned: success - type: dict +name: + description: + - A unique identifier for the instance, which cannot be changed after the instance + is created. Values are of the form projects//instances/[a-z][-a-z0-9]*[a-z0-9]. + The final segment of the name must be between 6 and 30 characters in length. + returned: success + type: str +config: + description: + - A reference to the instance configuration. + returned: success + type: str +displayName: + description: + - The descriptive name for this instance as it appears in UIs. Must be unique per + project and between 4 and 30 characters in length. + returned: success + type: str +nodeCount: + description: + - The number of nodes allocated to this instance. + returned: success + type: int +labels: + description: + - Cloud Labels are a flexible and lightweight mechanism for organizing cloud resources + into groups that reflect a customer's organizational needs and deployment strategies. + Cloud Labels can be used to filter collections of resources. They can be used + to control how resource metrics are aggregated. And they can be used as arguments + to policy management rules (e.g. route, firewall, load balancing, etc.). + - 'Label keys must be between 1 and 63 characters long and must conform to the following + regular expression: `[a-z]([-a-z0-9]*[a-z0-9])?`.' + - Label values must be between 0 and 63 characters long and must conform to the + regular expression `([a-z]([-a-z0-9]*[a-z0-9])?)?`. + - No more than 64 labels can be associated with a given resource. + - See U(https://goo.gl/xmQnxf) for more information on and examples of labels. + - 'If you plan to use labels in your own code, please note that additional characters + may be allowed in the future. And so you are advised to use an internal label + representation, such as JSON, which doesn''t rely upon specific characters being + disallowed. For example, representing labels as the string: name + "_" + value + would prove problematic if we were to allow "_" in a future release.' + - 'An object containing a list of "key": value pairs.' + - 'Example: { "name": "wrench", "mass": "1.3kg", "count": "3" }.' + returned: success + type: dict ''' ################################################################################ diff --git a/lib/ansible/modules/cloud/google/gcp_spanner_instance_facts.py b/lib/ansible/modules/cloud/google/gcp_spanner_instance_facts.py index 3e35b50351531b..79a5c656053723 100644 --- a/lib/ansible/modules/cloud/google/gcp_spanner_instance_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_spanner_instance_facts.py @@ -32,14 +32,15 @@ --- module: gcp_spanner_instance_facts description: - - Gather facts for GCP Instance +- Gather facts for GCP Instance short_description: Gather facts for GCP Instance version_added: 2.8 author: Google Inc. (@googlecloudplatform) requirements: - - python >= 2.6 - - requests >= 2.18.4 - - google-auth >= 1.3.0 +- python >= 2.6 +- requests >= 2.18.4 +- google-auth >= 1.3.0 +options: {} extends_documentation_fragment: gcp ''' @@ -53,55 +54,56 @@ RETURN = ''' items: - description: List of items - returned: always - type: complex - contains: - name: - description: - - A unique identifier for the instance, which cannot be changed after the instance - is created. Values are of the form projects//instances/[a-z][-a-z0-9]*[a-z0-9]. - The final segment of the name must be between 6 and 30 characters in length. - returned: success - type: str - config: - description: - - A reference to the instance configuration. - returned: success - type: str - displayName: - description: - - The descriptive name for this instance as it appears in UIs. Must be unique per - project and between 4 and 30 characters in length. - returned: success - type: str - nodeCount: - description: - - The number of nodes allocated to this instance. - returned: success - type: int - labels: - description: - - Cloud Labels are a flexible and lightweight mechanism for organizing cloud resources - into groups that reflect a customer's organizational needs and deployment strategies. - Cloud Labels can be used to filter collections of resources. They can be used to - control how resource metrics are aggregated. And they can be used as arguments to - policy management rules (e.g. route, firewall, load balancing, etc.). - - 'Label keys must be between 1 and 63 characters long and must conform to the following - regular expression: `[a-z]([-a-z0-9]*[a-z0-9])?`.' - - Label values must be between 0 and 63 characters long and must conform to the regular - expression `([a-z]([-a-z0-9]*[a-z0-9])?)?`. - - No more than 64 labels can be associated with a given resource. - - See U(https://goo.gl/xmQnxf) for more information on and examples of labels. - - 'If you plan to use labels in your own code, please note that additional characters - may be allowed in the future. And so you are advised to use an internal label representation, - such as JSON, which doesn''t rely upon specific characters being disallowed. For - example, representing labels as the string: name + "_" + value would prove problematic - if we were to allow "_" in a future release.' - - 'An object containing a list of "key": value pairs.' - - 'Example: { "name": "wrench", "mass": "1.3kg", "count": "3" }.' - returned: success - type: dict + description: List of items + returned: always + type: complex + contains: + name: + description: + - A unique identifier for the instance, which cannot be changed after the instance + is created. Values are of the form projects//instances/[a-z][-a-z0-9]*[a-z0-9]. + The final segment of the name must be between 6 and 30 characters in length. + returned: success + type: str + config: + description: + - A reference to the instance configuration. + returned: success + type: str + displayName: + description: + - The descriptive name for this instance as it appears in UIs. Must be unique + per project and between 4 and 30 characters in length. + returned: success + type: str + nodeCount: + description: + - The number of nodes allocated to this instance. + returned: success + type: int + labels: + description: + - Cloud Labels are a flexible and lightweight mechanism for organizing cloud + resources into groups that reflect a customer's organizational needs and deployment + strategies. Cloud Labels can be used to filter collections of resources. They + can be used to control how resource metrics are aggregated. And they can be + used as arguments to policy management rules (e.g. route, firewall, load balancing, + etc.). + - 'Label keys must be between 1 and 63 characters long and must conform to the + following regular expression: `[a-z]([-a-z0-9]*[a-z0-9])?`.' + - Label values must be between 0 and 63 characters long and must conform to + the regular expression `([a-z]([-a-z0-9]*[a-z0-9])?)?`. + - No more than 64 labels can be associated with a given resource. + - See U(https://goo.gl/xmQnxf) for more information on and examples of labels. + - 'If you plan to use labels in your own code, please note that additional characters + may be allowed in the future. And so you are advised to use an internal label + representation, such as JSON, which doesn''t rely upon specific characters + being disallowed. For example, representing labels as the string: name + "_" + + value would prove problematic if we were to allow "_" in a future release.' + - 'An object containing a list of "key": value pairs.' + - 'Example: { "name": "wrench", "mass": "1.3kg", "count": "3" }.' + returned: success + type: dict ''' ################################################################################ diff --git a/lib/ansible/modules/cloud/google/gcp_sql_database.py b/lib/ansible/modules/cloud/google/gcp_sql_database.py index 2069aeded45224..82a8523d97e378 100644 --- a/lib/ansible/modules/cloud/google/gcp_sql_database.py +++ b/lib/ansible/modules/cloud/google/gcp_sql_database.py @@ -32,42 +32,44 @@ --- module: gcp_sql_database description: - - Represents a SQL database inside the Cloud SQL instance, hosted in Google's cloud. +- Represents a SQL database inside the Cloud SQL instance, hosted in Google's cloud. short_description: Creates a GCP Database version_added: 2.7 author: Google Inc. (@googlecloudplatform) requirements: - - python >= 2.6 - - requests >= 2.18.4 - - google-auth >= 1.3.0 +- python >= 2.6 +- requests >= 2.18.4 +- google-auth >= 1.3.0 options: - state: - description: - - Whether the given object should exist in GCP - choices: ['present', 'absent'] - default: 'present' - charset: - description: - - The MySQL charset value. - required: false - collation: - description: - - The MySQL collation value. - required: false - name: - description: - - The name of the database in the Cloud SQL instance. - - This does not include the project ID or instance name. - required: false - instance: - description: - - The name of the Cloud SQL instance. This does not include the project ID. - - 'This field represents a link to a Instance resource in GCP. It can be specified - in two ways. You can add `register: name-of-resource` to a gcp_sql_instance task - and then set this instance field to "{{ name-of-resource }}" Alternatively, you - can set this instance to a dictionary with the name key where the value is the name - of your Instance.' - required: true + state: + description: + - Whether the given object should exist in GCP + choices: + - present + - absent + default: present + charset: + description: + - The MySQL charset value. + required: false + collation: + description: + - The MySQL collation value. + required: false + name: + description: + - The name of the database in the Cloud SQL instance. + - This does not include the project ID or instance name. + required: false + instance: + description: + - The name of the Cloud SQL instance. This does not include the project ID. + - 'This field represents a link to a Instance resource in GCP. It can be specified + in two ways. You can add `register: name-of-resource` to a gcp_sql_instance + task and then set this instance field to "{{ name-of-resource }}" Alternatively, + you can set this instance to a dictionary with the name key where the value + is the name of your Instance' + required: true extends_documentation_fragment: gcp ''' @@ -100,27 +102,27 @@ ''' RETURN = ''' - charset: - description: - - The MySQL charset value. - returned: success - type: str - collation: - description: - - The MySQL collation value. - returned: success - type: str - name: - description: - - The name of the database in the Cloud SQL instance. - - This does not include the project ID or instance name. - returned: success - type: str - instance: - description: - - The name of the Cloud SQL instance. This does not include the project ID. - returned: success - type: dict +charset: + description: + - The MySQL charset value. + returned: success + type: str +collation: + description: + - The MySQL collation value. + returned: success + type: str +name: + description: + - The name of the database in the Cloud SQL instance. + - This does not include the project ID or instance name. + returned: success + type: str +instance: + description: + - The name of the Cloud SQL instance. This does not include the project ID. + returned: success + type: dict ''' ################################################################################ diff --git a/lib/ansible/modules/cloud/google/gcp_sql_database_facts.py b/lib/ansible/modules/cloud/google/gcp_sql_database_facts.py index a9603065e24448..305c0aa7645105 100644 --- a/lib/ansible/modules/cloud/google/gcp_sql_database_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_sql_database_facts.py @@ -32,24 +32,24 @@ --- module: gcp_sql_database_facts description: - - Gather facts for GCP Database +- Gather facts for GCP Database short_description: Gather facts for GCP Database version_added: 2.8 author: Google Inc. (@googlecloudplatform) requirements: - - python >= 2.6 - - requests >= 2.18.4 - - google-auth >= 1.3.0 +- python >= 2.6 +- requests >= 2.18.4 +- google-auth >= 1.3.0 options: - instance: - description: - - The name of the Cloud SQL instance. This does not include the project ID. - - 'This field represents a link to a Instance resource in GCP. It can be specified - in two ways. You can add `register: name-of-resource` to a gcp_sql_instance task - and then set this instance field to "{{ name-of-resource }}" Alternatively, you - can set this instance to a dictionary with the name key where the value is the name - of your Instance.' - required: true + instance: + description: + - The name of the Cloud SQL instance. This does not include the project ID. + - 'This field represents a link to a Instance resource in GCP. It can be specified + in two ways. You can add `register: name-of-resource` to a gcp_sql_instance + task and then set this instance field to "{{ name-of-resource }}" Alternatively, + you can set this instance to a dictionary with the name key where the value + is the name of your Instance' + required: true extends_documentation_fragment: gcp ''' @@ -64,31 +64,31 @@ RETURN = ''' items: - description: List of items - returned: always - type: complex - contains: - charset: - description: - - The MySQL charset value. - returned: success - type: str - collation: - description: - - The MySQL collation value. - returned: success - type: str - name: - description: - - The name of the database in the Cloud SQL instance. - - This does not include the project ID or instance name. - returned: success - type: str - instance: - description: - - The name of the Cloud SQL instance. This does not include the project ID. - returned: success - type: dict + description: List of items + returned: always + type: complex + contains: + charset: + description: + - The MySQL charset value. + returned: success + type: str + collation: + description: + - The MySQL collation value. + returned: success + type: str + name: + description: + - The name of the database in the Cloud SQL instance. + - This does not include the project ID or instance name. + returned: success + type: str + instance: + description: + - The name of the Cloud SQL instance. This does not include the project ID. + returned: success + type: dict ''' ################################################################################ diff --git a/lib/ansible/modules/cloud/google/gcp_sql_instance.py b/lib/ansible/modules/cloud/google/gcp_sql_instance.py index e298130935a7cd..929f3f35fa373c 100644 --- a/lib/ansible/modules/cloud/google/gcp_sql_instance.py +++ b/lib/ansible/modules/cloud/google/gcp_sql_instance.py @@ -32,226 +32,241 @@ --- module: gcp_sql_instance description: - - Represents a Cloud SQL instance. Cloud SQL instances are SQL databases hosted in - Google's cloud. The Instances resource provides methods for common configuration - and management tasks. +- Represents a Cloud SQL instance. Cloud SQL instances are SQL databases hosted in + Google's cloud. The Instances resource provides methods for common configuration + and management tasks. short_description: Creates a GCP Instance version_added: 2.7 author: Google Inc. (@googlecloudplatform) requirements: - - python >= 2.6 - - requests >= 2.18.4 - - google-auth >= 1.3.0 +- python >= 2.6 +- requests >= 2.18.4 +- google-auth >= 1.3.0 options: - state: + state: + description: + - Whether the given object should exist in GCP + choices: + - present + - absent + default: present + backend_type: + description: + - "* FIRST_GEN: First Generation instance. MySQL only." + - "* SECOND_GEN: Second Generation instance or PostgreSQL instance." + - "* EXTERNAL: A database server that is not managed by Google." + required: false + choices: + - FIRST_GEN + - SECOND_GEN + - EXTERNAL + connection_name: + description: + - Connection name of the Cloud SQL instance used in connection strings. + required: false + database_version: + description: + - The database engine type and version. For First Generation instances, can be + MYSQL_5_5, or MYSQL_5_6. For Second Generation instances, can be MYSQL_5_6 or + MYSQL_5_7. Defaults to MYSQL_5_6. + - 'PostgreSQL instances: POSTGRES_9_6 The databaseVersion property can not be + changed after instance creation.' + required: false + choices: + - MYSQL_5_5 + - MYSQL_5_6 + - MYSQL_5_7 + - POSTGRES_9_6 + failover_replica: + description: + - The name and status of the failover replica. This property is applicable only + to Second Generation instances. + required: false + suboptions: + available: description: - - Whether the given object should exist in GCP - choices: ['present', 'absent'] - default: 'present' - backend_type: - description: - - "* FIRST_GEN: First Generation instance. MySQL only." - - "* SECOND_GEN: Second Generation instance or PostgreSQL instance." - - "* EXTERNAL: A database server that is not managed by Google." + - The availability status of the failover replica. A false status indicates + that the failover replica is out of sync. The master can only failover to + the falover replica when the status is true. required: false - choices: ['FIRST_GEN', 'SECOND_GEN', 'EXTERNAL'] - connection_name: + type: bool + name: description: - - Connection name of the Cloud SQL instance used in connection strings. + - The name of the failover replica. If specified at instance creation, a failover + replica is created for the instance. The name doesn't include the project + ID. This property is applicable only to Second Generation instances. required: false - database_version: + instance_type: + description: + - The instance type. This can be one of the following. + - "* CLOUD_SQL_INSTANCE: A Cloud SQL instance that is not replicating from a master." + - "* ON_PREMISES_INSTANCE: An instance running on the customer's premises." + - "* READ_REPLICA_INSTANCE: A Cloud SQL instance configured as a read-replica." + required: false + choices: + - CLOUD_SQL_INSTANCE + - ON_PREMISES_INSTANCE + - READ_REPLICA_INSTANCE + ipv6_address: + description: + - The IPv6 address assigned to the instance. This property is applicable only + to First Generation instances. + required: false + master_instance_name: + description: + - The name of the instance which will act as master in the replication setup. + required: false + max_disk_size: + description: + - The maximum disk size of the instance in bytes. + required: false + name: + description: + - Name of the Cloud SQL instance. This does not include the project ID. + required: true + region: + description: + - The geographical region. Defaults to us-central or us-central1 depending on + the instance type (First Generation or Second Generation/PostgreSQL). + required: false + replica_configuration: + description: + - Configuration specific to failover replicas and read replicas. + required: false + suboptions: + failover_target: description: - - The database engine type and version. For First Generation instances, can be MYSQL_5_5, - or MYSQL_5_6. For Second Generation instances, can be MYSQL_5_6 or MYSQL_5_7. Defaults - to MYSQL_5_6. - - 'PostgreSQL instances: POSTGRES_9_6 The databaseVersion property can not be changed - after instance creation.' + - Specifies if the replica is the failover target. If the field is set to + true the replica will be designated as a failover replica. + - In case the master instance fails, the replica instance will be promoted + as the new master instance. + - Only one replica can be specified as failover target, and the replica has + to be in different zone with the master instance. required: false - choices: ['MYSQL_5_5', 'MYSQL_5_6', 'MYSQL_5_7', 'POSTGRES_9_6'] - failover_replica: + type: bool + mysql_replica_configuration: description: - - The name and status of the failover replica. This property is applicable only to - Second Generation instances. + - MySQL specific configuration when replicating from a MySQL on-premises master. + Replication configuration information such as the username, password, certificates, + and keys are not stored in the instance metadata. The configuration information + is used only to set up the replication connection and is stored by MySQL + in a file named master.info in the data directory. required: false suboptions: - available: - description: - - The availability status of the failover replica. A false status indicates that the - failover replica is out of sync. The master can only failover to the falover replica - when the status is true. - required: false - type: bool - name: - description: - - The name of the failover replica. If specified at instance creation, a failover - replica is created for the instance. The name doesn't include the project ID. This - property is applicable only to Second Generation instances. - required: false - instance_type: - description: - - The instance type. This can be one of the following. - - "* CLOUD_SQL_INSTANCE: A Cloud SQL instance that is not replicating from a master." - - "* ON_PREMISES_INSTANCE: An instance running on the customer's premises." - - "* READ_REPLICA_INSTANCE: A Cloud SQL instance configured as a read-replica." - required: false - choices: ['CLOUD_SQL_INSTANCE', 'ON_PREMISES_INSTANCE', 'READ_REPLICA_INSTANCE'] - ipv6_address: - description: - - The IPv6 address assigned to the instance. This property is applicable only to First - Generation instances. - required: false - master_instance_name: + ca_certificate: + description: + - PEM representation of the trusted CA's x509 certificate. + required: false + client_certificate: + description: + - PEM representation of the slave's x509 certificate . + required: false + client_key: + description: + - PEM representation of the slave's private key. The corresponsing public + key is encoded in the client's asf asd certificate. + required: false + connect_retry_interval: + description: + - Seconds to wait between connect retries. MySQL's default is 60 seconds. + required: false + dump_file_path: + description: + - Path to a SQL dump file in Google Cloud Storage from which the slave + instance is to be created. The URI is in the form gs://bucketName/fileName. + Compressed gzip files (.gz) are also supported. Dumps should have the + binlog co-ordinates from which replication should begin. This can be + accomplished by setting --master-data to 1 when using mysqldump. + required: false + master_heartbeat_period: + description: + - Interval in milliseconds between replication heartbeats. + required: false + password: + description: + - The password for the replication connection. + required: false + ssl_cipher: + description: + - A list of permissible ciphers to use for SSL encryption. + required: false + username: + description: + - The username for the replication connection. + required: false + verify_server_certificate: + description: + - Whether or not to check the master's Common Name value in the certificate + that it sends during the SSL handshake. + required: false + type: bool + replica_names: description: - - The name of the instance which will act as master in the replication setup. + - The replicas of the instance. required: false - max_disk_size: - description: - - The maximum disk size of the instance in bytes. - required: false - name: - description: - - Name of the Cloud SQL instance. This does not include the project ID. - required: true - region: + service_account_email_address: description: - - The geographical region. Defaults to us-central or us-central1 depending on the - instance type (First Generation or Second Generation/PostgreSQL). + - The service account email address assigned to the instance. This property + is applicable only to Second Generation instances. required: false - replica_configuration: + settings: + description: + - The user settings. + required: false + suboptions: + ip_configuration: description: - - Configuration specific to failover replicas and read replicas. + - The settings for IP Management. This allows to enable or disable the instance + IP and manage which external networks can connect to the instance. The IPv4 + address cannot be disabled for Second Generation instances. required: false suboptions: - failover_target: - description: - - Specifies if the replica is the failover target. If the field is set to true the - replica will be designated as a failover replica. - - In case the master instance fails, the replica instance will be promoted as the - new master instance. - - Only one replica can be specified as failover target, and the replica has to be - in different zone with the master instance. - required: false - type: bool - mysql_replica_configuration: + ipv4_enabled: + description: + - Whether the instance should be assigned an IP address or not. + required: false + type: bool + authorized_networks: + description: + - The list of external networks that are allowed to connect to the instance + using the IP. In CIDR notation, also known as 'slash' notation (e.g. + 192.168.100.0/24). + required: false + suboptions: + expiration_time: description: - - MySQL specific configuration when replicating from a MySQL on-premises master. Replication - configuration information such as the username, password, certificates, and keys - are not stored in the instance metadata. The configuration information is used - only to set up the replication connection and is stored by MySQL in a file named - master.info in the data directory. + - The time when this access control entry expires in RFC 3339 format, + for example 2012-11-15T16:19:00.094Z. required: false - suboptions: - ca_certificate: - description: - - PEM representation of the trusted CA's x509 certificate. - required: false - client_certificate: - description: - - PEM representation of the slave's x509 certificate . - required: false - client_key: - description: - - PEM representation of the slave's private key. The corresponsing public key is encoded - in the client's asf asd certificate. - required: false - connect_retry_interval: - description: - - Seconds to wait between connect retries. MySQL's default is 60 seconds. - required: false - dump_file_path: - description: - - Path to a SQL dump file in Google Cloud Storage from which the slave instance is - to be created. The URI is in the form gs://bucketName/fileName. Compressed gzip - files (.gz) are also supported. Dumps should have the binlog co-ordinates from which - replication should begin. This can be accomplished by setting --master-data to 1 - when using mysqldump. - required: false - master_heartbeat_period: - description: - - Interval in milliseconds between replication heartbeats. - required: false - password: - description: - - The password for the replication connection. - required: false - ssl_cipher: - description: - - A list of permissible ciphers to use for SSL encryption. - required: false - username: - description: - - The username for the replication connection. - required: false - verify_server_certificate: - description: - - Whether or not to check the master's Common Name value in the certificate that it - sends during the SSL handshake. - required: false - type: bool - replica_names: + name: description: - - The replicas of the instance. + - An optional label to identify this entry. required: false - service_account_email_address: + value: description: - - The service account email address assigned to the instance. This property is applicable - only to Second Generation instances. + - The whitelisted value for the access control list. For example, + to grant access to a client from an external IP (IPv4 or IPv6) address + or subnet, use that address or subnet here. required: false - settings: + require_ssl: + description: + - Whether the mysqld should default to 'REQUIRE X509' for users connecting + over IP. + required: false + type: bool + tier: description: - - The user settings. + - The tier or machine type for this instance, for example db-n1-standard-1. + For MySQL instances, this field determines whether the instance is Second + Generation (recommended) or First Generation. + required: false + settings_version: + description: + - The version of instance settings. This is a required field for update method + to make sure concurrent updates are handled properly. During update, use + the most recent settingsVersion value for this instance and do not try to + update this value. required: false - suboptions: - ip_configuration: - description: - - The settings for IP Management. This allows to enable or disable the instance IP - and manage which external networks can connect to the instance. The IPv4 address - cannot be disabled for Second Generation instances. - required: false - suboptions: - ipv4_enabled: - description: - - Whether the instance should be assigned an IP address or not. - required: false - type: bool - authorized_networks: - description: - - The list of external networks that are allowed to connect to the instance using - the IP. In CIDR notation, also known as 'slash' notation (e.g. 192.168.100.0/24). - required: false - suboptions: - expiration_time: - description: - - The time when this access control entry expires in RFC 3339 format, for example - 2012-11-15T16:19:00.094Z. - required: false - name: - description: - - An optional label to identify this entry. - required: false - value: - description: - - The whitelisted value for the access control list. For example, to grant access - to a client from an external IP (IPv4 or IPv6) address or subnet, use that address - or subnet here. - required: false - require_ssl: - description: - - Whether the mysqld should default to 'REQUIRE X509' for users connecting over IP. - required: false - type: bool - tier: - description: - - The tier or machine type for this instance, for example db-n1-standard-1. For MySQL - instances, this field determines whether the instance is Second Generation (recommended) - or First Generation. - required: false - settings_version: - description: - - The version of instance settings. This is a required field for update method to - make sure concurrent updates are handled properly. During update, use the most - recent settingsVersion value for this instance and do not try to update this value. - required: false extends_documentation_fragment: gcp ''' @@ -273,263 +288,265 @@ ''' RETURN = ''' - backendType: - description: - - "* FIRST_GEN: First Generation instance. MySQL only." - - "* SECOND_GEN: Second Generation instance or PostgreSQL instance." - - "* EXTERNAL: A database server that is not managed by Google." - returned: success - type: str - connectionName: - description: - - Connection name of the Cloud SQL instance used in connection strings. - returned: success - type: str - databaseVersion: - description: - - The database engine type and version. For First Generation instances, can be MYSQL_5_5, - or MYSQL_5_6. For Second Generation instances, can be MYSQL_5_6 or MYSQL_5_7. Defaults - to MYSQL_5_6. - - 'PostgreSQL instances: POSTGRES_9_6 The databaseVersion property can not be changed - after instance creation.' - returned: success - type: str - failoverReplica: - description: - - The name and status of the failover replica. This property is applicable only to - Second Generation instances. - returned: success - type: complex - contains: - available: - description: - - The availability status of the failover replica. A false status indicates that the - failover replica is out of sync. The master can only failover to the falover replica - when the status is true. - returned: success - type: bool - name: - description: - - The name of the failover replica. If specified at instance creation, a failover - replica is created for the instance. The name doesn't include the project ID. This - property is applicable only to Second Generation instances. - returned: success - type: str - instanceType: - description: - - The instance type. This can be one of the following. - - "* CLOUD_SQL_INSTANCE: A Cloud SQL instance that is not replicating from a master." - - "* ON_PREMISES_INSTANCE: An instance running on the customer's premises." - - "* READ_REPLICA_INSTANCE: A Cloud SQL instance configured as a read-replica." - returned: success - type: str - ipAddresses: - description: - - The assigned IP addresses for the instance. - returned: success - type: complex - contains: - ipAddress: - description: - - The IP address assigned. - returned: success - type: str - timeToRetire: - description: - - The due time for this IP to be retired in RFC 3339 format, for example 2012-11-15T16:19:00.094Z. - This field is only available when the IP is scheduled to be retired. - returned: success - type: str - type: - description: - - The type of this IP address. A PRIMARY address is an address that can accept incoming - connections. An OUTGOING address is the source address of connections originating - from the instance, if supported. - returned: success - type: str - ipv6Address: - description: - - The IPv6 address assigned to the instance. This property is applicable only to First - Generation instances. - returned: success - type: str - masterInstanceName: - description: - - The name of the instance which will act as master in the replication setup. - returned: success - type: str - maxDiskSize: - description: - - The maximum disk size of the instance in bytes. - returned: success - type: int +backendType: + description: + - "* FIRST_GEN: First Generation instance. MySQL only." + - "* SECOND_GEN: Second Generation instance or PostgreSQL instance." + - "* EXTERNAL: A database server that is not managed by Google." + returned: success + type: str +connectionName: + description: + - Connection name of the Cloud SQL instance used in connection strings. + returned: success + type: str +databaseVersion: + description: + - The database engine type and version. For First Generation instances, can be MYSQL_5_5, + or MYSQL_5_6. For Second Generation instances, can be MYSQL_5_6 or MYSQL_5_7. + Defaults to MYSQL_5_6. + - 'PostgreSQL instances: POSTGRES_9_6 The databaseVersion property can not be changed + after instance creation.' + returned: success + type: str +failoverReplica: + description: + - The name and status of the failover replica. This property is applicable only + to Second Generation instances. + returned: success + type: complex + contains: + available: + description: + - The availability status of the failover replica. A false status indicates + that the failover replica is out of sync. The master can only failover to + the falover replica when the status is true. + returned: success + type: bool name: - description: - - Name of the Cloud SQL instance. This does not include the project ID. - returned: success - type: str - region: - description: - - The geographical region. Defaults to us-central or us-central1 depending on the - instance type (First Generation or Second Generation/PostgreSQL). - returned: success - type: str - replicaConfiguration: - description: - - Configuration specific to failover replicas and read replicas. - returned: success - type: complex - contains: - failoverTarget: - description: - - Specifies if the replica is the failover target. If the field is set to true the - replica will be designated as a failover replica. - - In case the master instance fails, the replica instance will be promoted as the - new master instance. - - Only one replica can be specified as failover target, and the replica has to be - in different zone with the master instance. - returned: success - type: bool - mysqlReplicaConfiguration: - description: - - MySQL specific configuration when replicating from a MySQL on-premises master. Replication - configuration information such as the username, password, certificates, and keys - are not stored in the instance metadata. The configuration information is used - only to set up the replication connection and is stored by MySQL in a file named - master.info in the data directory. - returned: success - type: complex - contains: - caCertificate: - description: - - PEM representation of the trusted CA's x509 certificate. - returned: success - type: str - clientCertificate: - description: - - PEM representation of the slave's x509 certificate . - returned: success - type: str - clientKey: - description: - - PEM representation of the slave's private key. The corresponsing public key is encoded - in the client's asf asd certificate. - returned: success - type: str - connectRetryInterval: - description: - - Seconds to wait between connect retries. MySQL's default is 60 seconds. - returned: success - type: int - dumpFilePath: - description: - - Path to a SQL dump file in Google Cloud Storage from which the slave instance is - to be created. The URI is in the form gs://bucketName/fileName. Compressed gzip - files (.gz) are also supported. Dumps should have the binlog co-ordinates from which - replication should begin. This can be accomplished by setting --master-data to 1 - when using mysqldump. - returned: success - type: str - masterHeartbeatPeriod: - description: - - Interval in milliseconds between replication heartbeats. - returned: success - type: int - password: - description: - - The password for the replication connection. - returned: success - type: str - sslCipher: - description: - - A list of permissible ciphers to use for SSL encryption. - returned: success - type: str - username: - description: - - The username for the replication connection. - returned: success - type: str - verifyServerCertificate: - description: - - Whether or not to check the master's Common Name value in the certificate that it - sends during the SSL handshake. - returned: success - type: bool - replicaNames: - description: - - The replicas of the instance. - returned: success - type: list - serviceAccountEmailAddress: - description: - - The service account email address assigned to the instance. This property is applicable - only to Second Generation instances. - returned: success - type: str - settings: - description: - - The user settings. - returned: success - type: complex - contains: - ipConfiguration: - description: - - The settings for IP Management. This allows to enable or disable the instance IP - and manage which external networks can connect to the instance. The IPv4 address - cannot be disabled for Second Generation instances. - returned: success - type: complex - contains: - ipv4Enabled: - description: - - Whether the instance should be assigned an IP address or not. - returned: success - type: bool - authorizedNetworks: - description: - - The list of external networks that are allowed to connect to the instance using - the IP. In CIDR notation, also known as 'slash' notation (e.g. 192.168.100.0/24). - returned: success - type: complex - contains: - expirationTime: - description: - - The time when this access control entry expires in RFC 3339 format, for example - 2012-11-15T16:19:00.094Z. - returned: success - type: str - name: - description: - - An optional label to identify this entry. - returned: success - type: str - value: - description: - - The whitelisted value for the access control list. For example, to grant access - to a client from an external IP (IPv4 or IPv6) address or subnet, use that address - or subnet here. - returned: success - type: str - requireSsl: - description: - - Whether the mysqld should default to 'REQUIRE X509' for users connecting over IP. - returned: success - type: bool - tier: - description: - - The tier or machine type for this instance, for example db-n1-standard-1. For MySQL - instances, this field determines whether the instance is Second Generation (recommended) - or First Generation. - returned: success - type: str - settingsVersion: - description: - - The version of instance settings. This is a required field for update method to - make sure concurrent updates are handled properly. During update, use the most - recent settingsVersion value for this instance and do not try to update this value. - returned: success - type: int + description: + - The name of the failover replica. If specified at instance creation, a failover + replica is created for the instance. The name doesn't include the project + ID. This property is applicable only to Second Generation instances. + returned: success + type: str +instanceType: + description: + - The instance type. This can be one of the following. + - "* CLOUD_SQL_INSTANCE: A Cloud SQL instance that is not replicating from a master." + - "* ON_PREMISES_INSTANCE: An instance running on the customer's premises." + - "* READ_REPLICA_INSTANCE: A Cloud SQL instance configured as a read-replica." + returned: success + type: str +ipAddresses: + description: + - The assigned IP addresses for the instance. + returned: success + type: complex + contains: + ipAddress: + description: + - The IP address assigned. + returned: success + type: str + timeToRetire: + description: + - The due time for this IP to be retired in RFC 3339 format, for example 2012-11-15T16:19:00.094Z. + This field is only available when the IP is scheduled to be retired. + returned: success + type: str + type: + description: + - The type of this IP address. A PRIMARY address is an address that can accept + incoming connections. An OUTGOING address is the source address of connections + originating from the instance, if supported. + returned: success + type: str +ipv6Address: + description: + - The IPv6 address assigned to the instance. This property is applicable only to + First Generation instances. + returned: success + type: str +masterInstanceName: + description: + - The name of the instance which will act as master in the replication setup. + returned: success + type: str +maxDiskSize: + description: + - The maximum disk size of the instance in bytes. + returned: success + type: int +name: + description: + - Name of the Cloud SQL instance. This does not include the project ID. + returned: success + type: str +region: + description: + - The geographical region. Defaults to us-central or us-central1 depending on the + instance type (First Generation or Second Generation/PostgreSQL). + returned: success + type: str +replicaConfiguration: + description: + - Configuration specific to failover replicas and read replicas. + returned: success + type: complex + contains: + failoverTarget: + description: + - Specifies if the replica is the failover target. If the field is set to true + the replica will be designated as a failover replica. + - In case the master instance fails, the replica instance will be promoted as + the new master instance. + - Only one replica can be specified as failover target, and the replica has + to be in different zone with the master instance. + returned: success + type: bool + mysqlReplicaConfiguration: + description: + - MySQL specific configuration when replicating from a MySQL on-premises master. + Replication configuration information such as the username, password, certificates, + and keys are not stored in the instance metadata. The configuration information + is used only to set up the replication connection and is stored by MySQL in + a file named master.info in the data directory. + returned: success + type: complex + contains: + caCertificate: + description: + - PEM representation of the trusted CA's x509 certificate. + returned: success + type: str + clientCertificate: + description: + - PEM representation of the slave's x509 certificate . + returned: success + type: str + clientKey: + description: + - PEM representation of the slave's private key. The corresponsing public + key is encoded in the client's asf asd certificate. + returned: success + type: str + connectRetryInterval: + description: + - Seconds to wait between connect retries. MySQL's default is 60 seconds. + returned: success + type: int + dumpFilePath: + description: + - Path to a SQL dump file in Google Cloud Storage from which the slave instance + is to be created. The URI is in the form gs://bucketName/fileName. Compressed + gzip files (.gz) are also supported. Dumps should have the binlog co-ordinates + from which replication should begin. This can be accomplished by setting + --master-data to 1 when using mysqldump. + returned: success + type: str + masterHeartbeatPeriod: + description: + - Interval in milliseconds between replication heartbeats. + returned: success + type: int + password: + description: + - The password for the replication connection. + returned: success + type: str + sslCipher: + description: + - A list of permissible ciphers to use for SSL encryption. + returned: success + type: str + username: + description: + - The username for the replication connection. + returned: success + type: str + verifyServerCertificate: + description: + - Whether or not to check the master's Common Name value in the certificate + that it sends during the SSL handshake. + returned: success + type: bool + replicaNames: + description: + - The replicas of the instance. + returned: success + type: list + serviceAccountEmailAddress: + description: + - The service account email address assigned to the instance. This property + is applicable only to Second Generation instances. + returned: success + type: str +settings: + description: + - The user settings. + returned: success + type: complex + contains: + ipConfiguration: + description: + - The settings for IP Management. This allows to enable or disable the instance + IP and manage which external networks can connect to the instance. The IPv4 + address cannot be disabled for Second Generation instances. + returned: success + type: complex + contains: + ipv4Enabled: + description: + - Whether the instance should be assigned an IP address or not. + returned: success + type: bool + authorizedNetworks: + description: + - The list of external networks that are allowed to connect to the instance + using the IP. In CIDR notation, also known as 'slash' notation (e.g. 192.168.100.0/24). + returned: success + type: complex + contains: + expirationTime: + description: + - The time when this access control entry expires in RFC 3339 format, + for example 2012-11-15T16:19:00.094Z. + returned: success + type: str + name: + description: + - An optional label to identify this entry. + returned: success + type: str + value: + description: + - The whitelisted value for the access control list. For example, to + grant access to a client from an external IP (IPv4 or IPv6) address + or subnet, use that address or subnet here. + returned: success + type: str + requireSsl: + description: + - Whether the mysqld should default to 'REQUIRE X509' for users connecting + over IP. + returned: success + type: bool + tier: + description: + - The tier or machine type for this instance, for example db-n1-standard-1. + For MySQL instances, this field determines whether the instance is Second + Generation (recommended) or First Generation. + returned: success + type: str + settingsVersion: + description: + - The version of instance settings. This is a required field for update method + to make sure concurrent updates are handled properly. During update, use the + most recent settingsVersion value for this instance and do not try to update + this value. + returned: success + type: int ''' ################################################################################ diff --git a/lib/ansible/modules/cloud/google/gcp_sql_instance_facts.py b/lib/ansible/modules/cloud/google/gcp_sql_instance_facts.py index 1722b4276ad808..d0794353a2c299 100644 --- a/lib/ansible/modules/cloud/google/gcp_sql_instance_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_sql_instance_facts.py @@ -32,14 +32,15 @@ --- module: gcp_sql_instance_facts description: - - Gather facts for GCP Instance +- Gather facts for GCP Instance short_description: Gather facts for GCP Instance version_added: 2.8 author: Google Inc. (@googlecloudplatform) requirements: - - python >= 2.6 - - requests >= 2.18.4 - - google-auth >= 1.3.0 +- python >= 2.6 +- requests >= 2.18.4 +- google-auth >= 1.3.0 +options: {} extends_documentation_fragment: gcp ''' @@ -53,267 +54,273 @@ RETURN = ''' items: - description: List of items - returned: always - type: complex - contains: - backendType: - description: - - "* FIRST_GEN: First Generation instance. MySQL only." - - "* SECOND_GEN: Second Generation instance or PostgreSQL instance." - - "* EXTERNAL: A database server that is not managed by Google." - returned: success - type: str - connectionName: - description: - - Connection name of the Cloud SQL instance used in connection strings. - returned: success - type: str - databaseVersion: - description: - - The database engine type and version. For First Generation instances, can be MYSQL_5_5, - or MYSQL_5_6. For Second Generation instances, can be MYSQL_5_6 or MYSQL_5_7. Defaults - to MYSQL_5_6. - - 'PostgreSQL instances: POSTGRES_9_6 The databaseVersion property can not be changed - after instance creation.' - returned: success - type: str - failoverReplica: - description: - - The name and status of the failover replica. This property is applicable only to - Second Generation instances. - returned: success - type: complex - contains: - available: - description: - - The availability status of the failover replica. A false status indicates that the - failover replica is out of sync. The master can only failover to the falover replica - when the status is true. - returned: success - type: bool - name: - description: - - The name of the failover replica. If specified at instance creation, a failover - replica is created for the instance. The name doesn't include the project ID. This - property is applicable only to Second Generation instances. - returned: success - type: str - instanceType: - description: - - The instance type. This can be one of the following. - - "* CLOUD_SQL_INSTANCE: A Cloud SQL instance that is not replicating from a master." - - "* ON_PREMISES_INSTANCE: An instance running on the customer's premises." - - "* READ_REPLICA_INSTANCE: A Cloud SQL instance configured as a read-replica." - returned: success - type: str - ipAddresses: - description: - - The assigned IP addresses for the instance. - returned: success - type: complex - contains: - ipAddress: - description: - - The IP address assigned. - returned: success - type: str - timeToRetire: - description: - - The due time for this IP to be retired in RFC 3339 format, for example 2012-11-15T16:19:00.094Z. - This field is only available when the IP is scheduled to be retired. - returned: success - type: str - type: - description: - - The type of this IP address. A PRIMARY address is an address that can accept incoming - connections. An OUTGOING address is the source address of connections originating - from the instance, if supported. - returned: success - type: str - ipv6Address: - description: - - The IPv6 address assigned to the instance. This property is applicable only to First - Generation instances. - returned: success - type: str - masterInstanceName: - description: - - The name of the instance which will act as master in the replication setup. - returned: success - type: str - maxDiskSize: - description: - - The maximum disk size of the instance in bytes. - returned: success - type: int + description: List of items + returned: always + type: complex + contains: + backendType: + description: + - "* FIRST_GEN: First Generation instance. MySQL only." + - "* SECOND_GEN: Second Generation instance or PostgreSQL instance." + - "* EXTERNAL: A database server that is not managed by Google." + returned: success + type: str + connectionName: + description: + - Connection name of the Cloud SQL instance used in connection strings. + returned: success + type: str + databaseVersion: + description: + - The database engine type and version. For First Generation instances, can + be MYSQL_5_5, or MYSQL_5_6. For Second Generation instances, can be MYSQL_5_6 + or MYSQL_5_7. Defaults to MYSQL_5_6. + - 'PostgreSQL instances: POSTGRES_9_6 The databaseVersion property can not be + changed after instance creation.' + returned: success + type: str + failoverReplica: + description: + - The name and status of the failover replica. This property is applicable only + to Second Generation instances. + returned: success + type: complex + contains: + available: + description: + - The availability status of the failover replica. A false status indicates + that the failover replica is out of sync. The master can only failover + to the falover replica when the status is true. + returned: success + type: bool name: - description: - - Name of the Cloud SQL instance. This does not include the project ID. - returned: success - type: str - region: - description: - - The geographical region. Defaults to us-central or us-central1 depending on the - instance type (First Generation or Second Generation/PostgreSQL). - returned: success - type: str - replicaConfiguration: - description: - - Configuration specific to failover replicas and read replicas. - returned: success - type: complex - contains: - failoverTarget: - description: - - Specifies if the replica is the failover target. If the field is set to true the - replica will be designated as a failover replica. - - In case the master instance fails, the replica instance will be promoted as the - new master instance. - - Only one replica can be specified as failover target, and the replica has to be - in different zone with the master instance. - returned: success - type: bool - mysqlReplicaConfiguration: - description: - - MySQL specific configuration when replicating from a MySQL on-premises master. Replication - configuration information such as the username, password, certificates, and keys - are not stored in the instance metadata. The configuration information is used - only to set up the replication connection and is stored by MySQL in a file named - master.info in the data directory. - returned: success - type: complex - contains: - caCertificate: - description: - - PEM representation of the trusted CA's x509 certificate. - returned: success - type: str - clientCertificate: - description: - - PEM representation of the slave's x509 certificate . - returned: success - type: str - clientKey: - description: - - PEM representation of the slave's private key. The corresponsing public key is encoded - in the client's asf asd certificate. - returned: success - type: str - connectRetryInterval: - description: - - Seconds to wait between connect retries. MySQL's default is 60 seconds. - returned: success - type: int - dumpFilePath: - description: - - Path to a SQL dump file in Google Cloud Storage from which the slave instance is - to be created. The URI is in the form gs://bucketName/fileName. Compressed gzip - files (.gz) are also supported. Dumps should have the binlog co-ordinates from which - replication should begin. This can be accomplished by setting --master-data to 1 - when using mysqldump. - returned: success - type: str - masterHeartbeatPeriod: - description: - - Interval in milliseconds between replication heartbeats. - returned: success - type: int - password: - description: - - The password for the replication connection. - returned: success - type: str - sslCipher: - description: - - A list of permissible ciphers to use for SSL encryption. - returned: success - type: str - username: - description: - - The username for the replication connection. - returned: success - type: str - verifyServerCertificate: - description: - - Whether or not to check the master's Common Name value in the certificate that it - sends during the SSL handshake. - returned: success - type: bool - replicaNames: - description: - - The replicas of the instance. - returned: success - type: list - serviceAccountEmailAddress: - description: - - The service account email address assigned to the instance. This property is applicable - only to Second Generation instances. - returned: success - type: str - settings: - description: - - The user settings. - returned: success - type: complex - contains: - ipConfiguration: - description: - - The settings for IP Management. This allows to enable or disable the instance IP - and manage which external networks can connect to the instance. The IPv4 address - cannot be disabled for Second Generation instances. - returned: success - type: complex - contains: - ipv4Enabled: - description: - - Whether the instance should be assigned an IP address or not. - returned: success - type: bool - authorizedNetworks: - description: - - The list of external networks that are allowed to connect to the instance using - the IP. In CIDR notation, also known as 'slash' notation (e.g. 192.168.100.0/24). - returned: success - type: complex - contains: - expirationTime: - description: - - The time when this access control entry expires in RFC 3339 format, for example - 2012-11-15T16:19:00.094Z. - returned: success - type: str - name: - description: - - An optional label to identify this entry. - returned: success - type: str - value: - description: - - The whitelisted value for the access control list. For example, to grant access - to a client from an external IP (IPv4 or IPv6) address or subnet, use that address - or subnet here. - returned: success - type: str - requireSsl: - description: - - Whether the mysqld should default to 'REQUIRE X509' for users connecting over IP. - returned: success - type: bool - tier: - description: - - The tier or machine type for this instance, for example db-n1-standard-1. For MySQL - instances, this field determines whether the instance is Second Generation (recommended) - or First Generation. - returned: success - type: str - settingsVersion: - description: - - The version of instance settings. This is a required field for update method to - make sure concurrent updates are handled properly. During update, use the most - recent settingsVersion value for this instance and do not try to update this value. - returned: success - type: int + description: + - The name of the failover replica. If specified at instance creation, a + failover replica is created for the instance. The name doesn't include + the project ID. This property is applicable only to Second Generation + instances. + returned: success + type: str + instanceType: + description: + - The instance type. This can be one of the following. + - "* CLOUD_SQL_INSTANCE: A Cloud SQL instance that is not replicating from a + master." + - "* ON_PREMISES_INSTANCE: An instance running on the customer's premises." + - "* READ_REPLICA_INSTANCE: A Cloud SQL instance configured as a read-replica." + returned: success + type: str + ipAddresses: + description: + - The assigned IP addresses for the instance. + returned: success + type: complex + contains: + ipAddress: + description: + - The IP address assigned. + returned: success + type: str + timeToRetire: + description: + - The due time for this IP to be retired in RFC 3339 format, for example + 2012-11-15T16:19:00.094Z. This field is only available when the IP is + scheduled to be retired. + returned: success + type: str + type: + description: + - The type of this IP address. A PRIMARY address is an address that can + accept incoming connections. An OUTGOING address is the source address + of connections originating from the instance, if supported. + returned: success + type: str + ipv6Address: + description: + - The IPv6 address assigned to the instance. This property is applicable only + to First Generation instances. + returned: success + type: str + masterInstanceName: + description: + - The name of the instance which will act as master in the replication setup. + returned: success + type: str + maxDiskSize: + description: + - The maximum disk size of the instance in bytes. + returned: success + type: int + name: + description: + - Name of the Cloud SQL instance. This does not include the project ID. + returned: success + type: str + region: + description: + - The geographical region. Defaults to us-central or us-central1 depending on + the instance type (First Generation or Second Generation/PostgreSQL). + returned: success + type: str + replicaConfiguration: + description: + - Configuration specific to failover replicas and read replicas. + returned: success + type: complex + contains: + failoverTarget: + description: + - Specifies if the replica is the failover target. If the field is set to + true the replica will be designated as a failover replica. + - In case the master instance fails, the replica instance will be promoted + as the new master instance. + - Only one replica can be specified as failover target, and the replica + has to be in different zone with the master instance. + returned: success + type: bool + mysqlReplicaConfiguration: + description: + - MySQL specific configuration when replicating from a MySQL on-premises + master. Replication configuration information such as the username, password, + certificates, and keys are not stored in the instance metadata. The configuration + information is used only to set up the replication connection and is stored + by MySQL in a file named master.info in the data directory. + returned: success + type: complex + contains: + caCertificate: + description: + - PEM representation of the trusted CA's x509 certificate. + returned: success + type: str + clientCertificate: + description: + - PEM representation of the slave's x509 certificate . + returned: success + type: str + clientKey: + description: + - PEM representation of the slave's private key. The corresponsing public + key is encoded in the client's asf asd certificate. + returned: success + type: str + connectRetryInterval: + description: + - Seconds to wait between connect retries. MySQL's default is 60 seconds. + returned: success + type: int + dumpFilePath: + description: + - Path to a SQL dump file in Google Cloud Storage from which the slave + instance is to be created. The URI is in the form gs://bucketName/fileName. + Compressed gzip files (.gz) are also supported. Dumps should have + the binlog co-ordinates from which replication should begin. This + can be accomplished by setting --master-data to 1 when using mysqldump. + returned: success + type: str + masterHeartbeatPeriod: + description: + - Interval in milliseconds between replication heartbeats. + returned: success + type: int + password: + description: + - The password for the replication connection. + returned: success + type: str + sslCipher: + description: + - A list of permissible ciphers to use for SSL encryption. + returned: success + type: str + username: + description: + - The username for the replication connection. + returned: success + type: str + verifyServerCertificate: + description: + - Whether or not to check the master's Common Name value in the certificate + that it sends during the SSL handshake. + returned: success + type: bool + replicaNames: + description: + - The replicas of the instance. + returned: success + type: list + serviceAccountEmailAddress: + description: + - The service account email address assigned to the instance. This property + is applicable only to Second Generation instances. + returned: success + type: str + settings: + description: + - The user settings. + returned: success + type: complex + contains: + ipConfiguration: + description: + - The settings for IP Management. This allows to enable or disable the instance + IP and manage which external networks can connect to the instance. The + IPv4 address cannot be disabled for Second Generation instances. + returned: success + type: complex + contains: + ipv4Enabled: + description: + - Whether the instance should be assigned an IP address or not. + returned: success + type: bool + authorizedNetworks: + description: + - The list of external networks that are allowed to connect to the instance + using the IP. In CIDR notation, also known as 'slash' notation (e.g. + 192.168.100.0/24). + returned: success + type: complex + contains: + expirationTime: + description: + - The time when this access control entry expires in RFC 3339 format, + for example 2012-11-15T16:19:00.094Z. + returned: success + type: str + name: + description: + - An optional label to identify this entry. + returned: success + type: str + value: + description: + - The whitelisted value for the access control list. For example, + to grant access to a client from an external IP (IPv4 or IPv6) + address or subnet, use that address or subnet here. + returned: success + type: str + requireSsl: + description: + - Whether the mysqld should default to 'REQUIRE X509' for users connecting + over IP. + returned: success + type: bool + tier: + description: + - The tier or machine type for this instance, for example db-n1-standard-1. + For MySQL instances, this field determines whether the instance is Second + Generation (recommended) or First Generation. + returned: success + type: str + settingsVersion: + description: + - The version of instance settings. This is a required field for update + method to make sure concurrent updates are handled properly. During update, + use the most recent settingsVersion value for this instance and do not + try to update this value. + returned: success + type: int ''' ################################################################################ diff --git a/lib/ansible/modules/cloud/google/gcp_sql_user.py b/lib/ansible/modules/cloud/google/gcp_sql_user.py index d0ab9e7ac10732..526c452d1ae849 100644 --- a/lib/ansible/modules/cloud/google/gcp_sql_user.py +++ b/lib/ansible/modules/cloud/google/gcp_sql_user.py @@ -32,43 +32,45 @@ --- module: gcp_sql_user description: - - The Users resource represents a database user in a Cloud SQL instance. +- The Users resource represents a database user in a Cloud SQL instance. short_description: Creates a GCP User version_added: 2.7 author: Google Inc. (@googlecloudplatform) requirements: - - python >= 2.6 - - requests >= 2.18.4 - - google-auth >= 1.3.0 +- python >= 2.6 +- requests >= 2.18.4 +- google-auth >= 1.3.0 options: - state: - description: - - Whether the given object should exist in GCP - choices: ['present', 'absent'] - default: 'present' - host: - description: - - The host name from which the user can connect. For insert operations, host defaults - to an empty string. For update operations, host is specified as part of the request - URL. The host name cannot be updated after insertion. - required: true - name: - description: - - The name of the user in the Cloud SQL instance. - required: true - instance: - description: - - The name of the Cloud SQL instance. This does not include the project ID. - - 'This field represents a link to a Instance resource in GCP. It can be specified - in two ways. You can add `register: name-of-resource` to a gcp_sql_instance task - and then set this instance field to "{{ name-of-resource }}" Alternatively, you - can set this instance to a dictionary with the name key where the value is the name - of your Instance.' - required: true - password: - description: - - The password for the user. - required: false + state: + description: + - Whether the given object should exist in GCP + choices: + - present + - absent + default: present + host: + description: + - The host name from which the user can connect. For insert operations, host defaults + to an empty string. For update operations, host is specified as part of the + request URL. The host name cannot be updated after insertion. + required: true + name: + description: + - The name of the user in the Cloud SQL instance. + required: true + instance: + description: + - The name of the Cloud SQL instance. This does not include the project ID. + - 'This field represents a link to a Instance resource in GCP. It can be specified + in two ways. You can add `register: name-of-resource` to a gcp_sql_instance + task and then set this instance field to "{{ name-of-resource }}" Alternatively, + you can set this instance to a dictionary with the name key where the value + is the name of your Instance' + required: true + password: + description: + - The password for the user. + required: false extends_documentation_fragment: gcp ''' @@ -102,28 +104,28 @@ ''' RETURN = ''' - host: - description: - - The host name from which the user can connect. For insert operations, host defaults - to an empty string. For update operations, host is specified as part of the request - URL. The host name cannot be updated after insertion. - returned: success - type: str - name: - description: - - The name of the user in the Cloud SQL instance. - returned: success - type: str - instance: - description: - - The name of the Cloud SQL instance. This does not include the project ID. - returned: success - type: dict - password: - description: - - The password for the user. - returned: success - type: str +host: + description: + - The host name from which the user can connect. For insert operations, host defaults + to an empty string. For update operations, host is specified as part of the request + URL. The host name cannot be updated after insertion. + returned: success + type: str +name: + description: + - The name of the user in the Cloud SQL instance. + returned: success + type: str +instance: + description: + - The name of the Cloud SQL instance. This does not include the project ID. + returned: success + type: dict +password: + description: + - The password for the user. + returned: success + type: str ''' ################################################################################ diff --git a/lib/ansible/modules/cloud/google/gcp_sql_user_facts.py b/lib/ansible/modules/cloud/google/gcp_sql_user_facts.py index 63f58621a27bd5..01c0cbc6c3d084 100644 --- a/lib/ansible/modules/cloud/google/gcp_sql_user_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_sql_user_facts.py @@ -32,24 +32,24 @@ --- module: gcp_sql_user_facts description: - - Gather facts for GCP User +- Gather facts for GCP User short_description: Gather facts for GCP User version_added: 2.8 author: Google Inc. (@googlecloudplatform) requirements: - - python >= 2.6 - - requests >= 2.18.4 - - google-auth >= 1.3.0 +- python >= 2.6 +- requests >= 2.18.4 +- google-auth >= 1.3.0 options: - instance: - description: - - The name of the Cloud SQL instance. This does not include the project ID. - - 'This field represents a link to a Instance resource in GCP. It can be specified - in two ways. You can add `register: name-of-resource` to a gcp_sql_instance task - and then set this instance field to "{{ name-of-resource }}" Alternatively, you - can set this instance to a dictionary with the name key where the value is the name - of your Instance.' - required: true + instance: + description: + - The name of the Cloud SQL instance. This does not include the project ID. + - 'This field represents a link to a Instance resource in GCP. It can be specified + in two ways. You can add `register: name-of-resource` to a gcp_sql_instance + task and then set this instance field to "{{ name-of-resource }}" Alternatively, + you can set this instance to a dictionary with the name key where the value + is the name of your Instance' + required: true extends_documentation_fragment: gcp ''' @@ -64,32 +64,32 @@ RETURN = ''' items: - description: List of items - returned: always - type: complex - contains: - host: - description: - - The host name from which the user can connect. For insert operations, host defaults - to an empty string. For update operations, host is specified as part of the request - URL. The host name cannot be updated after insertion. - returned: success - type: str - name: - description: - - The name of the user in the Cloud SQL instance. - returned: success - type: str - instance: - description: - - The name of the Cloud SQL instance. This does not include the project ID. - returned: success - type: dict - password: - description: - - The password for the user. - returned: success - type: str + description: List of items + returned: always + type: complex + contains: + host: + description: + - The host name from which the user can connect. For insert operations, host + defaults to an empty string. For update operations, host is specified as part + of the request URL. The host name cannot be updated after insertion. + returned: success + type: str + name: + description: + - The name of the user in the Cloud SQL instance. + returned: success + type: str + instance: + description: + - The name of the Cloud SQL instance. This does not include the project ID. + returned: success + type: dict + password: + description: + - The password for the user. + returned: success + type: str ''' ################################################################################ diff --git a/lib/ansible/modules/cloud/google/gcp_storage_bucket.py b/lib/ansible/modules/cloud/google/gcp_storage_bucket.py index 0d83987ba47d85..7c7f9b61468389 100644 --- a/lib/ansible/modules/cloud/google/gcp_storage_bucket.py +++ b/lib/ansible/modules/cloud/google/gcp_storage_bucket.py @@ -32,331 +32,365 @@ --- module: gcp_storage_bucket description: - - The Buckets resource represents a bucket in Google Cloud Storage. There is a single - global namespace shared by all buckets. For more information, see Bucket Name Requirements. - - Buckets contain objects which can be accessed by their own methods. In addition - to the acl property, buckets contain bucketAccessControls, for use in fine-grained - manipulation of an existing bucket's access controls. - - A bucket is always owned by the project team owners group. +- The Buckets resource represents a bucket in Google Cloud Storage. There is a single + global namespace shared by all buckets. For more information, see Bucket Name Requirements. +- Buckets contain objects which can be accessed by their own methods. In addition + to the acl property, buckets contain bucketAccessControls, for use in fine-grained + manipulation of an existing bucket's access controls. +- A bucket is always owned by the project team owners group. short_description: Creates a GCP Bucket version_added: 2.6 author: Google Inc. (@googlecloudplatform) requirements: - - python >= 2.6 - - requests >= 2.18.4 - - google-auth >= 1.3.0 +- python >= 2.6 +- requests >= 2.18.4 +- google-auth >= 1.3.0 options: - state: + state: + description: + - Whether the given object should exist in GCP + choices: + - present + - absent + default: present + acl: + description: + - Access controls on the bucket. + required: false + suboptions: + bucket: description: - - Whether the given object should exist in GCP - choices: ['present', 'absent'] - default: 'present' - acl: + - The name of the bucket. + - 'This field represents a link to a Bucket resource in GCP. It can be specified + in two ways. You can add `register: name-of-resource` to a gcp_storage_bucket + task and then set this bucket field to "{{ name-of-resource }}" Alternatively, + you can set this bucket to a dictionary with the name key where the value + is the name of your Bucket' + required: true + domain: description: - - Access controls on the bucket. + - The domain associated with the entity. + required: false + email: + description: + - The email address associated with the entity. + required: false + entity: + description: + - 'The entity holding the permission, in one of the following forms: user-userId + user-email group-groupId group-email domain-domain project-team-projectId + allUsers allAuthenticatedUsers Examples: The user liz@example.com would + be user-liz@example.com.' + - The group example@googlegroups.com would be group-example@googlegroups.com. + - To refer to all members of the Google Apps for Business domain example.com, + the entity would be domain-example.com. + required: true + entity_id: + description: + - The ID for the entity. + required: false + id: + description: + - The ID of the access-control entry. + required: false + project_team: + description: + - The project team associated with the entity. required: false suboptions: - bucket: - description: - - The name of the bucket. - - 'This field represents a link to a Bucket resource in GCP. It can be specified in - two ways. You can add `register: name-of-resource` to a gcp_storage_bucket task - and then set this bucket field to "{{ name-of-resource }}" Alternatively, you can - set this bucket to a dictionary with the name key where the value is the name of - your Bucket.' - required: true - domain: - description: - - The domain associated with the entity. - required: false - email: - description: - - The email address associated with the entity. - required: false - entity: - description: - - 'The entity holding the permission, in one of the following forms: user-userId - user-email group-groupId group-email domain-domain project-team-projectId allUsers - allAuthenticatedUsers Examples: The user liz@example.com would be - user-liz@example.com.' - - The group example@googlegroups.com would be group-example@googlegroups.com. - - To refer to all members of the Google Apps for Business domain example.com, the - entity would be domain-example.com. - required: true - entity_id: - description: - - The ID for the entity. - required: false - id: - description: - - The ID of the access-control entry. - required: false - project_team: - description: - - The project team associated with the entity. - required: false - suboptions: - project_number: - description: - - The project team associated with the entity. - required: false - team: - description: - - The team. - required: false - choices: ['editors', 'owners', 'viewers'] - role: - description: - - The access permission for the entity. - required: false - choices: ['OWNER', 'READER', 'WRITER'] - cors: + project_number: + description: + - The project team associated with the entity. + required: false + team: + description: + - The team. + required: false + choices: + - editors + - owners + - viewers + role: + description: + - The access permission for the entity. + required: false + choices: + - OWNER + - READER + - WRITER + cors: + description: + - The bucket's Cross-Origin Resource Sharing (CORS) configuration. + required: false + suboptions: + max_age_seconds: + description: + - The value, in seconds, to return in the Access-Control-Max-Age header used + in preflight responses. + required: false + method: + description: + - 'The list of HTTP methods on which to include CORS response headers, (GET, + OPTIONS, POST, etc) Note: "*" is permitted in the list of methods, and means + "any method".' + required: false + origin: + description: + - The list of Origins eligible to receive CORS response headers. + - 'Note: "*" is permitted in the list of origins, and means "any Origin".' + required: false + response_header: + description: + - The list of HTTP headers other than the simple response headers to give + permission for the user-agent to share across domains. + required: false + default_object_acl: + description: + - Default access controls to apply to new objects when no ACL is provided. + required: false + version_added: 2.7 + suboptions: + bucket: + description: + - The name of the bucket. + - 'This field represents a link to a Bucket resource in GCP. It can be specified + in two ways. You can add `register: name-of-resource` to a gcp_storage_bucket + task and then set this bucket field to "{{ name-of-resource }}" Alternatively, + you can set this bucket to a dictionary with the name key where the value + is the name of your Bucket' + required: true + domain: + description: + - The domain associated with the entity. + required: false + email: + description: + - The email address associated with the entity. + required: false + entity: + description: + - 'The entity holding the permission, in one of the following forms: * user-{{userId}} + * user-{{email}} (such as "user-liz@example.com") * group-{{groupId}} * + group-{{email}} (such as "group-example@googlegroups.com") * domain-{{domain}} + (such as "domain-example.com") * project-team-{{projectId}} * allUsers * + allAuthenticatedUsers .' + required: true + entity_id: + description: + - The ID for the entity. + required: false + generation: + description: + - The content generation of the object, if applied to an object. + required: false + id: + description: + - The ID of the access-control entry. + required: false + object: + description: + - The name of the object, if applied to an object. + required: false + project_team: description: - - The bucket's Cross-Origin Resource Sharing (CORS) configuration. + - The project team associated with the entity. required: false suboptions: - max_age_seconds: - description: - - The value, in seconds, to return in the Access-Control-Max-Age header used in preflight - responses. - required: false - method: - description: - - 'The list of HTTP methods on which to include CORS response headers, (GET, OPTIONS, - POST, etc) Note: "*" is permitted in the list of methods, and means "any method".' - required: false - origin: - description: - - The list of Origins eligible to receive CORS response headers. - - 'Note: "*" is permitted in the list of origins, and means "any Origin".' - required: false - response_header: - description: - - The list of HTTP headers other than the simple response headers to give permission - for the user-agent to share across domains. - required: false - default_object_acl: + project_number: + description: + - The project team associated with the entity. + required: false + team: + description: + - The team. + required: false + choices: + - editors + - owners + - viewers + role: + description: + - The access permission for the entity. + required: true + choices: + - OWNER + - READER + lifecycle: + description: + - The bucket's lifecycle configuration. + - See U(https://developers.google.com/storage/docs/lifecycle) for more information. + required: false + suboptions: + rule: description: - - Default access controls to apply to new objects when no ACL is provided. + - A lifecycle management rule, which is made of an action to take and the + condition(s) under which the action will be taken. required: false - version_added: 2.7 suboptions: - bucket: - description: - - The name of the bucket. - - 'This field represents a link to a Bucket resource in GCP. It can be specified in - two ways. You can add `register: name-of-resource` to a gcp_storage_bucket task - and then set this bucket field to "{{ name-of-resource }}" Alternatively, you can - set this bucket to a dictionary with the name key where the value is the name of - your Bucket.' - required: true - domain: - description: - - The domain associated with the entity. - required: false - email: - description: - - The email address associated with the entity. - required: false - entity: - description: - - 'The entity holding the permission, in one of the following forms: * user-{{userId}} * - user-{{email}} (such as "user-liz@example.com") * group-{{groupId}} * group-{{email}} - (such as "group-example@googlegroups.com") * domain-{{domain}} (such as "domain-example.com") * - project-team-{{projectId}} * allUsers * allAuthenticatedUsers .' - required: true - entity_id: + action: + description: + - The action to take. + required: false + suboptions: + storage_class: description: - - The ID for the entity. + - Target storage class. Required iff the type of the action is SetStorageClass. required: false - generation: + type: description: - - The content generation of the object, if applied to an object. + - Type of the action. Currently, only Delete and SetStorageClass are + supported. required: false - id: + choices: + - Delete + - SetStorageClass + condition: + description: + - The condition(s) under which the action will be taken. + required: false + suboptions: + age_days: description: - - The ID of the access-control entry. + - Age of an object (in days). This condition is satisfied when an + object reaches the specified age. required: false - object: + created_before: description: - - The name of the object, if applied to an object. + - A date in RFC 3339 format with only the date part (for instance, + "2013-01-15"). This condition is satisfied when an object is created + before midnight of the specified date in UTC. required: false - project_team: + is_live: description: - - The project team associated with the entity. + - Relevant only for versioned objects. If the value is true, this + condition matches live objects; if the value is false, it matches + archived objects. required: false - suboptions: - project_number: - description: - - The project team associated with the entity. - required: false - team: - description: - - The team. - required: false - choices: ['editors', 'owners', 'viewers'] - role: - description: - - The access permission for the entity. - required: true - choices: ['OWNER', 'READER'] - lifecycle: - description: - - The bucket's lifecycle configuration. - - See U(https://developers.google.com/storage/docs/lifecycle) for more information. - required: false - suboptions: - rule: - description: - - A lifecycle management rule, which is made of an action to take and the condition(s) - under which the action will be taken. - required: false - suboptions: - action: - description: - - The action to take. - required: false - suboptions: - storage_class: - description: - - Target storage class. Required iff the type of the action is SetStorageClass. - required: false - type: - description: - - Type of the action. Currently, only Delete and SetStorageClass are supported. - required: false - choices: ['Delete', 'SetStorageClass'] - condition: - description: - - The condition(s) under which the action will be taken. - required: false - suboptions: - age_days: - description: - - Age of an object (in days). This condition is satisfied when an object reaches the - specified age. - required: false - created_before: - description: - - A date in RFC 3339 format with only the date part (for instance, "2013-01-15"). - This condition is satisfied when an object is created before midnight of the specified - date in UTC. - required: false - is_live: - description: - - Relevant only for versioned objects. If the value is true, this condition matches - live objects; if the value is false, it matches archived objects. - required: false - type: bool - matches_storage_class: - description: - - Objects having any of the storage classes specified by this condition will be matched. - Values include MULTI_REGIONAL, REGIONAL, NEARLINE, COLDLINE, STANDARD, and DURABLE_REDUCED_AVAILABILITY. - required: false - num_newer_versions: - description: - - Relevant only for versioned objects. If the value is N, this condition is satisfied - when there are at least N versions (including the live version) newer than this - version of the object. - required: false - location: - description: - - The location of the bucket. Object data for objects in the bucket resides in physical - storage within this region. Defaults to US. See the developer's guide for the authoritative - list. - required: false - logging: - description: - - The bucket's logging configuration, which defines the destination bucket and optional - name prefix for the current bucket's logs. - required: false - suboptions: - log_bucket: + type: bool + matches_storage_class: description: - - The destination bucket where the current bucket's logs should be placed. + - Objects having any of the storage classes specified by this condition + will be matched. Values include MULTI_REGIONAL, REGIONAL, NEARLINE, + COLDLINE, STANDARD, and DURABLE_REDUCED_AVAILABILITY. required: false - log_object_prefix: + num_newer_versions: description: - - A prefix for log object names. + - Relevant only for versioned objects. If the value is N, this condition + is satisfied when there are at least N versions (including the live + version) newer than this version of the object. required: false - metageneration: + location: + description: + - The location of the bucket. Object data for objects in the bucket resides in + physical storage within this region. Defaults to US. See the developer's guide + for the authoritative list. + required: false + logging: + description: + - The bucket's logging configuration, which defines the destination bucket and + optional name prefix for the current bucket's logs. + required: false + suboptions: + log_bucket: description: - - The metadata generation of this bucket. + - The destination bucket where the current bucket's logs should be placed. required: false - name: + log_object_prefix: description: - - The name of the bucket. + - A prefix for log object names. required: false - owner: + metageneration: + description: + - The metadata generation of this bucket. + required: false + name: + description: + - The name of the bucket. + required: false + owner: + description: + - The owner of the bucket. This is always the project team's owner group. + required: false + suboptions: + entity: description: - - The owner of the bucket. This is always the project team's owner group. + - The entity, in the form project-owner-projectId. required: false - suboptions: - entity: - description: - - The entity, in the form project-owner-projectId. - required: false - entity_id: - description: - - The ID for the entity. - required: false - storage_class: + entity_id: description: - - The bucket's default storage class, used whenever no storageClass is specified for - a newly-created object. This defines how objects in the bucket are stored and determines - the SLA and the cost of storage. - - Values include MULTI_REGIONAL, REGIONAL, STANDARD, NEARLINE, COLDLINE, and DURABLE_REDUCED_AVAILABILITY. - If this value is not specified when the bucket is created, it will default to STANDARD. - For more information, see storage classes. + - The ID for the entity. required: false - choices: ['MULTI_REGIONAL', 'REGIONAL', 'STANDARD', 'NEARLINE', 'COLDLINE', 'DURABLE_REDUCED_AVAILABILITY'] - versioning: + storage_class: + description: + - The bucket's default storage class, used whenever no storageClass is specified + for a newly-created object. This defines how objects in the bucket are stored + and determines the SLA and the cost of storage. + - Values include MULTI_REGIONAL, REGIONAL, STANDARD, NEARLINE, COLDLINE, and DURABLE_REDUCED_AVAILABILITY. + If this value is not specified when the bucket is created, it will default to + STANDARD. For more information, see storage classes. + required: false + choices: + - MULTI_REGIONAL + - REGIONAL + - STANDARD + - NEARLINE + - COLDLINE + - DURABLE_REDUCED_AVAILABILITY + versioning: + description: + - The bucket's versioning configuration. + required: false + suboptions: + enabled: description: - - The bucket's versioning configuration. + - While set to true, versioning is fully enabled for this bucket. required: false - suboptions: - enabled: - description: - - While set to true, versioning is fully enabled for this bucket. - required: false - type: bool - website: + type: bool + website: + description: + - The bucket's website configuration, controlling how the service behaves when + accessing bucket contents as a web site. See the Static Website Examples for + more information. + required: false + suboptions: + main_page_suffix: description: - - The bucket's website configuration, controlling how the service behaves when accessing - bucket contents as a web site. See the Static Website Examples for more information. + - If the requested object path is missing, the service will ensure the path + has a trailing '/', append this suffix, and attempt to retrieve the resulting + object. This allows the creation of index.html objects to represent directory + pages. required: false - suboptions: - main_page_suffix: - description: - - If the requested object path is missing, the service will ensure the path has a - trailing '/', append this suffix, and attempt to retrieve the resulting object. - This allows the creation of index.html objects to represent directory pages. - required: false - not_found_page: - description: - - If the requested object path is missing, and any mainPageSuffix object is missing, - if applicable, the service will return the named object from this bucket as the - content for a 404 Not Found result. - required: false - project: + not_found_page: description: - - A valid API project identifier. + - If the requested object path is missing, and any mainPageSuffix object is + missing, if applicable, the service will return the named object from this + bucket as the content for a 404 Not Found result. required: false - predefined_default_object_acl: - description: - - Apply a predefined set of default object access controls to this bucket. - - 'Acceptable values are: - "authenticatedRead": Object owner gets OWNER access, - and allAuthenticatedUsers get READER access.' - - '- "bucketOwnerFullControl": Object owner gets OWNER access, and project team - owners get OWNER access.' - - '- "bucketOwnerRead": Object owner gets OWNER access, and project team owners - get READER access.' - - '- "private": Object owner gets OWNER access.' - - '- "projectPrivate": Object owner gets OWNER access, and project team members - get access according to their roles.' - - '- "publicRead": Object owner gets OWNER access, and allUsers get READER access.' - required: false - choices: ['authenticatedRead', 'bucketOwnerFullControl', 'bucketOwnerRead', 'private', 'projectPrivate', 'publicRead'] + project: + description: + - A valid API project identifier. + required: false + predefined_default_object_acl: + description: + - Apply a predefined set of default object access controls to this bucket. + - 'Acceptable values are: - "authenticatedRead": Object owner gets OWNER access, + and allAuthenticatedUsers get READER access.' + - '- "bucketOwnerFullControl": Object owner gets OWNER access, and project team + owners get OWNER access.' + - '- "bucketOwnerRead": Object owner gets OWNER access, and project team owners + get READER access.' + - '- "private": Object owner gets OWNER access.' + - '- "projectPrivate": Object owner gets OWNER access, and project team members + get access according to their roles.' + - '- "publicRead": Object owner gets OWNER access, and allUsers get READER access.' + required: false + choices: + - authenticatedRead + - bucketOwnerFullControl + - bucketOwnerRead + - private + - projectPrivate + - publicRead extends_documentation_fragment: gcp ''' @@ -371,369 +405,373 @@ ''' RETURN = ''' - acl: - description: - - Access controls on the bucket. - returned: success - type: complex - contains: - bucket: - description: - - The name of the bucket. - returned: success - type: dict - domain: - description: - - The domain associated with the entity. - returned: success - type: str - email: - description: - - The email address associated with the entity. - returned: success - type: str - entity: - description: - - 'The entity holding the permission, in one of the following forms: user-userId - user-email group-groupId group-email domain-domain project-team-projectId allUsers - allAuthenticatedUsers Examples: The user liz@example.com would be - user-liz@example.com.' - - The group example@googlegroups.com would be group-example@googlegroups.com. - - To refer to all members of the Google Apps for Business domain example.com, the - entity would be domain-example.com. - returned: success - type: str - entityId: - description: - - The ID for the entity. - returned: success - type: str - id: - description: - - The ID of the access-control entry. - returned: success - type: str - projectTeam: - description: - - The project team associated with the entity. - returned: success - type: complex - contains: - projectNumber: - description: - - The project team associated with the entity. - returned: success - type: str - team: - description: - - The team. - returned: success - type: str - role: - description: - - The access permission for the entity. - returned: success - type: str - cors: - description: - - The bucket's Cross-Origin Resource Sharing (CORS) configuration. - returned: success - type: complex - contains: - maxAgeSeconds: - description: - - The value, in seconds, to return in the Access-Control-Max-Age header used in preflight - responses. - returned: success - type: int - method: - description: - - 'The list of HTTP methods on which to include CORS response headers, (GET, OPTIONS, - POST, etc) Note: "*" is permitted in the list of methods, and means "any method".' - returned: success - type: list - origin: - description: - - The list of Origins eligible to receive CORS response headers. - - 'Note: "*" is permitted in the list of origins, and means "any Origin".' - returned: success - type: list - responseHeader: - description: - - The list of HTTP headers other than the simple response headers to give permission - for the user-agent to share across domains. - returned: success - type: list - defaultObjectAcl: - description: - - Default access controls to apply to new objects when no ACL is provided. - returned: success - type: complex - contains: - bucket: - description: - - The name of the bucket. - returned: success - type: dict - domain: - description: - - The domain associated with the entity. - returned: success - type: str - email: - description: - - The email address associated with the entity. - returned: success - type: str - entity: - description: - - 'The entity holding the permission, in one of the following forms: * user-{{userId}} * - user-{{email}} (such as "user-liz@example.com") * group-{{groupId}} * group-{{email}} - (such as "group-example@googlegroups.com") * domain-{{domain}} (such as "domain-example.com") * - project-team-{{projectId}} * allUsers * allAuthenticatedUsers .' - returned: success - type: str - entityId: - description: - - The ID for the entity. - returned: success - type: str - generation: - description: - - The content generation of the object, if applied to an object. - returned: success - type: int - id: - description: - - The ID of the access-control entry. - returned: success - type: str - object: - description: - - The name of the object, if applied to an object. - returned: success - type: str - projectTeam: - description: - - The project team associated with the entity. - returned: success - type: complex - contains: - projectNumber: - description: - - The project team associated with the entity. - returned: success - type: str - team: - description: - - The team. - returned: success - type: str - role: - description: - - The access permission for the entity. - returned: success - type: str +acl: + description: + - Access controls on the bucket. + returned: success + type: complex + contains: + bucket: + description: + - The name of the bucket. + returned: success + type: dict + domain: + description: + - The domain associated with the entity. + returned: success + type: str + email: + description: + - The email address associated with the entity. + returned: success + type: str + entity: + description: + - 'The entity holding the permission, in one of the following forms: user-userId + user-email group-groupId group-email domain-domain project-team-projectId + allUsers allAuthenticatedUsers Examples: The user liz@example.com would be + user-liz@example.com.' + - The group example@googlegroups.com would be group-example@googlegroups.com. + - To refer to all members of the Google Apps for Business domain example.com, + the entity would be domain-example.com. + returned: success + type: str + entityId: + description: + - The ID for the entity. + returned: success + type: str id: - description: - - The ID of the bucket. For buckets, the id and name properities are the same. - returned: success - type: str - lifecycle: - description: - - The bucket's lifecycle configuration. - - See U(https://developers.google.com/storage/docs/lifecycle) for more information. - returned: success - type: complex - contains: - rule: - description: - - A lifecycle management rule, which is made of an action to take and the condition(s) - under which the action will be taken. - returned: success - type: complex - contains: - action: - description: - - The action to take. - returned: success - type: complex - contains: - storageClass: - description: - - Target storage class. Required iff the type of the action is SetStorageClass. - returned: success - type: str - type: - description: - - Type of the action. Currently, only Delete and SetStorageClass are supported. - returned: success - type: str - condition: - description: - - The condition(s) under which the action will be taken. - returned: success - type: complex - contains: - ageDays: - description: - - Age of an object (in days). This condition is satisfied when an object reaches the - specified age. - returned: success - type: int - createdBefore: - description: - - A date in RFC 3339 format with only the date part (for instance, "2013-01-15"). - This condition is satisfied when an object is created before midnight of the specified - date in UTC. - returned: success - type: str - isLive: - description: - - Relevant only for versioned objects. If the value is true, this condition matches - live objects; if the value is false, it matches archived objects. - returned: success - type: bool - matchesStorageClass: - description: - - Objects having any of the storage classes specified by this condition will be matched. - Values include MULTI_REGIONAL, REGIONAL, NEARLINE, COLDLINE, STANDARD, and DURABLE_REDUCED_AVAILABILITY. - returned: success - type: list - numNewerVersions: - description: - - Relevant only for versioned objects. If the value is N, this condition is satisfied - when there are at least N versions (including the live version) newer than this - version of the object. - returned: success - type: int - location: - description: - - The location of the bucket. Object data for objects in the bucket resides in physical - storage within this region. Defaults to US. See the developer's guide for the authoritative - list. - returned: success - type: str - logging: - description: - - The bucket's logging configuration, which defines the destination bucket and optional - name prefix for the current bucket's logs. - returned: success - type: complex - contains: - logBucket: - description: - - The destination bucket where the current bucket's logs should be placed. - returned: success - type: str - logObjectPrefix: - description: - - A prefix for log object names. - returned: success - type: str - metageneration: - description: - - The metadata generation of this bucket. - returned: success - type: int - name: - description: - - The name of the bucket. - returned: success - type: str - owner: - description: - - The owner of the bucket. This is always the project team's owner group. - returned: success - type: complex - contains: - entity: - description: - - The entity, in the form project-owner-projectId. - returned: success - type: str - entityId: - description: - - The ID for the entity. - returned: success - type: str - projectNumber: - description: - - The project number of the project the bucket belongs to. - returned: success - type: int - storageClass: - description: - - The bucket's default storage class, used whenever no storageClass is specified for - a newly-created object. This defines how objects in the bucket are stored and determines - the SLA and the cost of storage. - - Values include MULTI_REGIONAL, REGIONAL, STANDARD, NEARLINE, COLDLINE, and DURABLE_REDUCED_AVAILABILITY. - If this value is not specified when the bucket is created, it will default to STANDARD. - For more information, see storage classes. - returned: success - type: str - timeCreated: - description: - - The creation time of the bucket in RFC 3339 format. - returned: success - type: str - updated: - description: - - The modification time of the bucket in RFC 3339 format. - returned: success - type: str - versioning: - description: - - The bucket's versioning configuration. - returned: success - type: complex - contains: - enabled: - description: - - While set to true, versioning is fully enabled for this bucket. - returned: success - type: bool - website: - description: - - The bucket's website configuration, controlling how the service behaves when accessing - bucket contents as a web site. See the Static Website Examples for more information. - returned: success - type: complex - contains: - mainPageSuffix: - description: - - If the requested object path is missing, the service will ensure the path has a - trailing '/', append this suffix, and attempt to retrieve the resulting object. - This allows the creation of index.html objects to represent directory pages. - returned: success - type: str - notFoundPage: - description: - - If the requested object path is missing, and any mainPageSuffix object is missing, - if applicable, the service will return the named object from this bucket as the - content for a 404 Not Found result. - returned: success - type: str - project: - description: - - A valid API project identifier. - returned: success - type: str - predefinedDefaultObjectAcl: - description: - - Apply a predefined set of default object access controls to this bucket. - - 'Acceptable values are: - "authenticatedRead": Object owner gets OWNER access, - and allAuthenticatedUsers get READER access.' - - '- "bucketOwnerFullControl": Object owner gets OWNER access, and project team - owners get OWNER access.' - - '- "bucketOwnerRead": Object owner gets OWNER access, and project team owners - get READER access.' - - '- "private": Object owner gets OWNER access.' - - '- "projectPrivate": Object owner gets OWNER access, and project team members - get access according to their roles.' - - '- "publicRead": Object owner gets OWNER access, and allUsers get READER access.' - returned: success - type: str + description: + - The ID of the access-control entry. + returned: success + type: str + projectTeam: + description: + - The project team associated with the entity. + returned: success + type: complex + contains: + projectNumber: + description: + - The project team associated with the entity. + returned: success + type: str + team: + description: + - The team. + returned: success + type: str + role: + description: + - The access permission for the entity. + returned: success + type: str +cors: + description: + - The bucket's Cross-Origin Resource Sharing (CORS) configuration. + returned: success + type: complex + contains: + maxAgeSeconds: + description: + - The value, in seconds, to return in the Access-Control-Max-Age header used + in preflight responses. + returned: success + type: int + method: + description: + - 'The list of HTTP methods on which to include CORS response headers, (GET, + OPTIONS, POST, etc) Note: "*" is permitted in the list of methods, and means + "any method".' + returned: success + type: list + origin: + description: + - The list of Origins eligible to receive CORS response headers. + - 'Note: "*" is permitted in the list of origins, and means "any Origin".' + returned: success + type: list + responseHeader: + description: + - The list of HTTP headers other than the simple response headers to give permission + for the user-agent to share across domains. + returned: success + type: list +defaultObjectAcl: + description: + - Default access controls to apply to new objects when no ACL is provided. + returned: success + type: complex + contains: + bucket: + description: + - The name of the bucket. + returned: success + type: dict + domain: + description: + - The domain associated with the entity. + returned: success + type: str + email: + description: + - The email address associated with the entity. + returned: success + type: str + entity: + description: + - 'The entity holding the permission, in one of the following forms: * user-{{userId}} + * user-{{email}} (such as "user-liz@example.com") * group-{{groupId}} * group-{{email}} + (such as "group-example@googlegroups.com") * domain-{{domain}} (such as "domain-example.com") + * project-team-{{projectId}} * allUsers * allAuthenticatedUsers .' + returned: success + type: str + entityId: + description: + - The ID for the entity. + returned: success + type: str + generation: + description: + - The content generation of the object, if applied to an object. + returned: success + type: int + id: + description: + - The ID of the access-control entry. + returned: success + type: str + object: + description: + - The name of the object, if applied to an object. + returned: success + type: str + projectTeam: + description: + - The project team associated with the entity. + returned: success + type: complex + contains: + projectNumber: + description: + - The project team associated with the entity. + returned: success + type: str + team: + description: + - The team. + returned: success + type: str + role: + description: + - The access permission for the entity. + returned: success + type: str +id: + description: + - The ID of the bucket. For buckets, the id and name properities are the same. + returned: success + type: str +lifecycle: + description: + - The bucket's lifecycle configuration. + - See U(https://developers.google.com/storage/docs/lifecycle) for more information. + returned: success + type: complex + contains: + rule: + description: + - A lifecycle management rule, which is made of an action to take and the condition(s) + under which the action will be taken. + returned: success + type: complex + contains: + action: + description: + - The action to take. + returned: success + type: complex + contains: + storageClass: + description: + - Target storage class. Required iff the type of the action is SetStorageClass. + returned: success + type: str + type: + description: + - Type of the action. Currently, only Delete and SetStorageClass are + supported. + returned: success + type: str + condition: + description: + - The condition(s) under which the action will be taken. + returned: success + type: complex + contains: + ageDays: + description: + - Age of an object (in days). This condition is satisfied when an object + reaches the specified age. + returned: success + type: int + createdBefore: + description: + - A date in RFC 3339 format with only the date part (for instance, "2013-01-15"). + This condition is satisfied when an object is created before midnight + of the specified date in UTC. + returned: success + type: str + isLive: + description: + - Relevant only for versioned objects. If the value is true, this condition + matches live objects; if the value is false, it matches archived objects. + returned: success + type: bool + matchesStorageClass: + description: + - Objects having any of the storage classes specified by this condition + will be matched. Values include MULTI_REGIONAL, REGIONAL, NEARLINE, + COLDLINE, STANDARD, and DURABLE_REDUCED_AVAILABILITY. + returned: success + type: list + numNewerVersions: + description: + - Relevant only for versioned objects. If the value is N, this condition + is satisfied when there are at least N versions (including the live + version) newer than this version of the object. + returned: success + type: int +location: + description: + - The location of the bucket. Object data for objects in the bucket resides in physical + storage within this region. Defaults to US. See the developer's guide for the + authoritative list. + returned: success + type: str +logging: + description: + - The bucket's logging configuration, which defines the destination bucket and optional + name prefix for the current bucket's logs. + returned: success + type: complex + contains: + logBucket: + description: + - The destination bucket where the current bucket's logs should be placed. + returned: success + type: str + logObjectPrefix: + description: + - A prefix for log object names. + returned: success + type: str +metageneration: + description: + - The metadata generation of this bucket. + returned: success + type: int +name: + description: + - The name of the bucket. + returned: success + type: str +owner: + description: + - The owner of the bucket. This is always the project team's owner group. + returned: success + type: complex + contains: + entity: + description: + - The entity, in the form project-owner-projectId. + returned: success + type: str + entityId: + description: + - The ID for the entity. + returned: success + type: str +projectNumber: + description: + - The project number of the project the bucket belongs to. + returned: success + type: int +storageClass: + description: + - The bucket's default storage class, used whenever no storageClass is specified + for a newly-created object. This defines how objects in the bucket are stored + and determines the SLA and the cost of storage. + - Values include MULTI_REGIONAL, REGIONAL, STANDARD, NEARLINE, COLDLINE, and DURABLE_REDUCED_AVAILABILITY. + If this value is not specified when the bucket is created, it will default to + STANDARD. For more information, see storage classes. + returned: success + type: str +timeCreated: + description: + - The creation time of the bucket in RFC 3339 format. + returned: success + type: str +updated: + description: + - The modification time of the bucket in RFC 3339 format. + returned: success + type: str +versioning: + description: + - The bucket's versioning configuration. + returned: success + type: complex + contains: + enabled: + description: + - While set to true, versioning is fully enabled for this bucket. + returned: success + type: bool +website: + description: + - The bucket's website configuration, controlling how the service behaves when accessing + bucket contents as a web site. See the Static Website Examples for more information. + returned: success + type: complex + contains: + mainPageSuffix: + description: + - If the requested object path is missing, the service will ensure the path + has a trailing '/', append this suffix, and attempt to retrieve the resulting + object. This allows the creation of index.html objects to represent directory + pages. + returned: success + type: str + notFoundPage: + description: + - If the requested object path is missing, and any mainPageSuffix object is + missing, if applicable, the service will return the named object from this + bucket as the content for a 404 Not Found result. + returned: success + type: str +project: + description: + - A valid API project identifier. + returned: success + type: str +predefinedDefaultObjectAcl: + description: + - Apply a predefined set of default object access controls to this bucket. + - 'Acceptable values are: - "authenticatedRead": Object owner gets OWNER access, + and allAuthenticatedUsers get READER access.' + - '- "bucketOwnerFullControl": Object owner gets OWNER access, and project team + owners get OWNER access.' + - '- "bucketOwnerRead": Object owner gets OWNER access, and project team owners + get READER access.' + - '- "private": Object owner gets OWNER access.' + - '- "projectPrivate": Object owner gets OWNER access, and project team members + get access according to their roles.' + - '- "publicRead": Object owner gets OWNER access, and allUsers get READER access.' + returned: success + type: str ''' ################################################################################ diff --git a/lib/ansible/modules/cloud/google/gcp_storage_bucket_access_control.py b/lib/ansible/modules/cloud/google/gcp_storage_bucket_access_control.py index 0f48f4aaf320cf..b4c3fc23af6442 100644 --- a/lib/ansible/modules/cloud/google/gcp_storage_bucket_access_control.py +++ b/lib/ansible/modules/cloud/google/gcp_storage_bucket_access_control.py @@ -32,71 +32,78 @@ --- module: gcp_storage_bucket_access_control description: - - The BucketAccessControls resource represents the Access Control Lists (ACLs) for - buckets within Google Cloud Storage. ACLs let you specify who has access to your - data and to what extent. - - 'There are three roles that can be assigned to an entity: READERs can get the bucket, - though no acl property will be returned, and list the bucket''s objects. WRITERs - are READERs, and they can insert objects into the bucket and delete the bucket''s - objects. OWNERs are WRITERs, and they can get the acl property of a bucket, update - a bucket, and call all BucketAccessControls methods on the bucket. For more information, - see Access Control, with the caveat that this API uses READER, WRITER, and OWNER - instead of READ, WRITE, and FULL_CONTROL.' +- The BucketAccessControls resource represents the Access Control Lists (ACLs) for + buckets within Google Cloud Storage. ACLs let you specify who has access to your + data and to what extent. +- 'There are three roles that can be assigned to an entity: READERs can get the bucket, + though no acl property will be returned, and list the bucket''s objects. WRITERs + are READERs, and they can insert objects into the bucket and delete the bucket''s + objects. OWNERs are WRITERs, and they can get the acl property of a bucket, update + a bucket, and call all BucketAccessControls methods on the bucket. For more information, + see Access Control, with the caveat that this API uses READER, WRITER, and OWNER + instead of READ, WRITE, and FULL_CONTROL.' short_description: Creates a GCP BucketAccessControl version_added: 2.6 author: Google Inc. (@googlecloudplatform) requirements: - - python >= 2.6 - - requests >= 2.18.4 - - google-auth >= 1.3.0 +- python >= 2.6 +- requests >= 2.18.4 +- google-auth >= 1.3.0 options: - state: + state: + description: + - Whether the given object should exist in GCP + choices: + - present + - absent + default: present + bucket: + description: + - The name of the bucket. + - 'This field represents a link to a Bucket resource in GCP. It can be specified + in two ways. You can add `register: name-of-resource` to a gcp_storage_bucket + task and then set this bucket field to "{{ name-of-resource }}" Alternatively, + you can set this bucket to a dictionary with the name key where the value is + the name of your Bucket' + required: true + entity: + description: + - 'The entity holding the permission, in one of the following forms: user-userId + user-email group-groupId group-email domain-domain project-team-projectId allUsers + allAuthenticatedUsers Examples: The user liz@example.com would be user-liz@example.com.' + - The group example@googlegroups.com would be group-example@googlegroups.com. + - To refer to all members of the Google Apps for Business domain example.com, + the entity would be domain-example.com. + required: true + entity_id: + description: + - The ID for the entity. + required: false + project_team: + description: + - The project team associated with the entity. + required: false + suboptions: + project_number: description: - - Whether the given object should exist in GCP - choices: ['present', 'absent'] - default: 'present' - bucket: - description: - - The name of the bucket. - - 'This field represents a link to a Bucket resource in GCP. It can be specified in - two ways. You can add `register: name-of-resource` to a gcp_storage_bucket task - and then set this bucket field to "{{ name-of-resource }}" Alternatively, you can - set this bucket to a dictionary with the name key where the value is the name of - your Bucket.' - required: true - entity: - description: - - 'The entity holding the permission, in one of the following forms: user-userId - user-email group-groupId group-email domain-domain project-team-projectId allUsers - allAuthenticatedUsers Examples: The user liz@example.com would be - user-liz@example.com.' - - The group example@googlegroups.com would be group-example@googlegroups.com. - - To refer to all members of the Google Apps for Business domain example.com, the - entity would be domain-example.com. - required: true - entity_id: - description: - - The ID for the entity. + - The project team associated with the entity. required: false - project_team: + team: description: - - The project team associated with the entity. + - The team. required: false - suboptions: - project_number: - description: - - The project team associated with the entity. - required: false - team: - description: - - The team. - required: false - choices: ['editors', 'owners', 'viewers'] - role: - description: - - The access permission for the entity. - required: false - choices: ['OWNER', 'READER', 'WRITER'] + choices: + - editors + - owners + - viewers + role: + description: + - The access permission for the entity. + required: false + choices: + - OWNER + - READER + - WRITER extends_documentation_fragment: gcp ''' @@ -122,63 +129,62 @@ ''' RETURN = ''' - bucket: - description: - - The name of the bucket. - returned: success - type: dict - domain: - description: - - The domain associated with the entity. - returned: success - type: str - email: - description: - - The email address associated with the entity. - returned: success - type: str - entity: - description: - - 'The entity holding the permission, in one of the following forms: user-userId - user-email group-groupId group-email domain-domain project-team-projectId allUsers - allAuthenticatedUsers Examples: The user liz@example.com would be - user-liz@example.com.' - - The group example@googlegroups.com would be group-example@googlegroups.com. - - To refer to all members of the Google Apps for Business domain example.com, the - entity would be domain-example.com. - returned: success - type: str - entityId: - description: - - The ID for the entity. - returned: success - type: str - id: - description: - - The ID of the access-control entry. - returned: success - type: str - projectTeam: - description: - - The project team associated with the entity. - returned: success - type: complex - contains: - projectNumber: - description: - - The project team associated with the entity. - returned: success - type: str - team: - description: - - The team. - returned: success - type: str - role: - description: - - The access permission for the entity. - returned: success - type: str +bucket: + description: + - The name of the bucket. + returned: success + type: dict +domain: + description: + - The domain associated with the entity. + returned: success + type: str +email: + description: + - The email address associated with the entity. + returned: success + type: str +entity: + description: + - 'The entity holding the permission, in one of the following forms: user-userId + user-email group-groupId group-email domain-domain project-team-projectId allUsers + allAuthenticatedUsers Examples: The user liz@example.com would be user-liz@example.com.' + - The group example@googlegroups.com would be group-example@googlegroups.com. + - To refer to all members of the Google Apps for Business domain example.com, the + entity would be domain-example.com. + returned: success + type: str +entityId: + description: + - The ID for the entity. + returned: success + type: str +id: + description: + - The ID of the access-control entry. + returned: success + type: str +projectTeam: + description: + - The project team associated with the entity. + returned: success + type: complex + contains: + projectNumber: + description: + - The project team associated with the entity. + returned: success + type: str + team: + description: + - The team. + returned: success + type: str +role: + description: + - The access permission for the entity. + returned: success + type: str ''' ################################################################################ From 624266e0cb205ceaf2d59000fb4e8dcefc6c7e70 Mon Sep 17 00:00:00 2001 From: Chris Stephens Date: Wed, 24 Oct 2018 19:05:06 +0000 Subject: [PATCH 052/144] Empty commit with no code changes --- .../google/gcp_compute_backend_service.py | 18 +++---- .../modules/cloud/google/gcp_compute_disk.py | 12 ++--- .../cloud/google/gcp_compute_health_check.py | 24 +++++----- .../modules/cloud/google/gcp_compute_image.py | 24 +++++----- .../cloud/google/gcp_compute_instance.py | 48 +++++++++---------- .../google/gcp_compute_instance_group.py | 6 +-- .../gcp_compute_instance_group_manager.py | 10 ++-- .../google/gcp_compute_instance_template.py | 48 +++++++++---------- .../gcp_compute_interconnect_attachment.py | 4 +- .../cloud/google/gcp_compute_network.py | 8 ++-- .../cloud/google/gcp_compute_region_disk.py | 8 ++-- .../cloud/google/gcp_compute_router.py | 6 +-- .../cloud/google/gcp_compute_subnetwork.py | 8 ++-- .../cloud/google/gcp_compute_url_map.py | 18 +++---- .../cloud/google/gcp_container_cluster.py | 30 ++++++------ .../cloud/google/gcp_container_node_pool.py | 6 +-- .../cloud/google/gcp_pubsub_subscription.py | 6 +-- .../modules/cloud/google/gcp_sql_instance.py | 34 ++++++------- .../cloud/google/gcp_storage_bucket.py | 18 +++---- .../gcp_storage_bucket_access_control.py | 6 +-- 20 files changed, 171 insertions(+), 171 deletions(-) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_backend_service.py b/lib/ansible/modules/cloud/google/gcp_compute_backend_service.py index d7ad80de27f82d..53f17b717977cd 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_backend_service.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_backend_service.py @@ -715,8 +715,8 @@ def resource_to_request(module): u'kind': 'compute#backendService', u'affinityCookieTtlSec': module.params.get('affinity_cookie_ttl_sec'), u'backends': BackendServiceBackendsArray(module.params.get('backends', []), module).to_request(), - u'cdnPolicy': BackendServiceCdnPolicy(module.params.get('cdn_policy', {}), module).to_request(), - u'connectionDraining': BackendServiceConnectionDraining(module.params.get('connection_draining', {}), module).to_request(), + u'cdnPolicy': BackendServiceCdnpolicy(module.params.get('cdn_policy', {}), module).to_request(), + u'connectionDraining': BackendServiceConnectiondraining(module.params.get('connection_draining', {}), module).to_request(), u'description': module.params.get('description'), u'enableCDN': module.params.get('enable_cdn'), u'healthChecks': module.params.get('health_checks'), @@ -795,8 +795,8 @@ def response_to_hash(module, response): return { u'affinityCookieTtlSec': response.get(u'affinityCookieTtlSec'), u'backends': BackendServiceBackendsArray(response.get(u'backends', []), module).from_response(), - u'cdnPolicy': BackendServiceCdnPolicy(response.get(u'cdnPolicy', {}), module).from_response(), - u'connectionDraining': BackendServiceConnectionDraining(response.get(u'connectionDraining', {}), module).from_response(), + u'cdnPolicy': BackendServiceCdnpolicy(response.get(u'cdnPolicy', {}), module).from_response(), + u'connectionDraining': BackendServiceConnectiondraining(response.get(u'connectionDraining', {}), module).from_response(), u'creationTimestamp': response.get(u'creationTimestamp'), u'description': response.get(u'description'), u'enableCDN': response.get(u'enableCDN'), @@ -906,7 +906,7 @@ def _response_from_item(self, item): }) -class BackendServiceCdnPolicy(object): +class BackendServiceCdnpolicy(object): def __init__(self, request, module): self.module = module if request: @@ -916,16 +916,16 @@ def __init__(self, request, module): def to_request(self): return remove_nones_from_dict({ - u'cacheKeyPolicy': BackendServiceCacheKeyPolicy(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): return remove_nones_from_dict({ - u'cacheKeyPolicy': BackendServiceCacheKeyPolicy(self.request.get(u'cacheKeyPolicy', {}), self.module).from_response() + u'cacheKeyPolicy': BackendServiceCachekeypolicy(self.request.get(u'cacheKeyPolicy', {}), self.module).from_response() }) -class BackendServiceCacheKeyPolicy(object): +class BackendServiceCachekeypolicy(object): def __init__(self, request, module): self.module = module if request: @@ -952,7 +952,7 @@ def from_response(self): }) -class BackendServiceConnectionDraining(object): +class BackendServiceConnectiondraining(object): def __init__(self, request, module): self.module = module if request: diff --git a/lib/ansible/modules/cloud/google/gcp_compute_disk.py b/lib/ansible/modules/cloud/google/gcp_compute_disk.py index 46913ae4c65e4f..c139a533d8abc1 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_disk.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_disk.py @@ -510,9 +510,9 @@ def delete(module, link, kind): def resource_to_request(module): request = { u'kind': 'compute#disk', - u'sourceImageEncryptionKey': DiskSourceImageEncryptionKey(module.params.get('source_image_encryption_key', {}), module).to_request(), - u'diskEncryptionKey': DiskDiskEncryptionKey(module.params.get('disk_encryption_key', {}), module).to_request(), - u'sourceSnapshotEncryptionKey': DiskSourceSnapshotEncryptionKey(module.params.get('source_snapshot_encryption_key', {}), module).to_request(), + u'sourceImageEncryptionKey': DiskSourceimageencryptionkey(module.params.get('source_image_encryption_key', {}), module).to_request(), + u'diskEncryptionKey': DiskDiskencryptionkey(module.params.get('disk_encryption_key', {}), module).to_request(), + u'sourceSnapshotEncryptionKey': DiskSourcesnapshotencryptionkey(module.params.get('source_snapshot_encryption_key', {}), module).to_request(), u'description': module.params.get('description'), u'labels': module.params.get('labels'), u'licenses': module.params.get('licenses'), @@ -647,7 +647,7 @@ def raise_if_errors(response, err_path, module): module.fail_json(msg=errors) -class DiskSourceImageEncryptionKey(object): +class DiskSourceimageencryptionkey(object): def __init__(self, request, module): self.module = module if request: @@ -668,7 +668,7 @@ def from_response(self): }) -class DiskDiskEncryptionKey(object): +class DiskDiskencryptionkey(object): def __init__(self, request, module): self.module = module if request: @@ -689,7 +689,7 @@ def from_response(self): }) -class DiskSourceSnapshotEncryptionKey(object): +class DiskSourcesnapshotencryptionkey(object): def __init__(self, request, module): self.module = module if request: 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 eba7560580ca95..6c80fb88a1cf55 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_health_check.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_health_check.py @@ -598,10 +598,10 @@ def resource_to_request(module): u'timeoutSec': module.params.get('timeout_sec'), u'unhealthyThreshold': module.params.get('unhealthy_threshold'), u'type': module.params.get('type'), - u'httpHealthCheck': HealthCheckHttpHealthCheck(module.params.get('http_health_check', {}), module).to_request(), - u'httpsHealthCheck': HealthCheckHttpsHealthCheck(module.params.get('https_health_check', {}), module).to_request(), - u'tcpHealthCheck': HealthCheckTcpHealthCheck(module.params.get('tcp_health_check', {}), module).to_request(), - u'sslHealthCheck': HealthCheckSslHealthCheck(module.params.get('ssl_health_check', {}), module).to_request() + u'httpHealthCheck': HealthCheckHttphealthcheck(module.params.get('http_health_check', {}), module).to_request(), + u'httpsHealthCheck': HealthCheckHttpshealthcheck(module.params.get('https_health_check', {}), module).to_request(), + u'tcpHealthCheck': HealthCheckTcphealthcheck(module.params.get('tcp_health_check', {}), module).to_request(), + u'sslHealthCheck': HealthCheckSslhealthcheck(module.params.get('ssl_health_check', {}), module).to_request() } return_vals = {} for k, v in request.items(): @@ -676,10 +676,10 @@ def response_to_hash(module, response): u'timeoutSec': response.get(u'timeoutSec'), u'unhealthyThreshold': response.get(u'unhealthyThreshold'), u'type': response.get(u'type'), - u'httpHealthCheck': HealthCheckHttpHealthCheck(response.get(u'httpHealthCheck', {}), module).from_response(), - u'httpsHealthCheck': HealthCheckHttpsHealthCheck(response.get(u'httpsHealthCheck', {}), module).from_response(), - u'tcpHealthCheck': HealthCheckTcpHealthCheck(response.get(u'tcpHealthCheck', {}), module).from_response(), - u'sslHealthCheck': HealthCheckSslHealthCheck(response.get(u'sslHealthCheck', {}), module).from_response() + u'httpHealthCheck': HealthCheckHttphealthcheck(response.get(u'httpHealthCheck', {}), module).from_response(), + u'httpsHealthCheck': HealthCheckHttpshealthcheck(response.get(u'httpsHealthCheck', {}), module).from_response(), + u'tcpHealthCheck': HealthCheckTcphealthcheck(response.get(u'tcpHealthCheck', {}), module).from_response(), + u'sslHealthCheck': HealthCheckSslhealthcheck(response.get(u'sslHealthCheck', {}), module).from_response() } @@ -720,7 +720,7 @@ def raise_if_errors(response, err_path, module): module.fail_json(msg=errors) -class HealthCheckHttpHealthCheck(object): +class HealthCheckHttphealthcheck(object): def __init__(self, request, module): self.module = module if request: @@ -747,7 +747,7 @@ def from_response(self): }) -class HealthCheckHttpsHealthCheck(object): +class HealthCheckHttpshealthcheck(object): def __init__(self, request, module): self.module = module if request: @@ -774,7 +774,7 @@ def from_response(self): }) -class HealthCheckTcpHealthCheck(object): +class HealthCheckTcphealthcheck(object): def __init__(self, request, module): self.module = module if request: @@ -801,7 +801,7 @@ def from_response(self): }) -class HealthCheckSslHealthCheck(object): +class HealthCheckSslhealthcheck(object): def __init__(self, request, module): self.module = module if request: diff --git a/lib/ansible/modules/cloud/google/gcp_compute_image.py b/lib/ansible/modules/cloud/google/gcp_compute_image.py index 145d3cee0c9e30..948c96b097412c 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_image.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_image.py @@ -508,13 +508,13 @@ def resource_to_request(module): u'description': module.params.get('description'), u'diskSizeGb': module.params.get('disk_size_gb'), u'family': module.params.get('family'), - u'guestOsFeatures': ImageGuestOsFeaturesArray(module.params.get('guest_os_features', []), module).to_request(), - u'imageEncryptionKey': ImageImageEncryptionKey(module.params.get('image_encryption_key', {}), module).to_request(), + u'guestOsFeatures': ImageGuestosfeaturesArray(module.params.get('guest_os_features', []), module).to_request(), + u'imageEncryptionKey': ImageImageencryptionkey(module.params.get('image_encryption_key', {}), module).to_request(), u'licenses': module.params.get('licenses'), u'name': module.params.get('name'), - u'rawDisk': ImageRawDisk(module.params.get('raw_disk', {}), module).to_request(), + u'rawDisk': ImageRawdisk(module.params.get('raw_disk', {}), module).to_request(), u'sourceDisk': replace_resource_dict(module.params.get(u'source_disk', {}), 'selfLink'), - u'sourceDiskEncryptionKey': ImageSourceDiskEncryptionKey(module.params.get('source_disk_encryption_key', {}), module).to_request(), + u'sourceDiskEncryptionKey': ImageSourcediskencryptionkey(module.params.get('source_disk_encryption_key', {}), module).to_request(), u'sourceDiskId': module.params.get('source_disk_id'), u'sourceType': module.params.get('source_type') } @@ -588,14 +588,14 @@ def response_to_hash(module, response): u'description': response.get(u'description'), u'diskSizeGb': response.get(u'diskSizeGb'), u'family': response.get(u'family'), - u'guestOsFeatures': ImageGuestOsFeaturesArray(response.get(u'guestOsFeatures', []), module).from_response(), + u'guestOsFeatures': ImageGuestosfeaturesArray(response.get(u'guestOsFeatures', []), module).from_response(), u'id': response.get(u'id'), - u'imageEncryptionKey': ImageImageEncryptionKey(response.get(u'imageEncryptionKey', {}), module).from_response(), + u'imageEncryptionKey': ImageImageencryptionkey(response.get(u'imageEncryptionKey', {}), module).from_response(), u'licenses': response.get(u'licenses'), u'name': response.get(u'name'), - u'rawDisk': ImageRawDisk(response.get(u'rawDisk', {}), module).from_response(), + u'rawDisk': ImageRawdisk(response.get(u'rawDisk', {}), module).from_response(), u'sourceDisk': response.get(u'sourceDisk'), - u'sourceDiskEncryptionKey': ImageSourceDiskEncryptionKey(response.get(u'sourceDiskEncryptionKey', {}), module).from_response(), + u'sourceDiskEncryptionKey': ImageSourcediskencryptionkey(response.get(u'sourceDiskEncryptionKey', {}), module).from_response(), u'sourceDiskId': response.get(u'sourceDiskId'), u'sourceType': response.get(u'sourceType') } @@ -665,7 +665,7 @@ def from_response(self): }) -class ImageGuestOsFeaturesArray(object): +class ImageGuestosfeaturesArray(object): def __init__(self, request, module): self.module = module if request: @@ -696,7 +696,7 @@ def _response_from_item(self, item): }) -class ImageImageEncryptionKey(object): +class ImageImageencryptionkey(object): def __init__(self, request, module): self.module = module if request: @@ -717,7 +717,7 @@ def from_response(self): }) -class ImageRawDisk(object): +class ImageRawdisk(object): def __init__(self, request, module): self.module = module if request: @@ -740,7 +740,7 @@ def from_response(self): }) -class ImageSourceDiskEncryptionKey(object): +class ImageSourcediskencryptionkey(object): def __init__(self, request, module): self.module = module if request: diff --git a/lib/ansible/modules/cloud/google/gcp_compute_instance.py b/lib/ansible/modules/cloud/google/gcp_compute_instance.py index 106f2bf28a23e3..70054bd6bc728f 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_instance.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_instance.py @@ -1011,15 +1011,15 @@ def resource_to_request(module): u'kind': 'compute#instance', u'canIpForward': module.params.get('can_ip_forward'), u'disks': InstanceDisksArray(module.params.get('disks', []), module).to_request(), - u'guestAccelerators': InstanceGuestAcceleratorsArray(module.params.get('guest_accelerators', []), module).to_request(), + u'guestAccelerators': InstanceGuestacceleratorsArray(module.params.get('guest_accelerators', []), module).to_request(), u'labelFingerprint': module.params.get('label_fingerprint'), u'metadata': module.params.get('metadata'), u'machineType': machine_type_selflink(module.params.get('machine_type'), module.params), u'minCpuPlatform': module.params.get('min_cpu_platform'), u'name': module.params.get('name'), - u'networkInterfaces': InstanceNetworkInterfacesArray(module.params.get('network_interfaces', []), module).to_request(), + u'networkInterfaces': InstanceNetworkinterfacesArray(module.params.get('network_interfaces', []), module).to_request(), u'scheduling': InstanceScheduling(module.params.get('scheduling', {}), module).to_request(), - u'serviceAccounts': InstanceServiceAccountsArray(module.params.get('service_accounts', []), module).to_request(), + u'serviceAccounts': InstanceServiceaccountsArray(module.params.get('service_accounts', []), module).to_request(), u'tags': InstanceTags(module.params.get('tags', {}), module).to_request() } request = encode_request(request, module) @@ -1094,16 +1094,16 @@ def response_to_hash(module, response): u'cpuPlatform': response.get(u'cpuPlatform'), u'creationTimestamp': response.get(u'creationTimestamp'), u'disks': InstanceDisksArray(module.params.get('disks', []), module).to_request(), - u'guestAccelerators': InstanceGuestAcceleratorsArray(response.get(u'guestAccelerators', []), module).from_response(), + u'guestAccelerators': InstanceGuestacceleratorsArray(response.get(u'guestAccelerators', []), module).from_response(), u'id': response.get(u'id'), u'labelFingerprint': response.get(u'labelFingerprint'), u'metadata': response.get(u'metadata'), u'machineType': response.get(u'machineType'), u'minCpuPlatform': response.get(u'minCpuPlatform'), u'name': response.get(u'name'), - u'networkInterfaces': InstanceNetworkInterfacesArray(response.get(u'networkInterfaces', []), module).from_response(), + u'networkInterfaces': InstanceNetworkinterfacesArray(response.get(u'networkInterfaces', []), module).from_response(), u'scheduling': InstanceScheduling(response.get(u'scheduling', {}), module).from_response(), - u'serviceAccounts': InstanceServiceAccountsArray(response.get(u'serviceAccounts', []), module).from_response(), + u'serviceAccounts': InstanceServiceaccountsArray(response.get(u'serviceAccounts', []), module).from_response(), u'status': response.get(u'status'), u'statusMessage': response.get(u'statusMessage'), u'tags': InstanceTags(response.get(u'tags', {}), module).from_response() @@ -1241,9 +1241,9 @@ def _request_for_item(self, item): u'autoDelete': item.get('auto_delete'), u'boot': item.get('boot'), u'deviceName': item.get('device_name'), - u'diskEncryptionKey': InstanceDiskEncryptionKey(item.get('disk_encryption_key', {}), self.module).to_request(), + u'diskEncryptionKey': InstanceDiskencryptionkey(item.get('disk_encryption_key', {}), self.module).to_request(), u'index': item.get('index'), - u'initializeParams': InstanceInitializeParams(item.get('initialize_params', {}), self.module).to_request(), + u'initializeParams': InstanceInitializeparams(item.get('initialize_params', {}), self.module).to_request(), u'interface': item.get('interface'), u'mode': item.get('mode'), u'source': replace_resource_dict(item.get(u'source', {}), 'selfLink'), @@ -1255,9 +1255,9 @@ def _response_from_item(self, item): u'autoDelete': item.get(u'autoDelete'), u'boot': item.get(u'boot'), u'deviceName': item.get(u'deviceName'), - u'diskEncryptionKey': InstanceDiskEncryptionKey(item.get(u'diskEncryptionKey', {}), self.module).from_response(), + u'diskEncryptionKey': InstanceDiskencryptionkey(item.get(u'diskEncryptionKey', {}), self.module).from_response(), u'index': item.get(u'index'), - u'initializeParams': InstanceInitializeParams(self.module.params.get('initialize_params', {}), self.module).to_request(), + u'initializeParams': InstanceInitializeparams(self.module.params.get('initialize_params', {}), self.module).to_request(), u'interface': item.get(u'interface'), u'mode': item.get(u'mode'), u'source': item.get(u'source'), @@ -1265,7 +1265,7 @@ def _response_from_item(self, item): }) -class InstanceDiskEncryptionKey(object): +class InstanceDiskencryptionkey(object): def __init__(self, request, module): self.module = module if request: @@ -1288,7 +1288,7 @@ def from_response(self): }) -class InstanceInitializeParams(object): +class InstanceInitializeparams(object): def __init__(self, request, module): self.module = module if request: @@ -1302,7 +1302,7 @@ def to_request(self): u'diskSizeGb': self.request.get('disk_size_gb'), u'diskType': disk_type_selflink(self.request.get('disk_type'), self.module.params), u'sourceImage': self.request.get('source_image'), - u'sourceImageEncryptionKey': InstanceSourceImageEncryptionKey(self.request.get('source_image_encryption_key', {}), self.module).to_request() + u'sourceImageEncryptionKey': InstanceSourceimageencryptionkey(self.request.get('source_image_encryption_key', {}), self.module).to_request() }) def from_response(self): @@ -1311,11 +1311,11 @@ def from_response(self): u'diskSizeGb': self.request.get(u'diskSizeGb'), u'diskType': self.request.get(u'diskType'), u'sourceImage': self.request.get(u'sourceImage'), - u'sourceImageEncryptionKey': InstanceSourceImageEncryptionKey(self.request.get(u'sourceImageEncryptionKey', {}), self.module).from_response() + u'sourceImageEncryptionKey': InstanceSourceimageencryptionkey(self.request.get(u'sourceImageEncryptionKey', {}), self.module).from_response() }) -class InstanceSourceImageEncryptionKey(object): +class InstanceSourceimageencryptionkey(object): def __init__(self, request, module): self.module = module if request: @@ -1336,7 +1336,7 @@ def from_response(self): }) -class InstanceGuestAcceleratorsArray(object): +class InstanceGuestacceleratorsArray(object): def __init__(self, request, module): self.module = module if request: @@ -1369,7 +1369,7 @@ def _response_from_item(self, item): }) -class InstanceNetworkInterfacesArray(object): +class InstanceNetworkinterfacesArray(object): def __init__(self, request, module): self.module = module if request: @@ -1391,8 +1391,8 @@ def from_response(self): def _request_for_item(self, item): return remove_nones_from_dict({ - u'accessConfigs': InstanceAccessConfigsArray(item.get('access_configs', []), self.module).to_request(), - u'aliasIpRanges': InstanceAliasIpRangesArray(item.get('alias_ip_ranges', []), self.module).to_request(), + u'accessConfigs': InstanceAccessconfigsArray(item.get('access_configs', []), self.module).to_request(), + u'aliasIpRanges': InstanceAliasiprangesArray(item.get('alias_ip_ranges', []), self.module).to_request(), u'name': item.get('name'), u'network': replace_resource_dict(item.get(u'network', {}), 'selfLink'), u'networkIP': item.get('network_ip'), @@ -1401,8 +1401,8 @@ def _request_for_item(self, item): def _response_from_item(self, item): return remove_nones_from_dict({ - u'accessConfigs': InstanceAccessConfigsArray(item.get(u'accessConfigs', []), self.module).from_response(), - u'aliasIpRanges': InstanceAliasIpRangesArray(item.get(u'aliasIpRanges', []), self.module).from_response(), + u'accessConfigs': InstanceAccessconfigsArray(item.get(u'accessConfigs', []), self.module).from_response(), + u'aliasIpRanges': InstanceAliasiprangesArray(item.get(u'aliasIpRanges', []), self.module).from_response(), u'name': item.get(u'name'), u'network': item.get(u'network'), u'networkIP': item.get(u'networkIP'), @@ -1410,7 +1410,7 @@ def _response_from_item(self, item): }) -class InstanceAccessConfigsArray(object): +class InstanceAccessconfigsArray(object): def __init__(self, request, module): self.module = module if request: @@ -1445,7 +1445,7 @@ def _response_from_item(self, item): }) -class InstanceAliasIpRangesArray(object): +class InstanceAliasiprangesArray(object): def __init__(self, request, module): self.module = module if request: @@ -1501,7 +1501,7 @@ def from_response(self): }) -class InstanceServiceAccountsArray(object): +class InstanceServiceaccountsArray(object): def __init__(self, request, module): self.module = module if request: diff --git a/lib/ansible/modules/cloud/google/gcp_compute_instance_group.py b/lib/ansible/modules/cloud/google/gcp_compute_instance_group.py index b12100e25f47c0..18ef11b69b0284 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_instance_group.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_instance_group.py @@ -307,7 +307,7 @@ def resource_to_request(module): u'kind': 'compute#instanceGroup', u'description': module.params.get('description'), u'name': module.params.get('name'), - u'namedPorts': InstanceGroupNamedPortsArray(module.params.get('named_ports', []), module).to_request(), + u'namedPorts': InstanceGroupNamedportsArray(module.params.get('named_ports', []), module).to_request(), u'network': replace_resource_dict(module.params.get(u'network', {}), 'selfLink'), u'region': region_selflink(module.params.get('region'), module.params), u'subnetwork': replace_resource_dict(module.params.get(u'subnetwork', {}), 'selfLink') @@ -380,7 +380,7 @@ def response_to_hash(module, response): u'description': response.get(u'description'), u'id': response.get(u'id'), u'name': response.get(u'name'), - u'namedPorts': InstanceGroupNamedPortsArray(response.get(u'namedPorts', []), module).from_response(), + u'namedPorts': InstanceGroupNamedportsArray(response.get(u'namedPorts', []), module).from_response(), u'network': response.get(u'network'), u'region': response.get(u'region'), u'subnetwork': response.get(u'subnetwork') @@ -493,7 +493,7 @@ def _build_request(self, instances): return request -class InstanceGroupNamedPortsArray(object): +class InstanceGroupNamedportsArray(object): def __init__(self, request, module): self.module = module if request: diff --git a/lib/ansible/modules/cloud/google/gcp_compute_instance_group_manager.py b/lib/ansible/modules/cloud/google/gcp_compute_instance_group_manager.py index 9bdc1cdbbbea8f..abfee18d668a75 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_instance_group_manager.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_instance_group_manager.py @@ -405,7 +405,7 @@ def resource_to_request(module): u'description': module.params.get('description'), u'instanceTemplate': replace_resource_dict(module.params.get(u'instance_template', {}), 'selfLink'), u'name': module.params.get('name'), - u'namedPorts': InstanceGroupManagerNamedPortsArray(module.params.get('named_ports', []), module).to_request(), + u'namedPorts': InstanceGroupManagerNamedportsArray(module.params.get('named_ports', []), module).to_request(), u'targetPools': replace_resource_dict(module.params.get('target_pools', []), 'selfLink'), u'targetSize': module.params.get('target_size') } @@ -475,13 +475,13 @@ def response_to_hash(module, response): return { u'baseInstanceName': response.get(u'baseInstanceName'), u'creationTimestamp': response.get(u'creationTimestamp'), - u'currentActions': InstanceGroupManagerCurrentActions(response.get(u'currentActions', {}), module).from_response(), + u'currentActions': InstanceGroupManagerCurrentactions(response.get(u'currentActions', {}), module).from_response(), u'description': module.params.get('description'), u'id': response.get(u'id'), u'instanceGroup': response.get(u'instanceGroup'), u'instanceTemplate': response.get(u'instanceTemplate'), u'name': response.get(u'name'), - u'namedPorts': InstanceGroupManagerNamedPortsArray(response.get(u'namedPorts', []), module).from_response(), + u'namedPorts': InstanceGroupManagerNamedportsArray(response.get(u'namedPorts', []), module).from_response(), u'region': response.get(u'region'), u'targetPools': response.get(u'targetPools'), u'targetSize': response.get(u'targetSize') @@ -534,7 +534,7 @@ def raise_if_errors(response, err_path, module): module.fail_json(msg=errors) -class InstanceGroupManagerCurrentActions(object): +class InstanceGroupManagerCurrentactions(object): def __init__(self, request, module): self.module = module if request: @@ -567,7 +567,7 @@ def from_response(self): }) -class InstanceGroupManagerNamedPortsArray(object): +class InstanceGroupManagerNamedportsArray(object): def __init__(self, request, module): self.module = module if request: diff --git a/lib/ansible/modules/cloud/google/gcp_compute_instance_template.py b/lib/ansible/modules/cloud/google/gcp_compute_instance_template.py index b26273b93b2071..3976435c7e9463 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_instance_template.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_instance_template.py @@ -1164,10 +1164,10 @@ def to_request(self): u'disks': InstanceTemplateDisksArray(self.request.get('disks', []), self.module).to_request(), u'machineType': self.request.get('machine_type'), u'metadata': self.request.get('metadata'), - u'guestAccelerators': InstanceTemplateGuestAcceleratorsArray(self.request.get('guest_accelerators', []), self.module).to_request(), - u'networkInterfaces': InstanceTemplateNetworkInterfacesArray(self.request.get('network_interfaces', []), self.module).to_request(), + u'guestAccelerators': InstanceTemplateGuestacceleratorsArray(self.request.get('guest_accelerators', []), self.module).to_request(), + u'networkInterfaces': InstanceTemplateNetworkinterfacesArray(self.request.get('network_interfaces', []), self.module).to_request(), u'scheduling': InstanceTemplateScheduling(self.request.get('scheduling', {}), self.module).to_request(), - u'serviceAccounts': InstanceTemplateServiceAccountsArray(self.request.get('service_accounts', []), self.module).to_request(), + u'serviceAccounts': InstanceTemplateServiceaccountsArray(self.request.get('service_accounts', []), self.module).to_request(), u'tags': InstanceTemplateTags(self.request.get('tags', {}), self.module).to_request() }) @@ -1178,10 +1178,10 @@ def from_response(self): u'disks': InstanceTemplateDisksArray(self.request.get(u'disks', []), self.module).from_response(), u'machineType': self.request.get(u'machineType'), u'metadata': self.request.get(u'metadata'), - u'guestAccelerators': InstanceTemplateGuestAcceleratorsArray(self.request.get(u'guestAccelerators', []), self.module).from_response(), - u'networkInterfaces': InstanceTemplateNetworkInterfacesArray(self.request.get(u'networkInterfaces', []), self.module).from_response(), + u'guestAccelerators': InstanceTemplateGuestacceleratorsArray(self.request.get(u'guestAccelerators', []), self.module).from_response(), + u'networkInterfaces': InstanceTemplateNetworkinterfacesArray(self.request.get(u'networkInterfaces', []), self.module).from_response(), u'scheduling': InstanceTemplateScheduling(self.request.get(u'scheduling', {}), self.module).from_response(), - u'serviceAccounts': InstanceTemplateServiceAccountsArray(self.request.get(u'serviceAccounts', []), self.module).from_response(), + u'serviceAccounts': InstanceTemplateServiceaccountsArray(self.request.get(u'serviceAccounts', []), self.module).from_response(), u'tags': InstanceTemplateTags(self.request.get(u'tags', {}), self.module).from_response() }) @@ -1211,9 +1211,9 @@ def _request_for_item(self, item): u'autoDelete': item.get('auto_delete'), u'boot': item.get('boot'), u'deviceName': item.get('device_name'), - u'diskEncryptionKey': InstanceTemplateDiskEncryptionKey(item.get('disk_encryption_key', {}), self.module).to_request(), + u'diskEncryptionKey': InstanceTemplateDiskencryptionkey(item.get('disk_encryption_key', {}), self.module).to_request(), u'index': item.get('index'), - u'initializeParams': InstanceTemplateInitializeParams(item.get('initialize_params', {}), self.module).to_request(), + u'initializeParams': InstanceTemplateInitializeparams(item.get('initialize_params', {}), self.module).to_request(), u'interface': item.get('interface'), u'mode': item.get('mode'), u'source': replace_resource_dict(item.get(u'source', {}), 'name'), @@ -1225,9 +1225,9 @@ def _response_from_item(self, item): u'autoDelete': item.get(u'autoDelete'), u'boot': item.get(u'boot'), u'deviceName': item.get(u'deviceName'), - u'diskEncryptionKey': InstanceTemplateDiskEncryptionKey(item.get(u'diskEncryptionKey', {}), self.module).from_response(), + u'diskEncryptionKey': InstanceTemplateDiskencryptionkey(item.get(u'diskEncryptionKey', {}), self.module).from_response(), u'index': item.get(u'index'), - u'initializeParams': InstanceTemplateInitializeParams(self.module.params.get('initialize_params', {}), self.module).to_request(), + u'initializeParams': InstanceTemplateInitializeparams(self.module.params.get('initialize_params', {}), self.module).to_request(), u'interface': item.get(u'interface'), u'mode': item.get(u'mode'), u'source': item.get(u'source'), @@ -1235,7 +1235,7 @@ def _response_from_item(self, item): }) -class InstanceTemplateDiskEncryptionKey(object): +class InstanceTemplateDiskencryptionkey(object): def __init__(self, request, module): self.module = module if request: @@ -1258,7 +1258,7 @@ def from_response(self): }) -class InstanceTemplateInitializeParams(object): +class InstanceTemplateInitializeparams(object): def __init__(self, request, module): self.module = module if request: @@ -1272,7 +1272,7 @@ def to_request(self): u'diskSizeGb': self.request.get('disk_size_gb'), u'diskType': disk_type_selflink(self.request.get('disk_type'), self.module.params), u'sourceImage': self.request.get('source_image'), - u'sourceImageEncryptionKey': InstanceTemplateSourceImageEncryptionKey(self.request.get('source_image_encryption_key', {}), self.module).to_request() + u'sourceImageEncryptionKey': InstanceTemplateSourceimageencryptionkey(self.request.get('source_image_encryption_key', {}), self.module).to_request() }) def from_response(self): @@ -1282,11 +1282,11 @@ def from_response(self): u'diskType': self.request.get(u'diskType'), u'sourceImage': self.request.get(u'sourceImage'), u'sourceImageEncryptionKey': - InstanceTemplateSourceImageEncryptionKey(self.request.get(u'sourceImageEncryptionKey', {}), self.module).from_response() + InstanceTemplateSourceimageencryptionkey(self.request.get(u'sourceImageEncryptionKey', {}), self.module).from_response() }) -class InstanceTemplateSourceImageEncryptionKey(object): +class InstanceTemplateSourceimageencryptionkey(object): def __init__(self, request, module): self.module = module if request: @@ -1307,7 +1307,7 @@ def from_response(self): }) -class InstanceTemplateGuestAcceleratorsArray(object): +class InstanceTemplateGuestacceleratorsArray(object): def __init__(self, request, module): self.module = module if request: @@ -1340,7 +1340,7 @@ def _response_from_item(self, item): }) -class InstanceTemplateNetworkInterfacesArray(object): +class InstanceTemplateNetworkinterfacesArray(object): def __init__(self, request, module): self.module = module if request: @@ -1362,8 +1362,8 @@ def from_response(self): def _request_for_item(self, item): return remove_nones_from_dict({ - u'accessConfigs': InstanceTemplateAccessConfigsArray(item.get('access_configs', []), self.module).to_request(), - u'aliasIpRanges': InstanceTemplateAliasIpRangesArray(item.get('alias_ip_ranges', []), self.module).to_request(), + u'accessConfigs': InstanceTemplateAccessconfigsArray(item.get('access_configs', []), self.module).to_request(), + u'aliasIpRanges': InstanceTemplateAliasiprangesArray(item.get('alias_ip_ranges', []), self.module).to_request(), u'name': item.get('name'), u'network': replace_resource_dict(item.get(u'network', {}), 'selfLink'), u'networkIP': item.get('network_ip'), @@ -1372,8 +1372,8 @@ def _request_for_item(self, item): def _response_from_item(self, item): return remove_nones_from_dict({ - u'accessConfigs': InstanceTemplateAccessConfigsArray(item.get(u'accessConfigs', []), self.module).from_response(), - u'aliasIpRanges': InstanceTemplateAliasIpRangesArray(item.get(u'aliasIpRanges', []), self.module).from_response(), + u'accessConfigs': InstanceTemplateAccessconfigsArray(item.get(u'accessConfigs', []), self.module).from_response(), + u'aliasIpRanges': InstanceTemplateAliasiprangesArray(item.get(u'aliasIpRanges', []), self.module).from_response(), u'name': item.get(u'name'), u'network': item.get(u'network'), u'networkIP': item.get(u'networkIP'), @@ -1381,7 +1381,7 @@ def _response_from_item(self, item): }) -class InstanceTemplateAccessConfigsArray(object): +class InstanceTemplateAccessconfigsArray(object): def __init__(self, request, module): self.module = module if request: @@ -1416,7 +1416,7 @@ def _response_from_item(self, item): }) -class InstanceTemplateAliasIpRangesArray(object): +class InstanceTemplateAliasiprangesArray(object): def __init__(self, request, module): self.module = module if request: @@ -1472,7 +1472,7 @@ def from_response(self): }) -class InstanceTemplateServiceAccountsArray(object): +class InstanceTemplateServiceaccountsArray(object): def __init__(self, request, module): self.module = module if request: diff --git a/lib/ansible/modules/cloud/google/gcp_compute_interconnect_attachment.py b/lib/ansible/modules/cloud/google/gcp_compute_interconnect_attachment.py index b11a094b50a20d..d9e91f4c6031bc 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_interconnect_attachment.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_interconnect_attachment.py @@ -327,7 +327,7 @@ def response_to_hash(module, response): u'customerRouterIpAddress': response.get(u'customerRouterIpAddress'), u'interconnect': response.get(u'interconnect'), u'description': response.get(u'description'), - u'privateInterconnectInfo': InterconnectAttachmentPrivateInterconnectInfo(response.get(u'privateInterconnectInfo', {}), module).from_response(), + u'privateInterconnectInfo': InterconnectAttachmentPrivateinterconnectinfo(response.get(u'privateInterconnectInfo', {}), module).from_response(), u'googleReferenceId': response.get(u'googleReferenceId'), u'router': response.get(u'router'), u'creationTimestamp': response.get(u'creationTimestamp'), @@ -382,7 +382,7 @@ def raise_if_errors(response, err_path, module): module.fail_json(msg=errors) -class InterconnectAttachmentPrivateInterconnectInfo(object): +class InterconnectAttachmentPrivateinterconnectinfo(object): def __init__(self, request, module): self.module = module if request: diff --git a/lib/ansible/modules/cloud/google/gcp_compute_network.py b/lib/ansible/modules/cloud/google/gcp_compute_network.py index e4d52c9dd19250..3dadbf13988604 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_network.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_network.py @@ -278,7 +278,7 @@ def routing_config_update(module, request, response): "projects/{project}/regions/{region}/subnetworks/{name}" ]).format(**module.params), { - u'routingConfig': NetworkRoutingConfigArray(module.params.get('routing_config', []), module).to_request() + u'routingConfig': NetworkRoutingconfigArray(module.params.get('routing_config', []), module).to_request() } ) @@ -295,7 +295,7 @@ def resource_to_request(module): u'IPv4Range': module.params.get('ipv4_range'), u'name': module.params.get('name'), u'autoCreateSubnetworks': module.params.get('auto_create_subnetworks'), - u'routingConfig': NetworkRoutingConfigArray(module.params.get('routing_config', []), module).to_request() + u'routingConfig': NetworkRoutingconfigArray(module.params.get('routing_config', []), module).to_request() } return_vals = {} for k, v in request.items(): @@ -369,7 +369,7 @@ def response_to_hash(module, response): u'subnetworks': response.get(u'subnetworks'), u'autoCreateSubnetworks': module.params.get('auto_create_subnetworks'), u'creationTimestamp': response.get(u'creationTimestamp'), - u'routingConfig': NetworkRoutingConfigArray(response.get(u'routingConfig', []), module).from_response() + u'routingConfig': NetworkRoutingconfigArray(response.get(u'routingConfig', []), module).from_response() } @@ -410,7 +410,7 @@ def raise_if_errors(response, err_path, module): module.fail_json(msg=errors) -class NetworkRoutingConfigArray(object): +class NetworkRoutingconfigArray(object): def __init__(self, request, module): self.module = module if request: diff --git a/lib/ansible/modules/cloud/google/gcp_compute_region_disk.py b/lib/ansible/modules/cloud/google/gcp_compute_region_disk.py index efa4603da9dc47..7847fb218d2597 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_region_disk.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_region_disk.py @@ -443,8 +443,8 @@ def delete(module, link, kind): def resource_to_request(module): request = { u'kind': 'compute#disk', - u'diskEncryptionKey': RegionDiskDiskEncryptionKey(module.params.get('disk_encryption_key', {}), module).to_request(), - u'sourceSnapshotEncryptionKey': RegionDiskSourceSnapshotEncryptionKey(module.params.get('source_snapshot_encryption_key', {}), module).to_request(), + u'diskEncryptionKey': RegionDiskDiskencryptionkey(module.params.get('disk_encryption_key', {}), module).to_request(), + u'sourceSnapshotEncryptionKey': RegionDiskSourcesnapshotencryptionkey(module.params.get('source_snapshot_encryption_key', {}), module).to_request(), u'description': module.params.get('description'), u'labels': module.params.get('labels'), u'licenses': module.params.get('licenses'), @@ -588,7 +588,7 @@ def raise_if_errors(response, err_path, module): module.fail_json(msg=errors) -class RegionDiskDiskEncryptionKey(object): +class RegionDiskDiskencryptionkey(object): def __init__(self, request, module): self.module = module if request: @@ -609,7 +609,7 @@ def from_response(self): }) -class RegionDiskSourceSnapshotEncryptionKey(object): +class RegionDiskSourcesnapshotencryptionkey(object): def __init__(self, request, module): self.module = module if request: diff --git a/lib/ansible/modules/cloud/google/gcp_compute_router.py b/lib/ansible/modules/cloud/google/gcp_compute_router.py index c3b225a2711eeb..585722b29c8d4c 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_router.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_router.py @@ -452,7 +452,7 @@ def to_request(self): u'asn': self.request.get('asn'), u'advertiseMode': self.request.get('advertise_mode'), u'advertisedGroups': self.request.get('advertised_groups'), - u'advertisedIpRanges': RouterAdvertisedIpRangesArray(self.request.get('advertised_ip_ranges', []), self.module).to_request() + u'advertisedIpRanges': RouterAdvertisediprangesArray(self.request.get('advertised_ip_ranges', []), self.module).to_request() }) def from_response(self): @@ -460,11 +460,11 @@ def from_response(self): u'asn': self.request.get(u'asn'), u'advertiseMode': self.request.get(u'advertiseMode'), u'advertisedGroups': self.request.get(u'advertisedGroups'), - u'advertisedIpRanges': RouterAdvertisedIpRangesArray(self.request.get(u'advertisedIpRanges', []), self.module).from_response() + u'advertisedIpRanges': RouterAdvertisediprangesArray(self.request.get(u'advertisedIpRanges', []), self.module).from_response() }) -class RouterAdvertisedIpRangesArray(object): +class RouterAdvertisediprangesArray(object): def __init__(self, request, module): self.module = module if request: diff --git a/lib/ansible/modules/cloud/google/gcp_compute_subnetwork.py b/lib/ansible/modules/cloud/google/gcp_compute_subnetwork.py index 359e3c3b662d6a..ddbf5d4c820615 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_subnetwork.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_subnetwork.py @@ -363,7 +363,7 @@ def enable_flow_logs_update(module, request, response): { u'enableFlowLogs': module.params.get('enable_flow_logs'), u'fingerprint': response.get('fingerprint'), - u'secondaryIpRanges': SubnetworkSecondaryIpRangesArray(module.params.get('secondary_ip_ranges', []), module).to_request() + u'secondaryIpRanges': SubnetworkSecondaryiprangesArray(module.params.get('secondary_ip_ranges', []), module).to_request() } ) @@ -394,7 +394,7 @@ def resource_to_request(module): u'name': module.params.get('name'), u'network': replace_resource_dict(module.params.get(u'network', {}), 'selfLink'), u'enableFlowLogs': module.params.get('enable_flow_logs'), - u'secondaryIpRanges': SubnetworkSecondaryIpRangesArray(module.params.get('secondary_ip_ranges', []), module).to_request(), + u'secondaryIpRanges': SubnetworkSecondaryiprangesArray(module.params.get('secondary_ip_ranges', []), module).to_request(), u'privateIpGoogleAccess': module.params.get('private_ip_google_access'), u'region': module.params.get('region') } @@ -471,7 +471,7 @@ def response_to_hash(module, response): u'network': replace_resource_dict(module.params.get(u'network', {}), 'selfLink'), u'enableFlowLogs': response.get(u'enableFlowLogs'), u'fingerprint': response.get(u'fingerprint'), - u'secondaryIpRanges': SubnetworkSecondaryIpRangesArray(response.get(u'secondaryIpRanges', []), module).from_response(), + u'secondaryIpRanges': SubnetworkSecondaryiprangesArray(response.get(u'secondaryIpRanges', []), module).from_response(), u'privateIpGoogleAccess': response.get(u'privateIpGoogleAccess'), u'region': module.params.get('region') } @@ -514,7 +514,7 @@ def raise_if_errors(response, err_path, module): module.fail_json(msg=errors) -class SubnetworkSecondaryIpRangesArray(object): +class SubnetworkSecondaryiprangesArray(object): def __init__(self, request, module): self.module = module if request: diff --git a/lib/ansible/modules/cloud/google/gcp_compute_url_map.py b/lib/ansible/modules/cloud/google/gcp_compute_url_map.py index a321b5ad5c9349..54d798d456c859 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_url_map.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_url_map.py @@ -448,9 +448,9 @@ def resource_to_request(module): u'kind': 'compute#urlMap', u'defaultService': replace_resource_dict(module.params.get(u'default_service', {}), 'selfLink'), u'description': module.params.get('description'), - u'hostRules': UrlMapHostRulesArray(module.params.get('host_rules', []), module).to_request(), + u'hostRules': UrlMapHostrulesArray(module.params.get('host_rules', []), module).to_request(), u'name': module.params.get('name'), - u'pathMatchers': UrlMapPathMatchersArray(module.params.get('path_matchers', []), module).to_request(), + u'pathMatchers': UrlMapPathmatchersArray(module.params.get('path_matchers', []), module).to_request(), u'tests': UrlMapTestsArray(module.params.get('tests', []), module).to_request() } return_vals = {} @@ -520,11 +520,11 @@ def response_to_hash(module, response): u'creationTimestamp': response.get(u'creationTimestamp'), u'defaultService': response.get(u'defaultService'), u'description': response.get(u'description'), - u'hostRules': UrlMapHostRulesArray(response.get(u'hostRules', []), module).from_response(), + u'hostRules': UrlMapHostrulesArray(response.get(u'hostRules', []), module).from_response(), u'id': response.get(u'id'), u'fingerprint': response.get(u'fingerprint'), u'name': module.params.get('name'), - u'pathMatchers': UrlMapPathMatchersArray(response.get(u'pathMatchers', []), module).from_response(), + u'pathMatchers': UrlMapPathmatchersArray(response.get(u'pathMatchers', []), module).from_response(), u'tests': UrlMapTestsArray(response.get(u'tests', []), module).from_response() } @@ -566,7 +566,7 @@ def raise_if_errors(response, err_path, module): module.fail_json(msg=errors) -class UrlMapHostRulesArray(object): +class UrlMapHostrulesArray(object): def __init__(self, request, module): self.module = module if request: @@ -601,7 +601,7 @@ def _response_from_item(self, item): }) -class UrlMapPathMatchersArray(object): +class UrlMapPathmatchersArray(object): def __init__(self, request, module): self.module = module if request: @@ -626,7 +626,7 @@ def _request_for_item(self, item): u'defaultService': replace_resource_dict(item.get(u'default_service', {}), 'selfLink'), u'description': item.get('description'), u'name': item.get('name'), - u'pathRules': UrlMapPathRulesArray(item.get('path_rules', []), self.module).to_request() + u'pathRules': UrlMapPathrulesArray(item.get('path_rules', []), self.module).to_request() }) def _response_from_item(self, item): @@ -634,11 +634,11 @@ def _response_from_item(self, item): u'defaultService': item.get(u'defaultService'), u'description': item.get(u'description'), u'name': item.get(u'name'), - u'pathRules': UrlMapPathRulesArray(item.get(u'pathRules', []), self.module).from_response() + u'pathRules': UrlMapPathrulesArray(item.get(u'pathRules', []), self.module).from_response() }) -class UrlMapPathRulesArray(object): +class UrlMapPathrulesArray(object): def __init__(self, request, module): self.module = module if request: diff --git a/lib/ansible/modules/cloud/google/gcp_container_cluster.py b/lib/ansible/modules/cloud/google/gcp_container_cluster.py index be699447f0e2e3..40ed9a5aa3ebf1 100644 --- a/lib/ansible/modules/cloud/google/gcp_container_cluster.py +++ b/lib/ansible/modules/cloud/google/gcp_container_cluster.py @@ -688,13 +688,13 @@ def resource_to_request(module): u'name': module.params.get('name'), u'description': module.params.get('description'), u'initialNodeCount': module.params.get('initial_node_count'), - u'nodeConfig': ClusterNodeConfig(module.params.get('node_config', {}), module).to_request(), - u'masterAuth': ClusterMasterAuth(module.params.get('master_auth', {}), module).to_request(), + u'nodeConfig': ClusterNodeconfig(module.params.get('node_config', {}), module).to_request(), + u'masterAuth': ClusterMasterauth(module.params.get('master_auth', {}), module).to_request(), u'loggingService': module.params.get('logging_service'), u'monitoringService': module.params.get('monitoring_service'), u'network': module.params.get('network'), u'clusterIpv4Cidr': module.params.get('cluster_ipv4_cidr'), - u'addonsConfig': ClusterAddonsConfig(module.params.get('addons_config', {}), module).to_request(), + u'addonsConfig': ClusterAddonsconfig(module.params.get('addons_config', {}), module).to_request(), u'subnetwork': module.params.get('subnetwork'), u'location': module.params.get('location') } @@ -766,13 +766,13 @@ def response_to_hash(module, response): u'name': response.get(u'name'), u'description': response.get(u'description'), u'initialNodeCount': module.params.get('initial_node_count'), - u'nodeConfig': ClusterNodeConfig(module.params.get('node_config', {}), module).to_request(), - u'masterAuth': ClusterMasterAuth(response.get(u'masterAuth', {}), module).from_response(), + u'nodeConfig': ClusterNodeconfig(module.params.get('node_config', {}), module).to_request(), + u'masterAuth': ClusterMasterauth(response.get(u'masterAuth', {}), module).from_response(), u'loggingService': response.get(u'loggingService'), u'monitoringService': response.get(u'monitoringService'), u'network': response.get(u'network'), u'clusterIpv4Cidr': response.get(u'clusterIpv4Cidr'), - u'addonsConfig': ClusterAddonsConfig(response.get(u'addonsConfig', {}), module).from_response(), + u'addonsConfig': ClusterAddonsconfig(response.get(u'addonsConfig', {}), module).from_response(), u'subnetwork': response.get(u'subnetwork'), u'location': response.get(u'location'), u'endpoint': response.get(u'endpoint'), @@ -840,7 +840,7 @@ def encode_request(resource_request, module): } -class ClusterNodeConfig(object): +class ClusterNodeconfig(object): def __init__(self, request, module): self.module = module if request: @@ -877,7 +877,7 @@ def from_response(self): }) -class ClusterMasterAuth(object): +class ClusterMasterauth(object): def __init__(self, request, module): self.module = module if request: @@ -904,7 +904,7 @@ def from_response(self): }) -class ClusterAddonsConfig(object): +class ClusterAddonsconfig(object): def __init__(self, request, module): self.module = module if request: @@ -914,18 +914,18 @@ def __init__(self, request, module): def to_request(self): return remove_nones_from_dict({ - u'httpLoadBalancing': ClusterHttpLoadBalancing(self.request.get('http_load_balancing', {}), self.module).to_request(), - u'horizontalPodAutoscaling': ClusterHorizontalPodAutoscaling(self.request.get('horizontal_pod_autoscaling', {}), self.module).to_request() + u'httpLoadBalancing': ClusterHttploadbalancing(self.request.get('http_load_balancing', {}), self.module).to_request(), + u'horizontalPodAutoscaling': ClusterHorizontalpodautoscaling(self.request.get('horizontal_pod_autoscaling', {}), self.module).to_request() }) def from_response(self): return remove_nones_from_dict({ - u'httpLoadBalancing': ClusterHttpLoadBalancing(self.request.get(u'httpLoadBalancing', {}), self.module).from_response(), - u'horizontalPodAutoscaling': ClusterHorizontalPodAutoscaling(self.request.get(u'horizontalPodAutoscaling', {}), self.module).from_response() + u'httpLoadBalancing': ClusterHttploadbalancing(self.request.get(u'httpLoadBalancing', {}), self.module).from_response(), + u'horizontalPodAutoscaling': ClusterHorizontalpodautoscaling(self.request.get(u'horizontalPodAutoscaling', {}), self.module).from_response() }) -class ClusterHttpLoadBalancing(object): +class ClusterHttploadbalancing(object): def __init__(self, request, module): self.module = module if request: @@ -944,7 +944,7 @@ def from_response(self): }) -class ClusterHorizontalPodAutoscaling(object): +class ClusterHorizontalpodautoscaling(object): def __init__(self, request, module): self.module = module if request: diff --git a/lib/ansible/modules/cloud/google/gcp_container_node_pool.py b/lib/ansible/modules/cloud/google/gcp_container_node_pool.py index 3c999f25acb9a4..28ef53050c3abc 100644 --- a/lib/ansible/modules/cloud/google/gcp_container_node_pool.py +++ b/lib/ansible/modules/cloud/google/gcp_container_node_pool.py @@ -738,18 +738,18 @@ def to_request(self): return remove_nones_from_dict({ u'autoUpgrade': self.request.get('auto_upgrade'), u'autoRepair': self.request.get('auto_repair'), - u'upgradeOptions': NodePoolUpgradeOptions(self.request.get('upgrade_options', {}), self.module).to_request() + u'upgradeOptions': NodePoolUpgradeoptions(self.request.get('upgrade_options', {}), self.module).to_request() }) def from_response(self): return remove_nones_from_dict({ u'autoUpgrade': self.request.get(u'autoUpgrade'), u'autoRepair': self.request.get(u'autoRepair'), - u'upgradeOptions': NodePoolUpgradeOptions(self.request.get(u'upgradeOptions', {}), self.module).from_response() + u'upgradeOptions': NodePoolUpgradeoptions(self.request.get(u'upgradeOptions', {}), self.module).from_response() }) -class NodePoolUpgradeOptions(object): +class NodePoolUpgradeoptions(object): def __init__(self, request, module): self.module = module if request: diff --git a/lib/ansible/modules/cloud/google/gcp_pubsub_subscription.py b/lib/ansible/modules/cloud/google/gcp_pubsub_subscription.py index 38c6cc12abf38b..dea237fef1f0f7 100644 --- a/lib/ansible/modules/cloud/google/gcp_pubsub_subscription.py +++ b/lib/ansible/modules/cloud/google/gcp_pubsub_subscription.py @@ -237,7 +237,7 @@ def resource_to_request(module): request = { u'name': module.params.get('name'), u'topic': replace_resource_dict(module.params.get(u'topic', {}), 'name'), - u'pushConfig': SubscriptionPushConfig(module.params.get('push_config', {}), module).to_request(), + u'pushConfig': SubscriptionPushconfig(module.params.get('push_config', {}), module).to_request(), u'ackDeadlineSeconds': module.params.get('ack_deadline_seconds') } request = encode_request(request, module) @@ -310,7 +310,7 @@ def response_to_hash(module, response): return { u'name': response.get(u'name'), u'topic': response.get(u'topic'), - u'pushConfig': SubscriptionPushConfig(response.get(u'pushConfig', {}), module).from_response(), + u'pushConfig': SubscriptionPushconfig(response.get(u'pushConfig', {}), module).from_response(), u'ackDeadlineSeconds': response.get(u'ackDeadlineSeconds') } @@ -334,7 +334,7 @@ def encode_request(request, module): return request -class SubscriptionPushConfig(object): +class SubscriptionPushconfig(object): def __init__(self, request, module): self.module = module if request: diff --git a/lib/ansible/modules/cloud/google/gcp_sql_instance.py b/lib/ansible/modules/cloud/google/gcp_sql_instance.py index 929f3f35fa373c..39a708579272ff 100644 --- a/lib/ansible/modules/cloud/google/gcp_sql_instance.py +++ b/lib/ansible/modules/cloud/google/gcp_sql_instance.py @@ -666,14 +666,14 @@ def resource_to_request(module): u'backendType': module.params.get('backend_type'), u'connectionName': module.params.get('connection_name'), u'databaseVersion': module.params.get('database_version'), - u'failoverReplica': InstanceFailoverReplica(module.params.get('failover_replica', {}), module).to_request(), + u'failoverReplica': InstanceFailoverreplica(module.params.get('failover_replica', {}), module).to_request(), u'instanceType': module.params.get('instance_type'), u'ipv6Address': module.params.get('ipv6_address'), u'masterInstanceName': module.params.get('master_instance_name'), u'maxDiskSize': module.params.get('max_disk_size'), u'name': module.params.get('name'), u'region': module.params.get('region'), - u'replicaConfiguration': InstanceReplicaConfiguration(module.params.get('replica_configuration', {}), module).to_request(), + u'replicaConfiguration': InstanceReplicaconfiguration(module.params.get('replica_configuration', {}), module).to_request(), u'settings': InstanceSettings(module.params.get('settings', {}), module).to_request() } return_vals = {} @@ -748,15 +748,15 @@ def response_to_hash(module, response): u'backendType': response.get(u'backendType'), u'connectionName': response.get(u'connectionName'), u'databaseVersion': response.get(u'databaseVersion'), - u'failoverReplica': InstanceFailoverReplica(response.get(u'failoverReplica', {}), module).from_response(), + u'failoverReplica': InstanceFailoverreplica(response.get(u'failoverReplica', {}), module).from_response(), u'instanceType': response.get(u'instanceType'), - u'ipAddresses': InstanceIpAddressesArray(response.get(u'ipAddresses', []), module).from_response(), + u'ipAddresses': InstanceIpaddressesArray(response.get(u'ipAddresses', []), module).from_response(), u'ipv6Address': response.get(u'ipv6Address'), u'masterInstanceName': response.get(u'masterInstanceName'), u'maxDiskSize': response.get(u'maxDiskSize'), u'name': response.get(u'name'), u'region': response.get(u'region'), - u'replicaConfiguration': InstanceReplicaConfiguration(response.get(u'replicaConfiguration', {}), module).from_response(), + u'replicaConfiguration': InstanceReplicaconfiguration(response.get(u'replicaConfiguration', {}), module).from_response(), u'settings': InstanceSettings(response.get(u'settings', {}), module).from_response() } @@ -798,7 +798,7 @@ def raise_if_errors(response, err_path, module): module.fail_json(msg=errors) -class InstanceFailoverReplica(object): +class InstanceFailoverreplica(object): def __init__(self, request, module): self.module = module if request: @@ -819,7 +819,7 @@ def from_response(self): }) -class InstanceIpAddressesArray(object): +class InstanceIpaddressesArray(object): def __init__(self, request, module): self.module = module if request: @@ -854,7 +854,7 @@ def _response_from_item(self, item): }) -class InstanceReplicaConfiguration(object): +class InstanceReplicaconfiguration(object): def __init__(self, request, module): self.module = module if request: @@ -865,7 +865,7 @@ def __init__(self, request, module): def to_request(self): return remove_nones_from_dict({ u'failoverTarget': self.request.get('failover_target'), - u'mysqlReplicaConfiguration': InstanceMysqlReplicaConfiguration(self.request.get('mysql_replica_configuration', {}), self.module).to_request(), + u'mysqlReplicaConfiguration': InstanceMysqlreplicaconfiguration(self.request.get('mysql_replica_configuration', {}), self.module).to_request(), u'replicaNames': self.request.get('replica_names'), u'serviceAccountEmailAddress': self.request.get('service_account_email_address') }) @@ -873,13 +873,13 @@ def to_request(self): def from_response(self): return remove_nones_from_dict({ u'failoverTarget': self.request.get(u'failoverTarget'), - u'mysqlReplicaConfiguration': InstanceMysqlReplicaConfiguration(self.request.get(u'mysqlReplicaConfiguration', {}), self.module).from_response(), + u'mysqlReplicaConfiguration': InstanceMysqlreplicaconfiguration(self.request.get(u'mysqlReplicaConfiguration', {}), self.module).from_response(), u'replicaNames': self.request.get(u'replicaNames'), u'serviceAccountEmailAddress': self.request.get(u'serviceAccountEmailAddress') }) -class InstanceMysqlReplicaConfiguration(object): +class InstanceMysqlreplicaconfiguration(object): def __init__(self, request, module): self.module = module if request: @@ -926,20 +926,20 @@ def __init__(self, request, module): def to_request(self): return remove_nones_from_dict({ - u'ipConfiguration': InstanceIpConfiguration(self.request.get('ip_configuration', {}), self.module).to_request(), + u'ipConfiguration': InstanceIpconfiguration(self.request.get('ip_configuration', {}), self.module).to_request(), u'tier': self.request.get('tier'), u'settingsVersion': self.request.get('settings_version') }) def from_response(self): return remove_nones_from_dict({ - u'ipConfiguration': InstanceIpConfiguration(self.request.get(u'ipConfiguration', {}), self.module).from_response(), + u'ipConfiguration': InstanceIpconfiguration(self.request.get(u'ipConfiguration', {}), self.module).from_response(), u'tier': self.request.get(u'tier'), u'settingsVersion': self.request.get(u'settingsVersion') }) -class InstanceIpConfiguration(object): +class InstanceIpconfiguration(object): def __init__(self, request, module): self.module = module if request: @@ -950,19 +950,19 @@ def __init__(self, request, module): def to_request(self): return remove_nones_from_dict({ u'ipv4Enabled': self.request.get('ipv4_enabled'), - u'authorizedNetworks': InstanceAuthorizedNetworksArray(self.request.get('authorized_networks', []), self.module).to_request(), + u'authorizedNetworks': InstanceAuthorizednetworksArray(self.request.get('authorized_networks', []), self.module).to_request(), u'requireSsl': self.request.get('require_ssl') }) def from_response(self): return remove_nones_from_dict({ u'ipv4Enabled': self.request.get(u'ipv4Enabled'), - u'authorizedNetworks': InstanceAuthorizedNetworksArray(self.request.get(u'authorizedNetworks', []), self.module).from_response(), + u'authorizedNetworks': InstanceAuthorizednetworksArray(self.request.get(u'authorizedNetworks', []), self.module).from_response(), u'requireSsl': self.request.get(u'requireSsl') }) -class InstanceAuthorizedNetworksArray(object): +class InstanceAuthorizednetworksArray(object): def __init__(self, request, module): self.module = module if request: diff --git a/lib/ansible/modules/cloud/google/gcp_storage_bucket.py b/lib/ansible/modules/cloud/google/gcp_storage_bucket.py index 7c7f9b61468389..f26361ef9a60c0 100644 --- a/lib/ansible/modules/cloud/google/gcp_storage_bucket.py +++ b/lib/ansible/modules/cloud/google/gcp_storage_bucket.py @@ -923,7 +923,7 @@ def resource_to_request(module): u'predefinedDefaultObjectAcl': module.params.get('predefined_default_object_acl'), u'acl': BucketAclArray(module.params.get('acl', []), module).to_request(), u'cors': BucketCorsArray(module.params.get('cors', []), module).to_request(), - u'defaultObjectAcl': BucketDefaultObjectAclArray(module.params.get('default_object_acl', []), module).to_request(), + u'defaultObjectAcl': BucketDefaultobjectaclArray(module.params.get('default_object_acl', []), module).to_request(), u'lifecycle': BucketLifecycle(module.params.get('lifecycle', {}), module).to_request(), u'location': module.params.get('location'), u'logging': BucketLogging(module.params.get('logging', {}), module).to_request(), @@ -1000,7 +1000,7 @@ def response_to_hash(module, response): return { u'acl': BucketAclArray(response.get(u'acl', []), module).from_response(), u'cors': BucketCorsArray(response.get(u'cors', []), module).from_response(), - u'defaultObjectAcl': BucketDefaultObjectAclArray(module.params.get('default_object_acl', []), module).to_request(), + u'defaultObjectAcl': BucketDefaultobjectaclArray(module.params.get('default_object_acl', []), module).to_request(), u'id': response.get(u'id'), u'lifecycle': BucketLifecycle(response.get(u'lifecycle', {}), module).from_response(), u'location': response.get(u'location'), @@ -1045,7 +1045,7 @@ def _request_for_item(self, item): u'entity': item.get('entity'), u'entityId': item.get('entity_id'), u'id': item.get('id'), - u'projectTeam': BucketProjectTeam(item.get('project_team', {}), self.module).to_request(), + u'projectTeam': BucketProjectteam(item.get('project_team', {}), self.module).to_request(), u'role': item.get('role') }) @@ -1057,12 +1057,12 @@ def _response_from_item(self, item): u'entity': item.get(u'entity'), u'entityId': item.get(u'entityId'), u'id': item.get(u'id'), - u'projectTeam': BucketProjectTeam(item.get(u'projectTeam', {}), self.module).from_response(), + u'projectTeam': BucketProjectteam(item.get(u'projectTeam', {}), self.module).from_response(), u'role': item.get(u'role') }) -class BucketProjectTeam(object): +class BucketProjectteam(object): def __init__(self, request, module): self.module = module if request: @@ -1120,7 +1120,7 @@ def _response_from_item(self, item): }) -class BucketDefaultObjectAclArray(object): +class BucketDefaultobjectaclArray(object): def __init__(self, request, module): self.module = module if request: @@ -1150,7 +1150,7 @@ def _request_for_item(self, item): u'generation': item.get('generation'), u'id': item.get('id'), u'object': item.get('object'), - u'projectTeam': BucketProjectTeam(item.get('project_team', {}), self.module).to_request(), + u'projectTeam': BucketProjectteam(item.get('project_team', {}), self.module).to_request(), u'role': item.get('role') }) @@ -1164,12 +1164,12 @@ def _response_from_item(self, item): u'generation': item.get(u'generation'), u'id': item.get(u'id'), u'object': item.get(u'object'), - u'projectTeam': BucketProjectTeam(item.get(u'projectTeam', {}), self.module).from_response(), + u'projectTeam': BucketProjectteam(item.get(u'projectTeam', {}), self.module).from_response(), u'role': item.get(u'role') }) -class BucketProjectTeam(object): +class BucketProjectteam(object): def __init__(self, request, module): self.module = module if request: diff --git a/lib/ansible/modules/cloud/google/gcp_storage_bucket_access_control.py b/lib/ansible/modules/cloud/google/gcp_storage_bucket_access_control.py index b4c3fc23af6442..d075f43d175091 100644 --- a/lib/ansible/modules/cloud/google/gcp_storage_bucket_access_control.py +++ b/lib/ansible/modules/cloud/google/gcp_storage_bucket_access_control.py @@ -268,7 +268,7 @@ def resource_to_request(module): u'bucket': replace_resource_dict(module.params.get(u'bucket', {}), 'name'), u'entity': module.params.get('entity'), u'entityId': module.params.get('entity_id'), - u'projectTeam': BucketAccessControlProjectTeam(module.params.get('project_team', {}), module).to_request(), + u'projectTeam': BucketAccessControlProjectteam(module.params.get('project_team', {}), module).to_request(), u'role': module.params.get('role') } return_vals = {} @@ -341,12 +341,12 @@ def response_to_hash(module, response): u'entity': response.get(u'entity'), u'entityId': response.get(u'entityId'), u'id': response.get(u'id'), - u'projectTeam': BucketAccessControlProjectTeam(response.get(u'projectTeam', {}), module).from_response(), + u'projectTeam': BucketAccessControlProjectteam(response.get(u'projectTeam', {}), module).from_response(), u'role': response.get(u'role') } -class BucketAccessControlProjectTeam(object): +class BucketAccessControlProjectteam(object): def __init__(self, request, module): self.module = module if request: From f62665e70d36952d82f853018c242746f3d217ee Mon Sep 17 00:00:00 2001 From: The Magician Date: Fri, 2 Nov 2018 13:38:39 -0700 Subject: [PATCH 053/144] Changed scopes defaults on Facts modules /cc @rambleraptor --- lib/ansible/modules/cloud/google/gcp_compute_address_facts.py | 2 +- .../modules/cloud/google/gcp_compute_backend_bucket_facts.py | 2 +- .../modules/cloud/google/gcp_compute_backend_service_facts.py | 2 +- lib/ansible/modules/cloud/google/gcp_compute_disk_facts.py | 2 +- lib/ansible/modules/cloud/google/gcp_compute_firewall_facts.py | 2 +- .../modules/cloud/google/gcp_compute_forwarding_rule_facts.py | 2 +- .../modules/cloud/google/gcp_compute_global_address_facts.py | 2 +- .../cloud/google/gcp_compute_global_forwarding_rule_facts.py | 2 +- .../modules/cloud/google/gcp_compute_health_check_facts.py | 2 +- .../modules/cloud/google/gcp_compute_http_health_check_facts.py | 2 +- .../cloud/google/gcp_compute_https_health_check_facts.py | 2 +- lib/ansible/modules/cloud/google/gcp_compute_image_facts.py | 2 +- lib/ansible/modules/cloud/google/gcp_compute_instance_facts.py | 2 +- .../modules/cloud/google/gcp_compute_instance_group_facts.py | 2 +- .../cloud/google/gcp_compute_instance_group_manager_facts.py | 2 +- .../modules/cloud/google/gcp_compute_instance_template_facts.py | 2 +- .../cloud/google/gcp_compute_interconnect_attachment_facts.py | 2 +- lib/ansible/modules/cloud/google/gcp_compute_network_facts.py | 2 +- .../modules/cloud/google/gcp_compute_region_disk_facts.py | 2 +- lib/ansible/modules/cloud/google/gcp_compute_route_facts.py | 2 +- lib/ansible/modules/cloud/google/gcp_compute_router_facts.py | 2 +- .../modules/cloud/google/gcp_compute_ssl_certificate_facts.py | 2 +- .../modules/cloud/google/gcp_compute_ssl_policy_facts.py | 2 +- .../modules/cloud/google/gcp_compute_subnetwork_facts.py | 2 +- .../modules/cloud/google/gcp_compute_target_http_proxy_facts.py | 2 +- .../cloud/google/gcp_compute_target_https_proxy_facts.py | 2 +- .../modules/cloud/google/gcp_compute_target_pool_facts.py | 2 +- .../modules/cloud/google/gcp_compute_target_ssl_proxy_facts.py | 2 +- .../modules/cloud/google/gcp_compute_target_tcp_proxy_facts.py | 2 +- .../cloud/google/gcp_compute_target_vpn_gateway_facts.py | 2 +- lib/ansible/modules/cloud/google/gcp_compute_url_map_facts.py | 2 +- .../modules/cloud/google/gcp_compute_vpn_tunnel_facts.py | 2 +- lib/ansible/modules/cloud/google/gcp_container_cluster_facts.py | 2 +- .../modules/cloud/google/gcp_container_node_pool_facts.py | 2 +- lib/ansible/modules/cloud/google/gcp_dns_managed_zone_facts.py | 2 +- .../modules/cloud/google/gcp_dns_resource_record_set_facts.py | 2 +- .../modules/cloud/google/gcp_pubsub_subscription_facts.py | 2 +- lib/ansible/modules/cloud/google/gcp_pubsub_topic_facts.py | 2 +- lib/ansible/modules/cloud/google/gcp_spanner_database_facts.py | 2 +- lib/ansible/modules/cloud/google/gcp_spanner_instance_facts.py | 2 +- lib/ansible/modules/cloud/google/gcp_sql_database_facts.py | 2 +- lib/ansible/modules/cloud/google/gcp_sql_instance_facts.py | 2 +- lib/ansible/modules/cloud/google/gcp_sql_user_facts.py | 2 +- 43 files changed, 43 insertions(+), 43 deletions(-) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_address_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_address_facts.py index 08d44dd12aa3b8..ba06eb409c6f35 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_address_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_address_facts.py @@ -155,7 +155,7 @@ def main(): ) ) - if 'scopes' not in module.params: + if not module.params['scopes']: module.params['scopes'] = ['https://www.googleapis.com/auth/compute'] items = fetch_list(module, collection(module), query_options(module.params['filters'])) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_backend_bucket_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_backend_bucket_facts.py index df85a6d62aa3fd..9e607bf6ef30cf 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_backend_bucket_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_backend_bucket_facts.py @@ -121,7 +121,7 @@ def main(): ) ) - if 'scopes' not in module.params: + if not module.params['scopes']: module.params['scopes'] = ['https://www.googleapis.com/auth/compute'] items = fetch_list(module, collection(module), query_options(module.params['filters'])) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_backend_service_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_backend_service_facts.py index 7fc7358d100a00..e6d7feaa914599 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_backend_service_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_backend_service_facts.py @@ -347,7 +347,7 @@ def main(): ) ) - if 'scopes' not in module.params: + if not module.params['scopes']: module.params['scopes'] = ['https://www.googleapis.com/auth/compute'] items = fetch_list(module, collection(module), query_options(module.params['filters'])) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_disk_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_disk_facts.py index c65e9d883d10ea..bf5af4150cc839 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_disk_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_disk_facts.py @@ -274,7 +274,7 @@ def main(): ) ) - if 'scopes' not in module.params: + if not module.params['scopes']: module.params['scopes'] = ['https://www.googleapis.com/auth/compute'] items = fetch_list(module, collection(module), query_options(module.params['filters'])) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_firewall_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_firewall_facts.py index 288b6e640fe634..1cc69b5d682d82 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_firewall_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_firewall_facts.py @@ -254,7 +254,7 @@ def main(): ) ) - if 'scopes' not in module.params: + if not module.params['scopes']: module.params['scopes'] = ['https://www.googleapis.com/auth/compute'] items = fetch_list(module, collection(module), query_options(module.params['filters'])) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_forwarding_rule_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_forwarding_rule_facts.py index d1f58bc45f678d..e5bd5fd37ee89e 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_forwarding_rule_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_forwarding_rule_facts.py @@ -236,7 +236,7 @@ def main(): ) ) - if 'scopes' not in module.params: + if not module.params['scopes']: module.params['scopes'] = ['https://www.googleapis.com/auth/compute'] items = fetch_list(module, collection(module), query_options(module.params['filters'])) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_global_address_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_global_address_facts.py index 981079f0550c43..2fb5e2e7e97c4e 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_global_address_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_global_address_facts.py @@ -135,7 +135,7 @@ def main(): ) ) - if 'scopes' not in module.params: + if not module.params['scopes']: module.params['scopes'] = ['https://www.googleapis.com/auth/compute'] items = fetch_list(module, collection(module), query_options(module.params['filters'])) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_global_forwarding_rule_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_global_forwarding_rule_facts.py index d28c240513f57f..3e2a134007490c 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_global_forwarding_rule_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_global_forwarding_rule_facts.py @@ -219,7 +219,7 @@ def main(): ) ) - if 'scopes' not in module.params: + if not module.params['scopes']: module.params['scopes'] = ['https://www.googleapis.com/auth/compute'] items = fetch_list(module, collection(module), query_options(module.params['filters'])) 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 1fb027f681f870..a35592f7a814bc 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 @@ -295,7 +295,7 @@ def main(): ) ) - if 'scopes' not in module.params: + if not module.params['scopes']: module.params['scopes'] = ['https://www.googleapis.com/auth/compute'] items = fetch_list(module, collection(module), query_options(module.params['filters'])) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_http_health_check_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_http_health_check_facts.py index e94eccee3a608f..bb78b4b9473f49 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_http_health_check_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_http_health_check_facts.py @@ -155,7 +155,7 @@ def main(): ) ) - if 'scopes' not in module.params: + if not module.params['scopes']: module.params['scopes'] = ['https://www.googleapis.com/auth/compute'] items = fetch_list(module, collection(module), query_options(module.params['filters'])) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_https_health_check_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_https_health_check_facts.py index 5061b6ae57f7dc..ca015c068b6f54 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_https_health_check_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_https_health_check_facts.py @@ -155,7 +155,7 @@ def main(): ) ) - if 'scopes' not in module.params: + if not module.params['scopes']: module.params['scopes'] = ['https://www.googleapis.com/auth/compute'] items = fetch_list(module, collection(module), query_options(module.params['filters'])) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_image_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_image_facts.py index 0f7f0f52a28166..22eede9405eec5 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_image_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_image_facts.py @@ -285,7 +285,7 @@ def main(): ) ) - if 'scopes' not in module.params: + if not module.params['scopes']: module.params['scopes'] = ['https://www.googleapis.com/auth/compute'] items = fetch_list(module, collection(module), query_options(module.params['filters'])) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_instance_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_instance_facts.py index d267dac692c89a..6c029571a804a2 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_instance_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_instance_facts.py @@ -489,7 +489,7 @@ def main(): ) ) - if 'scopes' not in module.params: + if not module.params['scopes']: module.params['scopes'] = ['https://www.googleapis.com/auth/compute'] items = fetch_list(module, collection(module), query_options(module.params['filters'])) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_instance_group_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_instance_group_facts.py index 02334cca7e7b45..e634572c88c9e0 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_instance_group_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_instance_group_facts.py @@ -164,7 +164,7 @@ def main(): ) ) - if 'scopes' not in module.params: + if not module.params['scopes']: module.params['scopes'] = ['https://www.googleapis.com/auth/compute'] items = fetch_list(module, collection(module), query_options(module.params['filters'])) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_instance_group_manager_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_instance_group_manager_facts.py index 33b45ec75cfefb..243c41335a305a 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_instance_group_manager_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_instance_group_manager_facts.py @@ -239,7 +239,7 @@ def main(): ) ) - if 'scopes' not in module.params: + if not module.params['scopes']: module.params['scopes'] = ['https://www.googleapis.com/auth/compute'] items = fetch_list(module, collection(module), query_options(module.params['filters'])) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_instance_template_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_instance_template_facts.py index 052d58190e1d23..d755d7853122a5 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_instance_template_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_instance_template_facts.py @@ -473,7 +473,7 @@ def main(): ) ) - if 'scopes' not in module.params: + if not module.params['scopes']: module.params['scopes'] = ['https://www.googleapis.com/auth/compute'] items = fetch_list(module, collection(module), query_options(module.params['filters'])) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_interconnect_attachment_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_interconnect_attachment_facts.py index 92a23f949a28c9..3f8d3dcea4f61f 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_interconnect_attachment_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_interconnect_attachment_facts.py @@ -167,7 +167,7 @@ def main(): ) ) - if 'scopes' not in module.params: + if not module.params['scopes']: module.params['scopes'] = ['https://www.googleapis.com/auth/compute'] items = fetch_list(module, collection(module), query_options(module.params['filters'])) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_network_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_network_facts.py index 4e70ab0b2cc61e..d54dad6c80eb1c 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_network_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_network_facts.py @@ -154,7 +154,7 @@ def main(): ) ) - if 'scopes' not in module.params: + if not module.params['scopes']: module.params['scopes'] = ['https://www.googleapis.com/auth/compute'] items = fetch_list(module, collection(module), query_options(module.params['filters'])) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_region_disk_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_region_disk_facts.py index 76dbfa764295de..6d13a1eb7aaf89 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_region_disk_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_region_disk_facts.py @@ -235,7 +235,7 @@ def main(): ) ) - if 'scopes' not in module.params: + if not module.params['scopes']: module.params['scopes'] = ['https://www.googleapis.com/auth/compute'] items = fetch_list(module, collection(module), query_options(module.params['filters'])) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_route_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_route_facts.py index da6e4e4114b14e..2e7f0dd2f4b66f 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_route_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_route_facts.py @@ -158,7 +158,7 @@ def main(): ) ) - if 'scopes' not in module.params: + if not module.params['scopes']: module.params['scopes'] = ['https://www.googleapis.com/auth/compute'] items = fetch_list(module, collection(module), query_options(module.params['filters'])) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_router_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_router_facts.py index 4f34effad6902e..50f61da2c1f5d7 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_router_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_router_facts.py @@ -174,7 +174,7 @@ def main(): ) ) - if 'scopes' not in module.params: + if not module.params['scopes']: module.params['scopes'] = ['https://www.googleapis.com/auth/compute'] items = fetch_list(module, collection(module), query_options(module.params['filters'])) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_ssl_certificate_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_ssl_certificate_facts.py index 69600b237b4ebb..e82ed7db546b55 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_ssl_certificate_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_ssl_certificate_facts.py @@ -122,7 +122,7 @@ def main(): ) ) - if 'scopes' not in module.params: + if not module.params['scopes']: module.params['scopes'] = ['https://www.googleapis.com/auth/compute'] items = fetch_list(module, collection(module), query_options(module.params['filters'])) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_ssl_policy_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_ssl_policy_facts.py index 95e0b1592ddae9..fffd3c62d09daa 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_ssl_policy_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_ssl_policy_facts.py @@ -160,7 +160,7 @@ def main(): ) ) - if 'scopes' not in module.params: + if not module.params['scopes']: module.params['scopes'] = ['https://www.googleapis.com/auth/compute'] items = fetch_list(module, collection(module), query_options(module.params['filters'])) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_subnetwork_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_subnetwork_facts.py index 8d04ae349c01ff..e6aa384bebd5dc 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_subnetwork_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_subnetwork_facts.py @@ -183,7 +183,7 @@ def main(): ) ) - if 'scopes' not in module.params: + if not module.params['scopes']: module.params['scopes'] = ['https://www.googleapis.com/auth/compute'] items = fetch_list(module, collection(module), query_options(module.params['filters'])) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_http_proxy_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_target_http_proxy_facts.py index 532b45575ce247..7a558e0d9b078a 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_http_proxy_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_http_proxy_facts.py @@ -116,7 +116,7 @@ def main(): ) ) - if 'scopes' not in module.params: + if not module.params['scopes']: module.params['scopes'] = ['https://www.googleapis.com/auth/compute'] items = fetch_list(module, collection(module), query_options(module.params['filters'])) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_https_proxy_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_target_https_proxy_facts.py index 61b08ccc8aa8d8..e486510e03a305 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_https_proxy_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_https_proxy_facts.py @@ -132,7 +132,7 @@ def main(): ) ) - if 'scopes' not in module.params: + if not module.params['scopes']: module.params['scopes'] = ['https://www.googleapis.com/auth/compute'] items = fetch_list(module, collection(module), query_options(module.params['filters'])) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_pool_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_target_pool_facts.py index 84e7b30be35bc3..47db6275023123 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_pool_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_pool_facts.py @@ -175,7 +175,7 @@ def main(): ) ) - if 'scopes' not in module.params: + if not module.params['scopes']: module.params['scopes'] = ['https://www.googleapis.com/auth/compute'] items = fetch_list(module, collection(module), query_options(module.params['filters'])) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_ssl_proxy_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_target_ssl_proxy_facts.py index cd80be52fdef4b..a1374d404a2387 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_ssl_proxy_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_ssl_proxy_facts.py @@ -128,7 +128,7 @@ def main(): ) ) - if 'scopes' not in module.params: + if not module.params['scopes']: module.params['scopes'] = ['https://www.googleapis.com/auth/compute'] items = fetch_list(module, collection(module), query_options(module.params['filters'])) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_tcp_proxy_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_target_tcp_proxy_facts.py index af46f9dfae65c5..cf6ca10f8db559 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_tcp_proxy_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_tcp_proxy_facts.py @@ -121,7 +121,7 @@ def main(): ) ) - if 'scopes' not in module.params: + if not module.params['scopes']: module.params['scopes'] = ['https://www.googleapis.com/auth/compute'] items = fetch_list(module, collection(module), query_options(module.params['filters'])) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_vpn_gateway_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_target_vpn_gateway_facts.py index a9c87095fa533e..2abbdcc6d4427f 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_vpn_gateway_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_vpn_gateway_facts.py @@ -137,7 +137,7 @@ def main(): ) ) - if 'scopes' not in module.params: + if not module.params['scopes']: module.params['scopes'] = ['https://www.googleapis.com/auth/compute'] items = fetch_list(module, collection(module), query_options(module.params['filters'])) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_url_map_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_url_map_facts.py index dce4404655230c..9c9d6c5f3ca06c 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_url_map_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_url_map_facts.py @@ -217,7 +217,7 @@ def main(): ) ) - if 'scopes' not in module.params: + if not module.params['scopes']: module.params['scopes'] = ['https://www.googleapis.com/auth/compute'] items = fetch_list(module, collection(module), query_options(module.params['filters'])) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_vpn_tunnel_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_vpn_tunnel_facts.py index 79ab37fd4fbcc6..0141d1a82f66f5 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_vpn_tunnel_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_vpn_tunnel_facts.py @@ -175,7 +175,7 @@ def main(): ) ) - if 'scopes' not in module.params: + if not module.params['scopes']: module.params['scopes'] = ['https://www.googleapis.com/auth/compute'] items = fetch_list(module, collection(module), query_options(module.params['filters'])) diff --git a/lib/ansible/modules/cloud/google/gcp_container_cluster_facts.py b/lib/ansible/modules/cloud/google/gcp_container_cluster_facts.py index f04e9d22cbd857..c9db24c02b0142 100644 --- a/lib/ansible/modules/cloud/google/gcp_container_cluster_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_container_cluster_facts.py @@ -375,7 +375,7 @@ def main(): ) ) - if 'scopes' not in module.params: + if not module.params['scopes']: module.params['scopes'] = ['https://www.googleapis.com/auth/cloud-platform'] items = fetch_list(module, collection(module)) diff --git a/lib/ansible/modules/cloud/google/gcp_container_node_pool_facts.py b/lib/ansible/modules/cloud/google/gcp_container_node_pool_facts.py index f43989d8b3073c..343f7f8d3a61b1 100644 --- a/lib/ansible/modules/cloud/google/gcp_container_node_pool_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_container_node_pool_facts.py @@ -276,7 +276,7 @@ def main(): ) ) - if 'scopes' not in module.params: + if not module.params['scopes']: module.params['scopes'] = ['https://www.googleapis.com/auth/cloud-platform'] items = fetch_list(module, collection(module)) diff --git a/lib/ansible/modules/cloud/google/gcp_dns_managed_zone_facts.py b/lib/ansible/modules/cloud/google/gcp_dns_managed_zone_facts.py index 4206d97901fad6..6a7e8205f11f3d 100644 --- a/lib/ansible/modules/cloud/google/gcp_dns_managed_zone_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_dns_managed_zone_facts.py @@ -123,7 +123,7 @@ def main(): ) ) - if 'scopes' not in module.params: + if not module.params['scopes']: module.params['scopes'] = ['https://www.googleapis.com/auth/ndev.clouddns.readwrite'] items = fetch_list(module, collection(module), module.params['dns_name']) diff --git a/lib/ansible/modules/cloud/google/gcp_dns_resource_record_set_facts.py b/lib/ansible/modules/cloud/google/gcp_dns_resource_record_set_facts.py index d75216a522854a..f5fd0c37cfe4f3 100644 --- a/lib/ansible/modules/cloud/google/gcp_dns_resource_record_set_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_dns_resource_record_set_facts.py @@ -115,7 +115,7 @@ def main(): ) ) - if 'scopes' not in module.params: + if not module.params['scopes']: module.params['scopes'] = ['https://www.googleapis.com/auth/ndev.clouddns.readwrite'] items = fetch_list(module, collection(module)) diff --git a/lib/ansible/modules/cloud/google/gcp_pubsub_subscription_facts.py b/lib/ansible/modules/cloud/google/gcp_pubsub_subscription_facts.py index 6e3710aa1447b3..ea1f16dd7dc137 100644 --- a/lib/ansible/modules/cloud/google/gcp_pubsub_subscription_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_pubsub_subscription_facts.py @@ -120,7 +120,7 @@ def main(): ) ) - if 'scopes' not in module.params: + if not module.params['scopes']: module.params['scopes'] = ['https://www.googleapis.com/auth/pubsub'] items = fetch_list(module, collection(module)) diff --git a/lib/ansible/modules/cloud/google/gcp_pubsub_topic_facts.py b/lib/ansible/modules/cloud/google/gcp_pubsub_topic_facts.py index a4a50f1f2d1a96..b9f42cdf2cf943 100644 --- a/lib/ansible/modules/cloud/google/gcp_pubsub_topic_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_pubsub_topic_facts.py @@ -82,7 +82,7 @@ def main(): ) ) - if 'scopes' not in module.params: + if not module.params['scopes']: module.params['scopes'] = ['https://www.googleapis.com/auth/pubsub'] items = fetch_list(module, collection(module)) diff --git a/lib/ansible/modules/cloud/google/gcp_spanner_database_facts.py b/lib/ansible/modules/cloud/google/gcp_spanner_database_facts.py index 09c45b3663443c..87e866a5e1b884 100644 --- a/lib/ansible/modules/cloud/google/gcp_spanner_database_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_spanner_database_facts.py @@ -108,7 +108,7 @@ def main(): ) ) - if 'scopes' not in module.params: + if not module.params['scopes']: module.params['scopes'] = ['https://www.googleapis.com/auth/spanner.admin'] items = fetch_list(module, collection(module)) diff --git a/lib/ansible/modules/cloud/google/gcp_spanner_instance_facts.py b/lib/ansible/modules/cloud/google/gcp_spanner_instance_facts.py index 79a5c656053723..639dc5159bff03 100644 --- a/lib/ansible/modules/cloud/google/gcp_spanner_instance_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_spanner_instance_facts.py @@ -123,7 +123,7 @@ def main(): ) ) - if 'scopes' not in module.params: + if not module.params['scopes']: module.params['scopes'] = ['https://www.googleapis.com/auth/spanner.admin'] items = fetch_list(module, collection(module)) diff --git a/lib/ansible/modules/cloud/google/gcp_sql_database_facts.py b/lib/ansible/modules/cloud/google/gcp_sql_database_facts.py index 305c0aa7645105..bebaf9cd732c6d 100644 --- a/lib/ansible/modules/cloud/google/gcp_sql_database_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_sql_database_facts.py @@ -109,7 +109,7 @@ def main(): ) ) - if 'scopes' not in module.params: + if not module.params['scopes']: module.params['scopes'] = ['https://www.googleapis.com/auth/sqlservice.admin'] items = fetch_list(module, collection(module)) diff --git a/lib/ansible/modules/cloud/google/gcp_sql_instance_facts.py b/lib/ansible/modules/cloud/google/gcp_sql_instance_facts.py index d0794353a2c299..fdde60aabce84e 100644 --- a/lib/ansible/modules/cloud/google/gcp_sql_instance_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_sql_instance_facts.py @@ -340,7 +340,7 @@ def main(): ) ) - if 'scopes' not in module.params: + if not module.params['scopes']: module.params['scopes'] = ['https://www.googleapis.com/auth/sqlservice.admin'] items = fetch_list(module, collection(module)) diff --git a/lib/ansible/modules/cloud/google/gcp_sql_user_facts.py b/lib/ansible/modules/cloud/google/gcp_sql_user_facts.py index 01c0cbc6c3d084..9e89835b5e4993 100644 --- a/lib/ansible/modules/cloud/google/gcp_sql_user_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_sql_user_facts.py @@ -110,7 +110,7 @@ def main(): ) ) - if 'scopes' not in module.params: + if not module.params['scopes']: module.params['scopes'] = ['https://www.googleapis.com/auth/sqlservice.admin'] items = fetch_list(module, collection(module)) From c8c031fc3e0b54601da23e4421b2844e9bc8365f Mon Sep 17 00:00:00 2001 From: The Magician Date: Fri, 2 Nov 2018 14:16:10 -0700 Subject: [PATCH 054/144] Adding minCpuPlatform to InstanceTemplate /cc @rambleraptor --- .../cloud/google/gcp_compute_instance_template.py | 14 ++++++++++++++ .../google/gcp_compute_instance_template_facts.py | 6 ++++++ 2 files changed, 20 insertions(+) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_instance_template.py b/lib/ansible/modules/cloud/google/gcp_compute_instance_template.py index 3976435c7e9463..18d2ff4bd3fff3 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_instance_template.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_instance_template.py @@ -229,6 +229,11 @@ description: - Reference to a gcompute_machine_type resource. required: true + min_cpu_platform: + description: + - Specifies a minimum CPU platform for the VM instance. Applicable values + are the friendly names of CPU platforms . + required: false metadata: description: - The metadata key/value pairs to assign to instances that are created from @@ -651,6 +656,12 @@ - Reference to a gcompute_machine_type resource. returned: success type: str + minCpuPlatform: + description: + - Specifies a minimum CPU platform for the VM instance. Applicable values are + the friendly names of CPU platforms . + returned: success + type: str metadata: description: - The metadata key/value pairs to assign to instances that are created from @@ -887,6 +898,7 @@ def main(): type=dict(type='str', choices=['SCRATCH', 'PERSISTENT']) )), machine_type=dict(required=True, type='str'), + min_cpu_platform=dict(type='str'), metadata=dict(type='dict'), guest_accelerators=dict(type='list', elements='dict', options=dict( accelerator_count=dict(type='int'), @@ -1163,6 +1175,7 @@ def to_request(self): u'description': self.request.get('description'), u'disks': InstanceTemplateDisksArray(self.request.get('disks', []), self.module).to_request(), u'machineType': self.request.get('machine_type'), + u'minCpuPlatform': self.request.get('min_cpu_platform'), u'metadata': self.request.get('metadata'), u'guestAccelerators': InstanceTemplateGuestacceleratorsArray(self.request.get('guest_accelerators', []), self.module).to_request(), u'networkInterfaces': InstanceTemplateNetworkinterfacesArray(self.request.get('network_interfaces', []), self.module).to_request(), @@ -1177,6 +1190,7 @@ def from_response(self): u'description': self.request.get(u'description'), u'disks': InstanceTemplateDisksArray(self.request.get(u'disks', []), self.module).from_response(), u'machineType': self.request.get(u'machineType'), + u'minCpuPlatform': self.request.get(u'minCpuPlatform'), u'metadata': self.request.get(u'metadata'), u'guestAccelerators': InstanceTemplateGuestacceleratorsArray(self.request.get(u'guestAccelerators', []), self.module).from_response(), u'networkInterfaces': InstanceTemplateNetworkinterfacesArray(self.request.get(u'networkInterfaces', []), self.module).from_response(), diff --git a/lib/ansible/modules/cloud/google/gcp_compute_instance_template_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_instance_template_facts.py index d755d7853122a5..bc6eb9398759df 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_instance_template_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_instance_template_facts.py @@ -263,6 +263,12 @@ - Reference to a gcompute_machine_type resource. returned: success type: str + minCpuPlatform: + description: + - Specifies a minimum CPU platform for the VM instance. Applicable values + are the friendly names of CPU platforms . + returned: success + type: str metadata: description: - The metadata key/value pairs to assign to instances that are created from From 4c814bae260702489e9e9f1a3e706c32deb39ce3 Mon Sep 17 00:00:00 2001 From: The Magician Date: Mon, 5 Nov 2018 11:35:37 -0800 Subject: [PATCH 055/144] Creating Service Accounts (#125) /cc @rambleraptor --- .../cloud/google/gcp_iam_service_account.py | 275 ++++++++++++++++++ .../google/gcp_iam_service_account_facts.py | 156 ++++++++++ .../targets/gcp_iam_service_account/aliases | 2 + .../gcp_iam_service_account/defaults/main.yml | 3 + .../gcp_iam_service_account/meta/main.yml | 0 .../gcp_iam_service_account/tasks/main.yml | 103 +++++++ 6 files changed, 539 insertions(+) create mode 100644 lib/ansible/modules/cloud/google/gcp_iam_service_account.py create mode 100644 lib/ansible/modules/cloud/google/gcp_iam_service_account_facts.py create mode 100644 test/integration/targets/gcp_iam_service_account/aliases create mode 100644 test/integration/targets/gcp_iam_service_account/defaults/main.yml create mode 100644 test/integration/targets/gcp_iam_service_account/meta/main.yml create mode 100644 test/integration/targets/gcp_iam_service_account/tasks/main.yml diff --git a/lib/ansible/modules/cloud/google/gcp_iam_service_account.py b/lib/ansible/modules/cloud/google/gcp_iam_service_account.py new file mode 100644 index 00000000000000..71267ae250b76d --- /dev/null +++ b/lib/ansible/modules/cloud/google/gcp_iam_service_account.py @@ -0,0 +1,275 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# +# Copyright (C) 2017 Google +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) +# ---------------------------------------------------------------------------- +# +# *** AUTO GENERATED CODE *** AUTO GENERATED CODE *** +# +# ---------------------------------------------------------------------------- +# +# This file is automatically generated by Magic Modules and manual +# changes will be clobbered when the file is regenerated. +# +# Please read more about how to change this file at +# https://www.github.com/GoogleCloudPlatform/magic-modules +# +# ---------------------------------------------------------------------------- + +from __future__ import absolute_import, division, print_function +__metaclass__ = type + +################################################################################ +# Documentation +################################################################################ + +ANSIBLE_METADATA = {'metadata_version': '1.1', + 'status': ["preview"], + 'supported_by': 'community'} + +DOCUMENTATION = ''' +--- +module: gcp_iam_service_account +description: +- A service account in the Identity and Access Management API. +short_description: Creates a GCP ServiceAccount +version_added: 2.8 +author: Google Inc. (@googlecloudplatform) +requirements: +- python >= 2.6 +- requests >= 2.18.4 +- google-auth >= 1.3.0 +options: + state: + description: + - Whether the given object should exist in GCP + choices: + - present + - absent + default: present + name: + description: + - The name of the service account. + required: false + display_name: + description: + - User specified description of service account. + required: false +extends_documentation_fragment: gcp +''' + +EXAMPLES = ''' +- name: create a service account + gcp_iam_service_account: + name: test-ansible@graphite-playground.google.com.iam.gserviceaccount.com + display_name: My Ansible test key + project: "test_project" + auth_kind: "serviceaccount" + service_account_file: "/tmp/auth.pem" + state: present +''' + +RETURN = ''' +name: + description: + - The name of the service account. + returned: success + type: str +projectId: + description: + - Id of the project that owns the service account. + returned: success + type: str +uniqueId: + description: + - Unique and stable id of the service account. + returned: success + type: str +email: + description: + - Email address of the service account. + returned: success + type: str +displayName: + description: + - User specified description of service account. + returned: success + type: str +oauth2ClientId: + description: + - OAuth2 client id for the service account. + returned: success + type: str +''' + +################################################################################ +# Imports +################################################################################ + +from ansible.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest, replace_resource_dict +import json + +################################################################################ +# Main +################################################################################ + + +def main(): + """Main function""" + + module = GcpModule( + argument_spec=dict( + state=dict(default='present', choices=['present', 'absent'], type='str'), + name=dict(type='str'), + display_name=dict(type='str') + ) + ) + + if not module.params['scopes']: + module.params['scopes'] = ['https://www.googleapis.com/auth/iam'] + + state = module.params['state'] + + fetch = fetch_resource(module, self_link(module)) + changed = False + + if fetch: + if state == 'present': + if is_different(module, fetch): + update(module, self_link(module)) + fetch = fetch_resource(module, self_link(module)) + changed = True + else: + delete(module, self_link(module)) + fetch = {} + changed = True + else: + if state == 'present': + fetch = create(module, collection(module)) + changed = True + else: + fetch = {} + + fetch.update({'changed': changed}) + + module.exit_json(**fetch) + + +def create(module, link): + auth = GcpSession(module, 'iam') + return return_if_object(module, auth.post(link, resource_to_request(module))) + + +def update(module, link): + auth = GcpSession(module, 'iam') + return return_if_object(module, auth.put(link, resource_to_request(module))) + + +def delete(module, link): + auth = GcpSession(module, 'iam') + return return_if_object(module, auth.delete(link)) + + +def resource_to_request(module): + request = { + u'name': module.params.get('name'), + u'displayName': module.params.get('display_name') + } + request = encode_request(request, module) + return_vals = {} + for k, v in request.items(): + if v: + return_vals[k] = v + + return return_vals + + +def fetch_resource(module, link, allow_not_found=True): + auth = GcpSession(module, 'iam') + return return_if_object(module, auth.get(link), allow_not_found) + + +def self_link(module): + return "https://iam.googleapis.com/v1/projects/{project}/serviceAccounts/{name}".format(**module.params) + + +def collection(module): + return "https://iam.googleapis.com/v1/projects/{project}/serviceAccounts".format(**module.params) + + +def return_if_object(module, response, allow_not_found=False): + # If not found, return nothing. + if allow_not_found and response.status_code == 404: + return None + + # If no content, return nothing. + if response.status_code == 204: + return None + + try: + module.raise_for_status(response) + result = response.json() + except getattr(json.decoder, 'JSONDecodeError', ValueError) as inst: + module.fail_json(msg="Invalid JSON response with error: %s" % inst) + + result = decode_response(result, module) + + if navigate_hash(result, ['error', 'errors']): + module.fail_json(msg=navigate_hash(result, ['error', 'errors'])) + + return result + + +def is_different(module, response): + request = resource_to_request(module) + response = response_to_hash(module, response) + request = decode_response(request, module) + + # Remove all output-only from response. + response_vals = {} + for k, v in response.items(): + if k in request: + response_vals[k] = v + + request_vals = {} + for k, v in request.items(): + if k in response: + request_vals[k] = v + + return GcpRequest(request_vals) != GcpRequest(response_vals) + + +# Remove unnecessary properties from the response. +# This is for doing comparisons with Ansible's current parameters. +def response_to_hash(module, response): + return { + u'name': response.get(u'name'), + u'projectId': response.get(u'projectId'), + u'uniqueId': response.get(u'uniqueId'), + u'email': response.get(u'email'), + u'displayName': response.get(u'displayName'), + u'oauth2ClientId': response.get(u'oauth2ClientId') + } + + +def encode_request(resource_request, module): + """Structures the request as accountId + rest of request""" + account_id = resource_request['name'].split('@')[0] + del resource_request['name'] + return { + 'accountId': account_id, + 'serviceAccount': resource_request + } + + +def decode_response(response, module): + """Unstructures the request from accountId + rest of request""" + if 'name' not in response: + return response + response['name'] = response['name'].split('/')[-1] + return response + + +if __name__ == '__main__': + main() diff --git a/lib/ansible/modules/cloud/google/gcp_iam_service_account_facts.py b/lib/ansible/modules/cloud/google/gcp_iam_service_account_facts.py new file mode 100644 index 00000000000000..646e906a5ad76a --- /dev/null +++ b/lib/ansible/modules/cloud/google/gcp_iam_service_account_facts.py @@ -0,0 +1,156 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# +# Copyright (C) 2017 Google +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) +# ---------------------------------------------------------------------------- +# +# *** AUTO GENERATED CODE *** AUTO GENERATED CODE *** +# +# ---------------------------------------------------------------------------- +# +# This file is automatically generated by Magic Modules and manual +# changes will be clobbered when the file is regenerated. +# +# Please read more about how to change this file at +# https://www.github.com/GoogleCloudPlatform/magic-modules +# +# ---------------------------------------------------------------------------- + +from __future__ import absolute_import, division, print_function +__metaclass__ = type + +################################################################################ +# Documentation +################################################################################ + +ANSIBLE_METADATA = {'metadata_version': '1.1', + 'status': ["preview"], + 'supported_by': 'community'} + +DOCUMENTATION = ''' +--- +module: gcp_iam_service_account_facts +description: +- Gather facts for GCP ServiceAccount +short_description: Gather facts for GCP ServiceAccount +version_added: 2.8 +author: Google Inc. (@googlecloudplatform) +requirements: +- python >= 2.6 +- requests >= 2.18.4 +- google-auth >= 1.3.0 +options: {} +extends_documentation_fragment: gcp +''' + +EXAMPLES = ''' +- name: a service account facts + gcp_iam_service_account_facts: + project: test_project + auth_kind: serviceaccount + service_account_file: "/tmp/auth.pem" +''' + +RETURN = ''' +items: + description: List of items + returned: always + type: complex + contains: + name: + description: + - The name of the service account. + returned: success + type: str + projectId: + description: + - Id of the project that owns the service account. + returned: success + type: str + uniqueId: + description: + - Unique and stable id of the service account. + returned: success + type: str + email: + description: + - Email address of the service account. + returned: success + type: str + displayName: + description: + - User specified description of service account. + returned: success + type: str + oauth2ClientId: + description: + - OAuth2 client id for the service account. + returned: success + type: str +''' + +################################################################################ +# Imports +################################################################################ +from ansible.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest +import json + +################################################################################ +# Main +################################################################################ + + +def main(): + module = GcpModule( + argument_spec=dict( + ) + ) + + if not module.params['scopes']: + module.params['scopes'] = ['https://www.googleapis.com/auth/iam'] + + items = fetch_list(module, collection(module)) + if items.get('items'): + items = items.get('items') + else: + items = [] + return_value = { + 'items': items + } + module.exit_json(**return_value) + + +def collection(module): + return "https://iam.googleapis.com/v1/projects/{project}/serviceAccounts".format(**module.params) + + +def fetch_list(module, link): + auth = GcpSession(module, 'iam') + response = auth.get(link) + return return_if_object(module, response) + + +def return_if_object(module, response): + # If not found, return nothing. + if response.status_code == 404: + return None + + # If no content, return nothing. + if response.status_code == 204: + return None + + try: + module.raise_for_status(response) + result = response.json() + except getattr(json.decoder, 'JSONDecodeError', ValueError) as inst: + module.fail_json(msg="Invalid JSON response with error: %s" % inst) + + if navigate_hash(result, ['error', 'errors']): + module.fail_json(msg=navigate_hash(result, ['error', 'errors'])) + + return result + + +if __name__ == "__main__": + main() diff --git a/test/integration/targets/gcp_iam_service_account/aliases b/test/integration/targets/gcp_iam_service_account/aliases new file mode 100644 index 00000000000000..9812f019ca4bae --- /dev/null +++ b/test/integration/targets/gcp_iam_service_account/aliases @@ -0,0 +1,2 @@ +cloud/gcp +unsupported diff --git a/test/integration/targets/gcp_iam_service_account/defaults/main.yml b/test/integration/targets/gcp_iam_service_account/defaults/main.yml new file mode 100644 index 00000000000000..aa87a2a8e0e0e0 --- /dev/null +++ b/test/integration/targets/gcp_iam_service_account/defaults/main.yml @@ -0,0 +1,3 @@ +--- +# defaults file +resource_name: '{{resource_prefix}}' diff --git a/test/integration/targets/gcp_iam_service_account/meta/main.yml b/test/integration/targets/gcp_iam_service_account/meta/main.yml new file mode 100644 index 00000000000000..e69de29bb2d1d6 diff --git a/test/integration/targets/gcp_iam_service_account/tasks/main.yml b/test/integration/targets/gcp_iam_service_account/tasks/main.yml new file mode 100644 index 00000000000000..519df9937f3b9a --- /dev/null +++ b/test/integration/targets/gcp_iam_service_account/tasks/main.yml @@ -0,0 +1,103 @@ +--- +# ---------------------------------------------------------------------------- +# +# *** AUTO GENERATED CODE *** AUTO GENERATED CODE *** +# +# ---------------------------------------------------------------------------- +# +# This file is automatically generated by Magic Modules and manual +# changes will be clobbered when the file is regenerated. +# +# Please read more about how to change this file at +# https://www.github.com/GoogleCloudPlatform/magic-modules +# +# ---------------------------------------------------------------------------- +# Pre-test setup +- name: delete a service account + gcp_iam_service_account: + name: test-ansible@graphite-playground.google.com.iam.gserviceaccount.com + display_name: My Ansible test key + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent +#---------------------------------------------------------- +- name: create a service account + gcp_iam_service_account: + name: test-ansible@graphite-playground.google.com.iam.gserviceaccount.com + display_name: My Ansible test key + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present + register: result +- name: assert changed is true + assert: + that: + - result.changed == true +- name: verify that service_account was created + gcp_iam_service_account_facts: + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + scopes: + - https://www.googleapis.com/auth/iam + register: results +- name: verify that command succeeded + assert: + that: + - results['items'] | length >= 1 +# ---------------------------------------------------------------------------- +- name: create a service account that already exists + gcp_iam_service_account: + name: test-ansible@graphite-playground.google.com.iam.gserviceaccount.com + display_name: My Ansible test key + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present + register: result +- name: assert changed is false + assert: + that: + - result.changed == false +#---------------------------------------------------------- +- name: delete a service account + gcp_iam_service_account: + name: test-ansible@graphite-playground.google.com.iam.gserviceaccount.com + display_name: My Ansible test key + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: result +- name: assert changed is true + assert: + that: + - result.changed == true +- name: verify that service_account was deleted + gcp_iam_service_account_facts: + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + scopes: + - https://www.googleapis.com/auth/iam + register: results +- name: verify that command succeeded + assert: + that: + - results['items'] | length == 0 +# ---------------------------------------------------------------------------- +- name: delete a service account that does not exist + gcp_iam_service_account: + name: test-ansible@graphite-playground.google.com.iam.gserviceaccount.com + display_name: My Ansible test key + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: result +- name: assert changed is false + assert: + that: + - result.changed == false From adf6ec907a402079b7656354bb000eb6b5aec339 Mon Sep 17 00:00:00 2001 From: The Magician Date: Tue, 6 Nov 2018 11:12:07 -0800 Subject: [PATCH 056/144] Ansible Projects (#116) /cc @rambleraptor --- lib/ansible/module_utils/gcp_utils.py | 2 +- .../cloud/google/gcp_compute_address.py | 2 - .../google/gcp_compute_backend_bucket.py | 2 - .../google/gcp_compute_backend_service.py | 2 - .../modules/cloud/google/gcp_compute_disk.py | 2 - .../cloud/google/gcp_compute_firewall.py | 2 - .../google/gcp_compute_forwarding_rule.py | 2 - .../google/gcp_compute_global_address.py | 2 - .../gcp_compute_global_forwarding_rule.py | 2 - .../cloud/google/gcp_compute_health_check.py | 2 - .../google/gcp_compute_http_health_check.py | 2 - .../google/gcp_compute_https_health_check.py | 2 - .../modules/cloud/google/gcp_compute_image.py | 2 - .../cloud/google/gcp_compute_instance.py | 2 - .../google/gcp_compute_instance_group.py | 2 - .../gcp_compute_instance_group_manager.py | 2 - .../google/gcp_compute_instance_template.py | 2 - .../gcp_compute_interconnect_attachment.py | 2 - .../cloud/google/gcp_compute_network.py | 2 - .../cloud/google/gcp_compute_region_disk.py | 2 - .../modules/cloud/google/gcp_compute_route.py | 2 - .../cloud/google/gcp_compute_router.py | 2 - .../google/gcp_compute_ssl_certificate.py | 2 - .../cloud/google/gcp_compute_ssl_policy.py | 2 - .../cloud/google/gcp_compute_subnetwork.py | 2 - .../google/gcp_compute_target_http_proxy.py | 2 - .../google/gcp_compute_target_https_proxy.py | 2 - .../cloud/google/gcp_compute_target_pool.py | 2 - .../google/gcp_compute_target_ssl_proxy.py | 2 - .../google/gcp_compute_target_tcp_proxy.py | 2 - .../google/gcp_compute_target_vpn_gateway.py | 2 - .../cloud/google/gcp_compute_url_map.py | 2 - .../cloud/google/gcp_compute_vpn_tunnel.py | 2 - .../cloud/google/gcp_container_cluster.py | 2 - .../cloud/google/gcp_container_node_pool.py | 2 - .../google/gcp_resourcemanager_project.py | 378 ++++++++++++++++++ .../gcp_resourcemanager_project_facts.py | 183 +++++++++ .../modules/cloud/google/gcp_sql_database.py | 8 +- .../modules/cloud/google/gcp_sql_instance.py | 8 +- .../modules/cloud/google/gcp_sql_user.py | 8 +- .../gcp_resourcemanager_project/aliases | 2 + .../defaults/main.yml | 3 + .../gcp_resourcemanager_project/meta/main.yml | 0 .../tasks/main.yml | 113 ++++++ 44 files changed, 686 insertions(+), 87 deletions(-) create mode 100644 lib/ansible/modules/cloud/google/gcp_resourcemanager_project.py create mode 100644 lib/ansible/modules/cloud/google/gcp_resourcemanager_project_facts.py create mode 100644 test/integration/targets/gcp_resourcemanager_project/aliases create mode 100644 test/integration/targets/gcp_resourcemanager_project/defaults/main.yml create mode 100644 test/integration/targets/gcp_resourcemanager_project/meta/main.yml create mode 100644 test/integration/targets/gcp_resourcemanager_project/tasks/main.yml diff --git a/lib/ansible/module_utils/gcp_utils.py b/lib/ansible/module_utils/gcp_utils.py index 9171e3f358b057..6ae28598fe53b1 100644 --- a/lib/ansible/module_utils/gcp_utils.py +++ b/lib/ansible/module_utils/gcp_utils.py @@ -153,7 +153,7 @@ def __init__(self, *args, **kwargs): arg_spec, dict( project=dict( - required=True, + required=False, type='str', fallback=(env_fallback, ['GCP_PROJECT'])), auth_kind=dict( diff --git a/lib/ansible/modules/cloud/google/gcp_compute_address.py b/lib/ansible/modules/cloud/google/gcp_compute_address.py index 466adddfbcefb1..b5b8726b47b3b3 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_address.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_address.py @@ -381,8 +381,6 @@ def wait_for_completion(status, op_result, module): while status != 'DONE': raise_if_errors(op_result, ['error', 'errors'], 'message') time.sleep(1.0) - if status not in ['PENDING', 'RUNNING', 'DONE']: - module.fail_json(msg="Invalid result %s" % status) op_result = fetch_resource(module, op_uri, 'compute#operation') status = navigate_hash(op_result, ['status']) return op_result diff --git a/lib/ansible/modules/cloud/google/gcp_compute_backend_bucket.py b/lib/ansible/modules/cloud/google/gcp_compute_backend_bucket.py index f5f9255fe66217..3cbc235d42e40b 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_backend_bucket.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_backend_bucket.py @@ -319,8 +319,6 @@ def wait_for_completion(status, op_result, module): while status != 'DONE': raise_if_errors(op_result, ['error', 'errors'], 'message') time.sleep(1.0) - if status not in ['PENDING', 'RUNNING', 'DONE']: - module.fail_json(msg="Invalid result %s" % status) op_result = fetch_resource(module, op_uri, 'compute#operation') status = navigate_hash(op_result, ['status']) return op_result diff --git a/lib/ansible/modules/cloud/google/gcp_compute_backend_service.py b/lib/ansible/modules/cloud/google/gcp_compute_backend_service.py index 53f17b717977cd..6f69be8da6313c 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_backend_service.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_backend_service.py @@ -846,8 +846,6 @@ def wait_for_completion(status, op_result, module): while status != 'DONE': raise_if_errors(op_result, ['error', 'errors'], 'message') time.sleep(1.0) - if status not in ['PENDING', 'RUNNING', 'DONE']: - module.fail_json(msg="Invalid result %s" % status) op_result = fetch_resource(module, op_uri, 'compute#operation') status = navigate_hash(op_result, ['status']) return op_result diff --git a/lib/ansible/modules/cloud/google/gcp_compute_disk.py b/lib/ansible/modules/cloud/google/gcp_compute_disk.py index c139a533d8abc1..c8156e2db4fdd0 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_disk.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_disk.py @@ -634,8 +634,6 @@ def wait_for_completion(status, op_result, module): while status != 'DONE': raise_if_errors(op_result, ['error', 'errors'], 'message') time.sleep(1.0) - if status not in ['PENDING', 'RUNNING', 'DONE']: - module.fail_json(msg="Invalid result %s" % status) op_result = fetch_resource(module, op_uri, 'compute#operation') status = navigate_hash(op_result, ['status']) return op_result diff --git a/lib/ansible/modules/cloud/google/gcp_compute_firewall.py b/lib/ansible/modules/cloud/google/gcp_compute_firewall.py index a1c5bac9110558..f75f16bdf331ec 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_firewall.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_firewall.py @@ -619,8 +619,6 @@ def wait_for_completion(status, op_result, module): while status != 'DONE': raise_if_errors(op_result, ['error', 'errors'], 'message') time.sleep(1.0) - if status not in ['PENDING', 'RUNNING', 'DONE']: - module.fail_json(msg="Invalid result %s" % status) op_result = fetch_resource(module, op_uri, 'compute#operation') status = navigate_hash(op_result, ['status']) return op_result diff --git a/lib/ansible/modules/cloud/google/gcp_compute_forwarding_rule.py b/lib/ansible/modules/cloud/google/gcp_compute_forwarding_rule.py index 60d4d81566d626..9ba834304a77a4 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_forwarding_rule.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_forwarding_rule.py @@ -617,8 +617,6 @@ def wait_for_completion(status, op_result, module): while status != 'DONE': raise_if_errors(op_result, ['error', 'errors'], 'message') time.sleep(1.0) - if status not in ['PENDING', 'RUNNING', 'DONE']: - module.fail_json(msg="Invalid result %s" % status) op_result = fetch_resource(module, op_uri, 'compute#operation') status = navigate_hash(op_result, ['status']) return op_result diff --git a/lib/ansible/modules/cloud/google/gcp_compute_global_address.py b/lib/ansible/modules/cloud/google/gcp_compute_global_address.py index 354d9b015dd618..88283797388344 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_global_address.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_global_address.py @@ -338,8 +338,6 @@ def wait_for_completion(status, op_result, module): while status != 'DONE': raise_if_errors(op_result, ['error', 'errors'], 'message') time.sleep(1.0) - if status not in ['PENDING', 'RUNNING', 'DONE']: - module.fail_json(msg="Invalid result %s" % status) op_result = fetch_resource(module, op_uri, 'compute#operation') status = navigate_hash(op_result, ['status']) return op_result diff --git a/lib/ansible/modules/cloud/google/gcp_compute_global_forwarding_rule.py b/lib/ansible/modules/cloud/google/gcp_compute_global_forwarding_rule.py index b832eb15b46dcc..bf43943e43deb9 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_global_forwarding_rule.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_global_forwarding_rule.py @@ -605,8 +605,6 @@ def wait_for_completion(status, op_result, module): while status != 'DONE': raise_if_errors(op_result, ['error', 'errors'], 'message') time.sleep(1.0) - if status not in ['PENDING', 'RUNNING', 'DONE']: - module.fail_json(msg="Invalid result %s" % status) op_result = fetch_resource(module, op_uri, 'compute#operation') status = navigate_hash(op_result, ['status']) return op_result 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 6c80fb88a1cf55..232dc92f78510d 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_health_check.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_health_check.py @@ -707,8 +707,6 @@ def wait_for_completion(status, op_result, module): while status != 'DONE': raise_if_errors(op_result, ['error', 'errors'], 'message') time.sleep(1.0) - if status not in ['PENDING', 'RUNNING', 'DONE']: - module.fail_json(msg="Invalid result %s" % status) op_result = fetch_resource(module, op_uri, 'compute#operation') status = navigate_hash(op_result, ['status']) return op_result diff --git a/lib/ansible/modules/cloud/google/gcp_compute_http_health_check.py b/lib/ansible/modules/cloud/google/gcp_compute_http_health_check.py index 00b0d320208c1d..75d259ef92f718 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_http_health_check.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_http_health_check.py @@ -388,8 +388,6 @@ def wait_for_completion(status, op_result, module): while status != 'DONE': raise_if_errors(op_result, ['error', 'errors'], 'message') time.sleep(1.0) - if status not in ['PENDING', 'RUNNING', 'DONE']: - module.fail_json(msg="Invalid result %s" % status) op_result = fetch_resource(module, op_uri, 'compute#operation') status = navigate_hash(op_result, ['status']) return op_result diff --git a/lib/ansible/modules/cloud/google/gcp_compute_https_health_check.py b/lib/ansible/modules/cloud/google/gcp_compute_https_health_check.py index 0803b9ee2ade5a..be515ce034b8af 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_https_health_check.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_https_health_check.py @@ -385,8 +385,6 @@ def wait_for_completion(status, op_result, module): while status != 'DONE': raise_if_errors(op_result, ['error', 'errors'], 'message') time.sleep(1.0) - if status not in ['PENDING', 'RUNNING', 'DONE']: - module.fail_json(msg="Invalid result %s" % status) op_result = fetch_resource(module, op_uri, 'compute#operation') status = navigate_hash(op_result, ['status']) return op_result diff --git a/lib/ansible/modules/cloud/google/gcp_compute_image.py b/lib/ansible/modules/cloud/google/gcp_compute_image.py index 948c96b097412c..80356c9b264128 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_image.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_image.py @@ -625,8 +625,6 @@ def wait_for_completion(status, op_result, module): while status != 'DONE': raise_if_errors(op_result, ['error', 'errors'], 'message') time.sleep(1.0) - if status not in ['PENDING', 'RUNNING', 'DONE']: - module.fail_json(msg="Invalid result %s" % status) op_result = fetch_resource(module, op_uri, 'compute#operation') status = navigate_hash(op_result, ['status']) return op_result diff --git a/lib/ansible/modules/cloud/google/gcp_compute_instance.py b/lib/ansible/modules/cloud/google/gcp_compute_instance.py index 70054bd6bc728f..b71b0d7173e9b9 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_instance.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_instance.py @@ -1152,8 +1152,6 @@ def wait_for_completion(status, op_result, module): while status != 'DONE': raise_if_errors(op_result, ['error', 'errors'], 'message') time.sleep(1.0) - if status not in ['PENDING', 'RUNNING', 'DONE']: - module.fail_json(msg="Invalid result %s" % status) op_result = fetch_resource(module, op_uri, 'compute#operation') status = navigate_hash(op_result, ['status']) return op_result diff --git a/lib/ansible/modules/cloud/google/gcp_compute_instance_group.py b/lib/ansible/modules/cloud/google/gcp_compute_instance_group.py index 18ef11b69b0284..63da353dcc096d 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_instance_group.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_instance_group.py @@ -420,8 +420,6 @@ def wait_for_completion(status, op_result, module): while status != 'DONE': raise_if_errors(op_result, ['error', 'errors'], 'message') time.sleep(1.0) - if status not in ['PENDING', 'RUNNING', 'DONE']: - module.fail_json(msg="Invalid result %s" % status) op_result = fetch_resource(module, op_uri, 'compute#operation') status = navigate_hash(op_result, ['status']) return op_result diff --git a/lib/ansible/modules/cloud/google/gcp_compute_instance_group_manager.py b/lib/ansible/modules/cloud/google/gcp_compute_instance_group_manager.py index abfee18d668a75..a84d86aac7572b 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_instance_group_manager.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_instance_group_manager.py @@ -521,8 +521,6 @@ def wait_for_completion(status, op_result, module): while status != 'DONE': raise_if_errors(op_result, ['error', 'errors'], 'message') time.sleep(1.0) - if status not in ['PENDING', 'RUNNING', 'DONE']: - module.fail_json(msg="Invalid result %s" % status) op_result = fetch_resource(module, op_uri, 'compute#operation') status = navigate_hash(op_result, ['status']) return op_result diff --git a/lib/ansible/modules/cloud/google/gcp_compute_instance_template.py b/lib/ansible/modules/cloud/google/gcp_compute_instance_template.py index 18d2ff4bd3fff3..2a7ac854fcffaa 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_instance_template.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_instance_template.py @@ -1097,8 +1097,6 @@ def wait_for_completion(status, op_result, module): while status != 'DONE': raise_if_errors(op_result, ['error', 'errors'], 'message') time.sleep(1.0) - if status not in ['PENDING', 'RUNNING', 'DONE']: - module.fail_json(msg="Invalid result %s" % status) op_result = fetch_resource(module, op_uri, 'compute#operation') status = navigate_hash(op_result, ['status']) return op_result diff --git a/lib/ansible/modules/cloud/google/gcp_compute_interconnect_attachment.py b/lib/ansible/modules/cloud/google/gcp_compute_interconnect_attachment.py index d9e91f4c6031bc..ef86aa2c472e7b 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_interconnect_attachment.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_interconnect_attachment.py @@ -369,8 +369,6 @@ def wait_for_completion(status, op_result, module): while status != 'DONE': raise_if_errors(op_result, ['error', 'errors'], 'message') time.sleep(1.0) - if status not in ['PENDING', 'RUNNING', 'DONE']: - module.fail_json(msg="Invalid result %s" % status) op_result = fetch_resource(module, op_uri, 'compute#operation') status = navigate_hash(op_result, ['status']) return op_result diff --git a/lib/ansible/modules/cloud/google/gcp_compute_network.py b/lib/ansible/modules/cloud/google/gcp_compute_network.py index 3dadbf13988604..ba5407e43a6990 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_network.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_network.py @@ -397,8 +397,6 @@ def wait_for_completion(status, op_result, module): while status != 'DONE': raise_if_errors(op_result, ['error', 'errors'], 'message') time.sleep(1.0) - if status not in ['PENDING', 'RUNNING', 'DONE']: - module.fail_json(msg="Invalid result %s" % status) op_result = fetch_resource(module, op_uri, 'compute#operation') status = navigate_hash(op_result, ['status']) return op_result diff --git a/lib/ansible/modules/cloud/google/gcp_compute_region_disk.py b/lib/ansible/modules/cloud/google/gcp_compute_region_disk.py index 7847fb218d2597..d13b3f739130bf 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_region_disk.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_region_disk.py @@ -575,8 +575,6 @@ def wait_for_completion(status, op_result, module): while status != 'DONE': raise_if_errors(op_result, ['error', 'errors'], 'message') time.sleep(1.0) - if status not in ['PENDING', 'RUNNING', 'DONE']: - module.fail_json(msg="Invalid result %s" % status) op_result = fetch_resource(module, op_uri, 'compute#operation') status = navigate_hash(op_result, ['status']) return op_result diff --git a/lib/ansible/modules/cloud/google/gcp_compute_route.py b/lib/ansible/modules/cloud/google/gcp_compute_route.py index 5bd29a366a4886..546b0dfd35efcc 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_route.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_route.py @@ -427,8 +427,6 @@ def wait_for_completion(status, op_result, module): while status != 'DONE': raise_if_errors(op_result, ['error', 'errors'], 'message') time.sleep(1.0) - if status not in ['PENDING', 'RUNNING', 'DONE']: - module.fail_json(msg="Invalid result %s" % status) op_result = fetch_resource(module, op_uri, 'compute#operation') status = navigate_hash(op_result, ['status']) return op_result diff --git a/lib/ansible/modules/cloud/google/gcp_compute_router.py b/lib/ansible/modules/cloud/google/gcp_compute_router.py index 585722b29c8d4c..be8bf03f37e1aa 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_router.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_router.py @@ -426,8 +426,6 @@ def wait_for_completion(status, op_result, module): while status != 'DONE': raise_if_errors(op_result, ['error', 'errors'], 'message') time.sleep(1.0) - if status not in ['PENDING', 'RUNNING', 'DONE']: - module.fail_json(msg="Invalid result %s" % status) op_result = fetch_resource(module, op_uri, 'compute#operation') status = navigate_hash(op_result, ['status']) return op_result diff --git a/lib/ansible/modules/cloud/google/gcp_compute_ssl_certificate.py b/lib/ansible/modules/cloud/google/gcp_compute_ssl_certificate.py index ebe6cbe1b5b324..1626e85c4de67c 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_ssl_certificate.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_ssl_certificate.py @@ -330,8 +330,6 @@ def wait_for_completion(status, op_result, module): while status != 'DONE': raise_if_errors(op_result, ['error', 'errors'], 'message') time.sleep(1.0) - if status not in ['PENDING', 'RUNNING', 'DONE']: - module.fail_json(msg="Invalid result %s" % status) op_result = fetch_resource(module, op_uri, 'compute#operation') status = navigate_hash(op_result, ['status']) return op_result diff --git a/lib/ansible/modules/cloud/google/gcp_compute_ssl_policy.py b/lib/ansible/modules/cloud/google/gcp_compute_ssl_policy.py index 654393126b5b5c..d1336036856b85 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_ssl_policy.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_ssl_policy.py @@ -372,8 +372,6 @@ def wait_for_completion(status, op_result, module): while status != 'DONE': raise_if_errors(op_result, ['error', 'errors'], 'message') time.sleep(1.0) - if status not in ['PENDING', 'RUNNING', 'DONE']: - module.fail_json(msg="Invalid result %s" % status) op_result = fetch_resource(module, op_uri, 'compute#operation') status = navigate_hash(op_result, ['status']) return op_result diff --git a/lib/ansible/modules/cloud/google/gcp_compute_subnetwork.py b/lib/ansible/modules/cloud/google/gcp_compute_subnetwork.py index ddbf5d4c820615..d8e2946595102a 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_subnetwork.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_subnetwork.py @@ -501,8 +501,6 @@ def wait_for_completion(status, op_result, module): while status != 'DONE': raise_if_errors(op_result, ['error', 'errors'], 'message') time.sleep(1.0) - if status not in ['PENDING', 'RUNNING', 'DONE']: - module.fail_json(msg="Invalid result %s" % status) op_result = fetch_resource(module, op_uri, 'compute#operation') status = navigate_hash(op_result, ['status']) return op_result diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_http_proxy.py b/lib/ansible/modules/cloud/google/gcp_compute_target_http_proxy.py index 1d67ec9ee272be..5fc0ec61a22697 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_http_proxy.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_http_proxy.py @@ -362,8 +362,6 @@ def wait_for_completion(status, op_result, module): while status != 'DONE': raise_if_errors(op_result, ['error', 'errors'], 'message') time.sleep(1.0) - if status not in ['PENDING', 'RUNNING', 'DONE']: - module.fail_json(msg="Invalid result %s" % status) op_result = fetch_resource(module, op_uri, 'compute#operation') status = navigate_hash(op_result, ['status']) return op_result diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_https_proxy.py b/lib/ansible/modules/cloud/google/gcp_compute_target_https_proxy.py index 7c848e915b59c3..d2e2eed5a64bba 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_https_proxy.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_https_proxy.py @@ -468,8 +468,6 @@ def wait_for_completion(status, op_result, module): while status != 'DONE': raise_if_errors(op_result, ['error', 'errors'], 'message') time.sleep(1.0) - if status not in ['PENDING', 'RUNNING', 'DONE']: - module.fail_json(msg="Invalid result %s" % status) op_result = fetch_resource(module, op_uri, 'compute#operation') status = navigate_hash(op_result, ['status']) return op_result diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_pool.py b/lib/ansible/modules/cloud/google/gcp_compute_target_pool.py index bac2c213786158..012a2de94365f9 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_pool.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_pool.py @@ -423,8 +423,6 @@ def wait_for_completion(status, op_result, module): while status != 'DONE': raise_if_errors(op_result, ['error', 'errors'], 'message') time.sleep(1.0) - if status not in ['PENDING', 'RUNNING', 'DONE']: - module.fail_json(msg="Invalid result %s" % status) op_result = fetch_resource(module, op_uri, 'compute#operation') status = navigate_hash(op_result, ['status']) return op_result diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_ssl_proxy.py b/lib/ansible/modules/cloud/google/gcp_compute_target_ssl_proxy.py index d58f9d54cf7014..2a59d7d0622ebd 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_ssl_proxy.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_ssl_proxy.py @@ -453,8 +453,6 @@ def wait_for_completion(status, op_result, module): while status != 'DONE': raise_if_errors(op_result, ['error', 'errors'], 'message') time.sleep(1.0) - if status not in ['PENDING', 'RUNNING', 'DONE']: - module.fail_json(msg="Invalid result %s" % status) op_result = fetch_resource(module, op_uri, 'compute#operation') status = navigate_hash(op_result, ['status']) return op_result diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_tcp_proxy.py b/lib/ansible/modules/cloud/google/gcp_compute_target_tcp_proxy.py index e198b600c97493..d31462939993eb 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_tcp_proxy.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_tcp_proxy.py @@ -388,8 +388,6 @@ def wait_for_completion(status, op_result, module): while status != 'DONE': raise_if_errors(op_result, ['error', 'errors'], 'message') time.sleep(1.0) - if status not in ['PENDING', 'RUNNING', 'DONE']: - module.fail_json(msg="Invalid result %s" % status) op_result = fetch_resource(module, op_uri, 'compute#operation') status = navigate_hash(op_result, ['status']) return op_result diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_vpn_gateway.py b/lib/ansible/modules/cloud/google/gcp_compute_target_vpn_gateway.py index fa8959f0033854..d01d144acbb1ce 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_vpn_gateway.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_vpn_gateway.py @@ -335,8 +335,6 @@ def wait_for_completion(status, op_result, module): while status != 'DONE': raise_if_errors(op_result, ['error', 'errors'], 'message') time.sleep(1.0) - if status not in ['PENDING', 'RUNNING', 'DONE']: - module.fail_json(msg="Invalid result %s" % status) op_result = fetch_resource(module, op_uri, 'compute#operation') status = navigate_hash(op_result, ['status']) return op_result diff --git a/lib/ansible/modules/cloud/google/gcp_compute_url_map.py b/lib/ansible/modules/cloud/google/gcp_compute_url_map.py index 54d798d456c859..25a549cc0abdfe 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_url_map.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_url_map.py @@ -553,8 +553,6 @@ def wait_for_completion(status, op_result, module): while status != 'DONE': raise_if_errors(op_result, ['error', 'errors'], 'message') time.sleep(1.0) - if status not in ['PENDING', 'RUNNING', 'DONE']: - module.fail_json(msg="Invalid result %s" % status) op_result = fetch_resource(module, op_uri, 'compute#operation') status = navigate_hash(op_result, ['status']) return op_result diff --git a/lib/ansible/modules/cloud/google/gcp_compute_vpn_tunnel.py b/lib/ansible/modules/cloud/google/gcp_compute_vpn_tunnel.py index 1d9016c2384855..b5ae722db114f8 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_vpn_tunnel.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_vpn_tunnel.py @@ -479,8 +479,6 @@ def wait_for_completion(status, op_result, module): while status != 'DONE': raise_if_errors(op_result, ['error', 'errors'], 'message') time.sleep(1.0) - if status not in ['PENDING', 'RUNNING', 'DONE']: - module.fail_json(msg="Invalid result %s" % status) op_result = fetch_resource(module, op_uri, 'compute#operation') status = navigate_hash(op_result, ['status']) return op_result diff --git a/lib/ansible/modules/cloud/google/gcp_container_cluster.py b/lib/ansible/modules/cloud/google/gcp_container_cluster.py index 40ed9a5aa3ebf1..5555ea5880eaa7 100644 --- a/lib/ansible/modules/cloud/google/gcp_container_cluster.py +++ b/lib/ansible/modules/cloud/google/gcp_container_cluster.py @@ -811,8 +811,6 @@ def wait_for_completion(status, op_result, module): while status != 'DONE': raise_if_errors(op_result, ['error', 'errors'], 'message') time.sleep(1.0) - if status not in ['PENDING', 'RUNNING', 'DONE', 'ABORTING']: - module.fail_json(msg="Invalid result %s" % status) op_result = fetch_resource(module, op_uri) status = navigate_hash(op_result, ['status']) return op_result diff --git a/lib/ansible/modules/cloud/google/gcp_container_node_pool.py b/lib/ansible/modules/cloud/google/gcp_container_node_pool.py index 28ef53050c3abc..d3196ff18aefcf 100644 --- a/lib/ansible/modules/cloud/google/gcp_container_node_pool.py +++ b/lib/ansible/modules/cloud/google/gcp_container_node_pool.py @@ -637,8 +637,6 @@ def wait_for_completion(status, op_result, module): while status != 'DONE': raise_if_errors(op_result, ['error', 'errors'], 'message') time.sleep(1.0) - if status not in ['PENDING', 'RUNNING', 'DONE', 'ABORTING']: - module.fail_json(msg="Invalid result %s" % status) op_result = fetch_resource(module, op_uri) status = navigate_hash(op_result, ['status']) return op_result diff --git a/lib/ansible/modules/cloud/google/gcp_resourcemanager_project.py b/lib/ansible/modules/cloud/google/gcp_resourcemanager_project.py new file mode 100644 index 00000000000000..fe46412bf2a80c --- /dev/null +++ b/lib/ansible/modules/cloud/google/gcp_resourcemanager_project.py @@ -0,0 +1,378 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# +# Copyright (C) 2017 Google +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) +# ---------------------------------------------------------------------------- +# +# *** AUTO GENERATED CODE *** AUTO GENERATED CODE *** +# +# ---------------------------------------------------------------------------- +# +# This file is automatically generated by Magic Modules and manual +# changes will be clobbered when the file is regenerated. +# +# Please read more about how to change this file at +# https://www.github.com/GoogleCloudPlatform/magic-modules +# +# ---------------------------------------------------------------------------- + +from __future__ import absolute_import, division, print_function +__metaclass__ = type + +################################################################################ +# Documentation +################################################################################ + +ANSIBLE_METADATA = {'metadata_version': '1.1', + 'status': ["preview"], + 'supported_by': 'community'} + +DOCUMENTATION = ''' +--- +module: gcp_resourcemanager_project +description: +- Represents a GCP Project. A project is a container for ACLs, APIs, App Engine Apps, + VMs, and other Google Cloud Platform resources. +short_description: Creates a GCP Project +version_added: 2.8 +author: Google Inc. (@googlecloudplatform) +requirements: +- python >= 2.6 +- requests >= 2.18.4 +- google-auth >= 1.3.0 +options: + state: + description: + - Whether the given object should exist in GCP + choices: + - present + - absent + default: present + name: + description: + - 'The user-assigned display name of the Project. It must be 4 to 30 characters. + Allowed characters are: lowercase and uppercase letters, numbers, hyphen, single-quote, + double-quote, space, and exclamation point.' + required: false + labels: + description: + - The labels associated with this Project. + - 'Label keys must be between 1 and 63 characters long and must conform to the + following regular expression: `[a-z]([-a-z0-9]*[a-z0-9])?`.' + - Label values must be between 0 and 63 characters long and must conform to the + regular expression `([a-z]([-a-z0-9]*[a-z0-9])?)?`. + - No more than 256 labels can be associated with a given resource. + - Clients should store labels in a representation such as JSON that does not depend + on specific characters being disallowed . + required: false + parent: + description: + - A parent organization. + required: false + suboptions: + type: + description: + - Must be organization. + required: false + id: + description: + - Id of the organization. + required: false + id: + description: + - The unique, user-assigned ID of the Project. It must be 6 to 30 lowercase letters, + digits, or hyphens. It must start with a letter. + - Trailing hyphens are prohibited. + required: true +extends_documentation_fragment: gcp +''' + +EXAMPLES = ''' +- name: create a project + gcp_resourcemanager_project: + name: My Sample Project + id: alextest-{{ 10000000000 | random }} + auth_kind: "serviceaccount" + service_account_file: "/tmp/auth.pem" + parent: + type: organization + id: 636173955921 + state: present +''' + +RETURN = ''' +number: + description: + - Number uniquely identifying the project. + returned: success + type: int +lifecycleState: + description: + - The Project lifecycle state. + returned: success + type: str +name: + description: + - 'The user-assigned display name of the Project. It must be 4 to 30 characters. + Allowed characters are: lowercase and uppercase letters, numbers, hyphen, single-quote, + double-quote, space, and exclamation point.' + returned: success + type: str +createTime: + description: + - Time of creation. + returned: success + type: str +labels: + description: + - The labels associated with this Project. + - 'Label keys must be between 1 and 63 characters long and must conform to the following + regular expression: `[a-z]([-a-z0-9]*[a-z0-9])?`.' + - Label values must be between 0 and 63 characters long and must conform to the + regular expression `([a-z]([-a-z0-9]*[a-z0-9])?)?`. + - No more than 256 labels can be associated with a given resource. + - Clients should store labels in a representation such as JSON that does not depend + on specific characters being disallowed . + returned: success + type: dict +parent: + description: + - A parent organization. + returned: success + type: complex + contains: + type: + description: + - Must be organization. + returned: success + type: str + id: + description: + - Id of the organization. + returned: success + type: str +id: + description: + - The unique, user-assigned ID of the Project. It must be 6 to 30 lowercase letters, + digits, or hyphens. It must start with a letter. + - Trailing hyphens are prohibited. + returned: success + type: str +''' + +################################################################################ +# Imports +################################################################################ + +from ansible.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest, remove_nones_from_dict, replace_resource_dict +import json +import time + +################################################################################ +# Main +################################################################################ + + +def main(): + """Main function""" + + module = GcpModule( + argument_spec=dict( + state=dict(default='present', choices=['present', 'absent'], type='str'), + name=dict(type='str'), + labels=dict(type='dict'), + parent=dict(type='dict', options=dict( + type=dict(type='str'), + id=dict(type='str') + )), + id=dict(required=True, type='str') + ) + ) + + if not module.params['scopes']: + module.params['scopes'] = ['https://www.googleapis.com/auth/cloud-platform'] + + state = module.params['state'] + + fetch = fetch_resource(module, self_link(module)) + changed = False + + if fetch: + if state == 'present': + if is_different(module, fetch): + update(module, self_link(module)) + fetch = fetch_resource(module, self_link(module)) + changed = True + else: + delete(module, self_link(module)) + fetch = {} + changed = True + else: + if state == 'present': + fetch = create(module, collection(module)) + changed = True + else: + fetch = {} + + fetch.update({'changed': changed}) + + module.exit_json(**fetch) + + +def create(module, link): + auth = GcpSession(module, 'resourcemanager') + return wait_for_operation(module, auth.post(link, resource_to_request(module))) + + +def update(module, link): + auth = GcpSession(module, 'resourcemanager') + return wait_for_operation(module, auth.put(link, resource_to_request(module))) + + +def delete(module, link): + auth = GcpSession(module, 'resourcemanager') + return wait_for_operation(module, auth.delete(link)) + + +def resource_to_request(module): + request = { + u'projectId': module.params.get('id'), + u'name': module.params.get('name'), + u'labels': module.params.get('labels'), + u'parent': ProjectParent(module.params.get('parent', {}), module).to_request() + } + return_vals = {} + for k, v in request.items(): + if v: + return_vals[k] = v + + return return_vals + + +def fetch_resource(module, link, allow_not_found=True): + auth = GcpSession(module, 'resourcemanager') + return return_if_object(module, auth.get(link), allow_not_found) + + +def self_link(module): + return "https://cloudresourcemanager.googleapis.com/v1/projects/{id}".format(**module.params) + + +def collection(module): + return "https://cloudresourcemanager.googleapis.com/v1/projects".format(**module.params) + + +def return_if_object(module, response, allow_not_found=False): + # If not found, return nothing. + if allow_not_found and response.status_code == 404: + return None + + # If no content, return nothing. + if response.status_code == 204: + return None + + # SQL only: return on 403 if not exist + if allow_not_found and response.status_code == 403: + return None + + try: + result = response.json() + except getattr(json.decoder, 'JSONDecodeError', ValueError) as inst: + module.fail_json(msg="Invalid JSON response with error: %s" % inst) + + if navigate_hash(result, ['error', 'message']): + module.fail_json(msg=navigate_hash(result, ['error', 'message'])) + + return result + + +def is_different(module, response): + request = resource_to_request(module) + response = response_to_hash(module, response) + + # Remove all output-only from response. + response_vals = {} + for k, v in response.items(): + if k in request: + response_vals[k] = v + + request_vals = {} + for k, v in request.items(): + if k in response: + request_vals[k] = v + + return GcpRequest(request_vals) != GcpRequest(response_vals) + + +# Remove unnecessary properties from the response. +# This is for doing comparisons with Ansible's current parameters. +def response_to_hash(module, response): + return { + u'projectNumber': response.get(u'number'), + u'lifecycleState': response.get(u'lifecycleState'), + u'name': response.get(u'name'), + u'createTime': response.get(u'createTime'), + u'labels': response.get(u'labels'), + u'parent': ProjectParent(response.get(u'parent', {}), module).from_response() + } + + +def async_op_url(module, extra_data=None): + if extra_data is None: + extra_data = {} + url = "https://cloudresourcemanager.googleapis.com/v1/{op_id}" + combined = extra_data.copy() + combined.update(module.params) + return url.format(**combined) + + +def wait_for_operation(module, response): + op_result = return_if_object(module, response) + if op_result is None: + return {} + status = navigate_hash(op_result, ['done']) + wait_done = wait_for_completion(status, op_result, module) + return navigate_hash(wait_done, ['response']) + + +def wait_for_completion(status, op_result, module): + op_id = navigate_hash(op_result, ['name']) + op_uri = async_op_url(module, {'op_id': op_id}) + if not status: + raise_if_errors(op_result, ['error'], 'message') + time.sleep(1.0) + op_result = fetch_resource(module, op_uri) + status = navigate_hash(op_result, ['done']) + return op_result + + +def raise_if_errors(response, err_path, module): + errors = navigate_hash(response, err_path) + if errors is not None: + module.fail_json(msg=errors) + + +class ProjectParent(object): + def __init__(self, request, module): + self.module = module + if request: + self.request = request + else: + self.request = {} + + def to_request(self): + return remove_nones_from_dict({ + u'type': self.request.get('type'), + u'id': self.request.get('id') + }) + + def from_response(self): + return remove_nones_from_dict({ + u'type': self.request.get(u'type'), + u'id': self.request.get(u'id') + }) + + +if __name__ == '__main__': + main() diff --git a/lib/ansible/modules/cloud/google/gcp_resourcemanager_project_facts.py b/lib/ansible/modules/cloud/google/gcp_resourcemanager_project_facts.py new file mode 100644 index 00000000000000..a27c1b331b3ae1 --- /dev/null +++ b/lib/ansible/modules/cloud/google/gcp_resourcemanager_project_facts.py @@ -0,0 +1,183 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# +# Copyright (C) 2017 Google +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) +# ---------------------------------------------------------------------------- +# +# *** AUTO GENERATED CODE *** AUTO GENERATED CODE *** +# +# ---------------------------------------------------------------------------- +# +# This file is automatically generated by Magic Modules and manual +# changes will be clobbered when the file is regenerated. +# +# Please read more about how to change this file at +# https://www.github.com/GoogleCloudPlatform/magic-modules +# +# ---------------------------------------------------------------------------- + +from __future__ import absolute_import, division, print_function +__metaclass__ = type + +################################################################################ +# Documentation +################################################################################ + +ANSIBLE_METADATA = {'metadata_version': '1.1', + 'status': ["preview"], + 'supported_by': 'community'} + +DOCUMENTATION = ''' +--- +module: gcp_resourcemanager_project_facts +description: +- Gather facts for GCP Project +short_description: Gather facts for GCP Project +version_added: 2.8 +author: Google Inc. (@googlecloudplatform) +requirements: +- python >= 2.6 +- requests >= 2.18.4 +- google-auth >= 1.3.0 +options: {} +extends_documentation_fragment: gcp +''' + +EXAMPLES = ''' +- name: a project facts + gcp_resourcemanager_project_facts: + project: test_project + auth_kind: serviceaccount + service_account_file: "/tmp/auth.pem" +''' + +RETURN = ''' +items: + description: List of items + returned: always + type: complex + contains: + number: + description: + - Number uniquely identifying the project. + returned: success + type: int + lifecycleState: + description: + - The Project lifecycle state. + returned: success + type: str + name: + description: + - 'The user-assigned display name of the Project. It must be 4 to 30 characters. + Allowed characters are: lowercase and uppercase letters, numbers, hyphen, + single-quote, double-quote, space, and exclamation point.' + returned: success + type: str + createTime: + description: + - Time of creation. + returned: success + type: str + labels: + description: + - The labels associated with this Project. + - 'Label keys must be between 1 and 63 characters long and must conform to the + following regular expression: `[a-z]([-a-z0-9]*[a-z0-9])?`.' + - Label values must be between 0 and 63 characters long and must conform to + the regular expression `([a-z]([-a-z0-9]*[a-z0-9])?)?`. + - No more than 256 labels can be associated with a given resource. + - Clients should store labels in a representation such as JSON that does not + depend on specific characters being disallowed . + returned: success + type: dict + parent: + description: + - A parent organization. + returned: success + type: complex + contains: + type: + description: + - Must be organization. + returned: success + type: str + id: + description: + - Id of the organization. + returned: success + type: str + id: + description: + - The unique, user-assigned ID of the Project. It must be 6 to 30 lowercase + letters, digits, or hyphens. It must start with a letter. + - Trailing hyphens are prohibited. + returned: success + type: str +''' + +################################################################################ +# Imports +################################################################################ +from ansible.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest +import json + +################################################################################ +# Main +################################################################################ + + +def main(): + module = GcpModule( + argument_spec=dict( + ) + ) + + if not module.params['scopes']: + module.params['scopes'] = ['https://www.googleapis.com/auth/cloud-platform'] + + items = fetch_list(module, collection(module)) + if items.get('projects'): + items = items.get('projects') + else: + items = [] + return_value = { + 'items': items + } + module.exit_json(**return_value) + + +def collection(module): + return "https://cloudresourcemanager.googleapis.com/v1/projects".format(**module.params) + + +def fetch_list(module, link): + auth = GcpSession(module, 'resourcemanager') + response = auth.get(link) + return return_if_object(module, response) + + +def return_if_object(module, response): + # If not found, return nothing. + if response.status_code == 404: + return None + + # If no content, return nothing. + if response.status_code == 204: + return None + + try: + module.raise_for_status(response) + result = response.json() + except getattr(json.decoder, 'JSONDecodeError', ValueError) as inst: + module.fail_json(msg="Invalid JSON response with error: %s" % inst) + + if navigate_hash(result, ['error', 'errors']): + module.fail_json(msg=navigate_hash(result, ['error', 'errors'])) + + return result + + +if __name__ == "__main__": + main() diff --git a/lib/ansible/modules/cloud/google/gcp_sql_database.py b/lib/ansible/modules/cloud/google/gcp_sql_database.py index 82a8523d97e378..e1d0832edc7cb0 100644 --- a/lib/ansible/modules/cloud/google/gcp_sql_database.py +++ b/lib/ansible/modules/cloud/google/gcp_sql_database.py @@ -236,7 +236,7 @@ def collection(module): def return_if_object(module, response, kind, allow_not_found=False): # If not found, return nothing. - if response.status_code == 404: + if allow_not_found and response.status_code == 404: return None # If no content, return nothing. @@ -244,7 +244,7 @@ def return_if_object(module, response, kind, allow_not_found=False): return None # SQL only: return on 403 if not exist - if response.status_code == 403: + if allow_not_found and response.status_code == 403: return None try: @@ -254,8 +254,6 @@ def return_if_object(module, response, kind, allow_not_found=False): if navigate_hash(result, ['error', 'errors']): module.fail_json(msg=navigate_hash(result, ['error', 'errors'])) - if result['kind'] != kind: - module.fail_json(msg="Incorrect result: {kind}".format(**result)) return result @@ -312,8 +310,6 @@ def wait_for_completion(status, op_result, module): while status != 'DONE': raise_if_errors(op_result, ['error', 'errors'], 'message') time.sleep(1.0) - if status not in ['PENDING', 'RUNNING', 'DONE']: - module.fail_json(msg="Invalid result %s" % status) op_result = fetch_resource(module, op_uri, 'sql#operation') status = navigate_hash(op_result, ['status']) return op_result diff --git a/lib/ansible/modules/cloud/google/gcp_sql_instance.py b/lib/ansible/modules/cloud/google/gcp_sql_instance.py index 39a708579272ff..2a9938f3a35d08 100644 --- a/lib/ansible/modules/cloud/google/gcp_sql_instance.py +++ b/lib/ansible/modules/cloud/google/gcp_sql_instance.py @@ -699,7 +699,7 @@ def collection(module): def return_if_object(module, response, kind, allow_not_found=False): # If not found, return nothing. - if response.status_code == 404: + if allow_not_found and response.status_code == 404: return None # If no content, return nothing. @@ -707,7 +707,7 @@ def return_if_object(module, response, kind, allow_not_found=False): return None # SQL only: return on 403 if not exist - if response.status_code == 403: + if allow_not_found and response.status_code == 403: return None try: @@ -717,8 +717,6 @@ def return_if_object(module, response, kind, allow_not_found=False): if navigate_hash(result, ['error', 'errors']): module.fail_json(msg=navigate_hash(result, ['error', 'errors'])) - if result['kind'] != kind: - module.fail_json(msg="Incorrect result: {kind}".format(**result)) return result @@ -785,8 +783,6 @@ def wait_for_completion(status, op_result, module): while status != 'DONE': raise_if_errors(op_result, ['error', 'errors'], 'message') time.sleep(1.0) - if status not in ['PENDING', 'RUNNING', 'DONE']: - module.fail_json(msg="Invalid result %s" % status) op_result = fetch_resource(module, op_uri, 'sql#operation') status = navigate_hash(op_result, ['status']) return op_result diff --git a/lib/ansible/modules/cloud/google/gcp_sql_user.py b/lib/ansible/modules/cloud/google/gcp_sql_user.py index 526c452d1ae849..566352420f2ae0 100644 --- a/lib/ansible/modules/cloud/google/gcp_sql_user.py +++ b/lib/ansible/modules/cloud/google/gcp_sql_user.py @@ -280,7 +280,7 @@ def collection(module): def return_if_object(module, response, kind, allow_not_found=False): # If not found, return nothing. - if response.status_code == 404: + if allow_not_found and response.status_code == 404: return None # If no content, return nothing. @@ -288,7 +288,7 @@ def return_if_object(module, response, kind, allow_not_found=False): return None # SQL only: return on 403 if not exist - if response.status_code == 403: + if allow_not_found and response.status_code == 403: return None try: @@ -298,8 +298,6 @@ def return_if_object(module, response, kind, allow_not_found=False): if navigate_hash(result, ['error', 'errors']): module.fail_json(msg=navigate_hash(result, ['error', 'errors'])) - if result['kind'] != kind: - module.fail_json(msg="Incorrect result: {kind}".format(**result)) return result @@ -355,8 +353,6 @@ def wait_for_completion(status, op_result, module): while status != 'DONE': raise_if_errors(op_result, ['error', 'errors'], 'message') time.sleep(1.0) - if status not in ['PENDING', 'RUNNING', 'DONE']: - module.fail_json(msg="Invalid result %s" % status) op_result = fetch_resource(module, op_uri, 'sql#operation') status = navigate_hash(op_result, ['status']) return op_result diff --git a/test/integration/targets/gcp_resourcemanager_project/aliases b/test/integration/targets/gcp_resourcemanager_project/aliases new file mode 100644 index 00000000000000..9812f019ca4bae --- /dev/null +++ b/test/integration/targets/gcp_resourcemanager_project/aliases @@ -0,0 +1,2 @@ +cloud/gcp +unsupported diff --git a/test/integration/targets/gcp_resourcemanager_project/defaults/main.yml b/test/integration/targets/gcp_resourcemanager_project/defaults/main.yml new file mode 100644 index 00000000000000..aa87a2a8e0e0e0 --- /dev/null +++ b/test/integration/targets/gcp_resourcemanager_project/defaults/main.yml @@ -0,0 +1,3 @@ +--- +# defaults file +resource_name: '{{resource_prefix}}' diff --git a/test/integration/targets/gcp_resourcemanager_project/meta/main.yml b/test/integration/targets/gcp_resourcemanager_project/meta/main.yml new file mode 100644 index 00000000000000..e69de29bb2d1d6 diff --git a/test/integration/targets/gcp_resourcemanager_project/tasks/main.yml b/test/integration/targets/gcp_resourcemanager_project/tasks/main.yml new file mode 100644 index 00000000000000..369522540321ce --- /dev/null +++ b/test/integration/targets/gcp_resourcemanager_project/tasks/main.yml @@ -0,0 +1,113 @@ +--- +# ---------------------------------------------------------------------------- +# +# *** AUTO GENERATED CODE *** AUTO GENERATED CODE *** +# +# ---------------------------------------------------------------------------- +# +# This file is automatically generated by Magic Modules and manual +# changes will be clobbered when the file is regenerated. +# +# Please read more about how to change this file at +# https://www.github.com/GoogleCloudPlatform/magic-modules +# +# ---------------------------------------------------------------------------- +# Pre-test setup +- name: delete a project + gcp_resourcemanager_project: + name: My Sample Project + id: alextest-{{ 10000000000 | random }} + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + parent: + type: organization + id: 636173955921 + state: absent +#---------------------------------------------------------- +- name: create a project + gcp_resourcemanager_project: + name: My Sample Project + id: alextest-{{ 10000000000 | random }} + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + parent: + type: organization + id: 636173955921 + state: present + register: result +- name: assert changed is true + assert: + that: + - result.changed == true +- name: verify that project was created + gcp_resourcemanager_project_facts: + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + scopes: + - https://www.googleapis.com/auth/cloud-platform + register: results +- name: verify that command succeeded + assert: + that: + - results['items'] | length >= 1 +# ---------------------------------------------------------------------------- +- name: create a project that already exists + gcp_resourcemanager_project: + name: My Sample Project + id: alextest-{{ 10000000000 | random }} + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + parent: + type: organization + id: 636173955921 + state: present + register: result +- name: assert changed is false + assert: + that: + - result.changed == false +#---------------------------------------------------------- +- name: delete a project + gcp_resourcemanager_project: + name: My Sample Project + id: alextest-{{ 10000000000 | random }} + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + parent: + type: organization + id: 636173955921 + state: absent + register: result +- name: assert changed is true + assert: + that: + - result.changed == true +- name: verify that project was deleted + gcp_resourcemanager_project_facts: + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + scopes: + - https://www.googleapis.com/auth/cloud-platform + register: results +- name: verify that command succeeded + assert: + that: + - results['items'] | length == 0 +# ---------------------------------------------------------------------------- +- name: delete a project that does not exist + gcp_resourcemanager_project: + name: My Sample Project + id: alextest-{{ 10000000000 | random }} + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + parent: + type: organization + id: 636173955921 + state: absent + register: result +- name: assert changed is false + assert: + that: + - result.changed == false From 16447d0a39773424e4c3639c445151b0788aac72 Mon Sep 17 00:00:00 2001 From: Roberto Jung Drebes Date: Tue, 13 Nov 2018 03:16:16 +0000 Subject: [PATCH 057/144] Add labels and updates to DNS managed zone --- .../cloud/google/gcp_dns_managed_zone.py | 57 +++++++++++++++---- .../google/gcp_dns_managed_zone_facts.py | 5 ++ 2 files changed, 52 insertions(+), 10 deletions(-) diff --git a/lib/ansible/modules/cloud/google/gcp_dns_managed_zone.py b/lib/ansible/modules/cloud/google/gcp_dns_managed_zone.py index 6a8ed21bf35e6a..e46350c6bead16 100644 --- a/lib/ansible/modules/cloud/google/gcp_dns_managed_zone.py +++ b/lib/ansible/modules/cloud/google/gcp_dns_managed_zone.py @@ -53,11 +53,11 @@ description: - A mutable string of at most 1024 characters associated with this resource for the user's convenience. Has no effect on the managed zone's function. - required: false + required: true dns_name: description: - The DNS name of this managed zone, for instance "example.com.". - required: false + required: true name: description: - User assigned name for this resource. @@ -69,7 +69,15 @@ is a set of DNS name servers that all host the same ManagedZones. Most users will leave this field unset. required: false + labels: + description: + - A set of key/value label pairs to assign to this ManagedZone. + required: false + version_added: 2.8 extends_documentation_fragment: gcp +notes: +- 'API Reference: U(https://cloud.google.com/dns/api/v1/managedZones)' +- 'Managing Zones: U(https://cloud.google.com/dns/zones/)' ''' EXAMPLES = ''' @@ -126,6 +134,11 @@ - This is in RFC3339 text format. returned: success type: str +labels: + description: + - A set of key/value label pairs to assign to this ManagedZone. + returned: success + type: dict ''' ################################################################################ @@ -146,10 +159,11 @@ def main(): module = GcpModule( argument_spec=dict( state=dict(default='present', choices=['present', 'absent'], type='str'), - description=dict(type='str'), - dns_name=dict(type='str'), + description=dict(required=True, type='str'), + dns_name=dict(required=True, type='str'), name=dict(required=True, type='str'), - name_server_set=dict(type='list', elements='str') + name_server_set=dict(type='list', elements='str'), + labels=dict(type='dict') ) ) @@ -165,7 +179,7 @@ def main(): if fetch: if state == 'present': if is_different(module, fetch): - update(module, self_link(module), kind) + update(module, self_link(module), kind, fetch) fetch = fetch_resource(module, self_link(module), kind) changed = True else: @@ -189,8 +203,29 @@ def create(module, link, kind): return return_if_object(module, auth.post(link, resource_to_request(module)), kind) -def update(module, link, kind): - module.fail_json(msg="ManagedZone cannot be edited") +def update(module, link, kind, fetch): + update_fields(module, resource_to_request(module), + response_to_hash(module, fetch)) + return fetch_resource(module, self_link(module), kind) + + +def update_fields(module, request, response): + if response.get('description') != request.get('description') or response.get('labels') != request.get('labels'): + description_update(module, request, response) + + +def description_update(module, request, response): + auth = GcpSession(module, 'dns') + auth.patch( + ''.join([ + "https://www.googleapis.com/dns/v1/", + "projects/{project}/managedZones/{name}" + ]).format(**module.params), + { + u'description': module.params.get('description'), + u'labels': module.params.get('labels') + } + ) def delete(module, link, kind): @@ -204,7 +239,8 @@ def resource_to_request(module): u'description': module.params.get('description'), u'dnsName': module.params.get('dns_name'), u'name': module.params.get('name'), - u'nameServerSet': module.params.get('name_server_set') + u'nameServerSet': module.params.get('name_server_set'), + u'labels': module.params.get('labels') } return_vals = {} for k, v in request.items(): @@ -276,7 +312,8 @@ def response_to_hash(module, response): u'name': response.get(u'name'), u'nameServers': response.get(u'nameServers'), u'nameServerSet': response.get(u'nameServerSet'), - u'creationTime': response.get(u'creationTime') + u'creationTime': response.get(u'creationTime'), + u'labels': response.get(u'labels') } diff --git a/lib/ansible/modules/cloud/google/gcp_dns_managed_zone_facts.py b/lib/ansible/modules/cloud/google/gcp_dns_managed_zone_facts.py index 6a7e8205f11f3d..164f0245e0bcd8 100644 --- a/lib/ansible/modules/cloud/google/gcp_dns_managed_zone_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_dns_managed_zone_facts.py @@ -103,6 +103,11 @@ - This is in RFC3339 text format. returned: success type: str + labels: + description: + - A set of key/value label pairs to assign to this ManagedZone. + returned: success + type: dict ''' ################################################################################ From 4d4db525a27b05f48a4e6ace700cea08415af9f0 Mon Sep 17 00:00:00 2001 From: The Magician Date: Mon, 19 Nov 2018 12:52:48 -0800 Subject: [PATCH 058/144] Splitting out a small typo fix unrelated from #697 (#130) /cc @drebes --- lib/ansible/modules/cloud/google/gcp_compute_instance.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_instance.py b/lib/ansible/modules/cloud/google/gcp_compute_instance.py index b71b0d7173e9b9..43c14a64d1f8c2 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_instance.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_instance.py @@ -993,7 +993,7 @@ def machine_type_update(module, request, response): auth.post( ''.join([ "https://www.googleapis.com/compute/v1/", - "projdcts/{project}/zones/{zone}/instances/{name}/setMachineType" + "projects/{project}/zones/{zone}/instances/{name}/setMachineType" ]).format(**module.params), { u'machineType': machine_type_selflink(module.params.get('machine_type'), module.params) From 20af1910b6ef1213574665403e2b6697c6815a45 Mon Sep 17 00:00:00 2001 From: The Magician Date: Mon, 26 Nov 2018 11:37:26 -0800 Subject: [PATCH 059/144] Remove bad network update calls on Ansible /cc @rambleraptor --- .../cloud/google/gcp_compute_network.py | 24 ++----------------- 1 file changed, 2 insertions(+), 22 deletions(-) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_network.py b/lib/ansible/modules/cloud/google/gcp_compute_network.py index ba5407e43a6990..7ab0f985d83792 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_network.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_network.py @@ -234,7 +234,7 @@ def main(): if fetch: if state == 'present': if is_different(module, fetch): - update(module, self_link(module), kind, fetch) + update(module, self_link(module), kind) fetch = fetch_resource(module, self_link(module), kind) changed = True else: @@ -258,31 +258,11 @@ def create(module, link, kind): return wait_for_operation(module, auth.post(link, resource_to_request(module))) -def update(module, link, kind, fetch): - update_fields(module, resource_to_request(module), - response_to_hash(module, fetch)) +def update(module, link, kind): auth = GcpSession(module, 'compute') return wait_for_operation(module, auth.patch(link, resource_to_request(module))) -def update_fields(module, request, response): - if response.get('routingConfig') != request.get('routingConfig'): - routing_config_update(module, request, response) - - -def routing_config_update(module, request, response): - auth = GcpSession(module, 'compute') - auth.patch( - ''.join([ - "https://www.googleapis.com/compute/v1/", - "projects/{project}/regions/{region}/subnetworks/{name}" - ]).format(**module.params), - { - u'routingConfig': NetworkRoutingconfigArray(module.params.get('routing_config', []), module).to_request() - } - ) - - def delete(module, link, kind): auth = GcpSession(module, 'compute') return wait_for_operation(module, auth.delete(link)) From d33f9be42a4d698ca681cb9b07f3e2c1c5e88206 Mon Sep 17 00:00:00 2001 From: The Magician Date: Tue, 27 Nov 2018 12:22:00 -0800 Subject: [PATCH 060/144] Ansible: Instance On/Off /cc @rambleraptor --- .../cloud/google/gcp_compute_instance.py | 57 +++++++++++++++++++ .../google/gcp_compute_instance_facts.py | 2 + 2 files changed, 59 insertions(+) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_instance.py b/lib/ansible/modules/cloud/google/gcp_compute_instance.py index 43c14a64d1f8c2..9686e48d93140d 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_instance.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_instance.py @@ -375,6 +375,22 @@ description: - The list of scopes to be made available for this service account. required: false + status: + description: + - 'The status of the instance. One of the following values: PROVISIONING, STAGING, + RUNNING, STOPPING, SUSPENDING, SUSPENDED, and TERMINATED.' + - As a user, use RUNNING to keep a machine "on" and TERMINATED to turn a machine + off . + required: false + version_added: 2.8 + choices: + - PROVISIONING + - STAGING + - RUNNING + - STOPPING + - SUSPENDING + - SUSPENDED + - TERMINATED tags: description: - A list of tags to apply to this instance. Tags are used to identify valid sources @@ -817,6 +833,8 @@ description: - 'The status of the instance. One of the following values: PROVISIONING, STAGING, RUNNING, STOPPING, SUSPENDING, SUSPENDED, and TERMINATED.' + - As a user, use RUNNING to keep a machine "on" and TERMINATED to turn a machine + off . returned: success type: str statusMessage: @@ -933,6 +951,7 @@ def main(): email=dict(type='str'), scopes=dict(type='list', elements='str') )), + status=dict(type='str', choices=['PROVISIONING', 'STAGING', 'RUNNING', 'STOPPING', 'SUSPENDING', 'SUSPENDED', 'TERMINATED']), tags=dict(type='dict', options=dict( fingerprint=dict(type='str'), items=dict(type='list', elements='str') @@ -967,6 +986,11 @@ def main(): else: fetch = {} + if fetch: + instance = InstancePower(module, fetch.get('status')) + instance.run() + if module.params.get('status'): + fetch.update({'status': module.params['status']}) fetch.update({'changed': changed}) module.exit_json(**fetch) @@ -1020,6 +1044,7 @@ def resource_to_request(module): u'networkInterfaces': InstanceNetworkinterfacesArray(module.params.get('network_interfaces', []), module).to_request(), u'scheduling': InstanceScheduling(module.params.get('scheduling', {}), module).to_request(), u'serviceAccounts': InstanceServiceaccountsArray(module.params.get('service_accounts', []), module).to_request(), + u'status': module.params.get('status'), u'tags': InstanceTags(module.params.get('tags', {}), module).to_request() } request = encode_request(request, module) @@ -1214,6 +1239,38 @@ def metadata_decoder(metadata): return items +class InstancePower(object): + def __init__(self, module, current_status): + self.module = module + self.current_status = current_status + self.desired_status = self.module.params.get('status') + + def run(self): + # GcpRequest handles unicode text handling + if GcpRequest({'status': self.current_status}) == GcpRequest({'status': self.desired_status}): + return + elif self.desired_status == 'RUNNING': + self.start() + elif self.desired_status == 'TERMINATED': + self.stop() + elif self.desired_status == 'SUSPENDED': + self.module.fail_json(msg="Instances cannot be suspended using Ansible") + + def start(self): + auth = GcpSession(self.module, 'compute') + wait_for_operation(self.module, auth.post(self._start_url())) + + def stop(self): + auth = GcpSession(self.module, 'compute') + wait_for_operation(self.module, auth.post(self._stop_url())) + + def _start_url(self): + return "https://www.googleapis.com/compute/v1/projects/{project}/zones/{zone}/instances/{name}/start".format(**self.module.params) + + def _stop_url(self): + return "https://www.googleapis.com/compute/v1/projects/{project}/zones/{zone}/instances/{name}/stop".format(**self.module.params) + + class InstanceDisksArray(object): def __init__(self, request, module): self.module = module diff --git a/lib/ansible/modules/cloud/google/gcp_compute_instance_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_instance_facts.py index 6c029571a804a2..9b6002698ca43c 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_instance_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_instance_facts.py @@ -432,6 +432,8 @@ description: - 'The status of the instance. One of the following values: PROVISIONING, STAGING, RUNNING, STOPPING, SUSPENDING, SUSPENDED, and TERMINATED.' + - As a user, use RUNNING to keep a machine "on" and TERMINATED to turn a machine + off . returned: success type: str statusMessage: From 074b753e6cea4a20efd94926d3708a2bac084347 Mon Sep 17 00:00:00 2001 From: The Magician Date: Tue, 27 Nov 2018 12:29:50 -0800 Subject: [PATCH 061/144] Ansible Storage Upload/Download --- lib/ansible/module_utils/gcp_utils.py | 14 +- .../cloud/google/gcp_storage_object.py | 285 ++++++++++++++++++ 2 files changed, 298 insertions(+), 1 deletion(-) create mode 100644 lib/ansible/modules/cloud/google/gcp_storage_object.py diff --git a/lib/ansible/module_utils/gcp_utils.py b/lib/ansible/module_utils/gcp_utils.py index 6ae28598fe53b1..6982bd15301b5b 100644 --- a/lib/ansible/module_utils/gcp_utils.py +++ b/lib/ansible/module_utils/gcp_utils.py @@ -77,12 +77,19 @@ def get(self, url, body=None, **kwargs): except getattr(requests.exceptions, 'RequestException') as inst: self.module.fail_json(msg=inst.message) - def post(self, url, body=None): + def post(self, url, body=None, headers={}, **kwargs): + kwargs.update({'json': body, 'headers': self._merge_dictionaries(headers, self._headers())}) try: return self.session().post(url, json=body, headers=self._headers()) except getattr(requests.exceptions, 'RequestException') as inst: self.module.fail_json(msg=inst.message) + def post_contents(self, url, file_contents=None, headers={}, **kwargs): + try: + return self.session().post(url, data=file_contents, headers=self._headers()) + except getattr(requests.exceptions, 'RequestException') as inst: + self.module.fail_json(msg=inst.message) + def delete(self, url, body=None): try: return self.session().delete(url, json=body, headers=self._headers()) @@ -142,6 +149,11 @@ def _headers(self): 'User-Agent': "Google-Ansible-MM-{0}".format(self.product) } + def _merge_dictionaries(self, a, b): + new = a.copy() + new.update(b) + return new + class GcpModule(AnsibleModule): def __init__(self, *args, **kwargs): diff --git a/lib/ansible/modules/cloud/google/gcp_storage_object.py b/lib/ansible/modules/cloud/google/gcp_storage_object.py new file mode 100644 index 00000000000000..ee110a81bc1725 --- /dev/null +++ b/lib/ansible/modules/cloud/google/gcp_storage_object.py @@ -0,0 +1,285 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# +# Copyright (C) 2017 Google +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) +# ---------------------------------------------------------------------------- +# +# *** AUTO GENERATED CODE *** AUTO GENERATED CODE *** +# +# ---------------------------------------------------------------------------- +# +# This file is automatically generated by Magic Modules and manual +# changes will be clobbered when the file is regenerated. +# +# Please read more about how to change this file at +# https://www.github.com/GoogleCloudPlatform/magic-modules +# +# ---------------------------------------------------------------------------- + +from __future__ import absolute_import, division, print_function +__metaclass__ = type + +################################################################################ +# Documentation +################################################################################ + +ANSIBLE_METADATA = {'metadata_version': '1.1', + 'status': ["preview"], + 'supported_by': 'community'} + +DOCUMENTATION = ''' +--- +module: gcp_storage_object +description: +- Upload or download a file from a GCS bucket. +short_description: Creates a GCP Object +version_added: 2.8 +author: Google Inc. (@googlecloudplatform) +requirements: +- python >= 2.6 +- requests >= 2.18.4 +- google-auth >= 1.3.0 +options: + state: + description: + - Whether the given object should exist in GCP + choices: + - present + - absent + default: present + action: + description: + - Upload or download from the bucket. + required: false + choices: + - download + - upload + overwrite: + description: + - "'Overwrite the file on the bucket/local machine. If overwrite is false and + a difference exists between GCS + local, module will fail with error' ." + required: false + type: bool + src: + description: + - Source location of file (may be local machine or cloud depending on action). + required: false + dest: + description: + - Destination location of file (may be local machine or cloud depending on action). + required: false + bucket: + description: + - The name of the bucket. + required: false +extends_documentation_fragment: gcp +''' + +EXAMPLES = ''' +- name: create a object + gcp_storage_object: + name: ansible-storage-module + action: download + bucket: ansible-bucket + src: modules.zip + dest: "~/modules.zip" + project: "test_project" + auth_kind: "serviceaccount" + service_account_file: "/tmp/auth.pem" + state: present +''' + +RETURN = ''' +action: + description: + - Upload or download from the bucket. + returned: success + type: str +overwrite: + description: + - "'Overwrite the file on the bucket/local machine. If overwrite is false and a + difference exists between GCS + local, module will fail with error' ." + returned: success + type: bool +src: + description: + - Source location of file (may be local machine or cloud depending on action). + returned: success + type: str +dest: + description: + - Destination location of file (may be local machine or cloud depending on action). + returned: success + type: str +bucket: + description: + - The name of the bucket. + returned: success + type: str +''' + +################################################################################ +# Imports +################################################################################ + +from ansible.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest, replace_resource_dict +import json +import os +import mimetypes +import hashlib +import base64 + +################################################################################ +# Main +################################################################################ + + +def main(): + """Main function""" + + module = GcpModule( + argument_spec=dict( + state=dict(default='present', choices=['present', 'absent'], type='str'), + action=dict(type='str', choices=['download', 'upload']), + overwrite=dict(type='bool'), + src=dict(type='path'), + dest=dict(type='path'), + bucket=dict(type='str') + ) + ) + + if not module.params['scopes']: + module.params['scopes'] = ['https://www.googleapis.com/auth/devstorage.full_control'] + + remote_object = fetch_resource(module, self_link(module)) + local_file_exists = os.path.isfile(local_file_path(module)) + + # Check if files exist. + if module.params['action'] == 'download' and not remote_object: + module.fail_json(msg="File does not exist in bucket") + + if module.params['action'] == 'upload' and not local_file_exists: + module.fail_json(msg="File does not exist on disk") + + # Check if we'll be overwriting files. + if not module.params['overwrite']: + remote_object['changed'] = False + if module.params['action'] == 'download' and local_file_exists: + # If files differ, throw an error + if get_md5_local(local_file_path(module)) != remote_object['md5Hash']: + module.fail_json(msg="Local file is different than remote file") + # If files are the same, module is done running. + else: + module.exit_json(**remote_object) + + elif module.params['action'] == 'upload' and remote_object: + # If files differ, throw an error + if get_md5_local(local_file_path(module)) != remote_object['md5Hash']: + module.fail_json(msg="Local file is different than remote file") + # If files are the same, module is done running. + else: + module.exit_json(**remote_object) + + # Upload/download the files + auth = GcpSession(module, 'storage') + if module.params['action'] == 'download': + results = download_file(module) + else: + results = upload_file(module) + + module.exit_json(**results) + + +def download_file(module): + auth = GcpSession(module, 'storage') + data = auth.get(media_link(module)) + with open(module.params['dest'], 'w') as f: + f.write(data.text.encode('utf8')) + return fetch_resource(module, self_link(module)) + + +def upload_file(module): + auth = GcpSession(module, 'storage') + with open(module.params['src'], 'r') as f: + results = return_if_object(module, auth.post_contents(upload_link(module), f, object_headers(module))) + results['changed'] = True + return results + + +def get_md5_local(path): + md5 = hashlib.md5() + with open(path, "rb") as f: + for chunk in iter(lambda: f.read(4096), b""): + md5.update(chunk) + return base64.b64encode(md5.digest()) + + +def get_md5_remote(module): + resource = fetch_resource(module, self_link(module)) + return resource.get('md5Hash') + + +def fetch_resource(module, link, allow_not_found=True): + auth = GcpSession(module, 'storage') + return return_if_object(module, auth.get(link), allow_not_found) + + +def self_link(module): + if module.params['action'] == 'download': + return "https://www.googleapis.com/storage/v1/b/{bucket}/o/{src}".format(**module.params) + else: + return "https://www.googleapis.com/storage/v1/b/{bucket}/o/{dest}".format(**module.params) + + +def local_file_path(module): + if module.params['action'] == 'download': + return module.params['dest'] + else: + return module.params['src'] + + +def media_link(module): + if module.params['action'] == 'download': + return "https://www.googleapis.com/storage/v1/b/{bucket}/o/{src}?alt=media".format(**module.params) + else: + return "https://www.googleapis.com/storage/v1/b/{bucket}/o/{dest}?alt=media".format(**module.params) + + +def upload_link(module): + return "https://www.googleapis.com/upload/storage/v1/b/{bucket}/o?uploadType=media&name={dest}".format(**module.params) + + +def return_if_object(module, response, allow_not_found=False): + # If not found, return nothing. + if allow_not_found and response.status_code == 404: + return None + + # If no content, return nothing. + if response.status_code == 204: + return None + + try: + module.raise_for_status(response) + result = response.json() + except getattr(json.decoder, 'JSONDecodeError', ValueError) as inst: + module.fail_json(msg="Invalid JSON response with error: %s" % inst) + + if navigate_hash(result, ['error', 'errors']): + module.fail_json(msg=navigate_hash(result, ['error', 'errors'])) + + return result + + +# Remove unnecessary properties from the response. +# This is for doing comparisons with Ansible's current parameters. +def object_headers(module): + return { + "name": module.params['dest'], + "Content-Type": mimetypes.guess_type(module.params['src'])[0], + "Content-Length": str(os.path.getsize(module.params['src'])) + } + + +if __name__ == '__main__': + main() From c0cb7349a36fb632d14a527cf81cb9b5cb1fd9a6 Mon Sep 17 00:00:00 2001 From: Dana Hoffman Date: Wed, 28 Nov 2018 00:17:58 +0000 Subject: [PATCH 062/144] Add sslPolicy to a few resources. --- .../google/gcp_compute_target_https_proxy.py | 37 ++++++++++++++++ .../gcp_compute_target_https_proxy_facts.py | 7 +++ .../google/gcp_compute_target_ssl_proxy.py | 43 +++++++++++++++++-- .../gcp_compute_target_ssl_proxy_facts.py | 7 +++ .../targets/gcp_storage_object/aliases | 2 + .../gcp_storage_object/defaults/main.yml | 3 ++ .../targets/gcp_storage_object/meta/main.yml | 0 7 files changed, 96 insertions(+), 3 deletions(-) create mode 100644 test/integration/targets/gcp_storage_object/aliases create mode 100644 test/integration/targets/gcp_storage_object/defaults/main.yml create mode 100644 test/integration/targets/gcp_storage_object/meta/main.yml diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_https_proxy.py b/lib/ansible/modules/cloud/google/gcp_compute_target_https_proxy.py index d2e2eed5a64bba..55bdaa9b5eb516 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_https_proxy.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_https_proxy.py @@ -81,6 +81,18 @@ between users and the load balancer. Currently, exactly one SSL certificate must be specified. required: true + ssl_policy: + description: + - A reference to the SslPolicy resource that will be associated with the TargetHttpsProxy + resource. If not set, the TargetHttpsProxy resource will not have any SSL policy + configured. + - 'This field represents a link to a SslPolicy resource in GCP. It can be specified + in two ways. You can add `register: name-of-resource` to a gcp_compute_ssl_policy + task and then set this ssl_policy field to "{{ name-of-resource }}" Alternatively, + you can set this ssl_policy to a dictionary with the selfLink key where the + value is the selfLink of your SslPolicy' + required: false + version_added: 2.8 url_map: description: - A reference to the UrlMap resource that defines the mapping from URL to the @@ -232,6 +244,13 @@ users and the load balancer. Currently, exactly one SSL certificate must be specified. returned: success type: list +sslPolicy: + description: + - A reference to the SslPolicy resource that will be associated with the TargetHttpsProxy + resource. If not set, the TargetHttpsProxy resource will not have any SSL policy + configured. + returned: success + type: dict urlMap: description: - A reference to the UrlMap resource that defines the mapping from URL to the BackendService. @@ -262,6 +281,7 @@ def main(): name=dict(required=True, type='str'), quic_override=dict(type='str', choices=['NONE', 'ENABLE', 'DISABLE']), ssl_certificates=dict(required=True, type='list', elements='dict'), + ssl_policy=dict(type='dict'), url_map=dict(required=True, type='dict') ) ) @@ -313,6 +333,8 @@ def update_fields(module, request, response): quic_override_update(module, request, response) if response.get('sslCertificates') != request.get('sslCertificates'): ssl_certificates_update(module, request, response) + if response.get('sslPolicy') != request.get('sslPolicy'): + ssl_policy_update(module, request, response) if response.get('urlMap') != request.get('urlMap'): url_map_update(module, request, response) @@ -343,6 +365,19 @@ def ssl_certificates_update(module, request, response): ) +def ssl_policy_update(module, request, response): + auth = GcpSession(module, 'compute') + auth.post( + ''.join([ + "https://www.googleapis.com/compute/v1/", + "projects/{project}/global/targetHttpsProxies/{name}/setSslPolicy" + ]).format(**module.params), + { + u'sslPolicy': replace_resource_dict(module.params.get(u'ssl_policy', {}), 'selfLink') + } + ) + + def url_map_update(module, request, response): auth = GcpSession(module, 'compute') auth.post( @@ -368,6 +403,7 @@ def resource_to_request(module): u'name': module.params.get('name'), u'quicOverride': module.params.get('quic_override'), u'sslCertificates': replace_resource_dict(module.params.get('ssl_certificates', []), 'selfLink'), + u'sslPolicy': replace_resource_dict(module.params.get(u'ssl_policy', {}), 'selfLink'), u'urlMap': replace_resource_dict(module.params.get(u'url_map', {}), 'selfLink') } return_vals = {} @@ -440,6 +476,7 @@ def response_to_hash(module, response): u'name': module.params.get('name'), u'quicOverride': response.get(u'quicOverride'), u'sslCertificates': response.get(u'sslCertificates'), + u'sslPolicy': response.get(u'sslPolicy'), u'urlMap': response.get(u'urlMap') } diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_https_proxy_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_target_https_proxy_facts.py index e486510e03a305..5cfb46bfc0f61c 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_https_proxy_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_https_proxy_facts.py @@ -106,6 +106,13 @@ must be specified. returned: success type: list + sslPolicy: + description: + - A reference to the SslPolicy resource that will be associated with the TargetHttpsProxy + resource. If not set, the TargetHttpsProxy resource will not have any SSL + policy configured. + returned: success + type: dict urlMap: description: - A reference to the UrlMap resource that defines the mapping from URL to the diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_ssl_proxy.py b/lib/ansible/modules/cloud/google/gcp_compute_target_ssl_proxy.py index 2a59d7d0622ebd..7f7bcdd256c8e0 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_ssl_proxy.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_ssl_proxy.py @@ -85,6 +85,18 @@ between users and the load balancer. Currently, exactly one SSL certificate must be specified. required: true + ssl_policy: + description: + - A reference to the SslPolicy resource that will be associated with the TargetSslProxy + resource. If not set, the TargetSslProxy resource will not have any SSL policy + configured. + - 'This field represents a link to a SslPolicy resource in GCP. It can be specified + in two ways. You can add `register: name-of-resource` to a gcp_compute_ssl_policy + task and then set this ssl_policy field to "{{ name-of-resource }}" Alternatively, + you can set this ssl_policy to a dictionary with the selfLink key where the + value is the selfLink of your SslPolicy' + required: false + version_added: 2.8 extends_documentation_fragment: gcp notes: - 'API Reference: U(https://cloud.google.com/compute/docs/reference/latest/targetSslProxies)' @@ -222,6 +234,13 @@ users and the load balancer. Currently, exactly one SSL certificate must be specified. returned: success type: list +sslPolicy: + description: + - A reference to the SslPolicy resource that will be associated with the TargetSslProxy + resource. If not set, the TargetSslProxy resource will not have any SSL policy + configured. + returned: success + type: dict ''' ################################################################################ @@ -247,7 +266,8 @@ def main(): name=dict(required=True, type='str'), proxy_header=dict(type='str', choices=['NONE', 'PROXY_V1']), service=dict(required=True, type='dict'), - ssl_certificates=dict(required=True, type='list', elements='dict') + ssl_certificates=dict(required=True, type='list', elements='dict'), + ssl_policy=dict(type='dict') ) ) @@ -300,6 +320,8 @@ def update_fields(module, request, response): service_update(module, request, response) if response.get('sslCertificates') != request.get('sslCertificates'): ssl_certificates_update(module, request, response) + if response.get('sslPolicy') != request.get('sslPolicy'): + ssl_policy_update(module, request, response) def proxy_header_update(module, request, response): @@ -341,6 +363,19 @@ def ssl_certificates_update(module, request, response): ) +def ssl_policy_update(module, request, response): + auth = GcpSession(module, 'compute') + auth.post( + ''.join([ + "https://www.googleapis.com/compute/v1/", + "projects/{project}/global/targetSslProxies/{name}/setSslPolicy" + ]).format(**module.params), + { + u'sslPolicy': replace_resource_dict(module.params.get(u'ssl_policy', {}), 'selfLink') + } + ) + + def delete(module, link, kind): auth = GcpSession(module, 'compute') return wait_for_operation(module, auth.delete(link)) @@ -353,7 +388,8 @@ def resource_to_request(module): u'name': module.params.get('name'), u'proxyHeader': module.params.get('proxy_header'), u'service': replace_resource_dict(module.params.get(u'service', {}), 'selfLink'), - u'sslCertificates': replace_resource_dict(module.params.get('ssl_certificates', []), 'selfLink') + u'sslCertificates': replace_resource_dict(module.params.get('ssl_certificates', []), 'selfLink'), + u'sslPolicy': replace_resource_dict(module.params.get(u'ssl_policy', {}), 'selfLink') } return_vals = {} for k, v in request.items(): @@ -425,7 +461,8 @@ def response_to_hash(module, response): u'name': module.params.get('name'), u'proxyHeader': response.get(u'proxyHeader'), u'service': response.get(u'service'), - u'sslCertificates': response.get(u'sslCertificates') + u'sslCertificates': response.get(u'sslCertificates'), + u'sslPolicy': response.get(u'sslPolicy') } diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_ssl_proxy_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_target_ssl_proxy_facts.py index a1374d404a2387..69b2fbadcb62cb 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_ssl_proxy_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_ssl_proxy_facts.py @@ -108,6 +108,13 @@ must be specified. returned: success type: list + sslPolicy: + description: + - A reference to the SslPolicy resource that will be associated with the TargetSslProxy + resource. If not set, the TargetSslProxy resource will not have any SSL policy + configured. + returned: success + type: dict ''' ################################################################################ diff --git a/test/integration/targets/gcp_storage_object/aliases b/test/integration/targets/gcp_storage_object/aliases new file mode 100644 index 00000000000000..9812f019ca4bae --- /dev/null +++ b/test/integration/targets/gcp_storage_object/aliases @@ -0,0 +1,2 @@ +cloud/gcp +unsupported diff --git a/test/integration/targets/gcp_storage_object/defaults/main.yml b/test/integration/targets/gcp_storage_object/defaults/main.yml new file mode 100644 index 00000000000000..aa87a2a8e0e0e0 --- /dev/null +++ b/test/integration/targets/gcp_storage_object/defaults/main.yml @@ -0,0 +1,3 @@ +--- +# defaults file +resource_name: '{{resource_prefix}}' diff --git a/test/integration/targets/gcp_storage_object/meta/main.yml b/test/integration/targets/gcp_storage_object/meta/main.yml new file mode 100644 index 00000000000000..e69de29bb2d1d6 From 5cbc78fa8d0b897b1aee349265a4ff6770a59917 Mon Sep 17 00:00:00 2001 From: The Magician Date: Thu, 29 Nov 2018 08:25:32 -0800 Subject: [PATCH 063/144] Fix bad type for Network routing_config.routing_mode (#136) /cc @rileykarson --- .../cloud/google/gcp_compute_network.py | 28 ++++++------------- 1 file changed, 8 insertions(+), 20 deletions(-) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_network.py b/lib/ansible/modules/cloud/google/gcp_compute_network.py index 7ab0f985d83792..d3a4e1343e2c89 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_network.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_network.py @@ -216,7 +216,7 @@ def main(): ipv4_range=dict(type='str'), name=dict(required=True, type='str'), auto_create_subnetworks=dict(type='bool'), - routing_config=dict(type='list', elements='dict', options=dict( + routing_config=dict(type='dict', options=dict( routing_mode=dict(required=True, type='str', choices=['REGIONAL', 'GLOBAL']) )) ) @@ -275,7 +275,7 @@ def resource_to_request(module): u'IPv4Range': module.params.get('ipv4_range'), u'name': module.params.get('name'), u'autoCreateSubnetworks': module.params.get('auto_create_subnetworks'), - u'routingConfig': NetworkRoutingconfigArray(module.params.get('routing_config', []), module).to_request() + u'routingConfig': NetworkRoutingconfig(module.params.get('routing_config', {}), module).to_request() } return_vals = {} for k, v in request.items(): @@ -349,7 +349,7 @@ def response_to_hash(module, response): u'subnetworks': response.get(u'subnetworks'), u'autoCreateSubnetworks': module.params.get('auto_create_subnetworks'), u'creationTimestamp': response.get(u'creationTimestamp'), - u'routingConfig': NetworkRoutingconfigArray(response.get(u'routingConfig', []), module).from_response() + u'routingConfig': NetworkRoutingconfig(response.get(u'routingConfig', {}), module).from_response() } @@ -388,34 +388,22 @@ def raise_if_errors(response, err_path, module): module.fail_json(msg=errors) -class NetworkRoutingconfigArray(object): +class NetworkRoutingconfig(object): def __init__(self, request, module): self.module = module if request: self.request = request else: - self.request = [] + self.request = {} def to_request(self): - items = [] - for item in self.request: - items.append(self._request_for_item(item)) - return items - - def from_response(self): - items = [] - for item in self.request: - items.append(self._response_from_item(item)) - return items - - def _request_for_item(self, item): return remove_nones_from_dict({ - u'routingMode': item.get('routing_mode') + u'routingMode': self.request.get('routing_mode') }) - def _response_from_item(self, item): + def from_response(self): return remove_nones_from_dict({ - u'routingMode': item.get(u'routingMode') + u'routingMode': self.request.get(u'routingMode') }) From 7c0cd26b7019ccdb5c3095557754f924c17b07a0 Mon Sep 17 00:00:00 2001 From: The Magician Date: Thu, 29 Nov 2018 10:25:17 -0800 Subject: [PATCH 064/144] Ansible: Service Account Keys (#135) /cc @rambleraptor --- .../google/gcp_iam_service_account_key.py | 286 ++++++++++++++++++ .../gcp_iam_service_account_key/aliases | 2 + .../defaults/main.yml | 3 + .../gcp_iam_service_account_key/meta/main.yml | 0 4 files changed, 291 insertions(+) create mode 100644 lib/ansible/modules/cloud/google/gcp_iam_service_account_key.py create mode 100644 test/integration/targets/gcp_iam_service_account_key/aliases create mode 100644 test/integration/targets/gcp_iam_service_account_key/defaults/main.yml create mode 100644 test/integration/targets/gcp_iam_service_account_key/meta/main.yml diff --git a/lib/ansible/modules/cloud/google/gcp_iam_service_account_key.py b/lib/ansible/modules/cloud/google/gcp_iam_service_account_key.py new file mode 100644 index 00000000000000..a5882f6615f533 --- /dev/null +++ b/lib/ansible/modules/cloud/google/gcp_iam_service_account_key.py @@ -0,0 +1,286 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# +# Copyright (C) 2017 Google +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) +# ---------------------------------------------------------------------------- +# +# *** AUTO GENERATED CODE *** AUTO GENERATED CODE *** +# +# ---------------------------------------------------------------------------- +# +# This file is automatically generated by Magic Modules and manual +# changes will be clobbered when the file is regenerated. +# +# Please read more about how to change this file at +# https://www.github.com/GoogleCloudPlatform/magic-modules +# +# ---------------------------------------------------------------------------- + +from __future__ import absolute_import, division, print_function +__metaclass__ = type + +################################################################################ +# Documentation +################################################################################ + +ANSIBLE_METADATA = {'metadata_version': '1.1', + 'status': ["preview"], + 'supported_by': 'community'} + +DOCUMENTATION = ''' +--- +module: gcp_iam_service_account_key +description: +- A service account in the Identity and Access Management API. +short_description: Creates a GCP ServiceAccountKey +version_added: 2.8 +author: Google Inc. (@googlecloudplatform) +requirements: +- python >= 2.6 +- requests >= 2.18.4 +- google-auth >= 1.3.0 +options: + state: + description: + - Whether the given object should exist in GCP + choices: + - present + - absent + default: present + private_key_type: + description: + - Output format for the service account key. + required: false + choices: + - TYPE_UNSPECIFIED + - TYPE_PKCS12_FILE + - TYPE_GOOGLE_CREDENTIALS_FILE + key_algorithm: + description: + - Specifies the algorithm for the key. + required: false + choices: + - KEY_ALG_UNSPECIFIED + - KEY_ALG_RSA_1024 + - KEY_ALG_RSA_2048 + service_account: + description: + - The name of the serviceAccount. + - 'This field represents a link to a ServiceAccount resource in GCP. It can be + specified in two ways. You can add `register: name-of-resource` to a gcp_iam_service_account + task and then set this service_account field to "{{ name-of-resource }}" Alternatively, + you can set this service_account to a dictionary with the name key where the + value is the name of your ServiceAccount' + required: false + path: + description: + - The full name of the file that will hold the service account private key. The + management of this file will depend on the value of sync_file parameter. + - File path must be absolute. + required: false +extends_documentation_fragment: gcp +''' + +EXAMPLES = ''' +- name: create a service account + gcp_iam_service_account: + name: test-ansible@graphite-playground.google.com.iam.gserviceaccount.com + display_name: My Ansible test key + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present + register: serviceaccount + +- name: create a service account key + gcp_iam_service_account_key: + service_account: "{{ serviceaccount }}" + private_key_type: TYPE_GOOGLE_CREDENTIALS_FILE + path: "~/test_account.json" + project: "test_project" + auth_kind: "serviceaccount" + service_account_file: "/tmp/auth.pem" + state: present +''' + +RETURN = ''' +name: + description: + - The name of the key. + returned: success + type: str +privateKeyType: + description: + - Output format for the service account key. + returned: success + type: str +keyAlgorithm: + description: + - Specifies the algorithm for the key. + returned: success + type: str +privateKeyData: + description: + - Private key data. Base-64 encoded. + returned: success + type: str +publicKeyData: + description: + - Public key data. Base-64 encoded. + returned: success + type: str +validAfterTime: + description: + - Key can only be used after this time. + returned: success + type: str +validBeforeTime: + description: + - Key can only be used before this time. + returned: success + type: str +serviceAccount: + description: + - The name of the serviceAccount. + returned: success + type: dict +path: + description: + - The full name of the file that will hold the service account private key. The + management of this file will depend on the value of sync_file parameter. + - File path must be absolute. + returned: success + type: str +''' + +################################################################################ +# Imports +################################################################################ + +from ansible.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest, replace_resource_dict +import json +import os +import mimetypes +import hashlib +import base64 + +################################################################################ +# Main +################################################################################ + + +def main(): + """Main function""" + + module = GcpModule( + argument_spec=dict( + state=dict(default='present', choices=['present', 'absent'], type='str'), + private_key_type=dict(type='str', choices=['TYPE_UNSPECIFIED', 'TYPE_PKCS12_FILE', 'TYPE_GOOGLE_CREDENTIALS_FILE']), + key_algorithm=dict(type='str', choices=['KEY_ALG_UNSPECIFIED', 'KEY_ALG_RSA_1024', 'KEY_ALG_RSA_2048']), + service_account=dict(type='dict'), + path=dict(type='path') + ) + ) + + if not module.params['scopes']: + module.params['scopes'] = ['https://www.googleapis.com/auth/iam'] + + state = module.params['state'] + + # If file exists, we're doing a no-op or deleting the key. + changed = False + if os.path.isfile(module.params['path']): + fetch = fetch_resource(module) + # If file exists and we should delete the file, delete it. + if fetch and module.params['state'] == 'absent': + delete(module) + changed = True + + # Create the file if present state and no current file. + elif module.params['state'] == 'present': + create(module) + changed = True + + # Not returning any information about the key because that information should + # end up in logs. + module.exit_json(**{'changed': changed, 'file_path': module.params['path']}) + + +def create(module): + auth = GcpSession(module, 'iam') + json_content = return_if_object(module, auth.post(self_link(module), resource_to_request(module))) + with open(module.params['path'], 'w') as f: + private_key_contents = base64.b64decode(json_content['privateKeyData']) + f.write(private_key_contents) + + +def delete(module): + auth = GcpSession(module, 'iam') + return return_if_object(module, auth.delete(self_link_from_file(module))) + + +def resource_to_request(module): + request = { + u'privateKeyType': module.params.get('private_key_type'), + u'keyAlgorithm': module.params.get('key_algorithm') + } + return_vals = {} + for k, v in request.items(): + if v: + return_vals[k] = v + + return return_vals + + +def fetch_resource(module): + auth = GcpSession(module, 'iam') + return return_if_object(module, auth.get(self_link_from_file(module))) + + +def key_name_from_file(filename, module): + with open(filename, 'r') as f: + try: + json_data = json.loads(f.read()) + return "projects/{project_id}/serviceAccounts/{client_email}/keys/{private_key_id}".format(**json_data) + except: + module.fail_json(msg="File is not a valid GCP JSON service account key") + + +def self_link_from_file(module): + key_name = key_name_from_file(module.params['path'], module) + return "https://iam.googleapis.com/v1/{key_name}".format(key_name=key_name) + + +def self_link(module): + results = { + 'project': module.params['project'], + 'service_account': replace_resource_dict(module.params['service_account'], 'name') + } + return "https://iam.googleapis.com/v1/projects/{project}/serviceAccounts/{service_account}/keys".format(**results) + + +def return_if_object(module, response): + # If not found, return nothing. + # return_if_object not used in any context where 404 means error. + if response.status_code == 404: + return None + + # If no content, return nothing. + if response.status_code == 204: + return None + + try: + module.raise_for_status(response) + result = response.json() + except getattr(json.decoder, 'JSONDecodeError', ValueError) as inst: + module.fail_json(msg="Invalid JSON response with error: %s" % inst) + + if navigate_hash(result, ['error', 'errors']): + module.fail_json(msg=navigate_hash(result, ['error', 'errors'])) + + return result + + +if __name__ == '__main__': + main() diff --git a/test/integration/targets/gcp_iam_service_account_key/aliases b/test/integration/targets/gcp_iam_service_account_key/aliases new file mode 100644 index 00000000000000..9812f019ca4bae --- /dev/null +++ b/test/integration/targets/gcp_iam_service_account_key/aliases @@ -0,0 +1,2 @@ +cloud/gcp +unsupported diff --git a/test/integration/targets/gcp_iam_service_account_key/defaults/main.yml b/test/integration/targets/gcp_iam_service_account_key/defaults/main.yml new file mode 100644 index 00000000000000..aa87a2a8e0e0e0 --- /dev/null +++ b/test/integration/targets/gcp_iam_service_account_key/defaults/main.yml @@ -0,0 +1,3 @@ +--- +# defaults file +resource_name: '{{resource_prefix}}' diff --git a/test/integration/targets/gcp_iam_service_account_key/meta/main.yml b/test/integration/targets/gcp_iam_service_account_key/meta/main.yml new file mode 100644 index 00000000000000..e69de29bb2d1d6 From c77d5cb7ef2bd7511b15d2bd9d560198b10ba972 Mon Sep 17 00:00:00 2001 From: The Magician Date: Fri, 30 Nov 2018 15:47:47 -0800 Subject: [PATCH 065/144] 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. From 54a2ed72b6645c30aa21784829efbbec31c9a076 Mon Sep 17 00:00:00 2001 From: The Magician Date: Mon, 3 Dec 2018 13:48:48 -0800 Subject: [PATCH 066/144] Fixing firewall issues on Ansible (#137) /cc @rambleraptor --- .../cloud/google/gcp_compute_firewall.py | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_firewall.py b/lib/ansible/modules/cloud/google/gcp_compute_firewall.py index f75f16bdf331ec..e5b825e99fe35f 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_firewall.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_firewall.py @@ -151,7 +151,9 @@ task and then set this network field to "{{ name-of-resource }}" Alternatively, you can set this network to a dictionary with the selfLink key where the value is the selfLink of your Network' - required: true + required: false + default: + selfLink: global/networks/default priority: description: - Priority for this rule. This is an integer between 0 and 65535, both inclusive. @@ -412,6 +414,7 @@ from ansible.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest, remove_nones_from_dict, replace_resource_dict import json +import re import time ################################################################################ @@ -438,7 +441,7 @@ def main(): direction=dict(type='str', choices=['INGRESS', 'EGRESS']), disabled=dict(type='bool'), name=dict(required=True, type='str'), - network=dict(required=True, type='dict'), + network=dict(default={'selfLink': 'global/networks/default'}, type='dict'), priority=dict(default=1000, type='int'), source_ranges=dict(type='list', elements='str'), source_service_accounts=dict(type='list', elements='str'), @@ -512,6 +515,7 @@ def resource_to_request(module): u'targetServiceAccounts': module.params.get('target_service_accounts'), u'targetTags': module.params.get('target_tags') } + request = encode_request(request, module) return_vals = {} for k, v in request.items(): if v: @@ -630,6 +634,15 @@ def raise_if_errors(response, err_path, module): module.fail_json(msg=errors) +def encode_request(request, module): + if 'network' in request and request['network'] is not None: + if not re.match(r'https://www.googleapis.com/compute/v1/projects/.*', request['network']): + request['network'] = 'https://www.googleapis.com/compute/v1/projects/{project}/{network}'.format(project=module.params['project'], + network=request['network']) + + return request + + class FirewallAllowedArray(object): def __init__(self, request, module): self.module = module From 2260ac5a2f89f8becfb910a88da878014f560c95 Mon Sep 17 00:00:00 2001 From: The Magician Date: Tue, 4 Dec 2018 11:24:35 -0800 Subject: [PATCH 067/144] Conflicts-with (#133) /cc @rambleraptor --- lib/ansible/modules/cloud/google/gcp_compute_firewall.py | 9 ++++++++- .../modules/cloud/google/gcp_compute_health_check.py | 3 ++- lib/ansible/modules/cloud/google/gcp_compute_network.py | 3 ++- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_firewall.py b/lib/ansible/modules/cloud/google/gcp_compute_firewall.py index e5b825e99fe35f..4f414adaf5e89e 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_firewall.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_firewall.py @@ -448,7 +448,14 @@ def main(): source_tags=dict(type='list', elements='str'), target_service_accounts=dict(type='list', elements='str'), target_tags=dict(type='list', elements='str') - ) + ), + mutually_exclusive=[['allowed', 'denied'], + ['destination_ranges', 'source_ranges', 'source_tags'], + ['destination_ranges', 'source_ranges'], + ['source_service_accounts', 'source_tags', 'target_tags'], + ['destination_ranges', 'source_service_accounts', 'source_tags', 'target_service_accounts'], + ['source_tags', 'target_service_accounts', 'target_tags'], + ['source_service_accounts', 'target_service_accounts', 'target_tags']] ) if not module.params['scopes']: 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 1ef36f1092af84..527bf6412da896 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_health_check.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_health_check.py @@ -567,7 +567,8 @@ def main(): port_name=dict(type='str'), proxy_header=dict(default='NONE', type='str', choices=['NONE', 'PROXY_V1']) )) - ) + ), + mutually_exclusive=[['http_health_check', 'https_health_check', 'ssl_health_check', 'tcp_health_check']] ) if not module.params['scopes']: diff --git a/lib/ansible/modules/cloud/google/gcp_compute_network.py b/lib/ansible/modules/cloud/google/gcp_compute_network.py index d3a4e1343e2c89..3844513261b753 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_network.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_network.py @@ -219,7 +219,8 @@ def main(): routing_config=dict(type='dict', options=dict( routing_mode=dict(required=True, type='str', choices=['REGIONAL', 'GLOBAL']) )) - ) + ), + mutually_exclusive=[['auto_create_subnetworks', 'ipv4_range']] ) if not module.params['scopes']: From 29020a22738e4bf0f95d9f22d72ffb6ebc5042d5 Mon Sep 17 00:00:00 2001 From: The Magician Date: Wed, 5 Dec 2018 11:22:48 -0800 Subject: [PATCH 068/144] Ansible: Auth fix for scopes (#140) /cc @rambleraptor --- lib/ansible/module_utils/gcp_utils.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/ansible/module_utils/gcp_utils.py b/lib/ansible/module_utils/gcp_utils.py index 6982bd15301b5b..7baeb2a71aef1b 100644 --- a/lib/ansible/module_utils/gcp_utils.py +++ b/lib/ansible/module_utils/gcp_utils.py @@ -111,7 +111,7 @@ def patch(self, url, body=None, **kwargs): def session(self): return AuthorizedSession( - self._credentials().with_scopes(self.module.params['scopes'])) + self._credentials()) def _validate(self): if not HAS_REQUESTS: @@ -133,11 +133,11 @@ def _validate(self): def _credentials(self): cred_type = self.module.params['auth_kind'] if cred_type == 'application': - credentials, project_id = google.auth.default() + credentials, project_id = google.auth.default(scopes=self.module.params['scopes']) return credentials elif cred_type == 'serviceaccount': path = os.path.realpath(os.path.expanduser(self.module.params['service_account_file'])) - return service_account.Credentials.from_service_account_file(path) + return service_account.Credentials.from_service_account_file(path).with_scopes(self.module.params['scopes']) elif cred_type == 'machineaccount': return google.auth.compute_engine.Credentials( self.module.params['service_account_email']) From 6d759b2956ec8b09b30dda5aa7b98627d1e662fb Mon Sep 17 00:00:00 2001 From: The Magician Date: Wed, 5 Dec 2018 13:24:45 -0800 Subject: [PATCH 069/144] Ansible: `false`s being lost in network requests (#141) --- lib/ansible/modules/cloud/google/gcp_compute_address.py | 2 +- lib/ansible/modules/cloud/google/gcp_compute_backend_bucket.py | 2 +- lib/ansible/modules/cloud/google/gcp_compute_backend_service.py | 2 +- lib/ansible/modules/cloud/google/gcp_compute_disk.py | 2 +- lib/ansible/modules/cloud/google/gcp_compute_firewall.py | 2 +- lib/ansible/modules/cloud/google/gcp_compute_forwarding_rule.py | 2 +- lib/ansible/modules/cloud/google/gcp_compute_global_address.py | 2 +- .../modules/cloud/google/gcp_compute_global_forwarding_rule.py | 2 +- lib/ansible/modules/cloud/google/gcp_compute_health_check.py | 2 +- .../modules/cloud/google/gcp_compute_http_health_check.py | 2 +- .../modules/cloud/google/gcp_compute_https_health_check.py | 2 +- lib/ansible/modules/cloud/google/gcp_compute_image.py | 2 +- lib/ansible/modules/cloud/google/gcp_compute_instance.py | 2 +- lib/ansible/modules/cloud/google/gcp_compute_instance_group.py | 2 +- .../modules/cloud/google/gcp_compute_instance_group_manager.py | 2 +- .../modules/cloud/google/gcp_compute_instance_template.py | 2 +- .../modules/cloud/google/gcp_compute_interconnect_attachment.py | 2 +- lib/ansible/modules/cloud/google/gcp_compute_network.py | 2 +- lib/ansible/modules/cloud/google/gcp_compute_region_disk.py | 2 +- lib/ansible/modules/cloud/google/gcp_compute_route.py | 2 +- lib/ansible/modules/cloud/google/gcp_compute_router.py | 2 +- lib/ansible/modules/cloud/google/gcp_compute_ssl_certificate.py | 2 +- lib/ansible/modules/cloud/google/gcp_compute_ssl_policy.py | 2 +- lib/ansible/modules/cloud/google/gcp_compute_subnetwork.py | 2 +- .../modules/cloud/google/gcp_compute_target_http_proxy.py | 2 +- .../modules/cloud/google/gcp_compute_target_https_proxy.py | 2 +- lib/ansible/modules/cloud/google/gcp_compute_target_pool.py | 2 +- .../modules/cloud/google/gcp_compute_target_ssl_proxy.py | 2 +- .../modules/cloud/google/gcp_compute_target_tcp_proxy.py | 2 +- .../modules/cloud/google/gcp_compute_target_vpn_gateway.py | 2 +- lib/ansible/modules/cloud/google/gcp_compute_url_map.py | 2 +- lib/ansible/modules/cloud/google/gcp_compute_vpn_tunnel.py | 2 +- lib/ansible/modules/cloud/google/gcp_container_cluster.py | 2 +- lib/ansible/modules/cloud/google/gcp_container_node_pool.py | 2 +- lib/ansible/modules/cloud/google/gcp_dns_managed_zone.py | 2 +- lib/ansible/modules/cloud/google/gcp_dns_resource_record_set.py | 2 +- lib/ansible/modules/cloud/google/gcp_iam_service_account.py | 2 +- lib/ansible/modules/cloud/google/gcp_pubsub_subscription.py | 2 +- lib/ansible/modules/cloud/google/gcp_pubsub_topic.py | 2 +- lib/ansible/modules/cloud/google/gcp_resourcemanager_project.py | 2 +- lib/ansible/modules/cloud/google/gcp_spanner_database.py | 2 +- lib/ansible/modules/cloud/google/gcp_spanner_instance.py | 2 +- lib/ansible/modules/cloud/google/gcp_sql_database.py | 2 +- lib/ansible/modules/cloud/google/gcp_sql_instance.py | 2 +- lib/ansible/modules/cloud/google/gcp_sql_user.py | 2 +- lib/ansible/modules/cloud/google/gcp_storage_bucket.py | 2 +- .../modules/cloud/google/gcp_storage_bucket_access_control.py | 2 +- 47 files changed, 47 insertions(+), 47 deletions(-) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_address.py b/lib/ansible/modules/cloud/google/gcp_compute_address.py index b5b8726b47b3b3..5fb90c7a32213a 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_address.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_address.py @@ -283,7 +283,7 @@ def resource_to_request(module): } return_vals = {} for k, v in request.items(): - if v: + if v is not None: return_vals[k] = v return return_vals diff --git a/lib/ansible/modules/cloud/google/gcp_compute_backend_bucket.py b/lib/ansible/modules/cloud/google/gcp_compute_backend_bucket.py index 3cbc235d42e40b..2828b09014e6d8 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_backend_bucket.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_backend_bucket.py @@ -224,7 +224,7 @@ def resource_to_request(module): } return_vals = {} for k, v in request.items(): - if v: + if v is not None: return_vals[k] = v return return_vals diff --git a/lib/ansible/modules/cloud/google/gcp_compute_backend_service.py b/lib/ansible/modules/cloud/google/gcp_compute_backend_service.py index 6f69be8da6313c..d9a27eaa560d5c 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_backend_service.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_backend_service.py @@ -731,7 +731,7 @@ def resource_to_request(module): } return_vals = {} for k, v in request.items(): - if v: + if v is not None: return_vals[k] = v return return_vals diff --git a/lib/ansible/modules/cloud/google/gcp_compute_disk.py b/lib/ansible/modules/cloud/google/gcp_compute_disk.py index c8156e2db4fdd0..164fe9812c52cd 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_disk.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_disk.py @@ -523,7 +523,7 @@ def resource_to_request(module): } return_vals = {} for k, v in request.items(): - if v: + if v is not None: return_vals[k] = v return return_vals diff --git a/lib/ansible/modules/cloud/google/gcp_compute_firewall.py b/lib/ansible/modules/cloud/google/gcp_compute_firewall.py index 4f414adaf5e89e..8c3dd12d497e2d 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_firewall.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_firewall.py @@ -525,7 +525,7 @@ def resource_to_request(module): request = encode_request(request, module) return_vals = {} for k, v in request.items(): - if v: + if v is not None: return_vals[k] = v return return_vals diff --git a/lib/ansible/modules/cloud/google/gcp_compute_forwarding_rule.py b/lib/ansible/modules/cloud/google/gcp_compute_forwarding_rule.py index 9ba834304a77a4..1ce3cd24dea76d 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_forwarding_rule.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_forwarding_rule.py @@ -513,7 +513,7 @@ def resource_to_request(module): } return_vals = {} for k, v in request.items(): - if v: + if v is not None: return_vals[k] = v return return_vals diff --git a/lib/ansible/modules/cloud/google/gcp_compute_global_address.py b/lib/ansible/modules/cloud/google/gcp_compute_global_address.py index 88283797388344..c40224c7825599 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_global_address.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_global_address.py @@ -232,7 +232,7 @@ def resource_to_request(module): } return_vals = {} for k, v in request.items(): - if v: + if v is not None: return_vals[k] = v return return_vals diff --git a/lib/ansible/modules/cloud/google/gcp_compute_global_forwarding_rule.py b/lib/ansible/modules/cloud/google/gcp_compute_global_forwarding_rule.py index bf43943e43deb9..c45f5e25796c18 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_global_forwarding_rule.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_global_forwarding_rule.py @@ -501,7 +501,7 @@ def resource_to_request(module): } return_vals = {} for k, v in request.items(): - if v: + if v is not None: return_vals[k] = v return return_vals 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 527bf6412da896..42d35caaf01403 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_health_check.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_health_check.py @@ -634,7 +634,7 @@ def resource_to_request(module): } return_vals = {} for k, v in request.items(): - if v: + if v is not None: return_vals[k] = v return return_vals diff --git a/lib/ansible/modules/cloud/google/gcp_compute_http_health_check.py b/lib/ansible/modules/cloud/google/gcp_compute_http_health_check.py index 75d259ef92f718..9979b5c2fef117 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_http_health_check.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_http_health_check.py @@ -288,7 +288,7 @@ def resource_to_request(module): } return_vals = {} for k, v in request.items(): - if v: + if v is not None: return_vals[k] = v return return_vals diff --git a/lib/ansible/modules/cloud/google/gcp_compute_https_health_check.py b/lib/ansible/modules/cloud/google/gcp_compute_https_health_check.py index be515ce034b8af..11d27b50c2878b 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_https_health_check.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_https_health_check.py @@ -285,7 +285,7 @@ def resource_to_request(module): } return_vals = {} for k, v in request.items(): - if v: + if v is not None: return_vals[k] = v return return_vals diff --git a/lib/ansible/modules/cloud/google/gcp_compute_image.py b/lib/ansible/modules/cloud/google/gcp_compute_image.py index 80356c9b264128..15bba3f5fb00ae 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_image.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_image.py @@ -520,7 +520,7 @@ def resource_to_request(module): } return_vals = {} for k, v in request.items(): - if v: + if v is not None: return_vals[k] = v return return_vals diff --git a/lib/ansible/modules/cloud/google/gcp_compute_instance.py b/lib/ansible/modules/cloud/google/gcp_compute_instance.py index 9686e48d93140d..5c16bca12de273 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_instance.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_instance.py @@ -1050,7 +1050,7 @@ def resource_to_request(module): request = encode_request(request, module) return_vals = {} for k, v in request.items(): - if v: + if v is not None: return_vals[k] = v return return_vals diff --git a/lib/ansible/modules/cloud/google/gcp_compute_instance_group.py b/lib/ansible/modules/cloud/google/gcp_compute_instance_group.py index 63da353dcc096d..8d958f33ab05d6 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_instance_group.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_instance_group.py @@ -314,7 +314,7 @@ def resource_to_request(module): } return_vals = {} for k, v in request.items(): - if v: + if v is not None: return_vals[k] = v return return_vals diff --git a/lib/ansible/modules/cloud/google/gcp_compute_instance_group_manager.py b/lib/ansible/modules/cloud/google/gcp_compute_instance_group_manager.py index a84d86aac7572b..4712f2c88db455 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_instance_group_manager.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_instance_group_manager.py @@ -411,7 +411,7 @@ def resource_to_request(module): } return_vals = {} for k, v in request.items(): - if v: + if v is not None: return_vals[k] = v return return_vals diff --git a/lib/ansible/modules/cloud/google/gcp_compute_instance_template.py b/lib/ansible/modules/cloud/google/gcp_compute_instance_template.py index 2a7ac854fcffaa..c47c21fd05c8ac 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_instance_template.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_instance_template.py @@ -991,7 +991,7 @@ def resource_to_request(module): request = encode_request(request, module) return_vals = {} for k, v in request.items(): - if v: + if v is not None: return_vals[k] = v return return_vals diff --git a/lib/ansible/modules/cloud/google/gcp_compute_interconnect_attachment.py b/lib/ansible/modules/cloud/google/gcp_compute_interconnect_attachment.py index ef86aa2c472e7b..4ea397ac20ab74 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_interconnect_attachment.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_interconnect_attachment.py @@ -261,7 +261,7 @@ def resource_to_request(module): } return_vals = {} for k, v in request.items(): - if v: + if v is not None: return_vals[k] = v return return_vals diff --git a/lib/ansible/modules/cloud/google/gcp_compute_network.py b/lib/ansible/modules/cloud/google/gcp_compute_network.py index 3844513261b753..a2bf801ceb8601 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_network.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_network.py @@ -280,7 +280,7 @@ def resource_to_request(module): } return_vals = {} for k, v in request.items(): - if v: + if v is not None: return_vals[k] = v return return_vals diff --git a/lib/ansible/modules/cloud/google/gcp_compute_region_disk.py b/lib/ansible/modules/cloud/google/gcp_compute_region_disk.py index d13b3f739130bf..914ace9cb29e05 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_region_disk.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_region_disk.py @@ -455,7 +455,7 @@ def resource_to_request(module): } return_vals = {} for k, v in request.items(): - if v: + if v is not None: return_vals[k] = v return return_vals diff --git a/lib/ansible/modules/cloud/google/gcp_compute_route.py b/lib/ansible/modules/cloud/google/gcp_compute_route.py index 546b0dfd35efcc..910bdb48f7c171 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_route.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_route.py @@ -327,7 +327,7 @@ def resource_to_request(module): } return_vals = {} for k, v in request.items(): - if v: + if v is not None: return_vals[k] = v return return_vals diff --git a/lib/ansible/modules/cloud/google/gcp_compute_router.py b/lib/ansible/modules/cloud/google/gcp_compute_router.py index be8bf03f37e1aa..ff64d09fdb6e40 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_router.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_router.py @@ -331,7 +331,7 @@ def resource_to_request(module): } return_vals = {} for k, v in request.items(): - if v: + if v is not None: return_vals[k] = v return return_vals diff --git a/lib/ansible/modules/cloud/google/gcp_compute_ssl_certificate.py b/lib/ansible/modules/cloud/google/gcp_compute_ssl_certificate.py index 1626e85c4de67c..7a2a9e005e878c 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_ssl_certificate.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_ssl_certificate.py @@ -235,7 +235,7 @@ def resource_to_request(module): } return_vals = {} for k, v in request.items(): - if v: + if v is not None: return_vals[k] = v return return_vals diff --git a/lib/ansible/modules/cloud/google/gcp_compute_ssl_policy.py b/lib/ansible/modules/cloud/google/gcp_compute_ssl_policy.py index d1336036856b85..f622beaca2ddf3 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_ssl_policy.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_ssl_policy.py @@ -273,7 +273,7 @@ def resource_to_request(module): } return_vals = {} for k, v in request.items(): - if v: + if v is not None: return_vals[k] = v return return_vals diff --git a/lib/ansible/modules/cloud/google/gcp_compute_subnetwork.py b/lib/ansible/modules/cloud/google/gcp_compute_subnetwork.py index d8e2946595102a..4ba98936426952 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_subnetwork.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_subnetwork.py @@ -400,7 +400,7 @@ def resource_to_request(module): } return_vals = {} for k, v in request.items(): - if v: + if v is not None: return_vals[k] = v return return_vals diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_http_proxy.py b/lib/ansible/modules/cloud/google/gcp_compute_target_http_proxy.py index 5fc0ec61a22697..ec5151bbc6049d 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_http_proxy.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_http_proxy.py @@ -268,7 +268,7 @@ def resource_to_request(module): } return_vals = {} for k, v in request.items(): - if v: + if v is not None: return_vals[k] = v return return_vals diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_https_proxy.py b/lib/ansible/modules/cloud/google/gcp_compute_target_https_proxy.py index d2e2eed5a64bba..123a95ab5f54f6 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_https_proxy.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_https_proxy.py @@ -372,7 +372,7 @@ def resource_to_request(module): } return_vals = {} for k, v in request.items(): - if v: + if v is not None: return_vals[k] = v return return_vals diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_pool.py b/lib/ansible/modules/cloud/google/gcp_compute_target_pool.py index 012a2de94365f9..baeff39d2e7746 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_pool.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_pool.py @@ -322,7 +322,7 @@ def resource_to_request(module): request = encode_request(request, module) return_vals = {} for k, v in request.items(): - if v: + if v is not None: return_vals[k] = v return return_vals diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_ssl_proxy.py b/lib/ansible/modules/cloud/google/gcp_compute_target_ssl_proxy.py index 2a59d7d0622ebd..d3e3b6d66553e7 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_ssl_proxy.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_ssl_proxy.py @@ -357,7 +357,7 @@ def resource_to_request(module): } return_vals = {} for k, v in request.items(): - if v: + if v is not None: return_vals[k] = v return return_vals diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_tcp_proxy.py b/lib/ansible/modules/cloud/google/gcp_compute_target_tcp_proxy.py index d31462939993eb..87a5ef9b53cb60 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_tcp_proxy.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_tcp_proxy.py @@ -293,7 +293,7 @@ def resource_to_request(module): } return_vals = {} for k, v in request.items(): - if v: + if v is not None: return_vals[k] = v return return_vals diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_vpn_gateway.py b/lib/ansible/modules/cloud/google/gcp_compute_target_vpn_gateway.py index d01d144acbb1ce..db5bb505394c82 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_vpn_gateway.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_vpn_gateway.py @@ -239,7 +239,7 @@ def resource_to_request(module): } return_vals = {} for k, v in request.items(): - if v: + if v is not None: return_vals[k] = v return return_vals diff --git a/lib/ansible/modules/cloud/google/gcp_compute_url_map.py b/lib/ansible/modules/cloud/google/gcp_compute_url_map.py index 25a549cc0abdfe..37734f927789c9 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_url_map.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_url_map.py @@ -455,7 +455,7 @@ def resource_to_request(module): } return_vals = {} for k, v in request.items(): - if v: + if v is not None: return_vals[k] = v return return_vals diff --git a/lib/ansible/modules/cloud/google/gcp_compute_vpn_tunnel.py b/lib/ansible/modules/cloud/google/gcp_compute_vpn_tunnel.py index b5ae722db114f8..0b240e982a70d3 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_vpn_tunnel.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_vpn_tunnel.py @@ -377,7 +377,7 @@ def resource_to_request(module): } return_vals = {} for k, v in request.items(): - if v: + if v is not None: return_vals[k] = v return return_vals diff --git a/lib/ansible/modules/cloud/google/gcp_container_cluster.py b/lib/ansible/modules/cloud/google/gcp_container_cluster.py index 5555ea5880eaa7..68cf3b0eee2547 100644 --- a/lib/ansible/modules/cloud/google/gcp_container_cluster.py +++ b/lib/ansible/modules/cloud/google/gcp_container_cluster.py @@ -701,7 +701,7 @@ def resource_to_request(module): request = encode_request(request, module) return_vals = {} for k, v in request.items(): - if v: + if v is not None: return_vals[k] = v return return_vals diff --git a/lib/ansible/modules/cloud/google/gcp_container_node_pool.py b/lib/ansible/modules/cloud/google/gcp_container_node_pool.py index d3196ff18aefcf..eb37cda187a6a3 100644 --- a/lib/ansible/modules/cloud/google/gcp_container_node_pool.py +++ b/lib/ansible/modules/cloud/google/gcp_container_node_pool.py @@ -531,7 +531,7 @@ def resource_to_request(module): request = encode_request(request, module) return_vals = {} for k, v in request.items(): - if v: + if v is not None: return_vals[k] = v return return_vals diff --git a/lib/ansible/modules/cloud/google/gcp_dns_managed_zone.py b/lib/ansible/modules/cloud/google/gcp_dns_managed_zone.py index e46350c6bead16..df8b09f32408b0 100644 --- a/lib/ansible/modules/cloud/google/gcp_dns_managed_zone.py +++ b/lib/ansible/modules/cloud/google/gcp_dns_managed_zone.py @@ -244,7 +244,7 @@ def resource_to_request(module): } return_vals = {} for k, v in request.items(): - if v: + if v is not None: return_vals[k] = v return return_vals diff --git a/lib/ansible/modules/cloud/google/gcp_dns_resource_record_set.py b/lib/ansible/modules/cloud/google/gcp_dns_resource_record_set.py index 936bbd361d0926..e935096ae7d1ba 100644 --- a/lib/ansible/modules/cloud/google/gcp_dns_resource_record_set.py +++ b/lib/ansible/modules/cloud/google/gcp_dns_resource_record_set.py @@ -252,7 +252,7 @@ def resource_to_request(module): } return_vals = {} for k, v in request.items(): - if v: + if v is not None: return_vals[k] = v return return_vals diff --git a/lib/ansible/modules/cloud/google/gcp_iam_service_account.py b/lib/ansible/modules/cloud/google/gcp_iam_service_account.py index 71267ae250b76d..06f10ec0739a41 100644 --- a/lib/ansible/modules/cloud/google/gcp_iam_service_account.py +++ b/lib/ansible/modules/cloud/google/gcp_iam_service_account.py @@ -179,7 +179,7 @@ def resource_to_request(module): request = encode_request(request, module) return_vals = {} for k, v in request.items(): - if v: + if v is not None: return_vals[k] = v return return_vals diff --git a/lib/ansible/modules/cloud/google/gcp_pubsub_subscription.py b/lib/ansible/modules/cloud/google/gcp_pubsub_subscription.py index dea237fef1f0f7..4eed3eb62e8120 100644 --- a/lib/ansible/modules/cloud/google/gcp_pubsub_subscription.py +++ b/lib/ansible/modules/cloud/google/gcp_pubsub_subscription.py @@ -243,7 +243,7 @@ def resource_to_request(module): request = encode_request(request, module) return_vals = {} for k, v in request.items(): - if v: + if v is not None: return_vals[k] = v return return_vals diff --git a/lib/ansible/modules/cloud/google/gcp_pubsub_topic.py b/lib/ansible/modules/cloud/google/gcp_pubsub_topic.py index a5d6027cbfdad1..b93b62fae5ce1e 100644 --- a/lib/ansible/modules/cloud/google/gcp_pubsub_topic.py +++ b/lib/ansible/modules/cloud/google/gcp_pubsub_topic.py @@ -147,7 +147,7 @@ def resource_to_request(module): request = encode_request(request, module) return_vals = {} for k, v in request.items(): - if v: + if v is not None: return_vals[k] = v return return_vals diff --git a/lib/ansible/modules/cloud/google/gcp_resourcemanager_project.py b/lib/ansible/modules/cloud/google/gcp_resourcemanager_project.py index fe46412bf2a80c..925bfd4880b1c8 100644 --- a/lib/ansible/modules/cloud/google/gcp_resourcemanager_project.py +++ b/lib/ansible/modules/cloud/google/gcp_resourcemanager_project.py @@ -244,7 +244,7 @@ def resource_to_request(module): } return_vals = {} for k, v in request.items(): - if v: + if v is not None: return_vals[k] = v return return_vals diff --git a/lib/ansible/modules/cloud/google/gcp_spanner_database.py b/lib/ansible/modules/cloud/google/gcp_spanner_database.py index f3f84f411d22f8..162cd2e21c9077 100644 --- a/lib/ansible/modules/cloud/google/gcp_spanner_database.py +++ b/lib/ansible/modules/cloud/google/gcp_spanner_database.py @@ -198,7 +198,7 @@ def resource_to_request(module): request = encode_request(request, module) return_vals = {} for k, v in request.items(): - if v: + if v is not None: return_vals[k] = v return return_vals diff --git a/lib/ansible/modules/cloud/google/gcp_spanner_instance.py b/lib/ansible/modules/cloud/google/gcp_spanner_instance.py index 1d4fe334d78c08..b3a574997c318e 100644 --- a/lib/ansible/modules/cloud/google/gcp_spanner_instance.py +++ b/lib/ansible/modules/cloud/google/gcp_spanner_instance.py @@ -235,7 +235,7 @@ def resource_to_request(module): } return_vals = {} for k, v in request.items(): - if v: + if v is not None: return_vals[k] = v return return_vals diff --git a/lib/ansible/modules/cloud/google/gcp_sql_database.py b/lib/ansible/modules/cloud/google/gcp_sql_database.py index e1d0832edc7cb0..97e9095c69b8ad 100644 --- a/lib/ansible/modules/cloud/google/gcp_sql_database.py +++ b/lib/ansible/modules/cloud/google/gcp_sql_database.py @@ -206,7 +206,7 @@ def resource_to_request(module): } return_vals = {} for k, v in request.items(): - if v: + if v is not None: return_vals[k] = v return return_vals diff --git a/lib/ansible/modules/cloud/google/gcp_sql_instance.py b/lib/ansible/modules/cloud/google/gcp_sql_instance.py index 2a9938f3a35d08..45a9c3eeda6854 100644 --- a/lib/ansible/modules/cloud/google/gcp_sql_instance.py +++ b/lib/ansible/modules/cloud/google/gcp_sql_instance.py @@ -678,7 +678,7 @@ def resource_to_request(module): } return_vals = {} for k, v in request.items(): - if v: + if v is not None: return_vals[k] = v return return_vals diff --git a/lib/ansible/modules/cloud/google/gcp_sql_user.py b/lib/ansible/modules/cloud/google/gcp_sql_user.py index 566352420f2ae0..0db23270074e77 100644 --- a/lib/ansible/modules/cloud/google/gcp_sql_user.py +++ b/lib/ansible/modules/cloud/google/gcp_sql_user.py @@ -211,7 +211,7 @@ def resource_to_request(module): } return_vals = {} for k, v in request.items(): - if v: + if v is not None: return_vals[k] = v return return_vals diff --git a/lib/ansible/modules/cloud/google/gcp_storage_bucket.py b/lib/ansible/modules/cloud/google/gcp_storage_bucket.py index f26361ef9a60c0..c5bebcb44af267 100644 --- a/lib/ansible/modules/cloud/google/gcp_storage_bucket.py +++ b/lib/ansible/modules/cloud/google/gcp_storage_bucket.py @@ -936,7 +936,7 @@ def resource_to_request(module): } return_vals = {} for k, v in request.items(): - if v: + if v is not None: return_vals[k] = v return return_vals diff --git a/lib/ansible/modules/cloud/google/gcp_storage_bucket_access_control.py b/lib/ansible/modules/cloud/google/gcp_storage_bucket_access_control.py index d075f43d175091..6e2d13f7e4046d 100644 --- a/lib/ansible/modules/cloud/google/gcp_storage_bucket_access_control.py +++ b/lib/ansible/modules/cloud/google/gcp_storage_bucket_access_control.py @@ -273,7 +273,7 @@ def resource_to_request(module): } return_vals = {} for k, v in request.items(): - if v: + if v is not None: return_vals[k] = v return return_vals From aa2beb87739b8a8be14957f8c79a1cf9aa667e16 Mon Sep 17 00:00:00 2001 From: The Magician Date: Wed, 5 Dec 2018 13:30:33 -0800 Subject: [PATCH 070/144] Fixing integration tests on SQL + DNS (#139) /cc @rambleraptor --- .../targets/gcp_dns_resource_record_set/tasks/main.yml | 4 ++-- test/integration/targets/gcp_sql_database/tasks/main.yml | 4 ++-- test/integration/targets/gcp_sql_user/tasks/main.yml | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/test/integration/targets/gcp_dns_resource_record_set/tasks/main.yml b/test/integration/targets/gcp_dns_resource_record_set/tasks/main.yml index d9866d4f151de8..5fd5876a0bd2f7 100644 --- a/test/integration/targets/gcp_dns_resource_record_set/tasks/main.yml +++ b/test/integration/targets/gcp_dns_resource_record_set/tasks/main.yml @@ -68,7 +68,7 @@ - name: verify that command succeeded assert: that: - - results['items'] | length >= 2 + - "'www.testzone-4.com.'in \"{{ results['items'] | map(attribute='name') | list }}\"" # ---------------------------------------------------------------------------- - name: create a resource record set that already exists gcp_dns_resource_record_set: @@ -121,7 +121,7 @@ - name: verify that command succeeded assert: that: - - results['items'] | length >= 2 + - "'www.testzone-4.com.'not in \"{{ results['items'] | map(attribute='name') | list }}\"" # ---------------------------------------------------------------------------- - name: delete a resource record set that does not exist gcp_dns_resource_record_set: diff --git a/test/integration/targets/gcp_sql_database/tasks/main.yml b/test/integration/targets/gcp_sql_database/tasks/main.yml index b14a93af7f19c3..aea8991e635d6e 100644 --- a/test/integration/targets/gcp_sql_database/tasks/main.yml +++ b/test/integration/targets/gcp_sql_database/tasks/main.yml @@ -65,7 +65,7 @@ - name: verify that command succeeded assert: that: - - results['items'] | length >= 1 + - "\"{{resource_name}}\" in \"{{ results['items'] | map(attribute='name') | list }}\"" # ---------------------------------------------------------------------------- - name: create a database that already exists gcp_sql_database: @@ -110,7 +110,7 @@ - name: verify that command succeeded assert: that: - - results['items'] | length == 0 + - "\"{{resource_name}}\" not in \"{{ results['items'] | map(attribute='name') | list }}\"" # ---------------------------------------------------------------------------- - name: delete a database that does not exist gcp_sql_database: diff --git a/test/integration/targets/gcp_sql_user/tasks/main.yml b/test/integration/targets/gcp_sql_user/tasks/main.yml index 3157df73f8e757..2434d04eb23e48 100644 --- a/test/integration/targets/gcp_sql_user/tasks/main.yml +++ b/test/integration/targets/gcp_sql_user/tasks/main.yml @@ -67,7 +67,7 @@ - name: verify that command succeeded assert: that: - - results['items'] | length >= 1 + - "'test-user' in \"{{ results['items'] | map(attribute='name') | list }}\"" # ---------------------------------------------------------------------------- - name: create a user that already exists gcp_sql_user: @@ -114,7 +114,7 @@ - name: verify that command succeeded assert: that: - - results['items'] | length == 0 + - "'test-user' not in \"{{ results['items'] | map(attribute='name') | list }}\"" # ---------------------------------------------------------------------------- - name: delete a user that does not exist gcp_sql_user: From 9988260045a29db4773aaea76e0b6431e9631d56 Mon Sep 17 00:00:00 2001 From: The Magician Date: Thu, 6 Dec 2018 11:00:32 -0800 Subject: [PATCH 071/144] Not Suppressing values accidentally (#143) /cc @rambleraptor --- lib/ansible/modules/cloud/google/gcp_compute_address.py | 2 +- lib/ansible/modules/cloud/google/gcp_compute_backend_bucket.py | 2 +- lib/ansible/modules/cloud/google/gcp_compute_backend_service.py | 2 +- lib/ansible/modules/cloud/google/gcp_compute_disk.py | 2 +- lib/ansible/modules/cloud/google/gcp_compute_firewall.py | 2 +- lib/ansible/modules/cloud/google/gcp_compute_forwarding_rule.py | 2 +- lib/ansible/modules/cloud/google/gcp_compute_global_address.py | 2 +- .../modules/cloud/google/gcp_compute_global_forwarding_rule.py | 2 +- lib/ansible/modules/cloud/google/gcp_compute_health_check.py | 2 +- .../modules/cloud/google/gcp_compute_http_health_check.py | 2 +- .../modules/cloud/google/gcp_compute_https_health_check.py | 2 +- lib/ansible/modules/cloud/google/gcp_compute_image.py | 2 +- lib/ansible/modules/cloud/google/gcp_compute_instance.py | 2 +- lib/ansible/modules/cloud/google/gcp_compute_instance_group.py | 2 +- .../modules/cloud/google/gcp_compute_instance_group_manager.py | 2 +- .../modules/cloud/google/gcp_compute_instance_template.py | 2 +- .../modules/cloud/google/gcp_compute_interconnect_attachment.py | 2 +- lib/ansible/modules/cloud/google/gcp_compute_network.py | 2 +- lib/ansible/modules/cloud/google/gcp_compute_region_disk.py | 2 +- lib/ansible/modules/cloud/google/gcp_compute_route.py | 2 +- lib/ansible/modules/cloud/google/gcp_compute_router.py | 2 +- lib/ansible/modules/cloud/google/gcp_compute_ssl_certificate.py | 2 +- lib/ansible/modules/cloud/google/gcp_compute_ssl_policy.py | 2 +- lib/ansible/modules/cloud/google/gcp_compute_subnetwork.py | 2 +- .../modules/cloud/google/gcp_compute_target_http_proxy.py | 2 +- .../modules/cloud/google/gcp_compute_target_https_proxy.py | 2 +- lib/ansible/modules/cloud/google/gcp_compute_target_pool.py | 2 +- .../modules/cloud/google/gcp_compute_target_ssl_proxy.py | 2 +- .../modules/cloud/google/gcp_compute_target_tcp_proxy.py | 2 +- .../modules/cloud/google/gcp_compute_target_vpn_gateway.py | 2 +- lib/ansible/modules/cloud/google/gcp_compute_url_map.py | 2 +- lib/ansible/modules/cloud/google/gcp_compute_vpn_tunnel.py | 2 +- lib/ansible/modules/cloud/google/gcp_container_cluster.py | 2 +- lib/ansible/modules/cloud/google/gcp_container_node_pool.py | 2 +- lib/ansible/modules/cloud/google/gcp_dns_managed_zone.py | 2 +- lib/ansible/modules/cloud/google/gcp_dns_resource_record_set.py | 2 +- lib/ansible/modules/cloud/google/gcp_iam_service_account.py | 2 +- lib/ansible/modules/cloud/google/gcp_pubsub_subscription.py | 2 +- lib/ansible/modules/cloud/google/gcp_pubsub_topic.py | 2 +- lib/ansible/modules/cloud/google/gcp_resourcemanager_project.py | 2 +- lib/ansible/modules/cloud/google/gcp_spanner_database.py | 2 +- lib/ansible/modules/cloud/google/gcp_spanner_instance.py | 2 +- lib/ansible/modules/cloud/google/gcp_sql_database.py | 2 +- lib/ansible/modules/cloud/google/gcp_sql_instance.py | 2 +- lib/ansible/modules/cloud/google/gcp_sql_user.py | 2 +- lib/ansible/modules/cloud/google/gcp_storage_bucket.py | 2 +- .../modules/cloud/google/gcp_storage_bucket_access_control.py | 2 +- 47 files changed, 47 insertions(+), 47 deletions(-) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_address.py b/lib/ansible/modules/cloud/google/gcp_compute_address.py index 5fb90c7a32213a..d42951084653eb 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_address.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_address.py @@ -283,7 +283,7 @@ def resource_to_request(module): } return_vals = {} for k, v in request.items(): - if v is not None: + if v or v is False: return_vals[k] = v return return_vals diff --git a/lib/ansible/modules/cloud/google/gcp_compute_backend_bucket.py b/lib/ansible/modules/cloud/google/gcp_compute_backend_bucket.py index 2828b09014e6d8..711baac99e8c18 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_backend_bucket.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_backend_bucket.py @@ -224,7 +224,7 @@ def resource_to_request(module): } return_vals = {} for k, v in request.items(): - if v is not None: + if v or v is False: return_vals[k] = v return return_vals diff --git a/lib/ansible/modules/cloud/google/gcp_compute_backend_service.py b/lib/ansible/modules/cloud/google/gcp_compute_backend_service.py index d9a27eaa560d5c..4716e96fceaac2 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_backend_service.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_backend_service.py @@ -731,7 +731,7 @@ def resource_to_request(module): } return_vals = {} for k, v in request.items(): - if v is not None: + if v or v is False: return_vals[k] = v return return_vals diff --git a/lib/ansible/modules/cloud/google/gcp_compute_disk.py b/lib/ansible/modules/cloud/google/gcp_compute_disk.py index 164fe9812c52cd..327313991a746c 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_disk.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_disk.py @@ -523,7 +523,7 @@ def resource_to_request(module): } return_vals = {} for k, v in request.items(): - if v is not None: + if v or v is False: return_vals[k] = v return return_vals diff --git a/lib/ansible/modules/cloud/google/gcp_compute_firewall.py b/lib/ansible/modules/cloud/google/gcp_compute_firewall.py index 8c3dd12d497e2d..0a91375152f986 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_firewall.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_firewall.py @@ -525,7 +525,7 @@ def resource_to_request(module): request = encode_request(request, module) return_vals = {} for k, v in request.items(): - if v is not None: + if v or v is False: return_vals[k] = v return return_vals diff --git a/lib/ansible/modules/cloud/google/gcp_compute_forwarding_rule.py b/lib/ansible/modules/cloud/google/gcp_compute_forwarding_rule.py index 1ce3cd24dea76d..192c73160b4f47 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_forwarding_rule.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_forwarding_rule.py @@ -513,7 +513,7 @@ def resource_to_request(module): } return_vals = {} for k, v in request.items(): - if v is not None: + if v or v is False: return_vals[k] = v return return_vals diff --git a/lib/ansible/modules/cloud/google/gcp_compute_global_address.py b/lib/ansible/modules/cloud/google/gcp_compute_global_address.py index c40224c7825599..4d6861a90fe6a5 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_global_address.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_global_address.py @@ -232,7 +232,7 @@ def resource_to_request(module): } return_vals = {} for k, v in request.items(): - if v is not None: + if v or v is False: return_vals[k] = v return return_vals diff --git a/lib/ansible/modules/cloud/google/gcp_compute_global_forwarding_rule.py b/lib/ansible/modules/cloud/google/gcp_compute_global_forwarding_rule.py index c45f5e25796c18..21acb0c69ffd86 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_global_forwarding_rule.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_global_forwarding_rule.py @@ -501,7 +501,7 @@ def resource_to_request(module): } return_vals = {} for k, v in request.items(): - if v is not None: + if v or v is False: return_vals[k] = v return return_vals 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 42d35caaf01403..7d957db291a821 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_health_check.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_health_check.py @@ -634,7 +634,7 @@ def resource_to_request(module): } return_vals = {} for k, v in request.items(): - if v is not None: + if v or v is False: return_vals[k] = v return return_vals diff --git a/lib/ansible/modules/cloud/google/gcp_compute_http_health_check.py b/lib/ansible/modules/cloud/google/gcp_compute_http_health_check.py index 9979b5c2fef117..bb6ca8b2322f9b 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_http_health_check.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_http_health_check.py @@ -288,7 +288,7 @@ def resource_to_request(module): } return_vals = {} for k, v in request.items(): - if v is not None: + if v or v is False: return_vals[k] = v return return_vals diff --git a/lib/ansible/modules/cloud/google/gcp_compute_https_health_check.py b/lib/ansible/modules/cloud/google/gcp_compute_https_health_check.py index 11d27b50c2878b..84054f37a61b9d 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_https_health_check.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_https_health_check.py @@ -285,7 +285,7 @@ def resource_to_request(module): } return_vals = {} for k, v in request.items(): - if v is not None: + if v or v is False: return_vals[k] = v return return_vals diff --git a/lib/ansible/modules/cloud/google/gcp_compute_image.py b/lib/ansible/modules/cloud/google/gcp_compute_image.py index 15bba3f5fb00ae..51385be535258e 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_image.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_image.py @@ -520,7 +520,7 @@ def resource_to_request(module): } return_vals = {} for k, v in request.items(): - if v is not None: + if v or v is False: return_vals[k] = v return return_vals diff --git a/lib/ansible/modules/cloud/google/gcp_compute_instance.py b/lib/ansible/modules/cloud/google/gcp_compute_instance.py index 5c16bca12de273..8d000083467a53 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_instance.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_instance.py @@ -1050,7 +1050,7 @@ def resource_to_request(module): request = encode_request(request, module) return_vals = {} for k, v in request.items(): - if v is not None: + if v or v is False: return_vals[k] = v return return_vals diff --git a/lib/ansible/modules/cloud/google/gcp_compute_instance_group.py b/lib/ansible/modules/cloud/google/gcp_compute_instance_group.py index 8d958f33ab05d6..fb10003a3dd40b 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_instance_group.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_instance_group.py @@ -314,7 +314,7 @@ def resource_to_request(module): } return_vals = {} for k, v in request.items(): - if v is not None: + if v or v is False: return_vals[k] = v return return_vals diff --git a/lib/ansible/modules/cloud/google/gcp_compute_instance_group_manager.py b/lib/ansible/modules/cloud/google/gcp_compute_instance_group_manager.py index 4712f2c88db455..d2b05b93dc55e5 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_instance_group_manager.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_instance_group_manager.py @@ -411,7 +411,7 @@ def resource_to_request(module): } return_vals = {} for k, v in request.items(): - if v is not None: + if v or v is False: return_vals[k] = v return return_vals diff --git a/lib/ansible/modules/cloud/google/gcp_compute_instance_template.py b/lib/ansible/modules/cloud/google/gcp_compute_instance_template.py index c47c21fd05c8ac..e4ed9770dd7919 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_instance_template.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_instance_template.py @@ -991,7 +991,7 @@ def resource_to_request(module): request = encode_request(request, module) return_vals = {} for k, v in request.items(): - if v is not None: + if v or v is False: return_vals[k] = v return return_vals diff --git a/lib/ansible/modules/cloud/google/gcp_compute_interconnect_attachment.py b/lib/ansible/modules/cloud/google/gcp_compute_interconnect_attachment.py index 4ea397ac20ab74..0e0f130267ddd1 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_interconnect_attachment.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_interconnect_attachment.py @@ -261,7 +261,7 @@ def resource_to_request(module): } return_vals = {} for k, v in request.items(): - if v is not None: + if v or v is False: return_vals[k] = v return return_vals diff --git a/lib/ansible/modules/cloud/google/gcp_compute_network.py b/lib/ansible/modules/cloud/google/gcp_compute_network.py index a2bf801ceb8601..e48b798b80de51 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_network.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_network.py @@ -280,7 +280,7 @@ def resource_to_request(module): } return_vals = {} for k, v in request.items(): - if v is not None: + if v or v is False: return_vals[k] = v return return_vals diff --git a/lib/ansible/modules/cloud/google/gcp_compute_region_disk.py b/lib/ansible/modules/cloud/google/gcp_compute_region_disk.py index 914ace9cb29e05..900d638e2617c1 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_region_disk.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_region_disk.py @@ -455,7 +455,7 @@ def resource_to_request(module): } return_vals = {} for k, v in request.items(): - if v is not None: + if v or v is False: return_vals[k] = v return return_vals diff --git a/lib/ansible/modules/cloud/google/gcp_compute_route.py b/lib/ansible/modules/cloud/google/gcp_compute_route.py index 910bdb48f7c171..703bd66ccc8a79 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_route.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_route.py @@ -327,7 +327,7 @@ def resource_to_request(module): } return_vals = {} for k, v in request.items(): - if v is not None: + if v or v is False: return_vals[k] = v return return_vals diff --git a/lib/ansible/modules/cloud/google/gcp_compute_router.py b/lib/ansible/modules/cloud/google/gcp_compute_router.py index ff64d09fdb6e40..460371fb5274a7 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_router.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_router.py @@ -331,7 +331,7 @@ def resource_to_request(module): } return_vals = {} for k, v in request.items(): - if v is not None: + if v or v is False: return_vals[k] = v return return_vals diff --git a/lib/ansible/modules/cloud/google/gcp_compute_ssl_certificate.py b/lib/ansible/modules/cloud/google/gcp_compute_ssl_certificate.py index 7a2a9e005e878c..f5faf874c24673 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_ssl_certificate.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_ssl_certificate.py @@ -235,7 +235,7 @@ def resource_to_request(module): } return_vals = {} for k, v in request.items(): - if v is not None: + if v or v is False: return_vals[k] = v return return_vals diff --git a/lib/ansible/modules/cloud/google/gcp_compute_ssl_policy.py b/lib/ansible/modules/cloud/google/gcp_compute_ssl_policy.py index f622beaca2ddf3..6425b0564b5986 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_ssl_policy.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_ssl_policy.py @@ -273,7 +273,7 @@ def resource_to_request(module): } return_vals = {} for k, v in request.items(): - if v is not None: + if v or v is False: return_vals[k] = v return return_vals diff --git a/lib/ansible/modules/cloud/google/gcp_compute_subnetwork.py b/lib/ansible/modules/cloud/google/gcp_compute_subnetwork.py index 4ba98936426952..b56c5b69b91101 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_subnetwork.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_subnetwork.py @@ -400,7 +400,7 @@ def resource_to_request(module): } return_vals = {} for k, v in request.items(): - if v is not None: + if v or v is False: return_vals[k] = v return return_vals diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_http_proxy.py b/lib/ansible/modules/cloud/google/gcp_compute_target_http_proxy.py index ec5151bbc6049d..5dcd1864506dfa 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_http_proxy.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_http_proxy.py @@ -268,7 +268,7 @@ def resource_to_request(module): } return_vals = {} for k, v in request.items(): - if v is not None: + if v or v is False: return_vals[k] = v return return_vals diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_https_proxy.py b/lib/ansible/modules/cloud/google/gcp_compute_target_https_proxy.py index 123a95ab5f54f6..87bba07fd7d5d0 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_https_proxy.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_https_proxy.py @@ -372,7 +372,7 @@ def resource_to_request(module): } return_vals = {} for k, v in request.items(): - if v is not None: + if v or v is False: return_vals[k] = v return return_vals diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_pool.py b/lib/ansible/modules/cloud/google/gcp_compute_target_pool.py index baeff39d2e7746..ddb94fccd25863 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_pool.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_pool.py @@ -322,7 +322,7 @@ def resource_to_request(module): request = encode_request(request, module) return_vals = {} for k, v in request.items(): - if v is not None: + if v or v is False: return_vals[k] = v return return_vals diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_ssl_proxy.py b/lib/ansible/modules/cloud/google/gcp_compute_target_ssl_proxy.py index d3e3b6d66553e7..44c7e6d2fec461 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_ssl_proxy.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_ssl_proxy.py @@ -357,7 +357,7 @@ def resource_to_request(module): } return_vals = {} for k, v in request.items(): - if v is not None: + if v or v is False: return_vals[k] = v return return_vals diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_tcp_proxy.py b/lib/ansible/modules/cloud/google/gcp_compute_target_tcp_proxy.py index 87a5ef9b53cb60..41dcf2a5dde907 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_tcp_proxy.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_tcp_proxy.py @@ -293,7 +293,7 @@ def resource_to_request(module): } return_vals = {} for k, v in request.items(): - if v is not None: + if v or v is False: return_vals[k] = v return return_vals diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_vpn_gateway.py b/lib/ansible/modules/cloud/google/gcp_compute_target_vpn_gateway.py index db5bb505394c82..68721994a1594c 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_vpn_gateway.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_vpn_gateway.py @@ -239,7 +239,7 @@ def resource_to_request(module): } return_vals = {} for k, v in request.items(): - if v is not None: + if v or v is False: return_vals[k] = v return return_vals diff --git a/lib/ansible/modules/cloud/google/gcp_compute_url_map.py b/lib/ansible/modules/cloud/google/gcp_compute_url_map.py index 37734f927789c9..fb557206db05fd 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_url_map.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_url_map.py @@ -455,7 +455,7 @@ def resource_to_request(module): } return_vals = {} for k, v in request.items(): - if v is not None: + if v or v is False: return_vals[k] = v return return_vals diff --git a/lib/ansible/modules/cloud/google/gcp_compute_vpn_tunnel.py b/lib/ansible/modules/cloud/google/gcp_compute_vpn_tunnel.py index 0b240e982a70d3..53cf6505ca0787 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_vpn_tunnel.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_vpn_tunnel.py @@ -377,7 +377,7 @@ def resource_to_request(module): } return_vals = {} for k, v in request.items(): - if v is not None: + if v or v is False: return_vals[k] = v return return_vals diff --git a/lib/ansible/modules/cloud/google/gcp_container_cluster.py b/lib/ansible/modules/cloud/google/gcp_container_cluster.py index 68cf3b0eee2547..4e71d4363e33a0 100644 --- a/lib/ansible/modules/cloud/google/gcp_container_cluster.py +++ b/lib/ansible/modules/cloud/google/gcp_container_cluster.py @@ -701,7 +701,7 @@ def resource_to_request(module): request = encode_request(request, module) return_vals = {} for k, v in request.items(): - if v is not None: + if v or v is False: return_vals[k] = v return return_vals diff --git a/lib/ansible/modules/cloud/google/gcp_container_node_pool.py b/lib/ansible/modules/cloud/google/gcp_container_node_pool.py index eb37cda187a6a3..adaac831d57a66 100644 --- a/lib/ansible/modules/cloud/google/gcp_container_node_pool.py +++ b/lib/ansible/modules/cloud/google/gcp_container_node_pool.py @@ -531,7 +531,7 @@ def resource_to_request(module): request = encode_request(request, module) return_vals = {} for k, v in request.items(): - if v is not None: + if v or v is False: return_vals[k] = v return return_vals diff --git a/lib/ansible/modules/cloud/google/gcp_dns_managed_zone.py b/lib/ansible/modules/cloud/google/gcp_dns_managed_zone.py index df8b09f32408b0..841a07c19cd409 100644 --- a/lib/ansible/modules/cloud/google/gcp_dns_managed_zone.py +++ b/lib/ansible/modules/cloud/google/gcp_dns_managed_zone.py @@ -244,7 +244,7 @@ def resource_to_request(module): } return_vals = {} for k, v in request.items(): - if v is not None: + if v or v is False: return_vals[k] = v return return_vals diff --git a/lib/ansible/modules/cloud/google/gcp_dns_resource_record_set.py b/lib/ansible/modules/cloud/google/gcp_dns_resource_record_set.py index e935096ae7d1ba..fd933ed6aae6a9 100644 --- a/lib/ansible/modules/cloud/google/gcp_dns_resource_record_set.py +++ b/lib/ansible/modules/cloud/google/gcp_dns_resource_record_set.py @@ -252,7 +252,7 @@ def resource_to_request(module): } return_vals = {} for k, v in request.items(): - if v is not None: + if v or v is False: return_vals[k] = v return return_vals diff --git a/lib/ansible/modules/cloud/google/gcp_iam_service_account.py b/lib/ansible/modules/cloud/google/gcp_iam_service_account.py index 06f10ec0739a41..122c32b51157fc 100644 --- a/lib/ansible/modules/cloud/google/gcp_iam_service_account.py +++ b/lib/ansible/modules/cloud/google/gcp_iam_service_account.py @@ -179,7 +179,7 @@ def resource_to_request(module): request = encode_request(request, module) return_vals = {} for k, v in request.items(): - if v is not None: + if v or v is False: return_vals[k] = v return return_vals diff --git a/lib/ansible/modules/cloud/google/gcp_pubsub_subscription.py b/lib/ansible/modules/cloud/google/gcp_pubsub_subscription.py index 4eed3eb62e8120..fd9fbd221de2b8 100644 --- a/lib/ansible/modules/cloud/google/gcp_pubsub_subscription.py +++ b/lib/ansible/modules/cloud/google/gcp_pubsub_subscription.py @@ -243,7 +243,7 @@ def resource_to_request(module): request = encode_request(request, module) return_vals = {} for k, v in request.items(): - if v is not None: + if v or v is False: return_vals[k] = v return return_vals diff --git a/lib/ansible/modules/cloud/google/gcp_pubsub_topic.py b/lib/ansible/modules/cloud/google/gcp_pubsub_topic.py index b93b62fae5ce1e..c70e22edb50db7 100644 --- a/lib/ansible/modules/cloud/google/gcp_pubsub_topic.py +++ b/lib/ansible/modules/cloud/google/gcp_pubsub_topic.py @@ -147,7 +147,7 @@ def resource_to_request(module): request = encode_request(request, module) return_vals = {} for k, v in request.items(): - if v is not None: + if v or v is False: return_vals[k] = v return return_vals diff --git a/lib/ansible/modules/cloud/google/gcp_resourcemanager_project.py b/lib/ansible/modules/cloud/google/gcp_resourcemanager_project.py index 925bfd4880b1c8..5ce0ef76846e10 100644 --- a/lib/ansible/modules/cloud/google/gcp_resourcemanager_project.py +++ b/lib/ansible/modules/cloud/google/gcp_resourcemanager_project.py @@ -244,7 +244,7 @@ def resource_to_request(module): } return_vals = {} for k, v in request.items(): - if v is not None: + if v or v is False: return_vals[k] = v return return_vals diff --git a/lib/ansible/modules/cloud/google/gcp_spanner_database.py b/lib/ansible/modules/cloud/google/gcp_spanner_database.py index 162cd2e21c9077..00bf487c43c47e 100644 --- a/lib/ansible/modules/cloud/google/gcp_spanner_database.py +++ b/lib/ansible/modules/cloud/google/gcp_spanner_database.py @@ -198,7 +198,7 @@ def resource_to_request(module): request = encode_request(request, module) return_vals = {} for k, v in request.items(): - if v is not None: + if v or v is False: return_vals[k] = v return return_vals diff --git a/lib/ansible/modules/cloud/google/gcp_spanner_instance.py b/lib/ansible/modules/cloud/google/gcp_spanner_instance.py index b3a574997c318e..4aa2fbb0149953 100644 --- a/lib/ansible/modules/cloud/google/gcp_spanner_instance.py +++ b/lib/ansible/modules/cloud/google/gcp_spanner_instance.py @@ -235,7 +235,7 @@ def resource_to_request(module): } return_vals = {} for k, v in request.items(): - if v is not None: + if v or v is False: return_vals[k] = v return return_vals diff --git a/lib/ansible/modules/cloud/google/gcp_sql_database.py b/lib/ansible/modules/cloud/google/gcp_sql_database.py index 97e9095c69b8ad..e0d110632cecba 100644 --- a/lib/ansible/modules/cloud/google/gcp_sql_database.py +++ b/lib/ansible/modules/cloud/google/gcp_sql_database.py @@ -206,7 +206,7 @@ def resource_to_request(module): } return_vals = {} for k, v in request.items(): - if v is not None: + if v or v is False: return_vals[k] = v return return_vals diff --git a/lib/ansible/modules/cloud/google/gcp_sql_instance.py b/lib/ansible/modules/cloud/google/gcp_sql_instance.py index 45a9c3eeda6854..161aa88976243f 100644 --- a/lib/ansible/modules/cloud/google/gcp_sql_instance.py +++ b/lib/ansible/modules/cloud/google/gcp_sql_instance.py @@ -678,7 +678,7 @@ def resource_to_request(module): } return_vals = {} for k, v in request.items(): - if v is not None: + if v or v is False: return_vals[k] = v return return_vals diff --git a/lib/ansible/modules/cloud/google/gcp_sql_user.py b/lib/ansible/modules/cloud/google/gcp_sql_user.py index 0db23270074e77..4e6f2c5c85c82f 100644 --- a/lib/ansible/modules/cloud/google/gcp_sql_user.py +++ b/lib/ansible/modules/cloud/google/gcp_sql_user.py @@ -211,7 +211,7 @@ def resource_to_request(module): } return_vals = {} for k, v in request.items(): - if v is not None: + if v or v is False: return_vals[k] = v return return_vals diff --git a/lib/ansible/modules/cloud/google/gcp_storage_bucket.py b/lib/ansible/modules/cloud/google/gcp_storage_bucket.py index c5bebcb44af267..3c00e92ad11b4a 100644 --- a/lib/ansible/modules/cloud/google/gcp_storage_bucket.py +++ b/lib/ansible/modules/cloud/google/gcp_storage_bucket.py @@ -936,7 +936,7 @@ def resource_to_request(module): } return_vals = {} for k, v in request.items(): - if v is not None: + if v or v is False: return_vals[k] = v return return_vals diff --git a/lib/ansible/modules/cloud/google/gcp_storage_bucket_access_control.py b/lib/ansible/modules/cloud/google/gcp_storage_bucket_access_control.py index 6e2d13f7e4046d..09e141f4bc08e6 100644 --- a/lib/ansible/modules/cloud/google/gcp_storage_bucket_access_control.py +++ b/lib/ansible/modules/cloud/google/gcp_storage_bucket_access_control.py @@ -273,7 +273,7 @@ def resource_to_request(module): } return_vals = {} for k, v in request.items(): - if v is not None: + if v or v is False: return_vals[k] = v return return_vals From 2ee8c7b9090e667ba73425f3188aa0a11eb08b0e Mon Sep 17 00:00:00 2001 From: Alex Stephen Date: Thu, 6 Dec 2018 12:51:27 -0800 Subject: [PATCH 072/144] removing interconnect tests --- .../tasks/main.yml | 116 ------------------ 1 file changed, 116 deletions(-) delete mode 100644 test/integration/targets/gcp_compute_interconnect_attachment/tasks/main.yml diff --git a/test/integration/targets/gcp_compute_interconnect_attachment/tasks/main.yml b/test/integration/targets/gcp_compute_interconnect_attachment/tasks/main.yml deleted file mode 100644 index 2ed187af54598e..00000000000000 --- a/test/integration/targets/gcp_compute_interconnect_attachment/tasks/main.yml +++ /dev/null @@ -1,116 +0,0 @@ ---- -# ---------------------------------------------------------------------------- -# -# *** AUTO GENERATED CODE *** AUTO GENERATED CODE *** -# -# ---------------------------------------------------------------------------- -# -# This file is automatically generated by Magic Modules and manual -# changes will be clobbered when the file is regenerated. -# -# Please read more about how to change this file at -# https://www.github.com/GoogleCloudPlatform/magic-modules -# -# ---------------------------------------------------------------------------- -# Pre-test setup -- name: delete a interconnect attachment - gcp_compute_interconnect_attachment: - name: "{{ resource_name }}" - region: us-central1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - interconnect: https://googleapis.com/compute/v1/projects/{{ gcp_project }}/global/interconnects/... - router: https://googleapis.com/compute/v1/projects/{{ gcp_project }}/regions/us-central1/routers/... - service_account_file: "{{ gcp_cred_file }}" - state: absent - register: disk -#---------------------------------------------------------- -- name: create a interconnect attachment - gcp_compute_interconnect_attachment: - name: "{{ resource_name }}" - region: us-central1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - interconnect: https://googleapis.com/compute/v1/projects/{{ gcp_project }}/global/interconnects/... - router: https://googleapis.com/compute/v1/projects/{{ gcp_project }}/regions/us-central1/routers/... - service_account_file: "{{ gcp_cred_file }}" - state: present - register: disk - register: result -- name: assert changed is true - assert: - that: - - result.changed == true - - "result.kind == 'compute#interconnectAttachment'" -- name: verify that interconnect_attachment was created - shell: | - gcloud compute interconnects attachments describe "{{ resource_name }}" --project="{{ gcp_project}}" --region="{{ gcp_region}}" - register: results -- name: verify that command succeeded - assert: - that: - - results.rc == 0 -# ---------------------------------------------------------------------------- -- name: create a interconnect attachment that already exists - gcp_compute_interconnect_attachment: - name: "{{ resource_name }}" - region: us-central1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - interconnect: https://googleapis.com/compute/v1/projects/{{ gcp_project }}/global/interconnects/... - router: https://googleapis.com/compute/v1/projects/{{ gcp_project }}/regions/us-central1/routers/... - service_account_file: "{{ gcp_cred_file }}" - state: present - register: disk - register: result -- name: assert changed is false - assert: - that: - - result.changed == false - - "result.kind == 'compute#interconnectAttachment'" -#---------------------------------------------------------- -- name: delete a interconnect attachment - gcp_compute_interconnect_attachment: - name: "{{ resource_name }}" - region: us-central1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - interconnect: https://googleapis.com/compute/v1/projects/{{ gcp_project }}/global/interconnects/... - router: https://googleapis.com/compute/v1/projects/{{ gcp_project }}/regions/us-central1/routers/... - service_account_file: "{{ gcp_cred_file }}" - state: absent - register: disk - register: result -- name: assert changed is true - assert: - that: - - result.changed == true - - result.has_key('kind') == False -- name: verify that interconnect_attachment was deleted - shell: | - gcloud compute interconnects attachments describe "{{ resource_name }}" --project="{{ gcp_project}}" --region="{{ gcp_region}}" - register: results - failed_when: results.rc == 0 -- name: verify that command succeeded - assert: - that: - - results.rc == 1 - - "\"'projects/{{ gcp_project }}/global/images/{{ resource_name }}' was not found\" in results.stderr" -# ---------------------------------------------------------------------------- -- name: delete a interconnect attachment that does not exist - gcp_compute_interconnect_attachment: - name: "{{ resource_name }}" - region: us-central1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - interconnect: https://googleapis.com/compute/v1/projects/{{ gcp_project }}/global/interconnects/... - router: https://googleapis.com/compute/v1/projects/{{ gcp_project }}/regions/us-central1/routers/... - service_account_file: "{{ gcp_cred_file }}" - state: absent - register: disk - register: result -- name: assert changed is false - assert: - that: - - result.changed == false - - result.has_key('kind') == False From 42abba7032e242b1fce517c182b0364641fce2bb Mon Sep 17 00:00:00 2001 From: The Magician Date: Thu, 6 Dec 2018 15:07:57 -0800 Subject: [PATCH 073/144] Bigquery (#127) /cc @rambleraptor --- .../cloud/google/gcp_bigquery_dataset.py | 555 ++++++ .../google/gcp_bigquery_dataset_facts.py | 253 +++ .../cloud/google/gcp_bigquery_table.py | 1582 +++++++++++++++++ .../cloud/google/gcp_bigquery_table_facts.py | 568 ++++++ .../targets/gcp_bigquery_dataset/aliases | 2 + .../gcp_bigquery_dataset/defaults/main.yml | 3 + .../gcp_bigquery_dataset/meta/main.yml | 0 .../gcp_bigquery_dataset/tasks/main.yml | 112 ++ .../targets/gcp_bigquery_table/aliases | 2 + .../gcp_bigquery_table/defaults/main.yml | 3 + .../targets/gcp_bigquery_table/meta/main.yml | 0 .../targets/gcp_bigquery_table/tasks/main.yml | 151 ++ 12 files changed, 3231 insertions(+) create mode 100644 lib/ansible/modules/cloud/google/gcp_bigquery_dataset.py create mode 100644 lib/ansible/modules/cloud/google/gcp_bigquery_dataset_facts.py create mode 100644 lib/ansible/modules/cloud/google/gcp_bigquery_table.py create mode 100644 lib/ansible/modules/cloud/google/gcp_bigquery_table_facts.py create mode 100644 test/integration/targets/gcp_bigquery_dataset/aliases create mode 100644 test/integration/targets/gcp_bigquery_dataset/defaults/main.yml create mode 100644 test/integration/targets/gcp_bigquery_dataset/meta/main.yml create mode 100644 test/integration/targets/gcp_bigquery_dataset/tasks/main.yml create mode 100644 test/integration/targets/gcp_bigquery_table/aliases create mode 100644 test/integration/targets/gcp_bigquery_table/defaults/main.yml create mode 100644 test/integration/targets/gcp_bigquery_table/meta/main.yml create mode 100644 test/integration/targets/gcp_bigquery_table/tasks/main.yml diff --git a/lib/ansible/modules/cloud/google/gcp_bigquery_dataset.py b/lib/ansible/modules/cloud/google/gcp_bigquery_dataset.py new file mode 100644 index 00000000000000..cd6eb1e9e34401 --- /dev/null +++ b/lib/ansible/modules/cloud/google/gcp_bigquery_dataset.py @@ -0,0 +1,555 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# +# Copyright (C) 2017 Google +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) +# ---------------------------------------------------------------------------- +# +# *** AUTO GENERATED CODE *** AUTO GENERATED CODE *** +# +# ---------------------------------------------------------------------------- +# +# This file is automatically generated by Magic Modules and manual +# changes will be clobbered when the file is regenerated. +# +# Please read more about how to change this file at +# https://www.github.com/GoogleCloudPlatform/magic-modules +# +# ---------------------------------------------------------------------------- + +from __future__ import absolute_import, division, print_function +__metaclass__ = type + +################################################################################ +# Documentation +################################################################################ + +ANSIBLE_METADATA = {'metadata_version': '1.1', + 'status': ["preview"], + 'supported_by': 'community'} + +DOCUMENTATION = ''' +--- +module: gcp_bigquery_dataset +description: +- Datasets allow you to organize and control access to your tables. +short_description: Creates a GCP Dataset +version_added: 2.8 +author: Google Inc. (@googlecloudplatform) +requirements: +- python >= 2.6 +- requests >= 2.18.4 +- google-auth >= 1.3.0 +options: + state: + description: + - Whether the given object should exist in GCP + choices: + - present + - absent + default: present + name: + description: + - Dataset name. + required: false + access: + description: + - Access controls on the bucket. + required: false + suboptions: + domain: + description: + - A domain to grant access to. Any users signed in with the domain specified + will be granted the specified access . + required: false + group_by_email: + description: + - An email address of a Google Group to grant access to. + required: false + role: + description: + - Describes the rights granted to the user specified by the other member of + the access object . + required: false + choices: + - READER + - WRITER + - OWNER + special_group: + description: + - A special group to grant access to. + required: false + user_by_email: + description: + - 'An email address of a user to grant access to. For example: fred@example.com + .' + required: false + view: + description: + - A view from a different dataset to grant access to. Queries executed against + that view will have read access to tables in this dataset. The role field + is not required when this field is set. If that view is updated by any user, + access to the view needs to be granted again via an update operation. + required: false + suboptions: + dataset_id: + description: + - The ID of the dataset containing this table. + required: true + project_id: + description: + - The ID of the project containing this table. + required: true + table_id: + description: + - The ID of the table. The ID must contain only letters (a-z, A-Z), numbers + (0-9), or underscores. The maximum length is 1,024 characters. + required: true + dataset_reference: + description: + - A reference that identifies the dataset. + required: true + suboptions: + dataset_id: + description: + - A unique ID for this dataset, without the project name. The ID must contain + only letters (a-z, A-Z), numbers (0-9), or underscores. The maximum length + is 1,024 characters. + required: true + project_id: + description: + - The ID of the project containing this dataset. + required: false + default_table_expiration_ms: + description: + - The default lifetime of all tables in the dataset, in milliseconds . + required: false + description: + description: + - A user-friendly description of the dataset. + required: false + friendly_name: + description: + - A descriptive name for the dataset. + required: false + labels: + description: + - The labels associated with this dataset. You can use these to organize and group + your datasets . + required: false + location: + description: + - The geographic location where the dataset should reside. Possible values include + EU and US. The default value is US. + required: false + default: US +extends_documentation_fragment: gcp +''' + +EXAMPLES = ''' +- name: create a dataset + gcp_bigquery_dataset: + name: my_example_dataset + dataset_reference: + dataset_id: my_example_dataset + project: "test_project" + auth_kind: "serviceaccount" + service_account_file: "/tmp/auth.pem" + state: present +''' + +RETURN = ''' +name: + description: + - Dataset name. + returned: success + type: str +access: + description: + - Access controls on the bucket. + returned: success + type: complex + contains: + domain: + description: + - A domain to grant access to. Any users signed in with the domain specified + will be granted the specified access . + returned: success + type: str + groupByEmail: + description: + - An email address of a Google Group to grant access to. + returned: success + type: str + role: + description: + - Describes the rights granted to the user specified by the other member of + the access object . + returned: success + type: str + specialGroup: + description: + - A special group to grant access to. + returned: success + type: str + userByEmail: + description: + - 'An email address of a user to grant access to. For example: fred@example.com + .' + returned: success + type: str + view: + description: + - A view from a different dataset to grant access to. Queries executed against + that view will have read access to tables in this dataset. The role field + is not required when this field is set. If that view is updated by any user, + access to the view needs to be granted again via an update operation. + returned: success + type: complex + contains: + datasetId: + description: + - The ID of the dataset containing this table. + returned: success + type: str + projectId: + description: + - The ID of the project containing this table. + returned: success + type: str + tableId: + description: + - The ID of the table. The ID must contain only letters (a-z, A-Z), numbers + (0-9), or underscores. The maximum length is 1,024 characters. + returned: success + type: str +creationTime: + description: + - The time when this dataset was created, in milliseconds since the epoch. + returned: success + type: int +datasetReference: + description: + - A reference that identifies the dataset. + returned: success + type: complex + contains: + datasetId: + description: + - A unique ID for this dataset, without the project name. The ID must contain + only letters (a-z, A-Z), numbers (0-9), or underscores. The maximum length + is 1,024 characters. + returned: success + type: str + projectId: + description: + - The ID of the project containing this dataset. + returned: success + type: str +defaultTableExpirationMs: + description: + - The default lifetime of all tables in the dataset, in milliseconds . + returned: success + type: int +description: + description: + - A user-friendly description of the dataset. + returned: success + type: str +friendlyName: + description: + - A descriptive name for the dataset. + returned: success + type: str +id: + description: + - The fully-qualified unique name of the dataset in the format projectId:datasetId. + The dataset name without the project name is given in the datasetId field . + returned: success + type: str +labels: + description: + - The labels associated with this dataset. You can use these to organize and group + your datasets . + returned: success + type: dict +lastModifiedTime: + description: + - The date when this dataset or any of its tables was last modified, in milliseconds + since the epoch. + returned: success + type: int +location: + description: + - The geographic location where the dataset should reside. Possible values include + EU and US. The default value is US. + returned: success + type: str +''' + +################################################################################ +# Imports +################################################################################ + +from ansible.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest, remove_nones_from_dict, replace_resource_dict +import json + +################################################################################ +# Main +################################################################################ + + +def main(): + """Main function""" + + module = GcpModule( + argument_spec=dict( + state=dict(default='present', choices=['present', 'absent'], type='str'), + name=dict(type='str'), + access=dict(type='list', elements='dict', options=dict( + domain=dict(type='str'), + group_by_email=dict(type='str'), + role=dict(type='str', choices=['READER', 'WRITER', 'OWNER']), + special_group=dict(type='str'), + user_by_email=dict(type='str'), + view=dict(type='dict', options=dict( + dataset_id=dict(required=True, type='str'), + project_id=dict(required=True, type='str'), + table_id=dict(required=True, type='str') + )) + )), + dataset_reference=dict(required=True, type='dict', options=dict( + dataset_id=dict(required=True, type='str'), + project_id=dict(type='str') + )), + default_table_expiration_ms=dict(type='int'), + description=dict(type='str'), + friendly_name=dict(type='str'), + labels=dict(type='dict'), + location=dict(default='US', type='str') + ) + ) + + if not module.params['scopes']: + module.params['scopes'] = ['https://www.googleapis.com/auth/bigquery'] + + state = module.params['state'] + kind = 'bigquery#dataset' + + fetch = fetch_resource(module, self_link(module), kind) + changed = False + + if fetch: + if state == 'present': + if is_different(module, fetch): + update(module, self_link(module), kind) + fetch = fetch_resource(module, self_link(module), kind) + changed = True + else: + delete(module, self_link(module), kind) + fetch = {} + changed = True + else: + if state == 'present': + fetch = create(module, collection(module), kind) + changed = True + else: + fetch = {} + + fetch.update({'changed': changed}) + + module.exit_json(**fetch) + + +def create(module, link, kind): + auth = GcpSession(module, 'bigquery') + return return_if_object(module, auth.post(link, resource_to_request(module)), kind) + + +def update(module, link, kind): + auth = GcpSession(module, 'bigquery') + return return_if_object(module, auth.put(link, resource_to_request(module)), kind) + + +def delete(module, link, kind): + auth = GcpSession(module, 'bigquery') + return return_if_object(module, auth.delete(link), kind) + + +def resource_to_request(module): + request = { + u'kind': 'bigquery#dataset', + u'name': module.params.get('name'), + u'access': DatasetAccessArray(module.params.get('access', []), module).to_request(), + u'datasetReference': DatasetDatasetreference(module.params.get('dataset_reference', {}), module).to_request(), + u'defaultTableExpirationMs': module.params.get('default_table_expiration_ms'), + u'description': module.params.get('description'), + u'friendlyName': module.params.get('friendly_name'), + u'labels': module.params.get('labels'), + u'location': module.params.get('location') + } + return_vals = {} + for k, v in request.items(): + if v or v is False: + return_vals[k] = v + + return return_vals + + +def fetch_resource(module, link, kind, allow_not_found=True): + auth = GcpSession(module, 'bigquery') + return return_if_object(module, auth.get(link), kind, allow_not_found) + + +def self_link(module): + return "https://www.googleapis.com/bigquery/v2/projects/{project}/datasets/{name}".format(**module.params) + + +def collection(module): + return "https://www.googleapis.com/bigquery/v2/projects/{project}/datasets".format(**module.params) + + +def return_if_object(module, response, kind, allow_not_found=False): + # If not found, return nothing. + if allow_not_found and response.status_code == 404: + return None + + # If no content, return nothing. + if response.status_code == 204: + return None + + try: + module.raise_for_status(response) + result = response.json() + except getattr(json.decoder, 'JSONDecodeError', ValueError) as inst: + module.fail_json(msg="Invalid JSON response with error: %s" % inst) + + if navigate_hash(result, ['error', 'errors']): + module.fail_json(msg=navigate_hash(result, ['error', 'errors'])) + + return result + + +def is_different(module, response): + request = resource_to_request(module) + response = response_to_hash(module, response) + + # Remove all output-only from response. + response_vals = {} + for k, v in response.items(): + if k in request: + response_vals[k] = v + + request_vals = {} + for k, v in request.items(): + if k in response: + request_vals[k] = v + + return GcpRequest(request_vals) != GcpRequest(response_vals) + + +# Remove unnecessary properties from the response. +# This is for doing comparisons with Ansible's current parameters. +def response_to_hash(module, response): + return { + u'name': response.get(u'name'), + u'access': DatasetAccessArray(response.get(u'access', []), module).from_response(), + u'creationTime': response.get(u'creationTime'), + u'datasetReference': DatasetDatasetreference(response.get(u'datasetReference', {}), module).from_response(), + u'defaultTableExpirationMs': response.get(u'defaultTableExpirationMs'), + u'description': response.get(u'description'), + u'friendlyName': response.get(u'friendlyName'), + u'id': response.get(u'id'), + u'labels': response.get(u'labels'), + u'lastModifiedTime': response.get(u'lastModifiedTime'), + u'location': response.get(u'location') + } + + +class DatasetAccessArray(object): + def __init__(self, request, module): + self.module = module + if request: + self.request = request + else: + self.request = [] + + def to_request(self): + items = [] + for item in self.request: + items.append(self._request_for_item(item)) + return items + + def from_response(self): + items = [] + for item in self.request: + items.append(self._response_from_item(item)) + return items + + def _request_for_item(self, item): + return remove_nones_from_dict({ + u'domain': item.get('domain'), + u'groupByEmail': item.get('group_by_email'), + u'role': item.get('role'), + u'specialGroup': item.get('special_group'), + u'userByEmail': item.get('user_by_email'), + u'view': DatasetView(item.get('view', {}), self.module).to_request() + }) + + def _response_from_item(self, item): + return remove_nones_from_dict({ + u'domain': item.get(u'domain'), + u'groupByEmail': item.get(u'groupByEmail'), + u'role': item.get(u'role'), + u'specialGroup': item.get(u'specialGroup'), + u'userByEmail': item.get(u'userByEmail'), + u'view': DatasetView(item.get(u'view', {}), self.module).from_response() + }) + + +class DatasetView(object): + def __init__(self, request, module): + self.module = module + if request: + self.request = request + else: + self.request = {} + + def to_request(self): + return remove_nones_from_dict({ + u'datasetId': self.request.get('dataset_id'), + u'projectId': self.request.get('project_id'), + u'tableId': self.request.get('table_id') + }) + + def from_response(self): + return remove_nones_from_dict({ + u'datasetId': self.request.get(u'datasetId'), + u'projectId': self.request.get(u'projectId'), + u'tableId': self.request.get(u'tableId') + }) + + +class DatasetDatasetreference(object): + def __init__(self, request, module): + self.module = module + if request: + self.request = request + else: + self.request = {} + + def to_request(self): + return remove_nones_from_dict({ + u'datasetId': self.request.get('dataset_id'), + u'projectId': self.request.get('project_id') + }) + + def from_response(self): + return remove_nones_from_dict({ + u'datasetId': self.request.get(u'datasetId'), + u'projectId': self.request.get(u'projectId') + }) + + +if __name__ == '__main__': + main() diff --git a/lib/ansible/modules/cloud/google/gcp_bigquery_dataset_facts.py b/lib/ansible/modules/cloud/google/gcp_bigquery_dataset_facts.py new file mode 100644 index 00000000000000..e390bd9aa5fbd9 --- /dev/null +++ b/lib/ansible/modules/cloud/google/gcp_bigquery_dataset_facts.py @@ -0,0 +1,253 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# +# Copyright (C) 2017 Google +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) +# ---------------------------------------------------------------------------- +# +# *** AUTO GENERATED CODE *** AUTO GENERATED CODE *** +# +# ---------------------------------------------------------------------------- +# +# This file is automatically generated by Magic Modules and manual +# changes will be clobbered when the file is regenerated. +# +# Please read more about how to change this file at +# https://www.github.com/GoogleCloudPlatform/magic-modules +# +# ---------------------------------------------------------------------------- + +from __future__ import absolute_import, division, print_function +__metaclass__ = type + +################################################################################ +# Documentation +################################################################################ + +ANSIBLE_METADATA = {'metadata_version': '1.1', + 'status': ["preview"], + 'supported_by': 'community'} + +DOCUMENTATION = ''' +--- +module: gcp_bigquery_dataset_facts +description: +- Gather facts for GCP Dataset +short_description: Gather facts for GCP Dataset +version_added: 2.8 +author: Google Inc. (@googlecloudplatform) +requirements: +- python >= 2.6 +- requests >= 2.18.4 +- google-auth >= 1.3.0 +options: {} +extends_documentation_fragment: gcp +''' + +EXAMPLES = ''' +- name: a dataset facts + gcp_bigquery_dataset_facts: + project: test_project + auth_kind: serviceaccount + service_account_file: "/tmp/auth.pem" +''' + +RETURN = ''' +items: + description: List of items + returned: always + type: complex + contains: + name: + description: + - Dataset name. + returned: success + type: str + access: + description: + - Access controls on the bucket. + returned: success + type: complex + contains: + domain: + description: + - A domain to grant access to. Any users signed in with the domain specified + will be granted the specified access . + returned: success + type: str + groupByEmail: + description: + - An email address of a Google Group to grant access to. + returned: success + type: str + role: + description: + - Describes the rights granted to the user specified by the other member + of the access object . + returned: success + type: str + specialGroup: + description: + - A special group to grant access to. + returned: success + type: str + userByEmail: + description: + - 'An email address of a user to grant access to. For example: fred@example.com + .' + returned: success + type: str + view: + description: + - A view from a different dataset to grant access to. Queries executed against + that view will have read access to tables in this dataset. The role field + is not required when this field is set. If that view is updated by any + user, access to the view needs to be granted again via an update operation. + returned: success + type: complex + contains: + datasetId: + description: + - The ID of the dataset containing this table. + returned: success + type: str + projectId: + description: + - The ID of the project containing this table. + returned: success + type: str + tableId: + description: + - The ID of the table. The ID must contain only letters (a-z, A-Z), + numbers (0-9), or underscores. The maximum length is 1,024 characters. + returned: success + type: str + creationTime: + description: + - The time when this dataset was created, in milliseconds since the epoch. + returned: success + type: int + datasetReference: + description: + - A reference that identifies the dataset. + returned: success + type: complex + contains: + datasetId: + description: + - A unique ID for this dataset, without the project name. The ID must contain + only letters (a-z, A-Z), numbers (0-9), or underscores. The maximum length + is 1,024 characters. + returned: success + type: str + projectId: + description: + - The ID of the project containing this dataset. + returned: success + type: str + defaultTableExpirationMs: + description: + - The default lifetime of all tables in the dataset, in milliseconds . + returned: success + type: int + description: + description: + - A user-friendly description of the dataset. + returned: success + type: str + friendlyName: + description: + - A descriptive name for the dataset. + returned: success + type: str + id: + description: + - The fully-qualified unique name of the dataset in the format projectId:datasetId. + The dataset name without the project name is given in the datasetId field + . + returned: success + type: str + labels: + description: + - The labels associated with this dataset. You can use these to organize and + group your datasets . + returned: success + type: dict + lastModifiedTime: + description: + - The date when this dataset or any of its tables was last modified, in milliseconds + since the epoch. + returned: success + type: int + location: + description: + - The geographic location where the dataset should reside. Possible values include + EU and US. The default value is US. + returned: success + type: str +''' + +################################################################################ +# Imports +################################################################################ +from ansible.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest +import json + +################################################################################ +# Main +################################################################################ + + +def main(): + module = GcpModule( + argument_spec=dict( + ) + ) + + if not module.params['scopes']: + module.params['scopes'] = ['https://www.googleapis.com/auth/bigquery'] + + items = fetch_list(module, collection(module)) + if items.get('datasets'): + items = items.get('datasets') + else: + items = [] + return_value = { + 'items': items + } + module.exit_json(**return_value) + + +def collection(module): + return "https://www.googleapis.com/bigquery/v2/projects/{project}/datasets".format(**module.params) + + +def fetch_list(module, link): + auth = GcpSession(module, 'bigquery') + response = auth.get(link) + return return_if_object(module, response) + + +def return_if_object(module, response): + # If not found, return nothing. + if response.status_code == 404: + return None + + # If no content, return nothing. + if response.status_code == 204: + return None + + try: + module.raise_for_status(response) + result = response.json() + except getattr(json.decoder, 'JSONDecodeError', ValueError) as inst: + module.fail_json(msg="Invalid JSON response with error: %s" % inst) + + if navigate_hash(result, ['error', 'errors']): + module.fail_json(msg=navigate_hash(result, ['error', 'errors'])) + + return result + + +if __name__ == "__main__": + main() diff --git a/lib/ansible/modules/cloud/google/gcp_bigquery_table.py b/lib/ansible/modules/cloud/google/gcp_bigquery_table.py new file mode 100644 index 00000000000000..7517c4613bdd99 --- /dev/null +++ b/lib/ansible/modules/cloud/google/gcp_bigquery_table.py @@ -0,0 +1,1582 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# +# Copyright (C) 2017 Google +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) +# ---------------------------------------------------------------------------- +# +# *** AUTO GENERATED CODE *** AUTO GENERATED CODE *** +# +# ---------------------------------------------------------------------------- +# +# This file is automatically generated by Magic Modules and manual +# changes will be clobbered when the file is regenerated. +# +# Please read more about how to change this file at +# https://www.github.com/GoogleCloudPlatform/magic-modules +# +# ---------------------------------------------------------------------------- + +from __future__ import absolute_import, division, print_function +__metaclass__ = type + +################################################################################ +# Documentation +################################################################################ + +ANSIBLE_METADATA = {'metadata_version': '1.1', + 'status': ["preview"], + 'supported_by': 'community'} + +DOCUMENTATION = ''' +--- +module: gcp_bigquery_table +description: +- A Table that belongs to a Dataset . +short_description: Creates a GCP Table +version_added: 2.8 +author: Google Inc. (@googlecloudplatform) +requirements: +- python >= 2.6 +- requests >= 2.18.4 +- google-auth >= 1.3.0 +options: + state: + description: + - Whether the given object should exist in GCP + choices: + - present + - absent + default: present + table_reference: + description: + - Reference describing the ID of this table. + required: false + suboptions: + dataset_id: + description: + - The ID of the dataset containing this table. + required: false + project_id: + description: + - The ID of the project containing this table. + required: false + table_id: + description: + - The ID of the the table. + required: false + description: + description: + - A user-friendly description of the dataset. + required: false + friendly_name: + description: + - A descriptive name for this table. + required: false + labels: + description: + - The labels associated with this dataset. You can use these to organize and group + your datasets . + required: false + name: + description: + - Name of the table. + required: false + view: + description: + - The view definition. + required: false + suboptions: + use_legacy_sql: + description: + - Specifies whether to use BigQuery's legacy SQL for this view . + required: false + type: bool + user_defined_function_resources: + description: + - Describes user-defined function resources used in the query. + required: false + suboptions: + inline_code: + description: + - An inline resource that contains code for a user-defined function (UDF). + Providing a inline code resource is equivalent to providing a URI for + a file containing the same code. + required: false + resource_uri: + description: + - A code resource to load from a Google Cloud Storage URI (gs://bucket/path). + required: false + time_partitioning: + description: + - If specified, configures time-based partitioning for this table. + required: false + suboptions: + expiration_ms: + description: + - Number of milliseconds for which to keep the storage for a partition. + required: false + type: + description: + - The only type supported is DAY, which will generate one partition per day. + required: false + choices: + - DAY + schema: + description: + - Describes the schema of this table. + required: false + suboptions: + fields: + description: + - Describes the fields in a table. + required: false + suboptions: + description: + description: + - The field description. The maximum length is 1,024 characters. + required: false + fields: + description: + - Describes the nested schema fields if the type property is set to RECORD. + required: false + mode: + description: + - The field mode. + required: false + choices: + - NULLABLE + - REQUIRED + - REPEATED + name: + description: + - The field name. + required: false + type: + description: + - The field data type. + required: false + choices: + - STRING + - BYTES + - INTEGER + - FLOAT + - TIMESTAMP + - DATE + - TIME + - DATETIME + - RECORD + encryption_configuration: + description: + - Custom encryption configuration. + required: false + suboptions: + kms_key_name: + description: + - Describes the Cloud KMS encryption key that will be used to protect destination + BigQuery table. The BigQuery Service Account associated with your project + requires access to this encryption key. + required: false + expiration_time: + description: + - The time when this table expires, in milliseconds since the epoch. If not present, + the table will persist indefinitely. + required: false + external_data_configuration: + description: + - Describes the data format, location, and other properties of a table stored + outside of BigQuery. By defining these properties, the data source can then + be queried as if it were a standard BigQuery table. + required: false + suboptions: + autodetect: + description: + - Try to detect schema and format options automatically. Any option specified + explicitly will be honored. + required: false + type: bool + compression: + description: + - The compression type of the data source. + required: false + choices: + - GZIP + - NONE + ignore_unknown_values: + description: + - Indicates if BigQuery should allow extra values that are not represented + in the table schema . + required: false + type: bool + max_bad_records: + description: + - The maximum number of bad records that BigQuery can ignore when reading + data . + required: false + default: '0' + source_format: + description: + - The data format. + required: false + choices: + - CSV + - GOOGLE_SHEETS + - NEWLINE_DELIMITED_JSON + - AVRO + - DATASTORE_BACKUP + - BIGTABLE + source_uris: + description: + - 'The fully-qualified URIs that point to your data in Google Cloud. For Google + Cloud Storage URIs: Each URI can contain one ''*'' wildcard character and + it must come after the ''bucket'' name. Size limits related to load jobs + apply to external data sources. For Google Cloud Bigtable URIs: Exactly + one URI can be specified and it has be a fully specified and valid HTTPS + URL for a Google Cloud Bigtable table. For Google Cloud Datastore backups, + exactly one URI can be specified. Also, the ''*'' wildcard character is + not allowed.' + required: false + schema: + description: + - The schema for the data. Schema is required for CSV and JSON formats. + required: false + suboptions: + fields: + description: + - Describes the fields in a table. + required: false + suboptions: + description: + description: + - The field description. + required: false + fields: + description: + - Describes the nested schema fields if the type property is set to + RECORD . + required: false + mode: + description: + - Field mode. + required: false + choices: + - NULLABLE + - REQUIRED + - REPEATED + name: + description: + - Field name. + required: false + type: + description: + - Field data type. + required: false + choices: + - STRING + - BYTES + - INTEGER + - FLOAT + - TIMESTAMP + - DATE + - TIME + - DATETIME + - RECORD + google_sheets_options: + description: + - Additional options if sourceFormat is set to GOOGLE_SHEETS. + required: false + suboptions: + skip_leading_rows: + description: + - The number of rows at the top of a Google Sheet that BigQuery will skip + when reading the data. + required: false + default: '0' + csv_options: + description: + - Additional properties to set if sourceFormat is set to CSV. + required: false + suboptions: + allow_jagged_rows: + description: + - Indicates if BigQuery should accept rows that are missing trailing optional + columns . + required: false + type: bool + allow_quoted_newlines: + description: + - Indicates if BigQuery should allow quoted data sections that contain + newline characters in a CSV file . + required: false + type: bool + encoding: + description: + - The character encoding of the data. + required: false + choices: + - UTF-8 + - ISO-8859-1 + field_delimiter: + description: + - The separator for fields in a CSV file. + required: false + quote: + description: + - The value that is used to quote data sections in a CSV file. + required: false + skip_leading_rows: + description: + - The number of rows at the top of a CSV file that BigQuery will skip + when reading the data. + required: false + default: '0' + bigtable_options: + description: + - Additional options if sourceFormat is set to BIGTABLE. + required: false + suboptions: + ignore_unspecified_column_families: + description: + - If field is true, then the column families that are not specified in + columnFamilies list are not exposed in the table schema . + required: false + type: bool + read_rowkey_as_string: + description: + - If field is true, then the rowkey column families will be read and converted + to string. + required: false + type: bool + column_families: + description: + - List of column families to expose in the table schema along with their + types. + required: false + suboptions: + columns: + description: + - Lists of columns that should be exposed as individual fields as + opposed to a list of (column name, value) pairs. + required: false + suboptions: + encoding: + description: + - The encoding of the values when the type is not STRING. + required: false + choices: + - TEXT + - BINARY + field_name: + description: + - If the qualifier is not a valid BigQuery field identifier, a + valid identifier must be provided as the column field name and + is used as field name in queries. + required: false + only_read_latest: + description: + - If this is set, only the latest version of value in this column + are exposed . + required: false + type: bool + qualifier_string: + description: + - Qualifier of the column. + required: true + type: + description: + - The type to convert the value in cells of this column. + required: false + choices: + - BYTES + - STRING + - INTEGER + - FLOAT + - BOOLEAN + encoding: + description: + - The encoding of the values when the type is not STRING. + required: false + choices: + - TEXT + - BINARY + family_id: + description: + - Identifier of the column family. + required: false + only_read_latest: + description: + - If this is set only the latest version of value are exposed for + all columns in this column family . + required: false + type: bool + type: + description: + - The type to convert the value in cells of this column family. + required: false + choices: + - BYTES + - STRING + - INTEGER + - FLOAT + - BOOLEAN + dataset: + description: + - Name of the dataset. + required: false +extends_documentation_fragment: gcp +''' + +EXAMPLES = ''' +- name: create a dataset + gcp_bigquery_dataset: + name: example_dataset + dataset_reference: + dataset_id: example_dataset + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present + register: dataset + +- name: create a table + gcp_bigquery_table: + name: example_table + dataset: example_dataset + table_reference: + dataset_id: example_dataset + project_id: "test_project" + table_id: example_table + project: "test_project" + auth_kind: "serviceaccount" + service_account_file: "/tmp/auth.pem" + state: present +''' + +RETURN = ''' +tableReference: + description: + - Reference describing the ID of this table. + returned: success + type: complex + contains: + datasetId: + description: + - The ID of the dataset containing this table. + returned: success + type: str + projectId: + description: + - The ID of the project containing this table. + returned: success + type: str + tableId: + description: + - The ID of the the table. + returned: success + type: str +creationTime: + description: + - The time when this dataset was created, in milliseconds since the epoch. + returned: success + type: int +description: + description: + - A user-friendly description of the dataset. + returned: success + type: str +friendlyName: + description: + - A descriptive name for this table. + returned: success + type: str +id: + description: + - An opaque ID uniquely identifying the table. + returned: success + type: str +labels: + description: + - The labels associated with this dataset. You can use these to organize and group + your datasets . + returned: success + type: dict +lastModifiedTime: + description: + - The time when this table was last modified, in milliseconds since the epoch. + returned: success + type: int +location: + description: + - The geographic location where the table resides. This value is inherited from + the dataset. + returned: success + type: str +name: + description: + - Name of the table. + returned: success + type: str +numBytes: + description: + - The size of this table in bytes, excluding any data in the streaming buffer. + returned: success + type: int +numLongTermBytes: + description: + - The number of bytes in the table that are considered "long-term storage". + returned: success + type: int +numRows: + description: + - The number of rows of data in this table, excluding any data in the streaming + buffer. + returned: success + type: int +type: + description: + - Describes the table type. + returned: success + type: str +view: + description: + - The view definition. + returned: success + type: complex + contains: + useLegacySql: + description: + - Specifies whether to use BigQuery's legacy SQL for this view . + returned: success + type: bool + userDefinedFunctionResources: + description: + - Describes user-defined function resources used in the query. + returned: success + type: complex + contains: + inlineCode: + description: + - An inline resource that contains code for a user-defined function (UDF). + Providing a inline code resource is equivalent to providing a URI for + a file containing the same code. + returned: success + type: str + resourceUri: + description: + - A code resource to load from a Google Cloud Storage URI (gs://bucket/path). + returned: success + type: str +timePartitioning: + description: + - If specified, configures time-based partitioning for this table. + returned: success + type: complex + contains: + expirationMs: + description: + - Number of milliseconds for which to keep the storage for a partition. + returned: success + type: int + type: + description: + - The only type supported is DAY, which will generate one partition per day. + returned: success + type: str +streamingBuffer: + description: + - Contains information regarding this table's streaming buffer, if one is present. + This field will be absent if the table is not being streamed to or if there is + no data in the streaming buffer. + returned: success + type: complex + contains: + estimatedBytes: + description: + - A lower-bound estimate of the number of bytes currently in the streaming buffer. + returned: success + type: int + estimatedRows: + description: + - A lower-bound estimate of the number of rows currently in the streaming buffer. + returned: success + type: int + oldestEntryTime: + description: + - Contains the timestamp of the oldest entry in the streaming buffer, in milliseconds + since the epoch, if the streaming buffer is available. + returned: success + type: int +schema: + description: + - Describes the schema of this table. + returned: success + type: complex + contains: + fields: + description: + - Describes the fields in a table. + returned: success + type: complex + contains: + description: + description: + - The field description. The maximum length is 1,024 characters. + returned: success + type: str + fields: + description: + - Describes the nested schema fields if the type property is set to RECORD. + returned: success + type: list + mode: + description: + - The field mode. + returned: success + type: str + name: + description: + - The field name. + returned: success + type: str + type: + description: + - The field data type. + returned: success + type: str +encryptionConfiguration: + description: + - Custom encryption configuration. + returned: success + type: complex + contains: + kmsKeyName: + description: + - Describes the Cloud KMS encryption key that will be used to protect destination + BigQuery table. The BigQuery Service Account associated with your project + requires access to this encryption key. + returned: success + type: str +expirationTime: + description: + - The time when this table expires, in milliseconds since the epoch. If not present, + the table will persist indefinitely. + returned: success + type: int +externalDataConfiguration: + description: + - Describes the data format, location, and other properties of a table stored outside + of BigQuery. By defining these properties, the data source can then be queried + as if it were a standard BigQuery table. + returned: success + type: complex + contains: + autodetect: + description: + - Try to detect schema and format options automatically. Any option specified + explicitly will be honored. + returned: success + type: bool + compression: + description: + - The compression type of the data source. + returned: success + type: str + ignoreUnknownValues: + description: + - Indicates if BigQuery should allow extra values that are not represented in + the table schema . + returned: success + type: bool + maxBadRecords: + description: + - The maximum number of bad records that BigQuery can ignore when reading data + . + returned: success + type: int + sourceFormat: + description: + - The data format. + returned: success + type: str + sourceUris: + description: + - 'The fully-qualified URIs that point to your data in Google Cloud. For Google + Cloud Storage URIs: Each URI can contain one ''*'' wildcard character and + it must come after the ''bucket'' name. Size limits related to load jobs apply + to external data sources. For Google Cloud Bigtable URIs: Exactly one URI + can be specified and it has be a fully specified and valid HTTPS URL for a + Google Cloud Bigtable table. For Google Cloud Datastore backups, exactly one + URI can be specified. Also, the ''*'' wildcard character is not allowed.' + returned: success + type: list + schema: + description: + - The schema for the data. Schema is required for CSV and JSON formats. + returned: success + type: complex + contains: + fields: + description: + - Describes the fields in a table. + returned: success + type: complex + contains: + description: + description: + - The field description. + returned: success + type: str + fields: + description: + - Describes the nested schema fields if the type property is set to + RECORD . + returned: success + type: list + mode: + description: + - Field mode. + returned: success + type: str + name: + description: + - Field name. + returned: success + type: str + type: + description: + - Field data type. + returned: success + type: str + googleSheetsOptions: + description: + - Additional options if sourceFormat is set to GOOGLE_SHEETS. + returned: success + type: complex + contains: + skipLeadingRows: + description: + - The number of rows at the top of a Google Sheet that BigQuery will skip + when reading the data. + returned: success + type: int + csvOptions: + description: + - Additional properties to set if sourceFormat is set to CSV. + returned: success + type: complex + contains: + allowJaggedRows: + description: + - Indicates if BigQuery should accept rows that are missing trailing optional + columns . + returned: success + type: bool + allowQuotedNewlines: + description: + - Indicates if BigQuery should allow quoted data sections that contain newline + characters in a CSV file . + returned: success + type: bool + encoding: + description: + - The character encoding of the data. + returned: success + type: str + fieldDelimiter: + description: + - The separator for fields in a CSV file. + returned: success + type: str + quote: + description: + - The value that is used to quote data sections in a CSV file. + returned: success + type: str + skipLeadingRows: + description: + - The number of rows at the top of a CSV file that BigQuery will skip when + reading the data. + returned: success + type: int + bigtableOptions: + description: + - Additional options if sourceFormat is set to BIGTABLE. + returned: success + type: complex + contains: + ignoreUnspecifiedColumnFamilies: + description: + - If field is true, then the column families that are not specified in columnFamilies + list are not exposed in the table schema . + returned: success + type: bool + readRowkeyAsString: + description: + - If field is true, then the rowkey column families will be read and converted + to string. + returned: success + type: bool + columnFamilies: + description: + - List of column families to expose in the table schema along with their + types. + returned: success + type: complex + contains: + columns: + description: + - Lists of columns that should be exposed as individual fields as opposed + to a list of (column name, value) pairs. + returned: success + type: complex + contains: + encoding: + description: + - The encoding of the values when the type is not STRING. + returned: success + type: str + fieldName: + description: + - If the qualifier is not a valid BigQuery field identifier, a valid + identifier must be provided as the column field name and is used + as field name in queries. + returned: success + type: str + onlyReadLatest: + description: + - If this is set, only the latest version of value in this column + are exposed . + returned: success + type: bool + qualifierString: + description: + - Qualifier of the column. + returned: success + type: str + type: + description: + - The type to convert the value in cells of this column. + returned: success + type: str + encoding: + description: + - The encoding of the values when the type is not STRING. + returned: success + type: str + familyId: + description: + - Identifier of the column family. + returned: success + type: str + onlyReadLatest: + description: + - If this is set only the latest version of value are exposed for all + columns in this column family . + returned: success + type: bool + type: + description: + - The type to convert the value in cells of this column family. + returned: success + type: str +dataset: + description: + - Name of the dataset. + returned: success + type: str +''' + +################################################################################ +# Imports +################################################################################ + +from ansible.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest, remove_nones_from_dict, replace_resource_dict +import json + +################################################################################ +# Main +################################################################################ + + +def main(): + """Main function""" + + module = GcpModule( + argument_spec=dict( + state=dict(default='present', choices=['present', 'absent'], type='str'), + table_reference=dict(type='dict', options=dict( + dataset_id=dict(type='str'), + project_id=dict(type='str'), + table_id=dict(type='str') + )), + description=dict(type='str'), + friendly_name=dict(type='str'), + labels=dict(type='dict'), + name=dict(type='str'), + view=dict(type='dict', options=dict( + use_legacy_sql=dict(type='bool'), + user_defined_function_resources=dict(type='list', elements='dict', options=dict( + inline_code=dict(type='str'), + resource_uri=dict(type='str') + )) + )), + time_partitioning=dict(type='dict', options=dict( + expiration_ms=dict(type='int'), + type=dict(type='str', choices=['DAY']) + )), + schema=dict(type='dict', options=dict( + fields=dict(type='list', elements='dict', options=dict( + description=dict(type='str'), + fields=dict(type='list', elements='str'), + mode=dict(type='str', choices=['NULLABLE', 'REQUIRED', 'REPEATED']), + name=dict(type='str'), + type=dict(type='str', choices=['STRING', 'BYTES', 'INTEGER', 'FLOAT', 'TIMESTAMP', 'DATE', 'TIME', 'DATETIME', 'RECORD']) + )) + )), + encryption_configuration=dict(type='dict', options=dict( + kms_key_name=dict(type='str') + )), + expiration_time=dict(type='int'), + external_data_configuration=dict(type='dict', options=dict( + autodetect=dict(type='bool'), + compression=dict(type='str', choices=['GZIP', 'NONE']), + ignore_unknown_values=dict(type='bool'), + max_bad_records=dict(default=0, type='int'), + source_format=dict(type='str', choices=['CSV', 'GOOGLE_SHEETS', 'NEWLINE_DELIMITED_JSON', 'AVRO', 'DATASTORE_BACKUP', 'BIGTABLE']), + source_uris=dict(type='list', elements='str'), + schema=dict(type='dict', options=dict( + fields=dict(type='list', elements='dict', options=dict( + description=dict(type='str'), + fields=dict(type='list', elements='str'), + mode=dict(type='str', choices=['NULLABLE', 'REQUIRED', 'REPEATED']), + name=dict(type='str'), + type=dict(type='str', choices=['STRING', 'BYTES', 'INTEGER', 'FLOAT', 'TIMESTAMP', 'DATE', 'TIME', 'DATETIME', 'RECORD']) + )) + )), + google_sheets_options=dict(type='dict', options=dict( + skip_leading_rows=dict(default=0, type='int') + )), + csv_options=dict(type='dict', options=dict( + allow_jagged_rows=dict(type='bool'), + allow_quoted_newlines=dict(type='bool'), + encoding=dict(type='str', choices=['UTF-8', 'ISO-8859-1']), + field_delimiter=dict(type='str'), + quote=dict(type='str'), + skip_leading_rows=dict(default=0, type='int') + )), + bigtable_options=dict(type='dict', options=dict( + ignore_unspecified_column_families=dict(type='bool'), + read_rowkey_as_string=dict(type='bool'), + column_families=dict(type='list', elements='dict', options=dict( + columns=dict(type='list', elements='dict', options=dict( + encoding=dict(type='str', choices=['TEXT', 'BINARY']), + field_name=dict(type='str'), + only_read_latest=dict(type='bool'), + qualifier_string=dict(required=True, type='str'), + type=dict(type='str', choices=['BYTES', 'STRING', 'INTEGER', 'FLOAT', 'BOOLEAN']) + )), + encoding=dict(type='str', choices=['TEXT', 'BINARY']), + family_id=dict(type='str'), + only_read_latest=dict(type='bool'), + type=dict(type='str', choices=['BYTES', 'STRING', 'INTEGER', 'FLOAT', 'BOOLEAN']) + )) + )) + )), + dataset=dict(type='str') + ) + ) + + if not module.params['scopes']: + module.params['scopes'] = ['https://www.googleapis.com/auth/bigquery'] + + state = module.params['state'] + kind = 'bigquery#table' + + fetch = fetch_resource(module, self_link(module), kind) + changed = False + + if fetch: + if state == 'present': + if is_different(module, fetch): + update(module, self_link(module), kind) + fetch = fetch_resource(module, self_link(module), kind) + changed = True + else: + delete(module, self_link(module), kind) + fetch = {} + changed = True + else: + if state == 'present': + fetch = create(module, collection(module), kind) + changed = True + else: + fetch = {} + + fetch.update({'changed': changed}) + + module.exit_json(**fetch) + + +def create(module, link, kind): + auth = GcpSession(module, 'bigquery') + return return_if_object(module, auth.post(link, resource_to_request(module)), kind) + + +def update(module, link, kind): + auth = GcpSession(module, 'bigquery') + return return_if_object(module, auth.put(link, resource_to_request(module)), kind) + + +def delete(module, link, kind): + auth = GcpSession(module, 'bigquery') + return return_if_object(module, auth.delete(link), kind) + + +def resource_to_request(module): + request = { + u'kind': 'bigquery#table', + u'tableReference': TableTablereference(module.params.get('table_reference', {}), module).to_request(), + u'description': module.params.get('description'), + u'friendlyName': module.params.get('friendly_name'), + u'labels': module.params.get('labels'), + u'name': module.params.get('name'), + u'view': TableView(module.params.get('view', {}), module).to_request(), + u'timePartitioning': TableTimepartitioning(module.params.get('time_partitioning', {}), module).to_request(), + u'schema': TableSchema(module.params.get('schema', {}), module).to_request(), + u'encryptionConfiguration': TableEncryptionconfiguration(module.params.get('encryption_configuration', {}), module).to_request(), + u'expirationTime': module.params.get('expiration_time'), + u'externalDataConfiguration': TableExternaldataconfiguration(module.params.get('external_data_configuration', {}), module).to_request() + } + return_vals = {} + for k, v in request.items(): + if v or v is False: + return_vals[k] = v + + return return_vals + + +def fetch_resource(module, link, kind, allow_not_found=True): + auth = GcpSession(module, 'bigquery') + return return_if_object(module, auth.get(link), kind, allow_not_found) + + +def self_link(module): + return "https://www.googleapis.com/bigquery/v2/projects/{project}/datasets/{dataset}/tables/{name}".format(**module.params) + + +def collection(module): + return "https://www.googleapis.com/bigquery/v2/projects/{project}/datasets/{dataset}/tables".format(**module.params) + + +def return_if_object(module, response, kind, allow_not_found=False): + # If not found, return nothing. + if allow_not_found and response.status_code == 404: + return None + + # If no content, return nothing. + if response.status_code == 204: + return None + + try: + module.raise_for_status(response) + result = response.json() + except getattr(json.decoder, 'JSONDecodeError', ValueError) as inst: + module.fail_json(msg="Invalid JSON response with error: %s" % inst) + + if navigate_hash(result, ['error', 'errors']): + module.fail_json(msg=navigate_hash(result, ['error', 'errors'])) + + return result + + +def is_different(module, response): + request = resource_to_request(module) + response = response_to_hash(module, response) + + # Remove all output-only from response. + response_vals = {} + for k, v in response.items(): + if k in request: + response_vals[k] = v + + request_vals = {} + for k, v in request.items(): + if k in response: + request_vals[k] = v + + return GcpRequest(request_vals) != GcpRequest(response_vals) + + +# Remove unnecessary properties from the response. +# This is for doing comparisons with Ansible's current parameters. +def response_to_hash(module, response): + return { + u'tableReference': TableTablereference(response.get(u'tableReference', {}), module).from_response(), + u'creationTime': response.get(u'creationTime'), + u'description': response.get(u'description'), + u'friendlyName': response.get(u'friendlyName'), + u'id': response.get(u'id'), + u'labels': response.get(u'labels'), + u'lastModifiedTime': response.get(u'lastModifiedTime'), + u'location': response.get(u'location'), + u'name': response.get(u'name'), + u'numBytes': response.get(u'numBytes'), + u'numLongTermBytes': response.get(u'numLongTermBytes'), + u'numRows': response.get(u'numRows'), + u'type': response.get(u'type'), + u'view': TableView(response.get(u'view', {}), module).from_response(), + u'timePartitioning': TableTimepartitioning(response.get(u'timePartitioning', {}), module).from_response(), + u'streamingBuffer': TableStreamingbuffer(response.get(u'streamingBuffer', {}), module).from_response(), + u'schema': TableSchema(response.get(u'schema', {}), module).from_response(), + u'encryptionConfiguration': TableEncryptionconfiguration(response.get(u'encryptionConfiguration', {}), module).from_response(), + u'expirationTime': response.get(u'expirationTime'), + u'externalDataConfiguration': TableExternaldataconfiguration(response.get(u'externalDataConfiguration', {}), module).from_response() + } + + +class TableTablereference(object): + def __init__(self, request, module): + self.module = module + if request: + self.request = request + else: + self.request = {} + + def to_request(self): + return remove_nones_from_dict({ + u'datasetId': self.request.get('dataset_id'), + u'projectId': self.request.get('project_id'), + u'tableId': self.request.get('table_id') + }) + + def from_response(self): + return remove_nones_from_dict({ + u'datasetId': self.request.get(u'datasetId'), + u'projectId': self.request.get(u'projectId'), + u'tableId': self.request.get(u'tableId') + }) + + +class TableView(object): + def __init__(self, request, module): + self.module = module + if request: + self.request = request + else: + self.request = {} + + def to_request(self): + return remove_nones_from_dict({ + u'useLegacySql': self.request.get('use_legacy_sql'), + u'userDefinedFunctionResources': + TableUserdefinedfunctionresourcesArray(self.request.get('user_defined_function_resources', []), self.module).to_request() + }) + + def from_response(self): + return remove_nones_from_dict({ + u'useLegacySql': self.request.get(u'useLegacySql'), + u'userDefinedFunctionResources': + TableUserdefinedfunctionresourcesArray(self.request.get(u'userDefinedFunctionResources', []), self.module).from_response() + }) + + +class TableUserdefinedfunctionresourcesArray(object): + def __init__(self, request, module): + self.module = module + if request: + self.request = request + else: + self.request = [] + + def to_request(self): + items = [] + for item in self.request: + items.append(self._request_for_item(item)) + return items + + def from_response(self): + items = [] + for item in self.request: + items.append(self._response_from_item(item)) + return items + + def _request_for_item(self, item): + return remove_nones_from_dict({ + u'inlineCode': item.get('inline_code'), + u'resourceUri': item.get('resource_uri') + }) + + def _response_from_item(self, item): + return remove_nones_from_dict({ + u'inlineCode': item.get(u'inlineCode'), + u'resourceUri': item.get(u'resourceUri') + }) + + +class TableTimepartitioning(object): + def __init__(self, request, module): + self.module = module + if request: + self.request = request + else: + self.request = {} + + def to_request(self): + return remove_nones_from_dict({ + u'expirationMs': self.request.get('expiration_ms'), + u'type': self.request.get('type') + }) + + def from_response(self): + return remove_nones_from_dict({ + u'expirationMs': self.request.get(u'expirationMs'), + u'type': self.request.get(u'type') + }) + + +class TableStreamingbuffer(object): + def __init__(self, request, module): + self.module = module + if request: + self.request = request + else: + self.request = {} + + def to_request(self): + return remove_nones_from_dict({ + u'estimatedBytes': self.request.get('estimated_bytes'), + u'estimatedRows': self.request.get('estimated_rows'), + u'oldestEntryTime': self.request.get('oldest_entry_time') + }) + + def from_response(self): + return remove_nones_from_dict({ + u'estimatedBytes': self.request.get(u'estimatedBytes'), + u'estimatedRows': self.request.get(u'estimatedRows'), + u'oldestEntryTime': self.request.get(u'oldestEntryTime') + }) + + +class TableSchema(object): + def __init__(self, request, module): + self.module = module + if request: + self.request = request + else: + self.request = {} + + def to_request(self): + return remove_nones_from_dict({ + u'fields': TableFieldsArray(self.request.get('fields', []), self.module).to_request() + }) + + def from_response(self): + return remove_nones_from_dict({ + u'fields': TableFieldsArray(self.request.get(u'fields', []), self.module).from_response() + }) + + +class TableFieldsArray(object): + def __init__(self, request, module): + self.module = module + if request: + self.request = request + else: + self.request = [] + + def to_request(self): + items = [] + for item in self.request: + items.append(self._request_for_item(item)) + return items + + def from_response(self): + items = [] + for item in self.request: + items.append(self._response_from_item(item)) + return items + + def _request_for_item(self, item): + return remove_nones_from_dict({ + u'description': item.get('description'), + u'fields': item.get('fields'), + u'mode': item.get('mode'), + u'name': item.get('name'), + u'type': item.get('type') + }) + + def _response_from_item(self, item): + return remove_nones_from_dict({ + u'description': item.get(u'description'), + u'fields': item.get(u'fields'), + u'mode': item.get(u'mode'), + u'name': item.get(u'name'), + u'type': item.get(u'type') + }) + + +class TableEncryptionconfiguration(object): + def __init__(self, request, module): + self.module = module + if request: + self.request = request + else: + self.request = {} + + def to_request(self): + return remove_nones_from_dict({ + u'kmsKeyName': self.request.get('kms_key_name') + }) + + def from_response(self): + return remove_nones_from_dict({ + u'kmsKeyName': self.request.get(u'kmsKeyName') + }) + + +class TableExternaldataconfiguration(object): + def __init__(self, request, module): + self.module = module + if request: + self.request = request + else: + self.request = {} + + def to_request(self): + return remove_nones_from_dict({ + u'autodetect': self.request.get('autodetect'), + u'compression': self.request.get('compression'), + u'ignoreUnknownValues': self.request.get('ignore_unknown_values'), + u'maxBadRecords': self.request.get('max_bad_records'), + u'sourceFormat': self.request.get('source_format'), + u'sourceUris': self.request.get('source_uris'), + u'schema': TableSchema(self.request.get('schema', {}), self.module).to_request(), + u'googleSheetsOptions': TableGooglesheetsoptions(self.request.get('google_sheets_options', {}), self.module).to_request(), + u'csvOptions': TableCsvoptions(self.request.get('csv_options', {}), self.module).to_request(), + u'bigtableOptions': TableBigtableoptions(self.request.get('bigtable_options', {}), self.module).to_request() + }) + + def from_response(self): + return remove_nones_from_dict({ + u'autodetect': self.request.get(u'autodetect'), + u'compression': self.request.get(u'compression'), + u'ignoreUnknownValues': self.request.get(u'ignoreUnknownValues'), + u'maxBadRecords': self.request.get(u'maxBadRecords'), + u'sourceFormat': self.request.get(u'sourceFormat'), + u'sourceUris': self.request.get(u'sourceUris'), + u'schema': TableSchema(self.request.get(u'schema', {}), self.module).from_response(), + u'googleSheetsOptions': TableGooglesheetsoptions(self.request.get(u'googleSheetsOptions', {}), self.module).from_response(), + u'csvOptions': TableCsvoptions(self.request.get(u'csvOptions', {}), self.module).from_response(), + u'bigtableOptions': TableBigtableoptions(self.request.get(u'bigtableOptions', {}), self.module).from_response() + }) + + +class TableSchema(object): + def __init__(self, request, module): + self.module = module + if request: + self.request = request + else: + self.request = {} + + def to_request(self): + return remove_nones_from_dict({ + u'fields': TableFieldsArray(self.request.get('fields', []), self.module).to_request() + }) + + def from_response(self): + return remove_nones_from_dict({ + u'fields': TableFieldsArray(self.request.get(u'fields', []), self.module).from_response() + }) + + +class TableFieldsArray(object): + def __init__(self, request, module): + self.module = module + if request: + self.request = request + else: + self.request = [] + + def to_request(self): + items = [] + for item in self.request: + items.append(self._request_for_item(item)) + return items + + def from_response(self): + items = [] + for item in self.request: + items.append(self._response_from_item(item)) + return items + + def _request_for_item(self, item): + return remove_nones_from_dict({ + u'description': item.get('description'), + u'fields': item.get('fields'), + u'mode': item.get('mode'), + u'name': item.get('name'), + u'type': item.get('type') + }) + + def _response_from_item(self, item): + return remove_nones_from_dict({ + u'description': item.get(u'description'), + u'fields': item.get(u'fields'), + u'mode': item.get(u'mode'), + u'name': item.get(u'name'), + u'type': item.get(u'type') + }) + + +class TableGooglesheetsoptions(object): + def __init__(self, request, module): + self.module = module + if request: + self.request = request + else: + self.request = {} + + def to_request(self): + return remove_nones_from_dict({ + u'skipLeadingRows': self.request.get('skip_leading_rows') + }) + + def from_response(self): + return remove_nones_from_dict({ + u'skipLeadingRows': self.request.get(u'skipLeadingRows') + }) + + +class TableCsvoptions(object): + def __init__(self, request, module): + self.module = module + if request: + self.request = request + else: + self.request = {} + + def to_request(self): + return remove_nones_from_dict({ + u'allowJaggedRows': self.request.get('allow_jagged_rows'), + u'allowQuotedNewlines': self.request.get('allow_quoted_newlines'), + u'encoding': self.request.get('encoding'), + u'fieldDelimiter': self.request.get('field_delimiter'), + u'quote': self.request.get('quote'), + u'skipLeadingRows': self.request.get('skip_leading_rows') + }) + + def from_response(self): + return remove_nones_from_dict({ + u'allowJaggedRows': self.request.get(u'allowJaggedRows'), + u'allowQuotedNewlines': self.request.get(u'allowQuotedNewlines'), + u'encoding': self.request.get(u'encoding'), + u'fieldDelimiter': self.request.get(u'fieldDelimiter'), + u'quote': self.request.get(u'quote'), + u'skipLeadingRows': self.request.get(u'skipLeadingRows') + }) + + +class TableBigtableoptions(object): + def __init__(self, request, module): + self.module = module + if request: + self.request = request + else: + self.request = {} + + def to_request(self): + return remove_nones_from_dict({ + u'ignoreUnspecifiedColumnFamilies': self.request.get('ignore_unspecified_column_families'), + u'readRowkeyAsString': self.request.get('read_rowkey_as_string'), + u'columnFamilies': TableColumnfamiliesArray(self.request.get('column_families', []), self.module).to_request() + }) + + def from_response(self): + return remove_nones_from_dict({ + u'ignoreUnspecifiedColumnFamilies': self.request.get(u'ignoreUnspecifiedColumnFamilies'), + u'readRowkeyAsString': self.request.get(u'readRowkeyAsString'), + u'columnFamilies': TableColumnfamiliesArray(self.request.get(u'columnFamilies', []), self.module).from_response() + }) + + +class TableColumnfamiliesArray(object): + def __init__(self, request, module): + self.module = module + if request: + self.request = request + else: + self.request = [] + + def to_request(self): + items = [] + for item in self.request: + items.append(self._request_for_item(item)) + return items + + def from_response(self): + items = [] + for item in self.request: + items.append(self._response_from_item(item)) + return items + + def _request_for_item(self, item): + return remove_nones_from_dict({ + u'columns': TableColumnsArray(item.get('columns', []), self.module).to_request(), + u'encoding': item.get('encoding'), + u'familyId': item.get('family_id'), + u'onlyReadLatest': item.get('only_read_latest'), + u'type': item.get('type') + }) + + def _response_from_item(self, item): + return remove_nones_from_dict({ + u'columns': TableColumnsArray(item.get(u'columns', []), self.module).from_response(), + u'encoding': item.get(u'encoding'), + u'familyId': item.get(u'familyId'), + u'onlyReadLatest': item.get(u'onlyReadLatest'), + u'type': item.get(u'type') + }) + + +class TableColumnsArray(object): + def __init__(self, request, module): + self.module = module + if request: + self.request = request + else: + self.request = [] + + def to_request(self): + items = [] + for item in self.request: + items.append(self._request_for_item(item)) + return items + + def from_response(self): + items = [] + for item in self.request: + items.append(self._response_from_item(item)) + return items + + def _request_for_item(self, item): + return remove_nones_from_dict({ + u'encoding': item.get('encoding'), + u'fieldName': item.get('field_name'), + u'onlyReadLatest': item.get('only_read_latest'), + u'qualifierString': item.get('qualifier_string'), + u'type': item.get('type') + }) + + def _response_from_item(self, item): + return remove_nones_from_dict({ + u'encoding': item.get(u'encoding'), + u'fieldName': item.get(u'fieldName'), + u'onlyReadLatest': item.get(u'onlyReadLatest'), + u'qualifierString': item.get(u'qualifierString'), + u'type': item.get(u'type') + }) + + +if __name__ == '__main__': + main() diff --git a/lib/ansible/modules/cloud/google/gcp_bigquery_table_facts.py b/lib/ansible/modules/cloud/google/gcp_bigquery_table_facts.py new file mode 100644 index 00000000000000..ba495767c6623d --- /dev/null +++ b/lib/ansible/modules/cloud/google/gcp_bigquery_table_facts.py @@ -0,0 +1,568 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# +# Copyright (C) 2017 Google +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) +# ---------------------------------------------------------------------------- +# +# *** AUTO GENERATED CODE *** AUTO GENERATED CODE *** +# +# ---------------------------------------------------------------------------- +# +# This file is automatically generated by Magic Modules and manual +# changes will be clobbered when the file is regenerated. +# +# Please read more about how to change this file at +# https://www.github.com/GoogleCloudPlatform/magic-modules +# +# ---------------------------------------------------------------------------- + +from __future__ import absolute_import, division, print_function +__metaclass__ = type + +################################################################################ +# Documentation +################################################################################ + +ANSIBLE_METADATA = {'metadata_version': '1.1', + 'status': ["preview"], + 'supported_by': 'community'} + +DOCUMENTATION = ''' +--- +module: gcp_bigquery_table_facts +description: +- Gather facts for GCP Table +short_description: Gather facts for GCP Table +version_added: 2.8 +author: Google Inc. (@googlecloudplatform) +requirements: +- python >= 2.6 +- requests >= 2.18.4 +- google-auth >= 1.3.0 +options: + dataset: + description: + - Name of the dataset. + required: false +extends_documentation_fragment: gcp +''' + +EXAMPLES = ''' +- name: a table facts + gcp_bigquery_table_facts: + dataset: example_dataset + project: test_project + auth_kind: serviceaccount + service_account_file: "/tmp/auth.pem" +''' + +RETURN = ''' +items: + description: List of items + returned: always + type: complex + contains: + tableReference: + description: + - Reference describing the ID of this table. + returned: success + type: complex + contains: + datasetId: + description: + - The ID of the dataset containing this table. + returned: success + type: str + projectId: + description: + - The ID of the project containing this table. + returned: success + type: str + tableId: + description: + - The ID of the the table. + returned: success + type: str + creationTime: + description: + - The time when this dataset was created, in milliseconds since the epoch. + returned: success + type: int + description: + description: + - A user-friendly description of the dataset. + returned: success + type: str + friendlyName: + description: + - A descriptive name for this table. + returned: success + type: str + id: + description: + - An opaque ID uniquely identifying the table. + returned: success + type: str + labels: + description: + - The labels associated with this dataset. You can use these to organize and + group your datasets . + returned: success + type: dict + lastModifiedTime: + description: + - The time when this table was last modified, in milliseconds since the epoch. + returned: success + type: int + location: + description: + - The geographic location where the table resides. This value is inherited from + the dataset. + returned: success + type: str + name: + description: + - Name of the table. + returned: success + type: str + numBytes: + description: + - The size of this table in bytes, excluding any data in the streaming buffer. + returned: success + type: int + numLongTermBytes: + description: + - The number of bytes in the table that are considered "long-term storage". + returned: success + type: int + numRows: + description: + - The number of rows of data in this table, excluding any data in the streaming + buffer. + returned: success + type: int + type: + description: + - Describes the table type. + returned: success + type: str + view: + description: + - The view definition. + returned: success + type: complex + contains: + useLegacySql: + description: + - Specifies whether to use BigQuery's legacy SQL for this view . + returned: success + type: bool + userDefinedFunctionResources: + description: + - Describes user-defined function resources used in the query. + returned: success + type: complex + contains: + inlineCode: + description: + - An inline resource that contains code for a user-defined function + (UDF). Providing a inline code resource is equivalent to providing + a URI for a file containing the same code. + returned: success + type: str + resourceUri: + description: + - A code resource to load from a Google Cloud Storage URI (gs://bucket/path). + returned: success + type: str + timePartitioning: + description: + - If specified, configures time-based partitioning for this table. + returned: success + type: complex + contains: + expirationMs: + description: + - Number of milliseconds for which to keep the storage for a partition. + returned: success + type: int + type: + description: + - The only type supported is DAY, which will generate one partition per + day. + returned: success + type: str + streamingBuffer: + description: + - Contains information regarding this table's streaming buffer, if one is present. + This field will be absent if the table is not being streamed to or if there + is no data in the streaming buffer. + returned: success + type: complex + contains: + estimatedBytes: + description: + - A lower-bound estimate of the number of bytes currently in the streaming + buffer. + returned: success + type: int + estimatedRows: + description: + - A lower-bound estimate of the number of rows currently in the streaming + buffer. + returned: success + type: int + oldestEntryTime: + description: + - Contains the timestamp of the oldest entry in the streaming buffer, in + milliseconds since the epoch, if the streaming buffer is available. + returned: success + type: int + schema: + description: + - Describes the schema of this table. + returned: success + type: complex + contains: + fields: + description: + - Describes the fields in a table. + returned: success + type: complex + contains: + description: + description: + - The field description. The maximum length is 1,024 characters. + returned: success + type: str + fields: + description: + - Describes the nested schema fields if the type property is set to + RECORD. + returned: success + type: list + mode: + description: + - The field mode. + returned: success + type: str + name: + description: + - The field name. + returned: success + type: str + type: + description: + - The field data type. + returned: success + type: str + encryptionConfiguration: + description: + - Custom encryption configuration. + returned: success + type: complex + contains: + kmsKeyName: + description: + - Describes the Cloud KMS encryption key that will be used to protect destination + BigQuery table. The BigQuery Service Account associated with your project + requires access to this encryption key. + returned: success + type: str + expirationTime: + description: + - The time when this table expires, in milliseconds since the epoch. If not + present, the table will persist indefinitely. + returned: success + type: int + externalDataConfiguration: + description: + - Describes the data format, location, and other properties of a table stored + outside of BigQuery. By defining these properties, the data source can then + be queried as if it were a standard BigQuery table. + returned: success + type: complex + contains: + autodetect: + description: + - Try to detect schema and format options automatically. Any option specified + explicitly will be honored. + returned: success + type: bool + compression: + description: + - The compression type of the data source. + returned: success + type: str + ignoreUnknownValues: + description: + - Indicates if BigQuery should allow extra values that are not represented + in the table schema . + returned: success + type: bool + maxBadRecords: + description: + - The maximum number of bad records that BigQuery can ignore when reading + data . + returned: success + type: int + sourceFormat: + description: + - The data format. + returned: success + type: str + sourceUris: + description: + - 'The fully-qualified URIs that point to your data in Google Cloud. For + Google Cloud Storage URIs: Each URI can contain one ''*'' wildcard character + and it must come after the ''bucket'' name. Size limits related to load + jobs apply to external data sources. For Google Cloud Bigtable URIs: Exactly + one URI can be specified and it has be a fully specified and valid HTTPS + URL for a Google Cloud Bigtable table. For Google Cloud Datastore backups, + exactly one URI can be specified. Also, the ''*'' wildcard character is + not allowed.' + returned: success + type: list + schema: + description: + - The schema for the data. Schema is required for CSV and JSON formats. + returned: success + type: complex + contains: + fields: + description: + - Describes the fields in a table. + returned: success + type: complex + contains: + description: + description: + - The field description. + returned: success + type: str + fields: + description: + - Describes the nested schema fields if the type property is set + to RECORD . + returned: success + type: list + mode: + description: + - Field mode. + returned: success + type: str + name: + description: + - Field name. + returned: success + type: str + type: + description: + - Field data type. + returned: success + type: str + googleSheetsOptions: + description: + - Additional options if sourceFormat is set to GOOGLE_SHEETS. + returned: success + type: complex + contains: + skipLeadingRows: + description: + - The number of rows at the top of a Google Sheet that BigQuery will + skip when reading the data. + returned: success + type: int + csvOptions: + description: + - Additional properties to set if sourceFormat is set to CSV. + returned: success + type: complex + contains: + allowJaggedRows: + description: + - Indicates if BigQuery should accept rows that are missing trailing + optional columns . + returned: success + type: bool + allowQuotedNewlines: + description: + - Indicates if BigQuery should allow quoted data sections that contain + newline characters in a CSV file . + returned: success + type: bool + encoding: + description: + - The character encoding of the data. + returned: success + type: str + fieldDelimiter: + description: + - The separator for fields in a CSV file. + returned: success + type: str + quote: + description: + - The value that is used to quote data sections in a CSV file. + returned: success + type: str + skipLeadingRows: + description: + - The number of rows at the top of a CSV file that BigQuery will skip + when reading the data. + returned: success + type: int + bigtableOptions: + description: + - Additional options if sourceFormat is set to BIGTABLE. + returned: success + type: complex + contains: + ignoreUnspecifiedColumnFamilies: + description: + - If field is true, then the column families that are not specified + in columnFamilies list are not exposed in the table schema . + returned: success + type: bool + readRowkeyAsString: + description: + - If field is true, then the rowkey column families will be read and + converted to string. + returned: success + type: bool + columnFamilies: + description: + - List of column families to expose in the table schema along with their + types. + returned: success + type: complex + contains: + columns: + description: + - Lists of columns that should be exposed as individual fields as + opposed to a list of (column name, value) pairs. + returned: success + type: complex + contains: + encoding: + description: + - The encoding of the values when the type is not STRING. + returned: success + type: str + fieldName: + description: + - If the qualifier is not a valid BigQuery field identifier, + a valid identifier must be provided as the column field name + and is used as field name in queries. + returned: success + type: str + onlyReadLatest: + description: + - If this is set, only the latest version of value in this column + are exposed . + returned: success + type: bool + qualifierString: + description: + - Qualifier of the column. + returned: success + type: str + type: + description: + - The type to convert the value in cells of this column. + returned: success + type: str + encoding: + description: + - The encoding of the values when the type is not STRING. + returned: success + type: str + familyId: + description: + - Identifier of the column family. + returned: success + type: str + onlyReadLatest: + description: + - If this is set only the latest version of value are exposed for + all columns in this column family . + returned: success + type: bool + type: + description: + - The type to convert the value in cells of this column family. + returned: success + type: str + dataset: + description: + - Name of the dataset. + returned: success + type: str +''' + +################################################################################ +# Imports +################################################################################ +from ansible.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest +import json + +################################################################################ +# Main +################################################################################ + + +def main(): + module = GcpModule( + argument_spec=dict( + dataset=dict(type='str') + ) + ) + + if not module.params['scopes']: + module.params['scopes'] = ['https://www.googleapis.com/auth/bigquery'] + + items = fetch_list(module, collection(module)) + if items.get('tables'): + items = items.get('tables') + else: + items = [] + return_value = { + 'items': items + } + module.exit_json(**return_value) + + +def collection(module): + return "https://www.googleapis.com/bigquery/v2/projects/{project}/datasets/{dataset}/tables".format(**module.params) + + +def fetch_list(module, link): + auth = GcpSession(module, 'bigquery') + response = auth.get(link) + return return_if_object(module, response) + + +def return_if_object(module, response): + # If not found, return nothing. + if response.status_code == 404: + return None + + # If no content, return nothing. + if response.status_code == 204: + return None + + try: + module.raise_for_status(response) + result = response.json() + except getattr(json.decoder, 'JSONDecodeError', ValueError) as inst: + module.fail_json(msg="Invalid JSON response with error: %s" % inst) + + if navigate_hash(result, ['error', 'errors']): + module.fail_json(msg=navigate_hash(result, ['error', 'errors'])) + + return result + + +if __name__ == "__main__": + main() diff --git a/test/integration/targets/gcp_bigquery_dataset/aliases b/test/integration/targets/gcp_bigquery_dataset/aliases new file mode 100644 index 00000000000000..9812f019ca4bae --- /dev/null +++ b/test/integration/targets/gcp_bigquery_dataset/aliases @@ -0,0 +1,2 @@ +cloud/gcp +unsupported diff --git a/test/integration/targets/gcp_bigquery_dataset/defaults/main.yml b/test/integration/targets/gcp_bigquery_dataset/defaults/main.yml new file mode 100644 index 00000000000000..aa87a2a8e0e0e0 --- /dev/null +++ b/test/integration/targets/gcp_bigquery_dataset/defaults/main.yml @@ -0,0 +1,3 @@ +--- +# defaults file +resource_name: '{{resource_prefix}}' diff --git a/test/integration/targets/gcp_bigquery_dataset/meta/main.yml b/test/integration/targets/gcp_bigquery_dataset/meta/main.yml new file mode 100644 index 00000000000000..e69de29bb2d1d6 diff --git a/test/integration/targets/gcp_bigquery_dataset/tasks/main.yml b/test/integration/targets/gcp_bigquery_dataset/tasks/main.yml new file mode 100644 index 00000000000000..db480b71f6ef32 --- /dev/null +++ b/test/integration/targets/gcp_bigquery_dataset/tasks/main.yml @@ -0,0 +1,112 @@ +--- +# ---------------------------------------------------------------------------- +# +# *** AUTO GENERATED CODE *** AUTO GENERATED CODE *** +# +# ---------------------------------------------------------------------------- +# +# This file is automatically generated by Magic Modules and manual +# changes will be clobbered when the file is regenerated. +# +# Please read more about how to change this file at +# https://www.github.com/GoogleCloudPlatform/magic-modules +# +# ---------------------------------------------------------------------------- +# Pre-test setup +- name: delete a dataset + gcp_bigquery_dataset: + name: my_example_dataset + dataset_reference: + dataset_id: my_example_dataset + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent +#---------------------------------------------------------- +- name: create a dataset + gcp_bigquery_dataset: + name: my_example_dataset + dataset_reference: + dataset_id: my_example_dataset + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present + register: result +- name: assert changed is true + assert: + that: + - result.changed == true + - "result.kind == 'bigquery#dataset'" +- name: verify that dataset was created + gcp_bigquery_dataset_facts: + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + scopes: + - https://www.googleapis.com/auth/bigquery + register: results +- name: verify that command succeeded + assert: + that: + - results['items'] | length >= 1 +# ---------------------------------------------------------------------------- +- name: create a dataset that already exists + gcp_bigquery_dataset: + name: my_example_dataset + dataset_reference: + dataset_id: my_example_dataset + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present + register: result +- name: assert changed is false + assert: + that: + - result.changed == false + - "result.kind == 'bigquery#dataset'" +#---------------------------------------------------------- +- name: delete a dataset + gcp_bigquery_dataset: + name: my_example_dataset + dataset_reference: + dataset_id: my_example_dataset + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: result +- name: assert changed is true + assert: + that: + - result.changed == true + - result.has_key('kind') == False +- name: verify that dataset was deleted + gcp_bigquery_dataset_facts: + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + scopes: + - https://www.googleapis.com/auth/bigquery + register: results +- name: verify that command succeeded + assert: + that: + - results['items'] | length == 0 +# ---------------------------------------------------------------------------- +- name: delete a dataset that does not exist + gcp_bigquery_dataset: + name: my_example_dataset + dataset_reference: + dataset_id: my_example_dataset + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: result +- name: assert changed is false + assert: + that: + - result.changed == false + - result.has_key('kind') == False diff --git a/test/integration/targets/gcp_bigquery_table/aliases b/test/integration/targets/gcp_bigquery_table/aliases new file mode 100644 index 00000000000000..9812f019ca4bae --- /dev/null +++ b/test/integration/targets/gcp_bigquery_table/aliases @@ -0,0 +1,2 @@ +cloud/gcp +unsupported diff --git a/test/integration/targets/gcp_bigquery_table/defaults/main.yml b/test/integration/targets/gcp_bigquery_table/defaults/main.yml new file mode 100644 index 00000000000000..aa87a2a8e0e0e0 --- /dev/null +++ b/test/integration/targets/gcp_bigquery_table/defaults/main.yml @@ -0,0 +1,3 @@ +--- +# defaults file +resource_name: '{{resource_prefix}}' diff --git a/test/integration/targets/gcp_bigquery_table/meta/main.yml b/test/integration/targets/gcp_bigquery_table/meta/main.yml new file mode 100644 index 00000000000000..e69de29bb2d1d6 diff --git a/test/integration/targets/gcp_bigquery_table/tasks/main.yml b/test/integration/targets/gcp_bigquery_table/tasks/main.yml new file mode 100644 index 00000000000000..74a139a31ecc3a --- /dev/null +++ b/test/integration/targets/gcp_bigquery_table/tasks/main.yml @@ -0,0 +1,151 @@ +--- +# ---------------------------------------------------------------------------- +# +# *** AUTO GENERATED CODE *** AUTO GENERATED CODE *** +# +# ---------------------------------------------------------------------------- +# +# This file is automatically generated by Magic Modules and manual +# changes will be clobbered when the file is regenerated. +# +# Please read more about how to change this file at +# https://www.github.com/GoogleCloudPlatform/magic-modules +# +# ---------------------------------------------------------------------------- +# Pre-test setup +- name: create a dataset + gcp_bigquery_dataset: + name: example_dataset + dataset_reference: + dataset_id: example_dataset + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present + register: dataset +- name: delete a table + gcp_bigquery_table: + name: example_table + dataset: example_dataset + table_reference: + dataset_id: example_dataset + project_id: "{{ gcp_project }}" + table_id: example_table + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent +#---------------------------------------------------------- +- name: create a table + gcp_bigquery_table: + name: example_table + dataset: example_dataset + table_reference: + dataset_id: example_dataset + project_id: "{{ gcp_project }}" + table_id: example_table + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present + register: result +- name: assert changed is true + assert: + that: + - result.changed == true + - "result.kind == 'bigquery#table'" +- name: verify that table was created + gcp_bigquery_table_facts: + dataset: example_dataset + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + scopes: + - https://www.googleapis.com/auth/bigquery + register: results +- name: verify that command succeeded + assert: + that: + - results['items'] | length >= 1 +# ---------------------------------------------------------------------------- +- name: create a table that already exists + gcp_bigquery_table: + name: example_table + dataset: example_dataset + table_reference: + dataset_id: example_dataset + project_id: "{{ gcp_project }}" + table_id: example_table + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present + register: result +- name: assert changed is false + assert: + that: + - result.changed == false + - "result.kind == 'bigquery#table'" +#---------------------------------------------------------- +- name: delete a table + gcp_bigquery_table: + name: example_table + dataset: example_dataset + table_reference: + dataset_id: example_dataset + project_id: "{{ gcp_project }}" + table_id: example_table + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: result +- name: assert changed is true + assert: + that: + - result.changed == true + - result.has_key('kind') == False +- name: verify that table was deleted + gcp_bigquery_table_facts: + dataset: example_dataset + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + scopes: + - https://www.googleapis.com/auth/bigquery + register: results +- name: verify that command succeeded + assert: + that: + - results['items'] | length == 0 +# ---------------------------------------------------------------------------- +- name: delete a table that does not exist + gcp_bigquery_table: + name: example_table + dataset: example_dataset + table_reference: + dataset_id: example_dataset + project_id: "{{ gcp_project }}" + table_id: example_table + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: result +- name: assert changed is false + assert: + that: + - result.changed == false + - result.has_key('kind') == False +#--------------------------------------------------------- +# Post-test teardown +- name: delete a dataset + gcp_bigquery_dataset: + name: example_dataset + dataset_reference: + dataset_id: example_dataset + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: dataset From 415ad931a81cd5f4af1a1bce473faf55c45f0536 Mon Sep 17 00:00:00 2001 From: The Magician Date: Thu, 6 Dec 2018 15:14:19 -0800 Subject: [PATCH 074/144] Integration test fixes (#142) /cc @rambleraptor --- .../cloud/google/gcp_compute_region_disk.py | 4 +-- .../cloud/google/gcp_compute_vpn_tunnel.py | 10 +++--- .../cloud/google/gcp_pubsub_subscription.py | 2 -- .../modules/cloud/google/gcp_sql_database.py | 2 +- .../modules/cloud/google/gcp_sql_user.py | 2 +- .../gcp_compute_backend_bucket/tasks/main.yml | 2 ++ .../tasks/main.yml | 3 ++ .../tasks/main.yml | 3 ++ .../tasks/main.yml | 7 ++++ .../targets/gcp_compute_image/tasks/main.yml | 2 ++ .../gcp_compute_instance/tasks/main.yml | 4 +++ .../gcp_compute_instance_group/tasks/main.yml | 2 ++ .../tasks/main.yml | 4 +++ .../tasks/main.yml | 3 ++ .../gcp_compute_region_disk/tasks/main.yml | 20 +++++------ .../targets/gcp_compute_route/tasks/main.yml | 2 ++ .../targets/gcp_compute_router/tasks/main.yml | 2 ++ .../gcp_compute_subnetwork/tasks/main.yml | 2 ++ .../tasks/main.yml | 5 +++ .../tasks/main.yml | 6 ++++ .../tasks/main.yml | 5 +++ .../tasks/main.yml | 4 +++ .../tasks/main.yml | 3 ++ .../gcp_compute_url_map/tasks/main.yml | 4 +++ .../gcp_compute_vpn_tunnel/tasks/main.yml | 36 ++++++++++--------- .../gcp_container_cluster/tasks/main.yml | 4 +-- .../gcp_container_node_pool/tasks/main.yml | 6 ++-- .../tasks/main.yml | 2 ++ .../gcp_pubsub_subscription/tasks/main.yml | 16 +++------ .../targets/gcp_pubsub_topic/tasks/main.yml | 4 +-- .../gcp_spanner_database/tasks/main.yml | 6 ++-- .../gcp_spanner_instance/tasks/main.yml | 4 +-- .../targets/gcp_sql_database/tasks/main.yml | 6 ++-- .../targets/gcp_sql_user/tasks/main.yml | 6 ++-- .../tasks/main.yml | 2 ++ 35 files changed, 132 insertions(+), 63 deletions(-) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_region_disk.py b/lib/ansible/modules/cloud/google/gcp_compute_region_disk.py index 900d638e2617c1..4b35852e88fb1c 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_region_disk.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_region_disk.py @@ -165,8 +165,8 @@ raw_key: SGVsbG8gZnJvbSBHb29nbGUgQ2xvdWQgUGxhdGZvcm0= region: us-central1 replica_zones: - - us-central1-a - - us-central1-f + - https://www.googleapis.com/compute/v1/projects/google.com:graphite-playground/zones/us-central1-a + - https://www.googleapis.com/compute/v1/projects/google.com:graphite-playground/zones/us-central1-b project: "test_project" auth_kind: "serviceaccount" service_account_file: "/tmp/auth.pem" diff --git a/lib/ansible/modules/cloud/google/gcp_compute_vpn_tunnel.py b/lib/ansible/modules/cloud/google/gcp_compute_vpn_tunnel.py index 53cf6505ca0787..abd6749be90333 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_vpn_tunnel.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_vpn_tunnel.py @@ -125,7 +125,7 @@ EXAMPLES = ''' - name: create a network gcp_compute_network: - name: "network-vpn_tunnel" + name: "network-vpn-tunnel" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" @@ -134,7 +134,7 @@ - name: create a router gcp_compute_router: - name: "router-vpn_tunnel" + name: "router-vpn-tunnel" network: "{{ network }}" bgp: asn: 64514 @@ -153,7 +153,7 @@ - name: create a target vpn gateway gcp_compute_target_vpn_gateway: - name: "gateway-vpn_tunnel" + name: "gateway-vpn-tunnel" region: us-west1 network: "{{ network }}" project: "{{ gcp_project }}" @@ -162,8 +162,8 @@ state: present register: gateway -- name: create a vpn tunnel - gcp_compute_vpn_tunnel: +- name: create a vpn-tunnel + gcp_compute_vpn-tunnel: name: "test_object" region: us-west1 target_vpn_gateway: "{{ gateway }}" diff --git a/lib/ansible/modules/cloud/google/gcp_pubsub_subscription.py b/lib/ansible/modules/cloud/google/gcp_pubsub_subscription.py index fd9fbd221de2b8..205738a25e1a54 100644 --- a/lib/ansible/modules/cloud/google/gcp_pubsub_subscription.py +++ b/lib/ansible/modules/cloud/google/gcp_pubsub_subscription.py @@ -108,8 +108,6 @@ gcp_pubsub_subscription: name: "test_object" topic: "{{ topic }}" - push_config: - push_endpoint: https://myapp.graphite.cloudnativeapp.com/webhook/sub1 ack_deadline_seconds: 300 project: "test_project" auth_kind: "serviceaccount" diff --git a/lib/ansible/modules/cloud/google/gcp_sql_database.py b/lib/ansible/modules/cloud/google/gcp_sql_database.py index e0d110632cecba..f46435aeaf2223 100644 --- a/lib/ansible/modules/cloud/google/gcp_sql_database.py +++ b/lib/ansible/modules/cloud/google/gcp_sql_database.py @@ -76,7 +76,7 @@ EXAMPLES = ''' - name: create a instance gcp_sql_instance: - name: "instance-database" + name: "{{ resource_name }}" settings: ip_configuration: authorized_networks: diff --git a/lib/ansible/modules/cloud/google/gcp_sql_user.py b/lib/ansible/modules/cloud/google/gcp_sql_user.py index 4e6f2c5c85c82f..8de5a07d571dbe 100644 --- a/lib/ansible/modules/cloud/google/gcp_sql_user.py +++ b/lib/ansible/modules/cloud/google/gcp_sql_user.py @@ -77,7 +77,7 @@ EXAMPLES = ''' - name: create a instance gcp_sql_instance: - name: "instance-user" + name: "{{ resource_name }}" settings: ip_configuration: authorized_networks: diff --git a/test/integration/targets/gcp_compute_backend_bucket/tasks/main.yml b/test/integration/targets/gcp_compute_backend_bucket/tasks/main.yml index a9736e72482264..c7f53425d869d5 100644 --- a/test/integration/targets/gcp_compute_backend_bucket/tasks/main.yml +++ b/test/integration/targets/gcp_compute_backend_bucket/tasks/main.yml @@ -129,6 +129,7 @@ - result.has_key('kind') == False #--------------------------------------------------------- # Post-test teardown +# If errors happen, don't crash the playbook! - name: delete a bucket gcp_storage_bucket: name: "bucket-backendbucket" @@ -137,3 +138,4 @@ service_account_file: "{{ gcp_cred_file }}" state: absent register: bucket + ignore_errors: true diff --git a/test/integration/targets/gcp_compute_backend_service/tasks/main.yml b/test/integration/targets/gcp_compute_backend_service/tasks/main.yml index c424ff3c3b4d48..3c73e067336303 100644 --- a/test/integration/targets/gcp_compute_backend_service/tasks/main.yml +++ b/test/integration/targets/gcp_compute_backend_service/tasks/main.yml @@ -152,6 +152,7 @@ - result.has_key('kind') == False #--------------------------------------------------------- # Post-test teardown +# If errors happen, don't crash the playbook! - name: delete a http health check gcp_compute_http_health_check: name: "httphealthcheck-backendservice" @@ -164,6 +165,7 @@ service_account_file: "{{ gcp_cred_file }}" state: absent register: healthcheck + ignore_errors: true - name: delete a instance group gcp_compute_instance_group: name: "instancegroup-backendservice" @@ -173,3 +175,4 @@ service_account_file: "{{ gcp_cred_file }}" state: absent register: instancegroup + ignore_errors: true diff --git a/test/integration/targets/gcp_compute_forwarding_rule/tasks/main.yml b/test/integration/targets/gcp_compute_forwarding_rule/tasks/main.yml index 865cb3777670f3..a8b9bf36f379fe 100644 --- a/test/integration/targets/gcp_compute_forwarding_rule/tasks/main.yml +++ b/test/integration/targets/gcp_compute_forwarding_rule/tasks/main.yml @@ -151,6 +151,7 @@ - result.has_key('kind') == False #--------------------------------------------------------- # Post-test teardown +# If errors happen, don't crash the playbook! - name: delete a target pool gcp_compute_target_pool: name: "targetpool-forwardingrule" @@ -160,6 +161,7 @@ service_account_file: "{{ gcp_cred_file }}" state: absent register: targetpool + ignore_errors: true - name: delete a address gcp_compute_address: name: "address-forwardingrule" @@ -169,3 +171,4 @@ service_account_file: "{{ gcp_cred_file }}" state: absent register: address + ignore_errors: true diff --git a/test/integration/targets/gcp_compute_global_forwarding_rule/tasks/main.yml b/test/integration/targets/gcp_compute_global_forwarding_rule/tasks/main.yml index aaaf8f35be0729..e0a7c7af1ca083 100644 --- a/test/integration/targets/gcp_compute_global_forwarding_rule/tasks/main.yml +++ b/test/integration/targets/gcp_compute_global_forwarding_rule/tasks/main.yml @@ -186,6 +186,7 @@ - result.has_key('kind') == False #--------------------------------------------------------- # Post-test teardown +# If errors happen, don't crash the playbook! - name: delete a target http proxy gcp_compute_target_http_proxy: name: "targethttpproxy-globalforwardingrule" @@ -195,6 +196,7 @@ service_account_file: "{{ gcp_cred_file }}" state: absent register: httpproxy + ignore_errors: true - name: delete a url map gcp_compute_url_map: name: "urlmap-globalforwardingrule" @@ -204,6 +206,7 @@ service_account_file: "{{ gcp_cred_file }}" state: absent register: urlmap + ignore_errors: true - name: delete a backend service gcp_compute_backend_service: name: "backendservice-globalforwardingrule" @@ -217,6 +220,7 @@ service_account_file: "{{ gcp_cred_file }}" state: absent register: backendservice + ignore_errors: true - name: delete a http health check gcp_compute_http_health_check: name: "httphealthcheck-globalforwardingrule" @@ -229,6 +233,7 @@ service_account_file: "{{ gcp_cred_file }}" state: absent register: healthcheck + ignore_errors: true - name: delete a instance group gcp_compute_instance_group: name: "instancegroup-globalforwardingrule" @@ -238,6 +243,7 @@ service_account_file: "{{ gcp_cred_file }}" state: absent register: instancegroup + ignore_errors: true - name: delete a global address gcp_compute_global_address: name: "globaladdress-globalforwardingrule" @@ -246,3 +252,4 @@ service_account_file: "{{ gcp_cred_file }}" state: absent register: globaladdress + ignore_errors: true diff --git a/test/integration/targets/gcp_compute_image/tasks/main.yml b/test/integration/targets/gcp_compute_image/tasks/main.yml index 924ef0f63539ee..67dad40c4dd0cc 100644 --- a/test/integration/targets/gcp_compute_image/tasks/main.yml +++ b/test/integration/targets/gcp_compute_image/tasks/main.yml @@ -120,6 +120,7 @@ - result.has_key('kind') == False #--------------------------------------------------------- # Post-test teardown +# If errors happen, don't crash the playbook! - name: delete a disk gcp_compute_disk: name: "disk-image" @@ -129,3 +130,4 @@ service_account_file: "{{ gcp_cred_file }}" state: absent register: disk + ignore_errors: true diff --git a/test/integration/targets/gcp_compute_instance/tasks/main.yml b/test/integration/targets/gcp_compute_instance/tasks/main.yml index 867ea258ed8060..5bb5db8b869707 100644 --- a/test/integration/targets/gcp_compute_instance/tasks/main.yml +++ b/test/integration/targets/gcp_compute_instance/tasks/main.yml @@ -211,6 +211,7 @@ - result.has_key('kind') == False #--------------------------------------------------------- # Post-test teardown +# If errors happen, don't crash the playbook! - name: delete a address gcp_compute_address: name: "address-instance" @@ -220,6 +221,7 @@ service_account_file: "{{ gcp_cred_file }}" state: absent register: address + ignore_errors: true - name: delete a network gcp_compute_network: name: "network-instance" @@ -228,6 +230,7 @@ service_account_file: "{{ gcp_cred_file }}" state: absent register: network + ignore_errors: true - name: delete a disk gcp_compute_disk: name: "disk-instance" @@ -239,3 +242,4 @@ service_account_file: "{{ gcp_cred_file }}" state: absent register: disk + ignore_errors: true diff --git a/test/integration/targets/gcp_compute_instance_group/tasks/main.yml b/test/integration/targets/gcp_compute_instance_group/tasks/main.yml index 32c7d237dca7e4..1857ec323fb13a 100644 --- a/test/integration/targets/gcp_compute_instance_group/tasks/main.yml +++ b/test/integration/targets/gcp_compute_instance_group/tasks/main.yml @@ -141,6 +141,7 @@ - result.has_key('kind') == False #--------------------------------------------------------- # Post-test teardown +# If errors happen, don't crash the playbook! - name: delete a network gcp_compute_network: name: "network-instancegroup" @@ -149,3 +150,4 @@ service_account_file: "{{ gcp_cred_file }}" state: absent register: network + ignore_errors: true diff --git a/test/integration/targets/gcp_compute_instance_group_manager/tasks/main.yml b/test/integration/targets/gcp_compute_instance_group_manager/tasks/main.yml index 963475649767c6..54b3cd887bf369 100644 --- a/test/integration/targets/gcp_compute_instance_group_manager/tasks/main.yml +++ b/test/integration/targets/gcp_compute_instance_group_manager/tasks/main.yml @@ -166,6 +166,7 @@ - result.has_key('kind') == False #--------------------------------------------------------- # Post-test teardown +# If errors happen, don't crash the playbook! - name: delete a instance template gcp_compute_instance_template: name: "{{ resource_name }}" @@ -187,6 +188,7 @@ service_account_file: "{{ gcp_cred_file }}" state: absent register: instancetemplate + ignore_errors: true - name: delete a address gcp_compute_address: name: "address-instancetemplate" @@ -196,6 +198,7 @@ service_account_file: "{{ gcp_cred_file }}" state: absent register: address + ignore_errors: true - name: delete a network gcp_compute_network: name: "network-instancetemplate" @@ -204,3 +207,4 @@ service_account_file: "{{ gcp_cred_file }}" state: absent register: network + ignore_errors: true diff --git a/test/integration/targets/gcp_compute_instance_template/tasks/main.yml b/test/integration/targets/gcp_compute_instance_template/tasks/main.yml index b20603bdb11820..4873fc30d73684 100644 --- a/test/integration/targets/gcp_compute_instance_template/tasks/main.yml +++ b/test/integration/targets/gcp_compute_instance_template/tasks/main.yml @@ -188,6 +188,7 @@ - result.has_key('kind') == False #--------------------------------------------------------- # Post-test teardown +# If errors happen, don't crash the playbook! - name: delete a address gcp_compute_address: name: "address-instancetemplate" @@ -197,6 +198,7 @@ service_account_file: "{{ gcp_cred_file }}" state: absent register: address + ignore_errors: true - name: delete a network gcp_compute_network: name: "network-instancetemplate" @@ -205,3 +207,4 @@ service_account_file: "{{ gcp_cred_file }}" state: absent register: network + ignore_errors: true diff --git a/test/integration/targets/gcp_compute_region_disk/tasks/main.yml b/test/integration/targets/gcp_compute_region_disk/tasks/main.yml index 9e850c3a717468..c20b77d5215eef 100644 --- a/test/integration/targets/gcp_compute_region_disk/tasks/main.yml +++ b/test/integration/targets/gcp_compute_region_disk/tasks/main.yml @@ -21,8 +21,8 @@ raw_key: SGVsbG8gZnJvbSBHb29nbGUgQ2xvdWQgUGxhdGZvcm0= region: us-central1 replica_zones: - - us-central1-a - - us-central1-f + - https://www.googleapis.com/compute/v1/projects/google.com:graphite-playground/zones/us-central1-a + - https://www.googleapis.com/compute/v1/projects/google.com:graphite-playground/zones/us-central1-b project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" @@ -36,8 +36,8 @@ raw_key: SGVsbG8gZnJvbSBHb29nbGUgQ2xvdWQgUGxhdGZvcm0= region: us-central1 replica_zones: - - us-central1-a - - us-central1-f + - https://www.googleapis.com/compute/v1/projects/google.com:graphite-playground/zones/us-central1-a + - https://www.googleapis.com/compute/v1/projects/google.com:graphite-playground/zones/us-central1-b project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" @@ -72,8 +72,8 @@ raw_key: SGVsbG8gZnJvbSBHb29nbGUgQ2xvdWQgUGxhdGZvcm0= region: us-central1 replica_zones: - - us-central1-a - - us-central1-f + - https://www.googleapis.com/compute/v1/projects/google.com:graphite-playground/zones/us-central1-a + - https://www.googleapis.com/compute/v1/projects/google.com:graphite-playground/zones/us-central1-b project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" @@ -93,8 +93,8 @@ raw_key: SGVsbG8gZnJvbSBHb29nbGUgQ2xvdWQgUGxhdGZvcm0= region: us-central1 replica_zones: - - us-central1-a - - us-central1-f + - https://www.googleapis.com/compute/v1/projects/google.com:graphite-playground/zones/us-central1-a + - https://www.googleapis.com/compute/v1/projects/google.com:graphite-playground/zones/us-central1-b project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" @@ -129,8 +129,8 @@ raw_key: SGVsbG8gZnJvbSBHb29nbGUgQ2xvdWQgUGxhdGZvcm0= region: us-central1 replica_zones: - - us-central1-a - - us-central1-f + - https://www.googleapis.com/compute/v1/projects/google.com:graphite-playground/zones/us-central1-a + - https://www.googleapis.com/compute/v1/projects/google.com:graphite-playground/zones/us-central1-b project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" diff --git a/test/integration/targets/gcp_compute_route/tasks/main.yml b/test/integration/targets/gcp_compute_route/tasks/main.yml index 2004ecc7b47cd0..70cf6e7b173e24 100644 --- a/test/integration/targets/gcp_compute_route/tasks/main.yml +++ b/test/integration/targets/gcp_compute_route/tasks/main.yml @@ -144,6 +144,7 @@ - result.has_key('kind') == False #--------------------------------------------------------- # Post-test teardown +# If errors happen, don't crash the playbook! - name: delete a network gcp_compute_network: name: "network-route" @@ -152,3 +153,4 @@ service_account_file: "{{ gcp_cred_file }}" state: absent register: network + ignore_errors: true diff --git a/test/integration/targets/gcp_compute_router/tasks/main.yml b/test/integration/targets/gcp_compute_router/tasks/main.yml index ee60d6a543d822..bad78bd73fe75e 100644 --- a/test/integration/targets/gcp_compute_router/tasks/main.yml +++ b/test/integration/targets/gcp_compute_router/tasks/main.yml @@ -166,6 +166,7 @@ - result.has_key('kind') == False #--------------------------------------------------------- # Post-test teardown +# If errors happen, don't crash the playbook! - name: delete a network gcp_compute_network: name: "network-router" @@ -174,3 +175,4 @@ service_account_file: "{{ gcp_cred_file }}" state: absent register: network + ignore_errors: true diff --git a/test/integration/targets/gcp_compute_subnetwork/tasks/main.yml b/test/integration/targets/gcp_compute_subnetwork/tasks/main.yml index 69da3920d8e48d..6c0eeb5dbb3b2a 100644 --- a/test/integration/targets/gcp_compute_subnetwork/tasks/main.yml +++ b/test/integration/targets/gcp_compute_subnetwork/tasks/main.yml @@ -132,6 +132,7 @@ - result.has_key('kind') == False #--------------------------------------------------------- # Post-test teardown +# If errors happen, don't crash the playbook! - name: delete a network gcp_compute_network: name: "network-subnetwork" @@ -141,3 +142,4 @@ service_account_file: "{{ gcp_cred_file }}" state: absent register: network + ignore_errors: true diff --git a/test/integration/targets/gcp_compute_target_http_proxy/tasks/main.yml b/test/integration/targets/gcp_compute_target_http_proxy/tasks/main.yml index cfd7217a465d86..cee3802ba29241 100644 --- a/test/integration/targets/gcp_compute_target_http_proxy/tasks/main.yml +++ b/test/integration/targets/gcp_compute_target_http_proxy/tasks/main.yml @@ -154,6 +154,7 @@ - result.has_key('kind') == False #--------------------------------------------------------- # Post-test teardown +# If errors happen, don't crash the playbook! - name: delete a url map gcp_compute_url_map: name: "urlmap-targethttpproxy" @@ -163,6 +164,7 @@ service_account_file: "{{ gcp_cred_file }}" state: absent register: urlmap + ignore_errors: true - name: delete a backend service gcp_compute_backend_service: name: "backendservice-targethttpproxy" @@ -176,6 +178,7 @@ service_account_file: "{{ gcp_cred_file }}" state: absent register: backendservice + ignore_errors: true - name: delete a http health check gcp_compute_http_health_check: name: "httphealthcheck-targethttpproxy" @@ -188,6 +191,7 @@ service_account_file: "{{ gcp_cred_file }}" state: absent register: healthcheck + ignore_errors: true - name: delete a instance group gcp_compute_instance_group: name: "instancegroup-targethttpproxy" @@ -197,3 +201,4 @@ service_account_file: "{{ gcp_cred_file }}" state: absent register: instancegroup + ignore_errors: true diff --git a/test/integration/targets/gcp_compute_target_https_proxy/tasks/main.yml b/test/integration/targets/gcp_compute_target_https_proxy/tasks/main.yml index f8d18634fbde9c..7a50dc4304c061 100644 --- a/test/integration/targets/gcp_compute_target_https_proxy/tasks/main.yml +++ b/test/integration/targets/gcp_compute_target_https_proxy/tasks/main.yml @@ -197,6 +197,7 @@ - result.has_key('kind') == False #--------------------------------------------------------- # Post-test teardown +# If errors happen, don't crash the playbook! - name: delete a ssl certificate gcp_compute_ssl_certificate: name: "sslcert-targethttpsproxy" @@ -230,6 +231,7 @@ service_account_file: "{{ gcp_cred_file }}" state: absent register: sslcert + ignore_errors: true - name: delete a url map gcp_compute_url_map: name: "urlmap-targethttpsproxy" @@ -239,6 +241,7 @@ service_account_file: "{{ gcp_cred_file }}" state: absent register: urlmap + ignore_errors: true - name: delete a backend service gcp_compute_backend_service: name: "backendservice-targethttpsproxy" @@ -252,6 +255,7 @@ service_account_file: "{{ gcp_cred_file }}" state: absent register: backendservice + ignore_errors: true - name: delete a http health check gcp_compute_http_health_check: name: "httphealthcheck-targethttpsproxy" @@ -264,6 +268,7 @@ service_account_file: "{{ gcp_cred_file }}" state: absent register: healthcheck + ignore_errors: true - name: delete a instance group gcp_compute_instance_group: name: "instancegroup-targethttpsproxy" @@ -273,3 +278,4 @@ service_account_file: "{{ gcp_cred_file }}" state: absent register: instancegroup + ignore_errors: true diff --git a/test/integration/targets/gcp_compute_target_ssl_proxy/tasks/main.yml b/test/integration/targets/gcp_compute_target_ssl_proxy/tasks/main.yml index 2b9f24154f5b9c..f2b14904a20b66 100644 --- a/test/integration/targets/gcp_compute_target_ssl_proxy/tasks/main.yml +++ b/test/integration/targets/gcp_compute_target_ssl_proxy/tasks/main.yml @@ -192,6 +192,7 @@ - result.has_key('kind') == False #--------------------------------------------------------- # Post-test teardown +# If errors happen, don't crash the playbook! - name: delete a ssl certificate gcp_compute_ssl_certificate: name: "sslcert-targetsslproxy" @@ -225,6 +226,7 @@ service_account_file: "{{ gcp_cred_file }}" state: absent register: sslcert + ignore_errors: true - name: delete a backend service gcp_compute_backend_service: name: "backendservice-targetsslproxy" @@ -238,6 +240,7 @@ service_account_file: "{{ gcp_cred_file }}" state: absent register: backendservice + ignore_errors: true - name: delete a health check gcp_compute_health_check: name: "healthcheck-targetsslproxy" @@ -254,6 +257,7 @@ service_account_file: "{{ gcp_cred_file }}" state: absent register: healthcheck + ignore_errors: true - name: delete a instance group gcp_compute_instance_group: name: "instancegroup-targetsslproxy" @@ -263,3 +267,4 @@ service_account_file: "{{ gcp_cred_file }}" state: absent register: instancegroup + ignore_errors: true diff --git a/test/integration/targets/gcp_compute_target_tcp_proxy/tasks/main.yml b/test/integration/targets/gcp_compute_target_tcp_proxy/tasks/main.yml index 1a552a262dc84c..e057e090a70dac 100644 --- a/test/integration/targets/gcp_compute_target_tcp_proxy/tasks/main.yml +++ b/test/integration/targets/gcp_compute_target_tcp_proxy/tasks/main.yml @@ -154,6 +154,7 @@ - result.has_key('kind') == False #--------------------------------------------------------- # Post-test teardown +# If errors happen, don't crash the playbook! - name: delete a backend service gcp_compute_backend_service: name: "backendservice-targettcpproxy" @@ -167,6 +168,7 @@ service_account_file: "{{ gcp_cred_file }}" state: absent register: backendservice + ignore_errors: true - name: delete a health check gcp_compute_health_check: name: "healthcheck-targettcpproxy" @@ -183,6 +185,7 @@ service_account_file: "{{ gcp_cred_file }}" state: absent register: healthcheck + ignore_errors: true - name: delete a instance group gcp_compute_instance_group: name: "instancegroup-targettcpproxy" @@ -192,3 +195,4 @@ service_account_file: "{{ gcp_cred_file }}" state: absent register: instancegroup + ignore_errors: true diff --git a/test/integration/targets/gcp_compute_target_vpn_gateway/tasks/main.yml b/test/integration/targets/gcp_compute_target_vpn_gateway/tasks/main.yml index c97e3fe1f59303..ed7d69449f4ccb 100644 --- a/test/integration/targets/gcp_compute_target_vpn_gateway/tasks/main.yml +++ b/test/integration/targets/gcp_compute_target_vpn_gateway/tasks/main.yml @@ -135,6 +135,7 @@ - result.has_key('kind') == False #--------------------------------------------------------- # Post-test teardown +# If errors happen, don't crash the playbook! - name: delete a network gcp_compute_network: name: "network-vpngateway" @@ -143,6 +144,7 @@ service_account_file: "{{ gcp_cred_file }}" state: absent register: network + ignore_errors: true - name: delete a address gcp_compute_address: name: "address-vpngateway" @@ -152,3 +154,4 @@ service_account_file: "{{ gcp_cred_file }}" state: absent register: address + ignore_errors: true diff --git a/test/integration/targets/gcp_compute_url_map/tasks/main.yml b/test/integration/targets/gcp_compute_url_map/tasks/main.yml index 3931d7cbec824b..6e4a16f5fcae76 100644 --- a/test/integration/targets/gcp_compute_url_map/tasks/main.yml +++ b/test/integration/targets/gcp_compute_url_map/tasks/main.yml @@ -145,6 +145,7 @@ - result.has_key('kind') == False #--------------------------------------------------------- # Post-test teardown +# If errors happen, don't crash the playbook! - name: delete a backend service gcp_compute_backend_service: name: "backendservice-urlmap" @@ -158,6 +159,7 @@ service_account_file: "{{ gcp_cred_file }}" state: absent register: backendservice + ignore_errors: true - name: delete a http health check gcp_compute_http_health_check: name: "httphealthcheck-urlmap" @@ -170,6 +172,7 @@ service_account_file: "{{ gcp_cred_file }}" state: absent register: healthcheck + ignore_errors: true - name: delete a instance group gcp_compute_instance_group: name: "instancegroup-urlmap" @@ -179,3 +182,4 @@ service_account_file: "{{ gcp_cred_file }}" state: absent register: instancegroup + ignore_errors: true diff --git a/test/integration/targets/gcp_compute_vpn_tunnel/tasks/main.yml b/test/integration/targets/gcp_compute_vpn_tunnel/tasks/main.yml index ca5db7e2fa1522..a46191a7246ffb 100644 --- a/test/integration/targets/gcp_compute_vpn_tunnel/tasks/main.yml +++ b/test/integration/targets/gcp_compute_vpn_tunnel/tasks/main.yml @@ -15,7 +15,7 @@ # Pre-test setup - name: create a network gcp_compute_network: - name: "network-vpn_tunnel" + name: "network-vpn-tunnel" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" @@ -23,7 +23,7 @@ register: network - name: create a router gcp_compute_router: - name: "router-vpn_tunnel" + name: "router-vpn-tunnel" network: "{{ network }}" bgp: asn: 64514 @@ -41,7 +41,7 @@ register: router - name: create a target vpn gateway gcp_compute_target_vpn_gateway: - name: "gateway-vpn_tunnel" + name: "gateway-vpn-tunnel" region: us-west1 network: "{{ network }}" project: "{{ gcp_project }}" @@ -49,8 +49,8 @@ service_account_file: "{{ gcp_cred_file }}" state: present register: gateway -- name: delete a vpn tunnel - gcp_compute_vpn_tunnel: +- name: delete a vpn-tunnel + gcp_compute_vpn-tunnel: name: "{{ resource_name }}" region: us-west1 target_vpn_gateway: "{{ gateway }}" @@ -61,8 +61,8 @@ service_account_file: "{{ gcp_cred_file }}" state: absent #---------------------------------------------------------- -- name: create a vpn tunnel - gcp_compute_vpn_tunnel: +- name: create a vpn-tunnel + gcp_compute_vpn-tunnel: name: "{{ resource_name }}" region: us-west1 target_vpn_gateway: "{{ gateway }}" @@ -94,8 +94,8 @@ that: - results['items'] | length == 1 # ---------------------------------------------------------------------------- -- name: create a vpn tunnel that already exists - gcp_compute_vpn_tunnel: +- name: create a vpn-tunnel that already exists + gcp_compute_vpn-tunnel: name: "{{ resource_name }}" region: us-west1 target_vpn_gateway: "{{ gateway }}" @@ -112,8 +112,8 @@ - result.changed == false - "result.kind == 'compute#vpnTunnel'" #---------------------------------------------------------- -- name: delete a vpn tunnel - gcp_compute_vpn_tunnel: +- name: delete a vpn-tunnel + gcp_compute_vpn-tunnel: name: "{{ resource_name }}" region: us-west1 target_vpn_gateway: "{{ gateway }}" @@ -145,8 +145,8 @@ that: - results['items'] | length == 0 # ---------------------------------------------------------------------------- -- name: delete a vpn tunnel that does not exist - gcp_compute_vpn_tunnel: +- name: delete a vpn-tunnel that does not exist + gcp_compute_vpn-tunnel: name: "{{ resource_name }}" region: us-west1 target_vpn_gateway: "{{ gateway }}" @@ -164,9 +164,10 @@ - result.has_key('kind') == False #--------------------------------------------------------- # Post-test teardown +# If errors happen, don't crash the playbook! - name: delete a target vpn gateway gcp_compute_target_vpn_gateway: - name: "gateway-vpn_tunnel" + name: "gateway-vpn-tunnel" region: us-west1 network: "{{ network }}" project: "{{ gcp_project }}" @@ -174,9 +175,10 @@ service_account_file: "{{ gcp_cred_file }}" state: absent register: gateway + ignore_errors: true - name: delete a router gcp_compute_router: - name: "router-vpn_tunnel" + name: "router-vpn-tunnel" network: "{{ network }}" bgp: asn: 64514 @@ -192,11 +194,13 @@ service_account_file: "{{ gcp_cred_file }}" state: absent register: router + ignore_errors: true - name: delete a network gcp_compute_network: - name: "network-vpn_tunnel" + name: "network-vpn-tunnel" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" state: absent register: network + ignore_errors: true diff --git a/test/integration/targets/gcp_container_cluster/tasks/main.yml b/test/integration/targets/gcp_container_cluster/tasks/main.yml index fa0e74690b11d2..21ab8225612f29 100644 --- a/test/integration/targets/gcp_container_cluster/tasks/main.yml +++ b/test/integration/targets/gcp_container_cluster/tasks/main.yml @@ -61,7 +61,7 @@ - name: verify that command succeeded assert: that: - - results['items'] | length >= 1 + - "'my-cluster' in \"{{ results['items'] | map(attribute='name') | list }}\"" # ---------------------------------------------------------------------------- - name: create a cluster that already exists gcp_container_cluster: @@ -116,7 +116,7 @@ - name: verify that command succeeded assert: that: - - results['items'] | length == 0 + - "'my-cluster' not in \"{{ results['items'] | map(attribute='name') | list }}\"" # ---------------------------------------------------------------------------- - name: delete a cluster that does not exist gcp_container_cluster: diff --git a/test/integration/targets/gcp_container_node_pool/tasks/main.yml b/test/integration/targets/gcp_container_node_pool/tasks/main.yml index a151085d9f6a98..9047ac40f644dd 100644 --- a/test/integration/targets/gcp_container_node_pool/tasks/main.yml +++ b/test/integration/targets/gcp_container_node_pool/tasks/main.yml @@ -62,7 +62,7 @@ - name: verify that command succeeded assert: that: - - results['items'] | length >= 1 + - "'my-pool' in \"{{ results['items'] | map(attribute='name') | list }}\"" # ---------------------------------------------------------------------------- - name: create a node pool that already exists gcp_container_node_pool: @@ -108,7 +108,7 @@ - name: verify that command succeeded assert: that: - - results['items'] | length == 0 + - "'my-pool' not in \"{{ results['items'] | map(attribute='name') | list }}\"" # ---------------------------------------------------------------------------- - name: delete a node pool that does not exist gcp_container_node_pool: @@ -127,6 +127,7 @@ - result.changed == false #--------------------------------------------------------- # Post-test teardown +# If errors happen, don't crash the playbook! - name: delete a cluster gcp_container_cluster: name: "cluster-nodepool" @@ -137,3 +138,4 @@ service_account_file: "{{ gcp_cred_file }}" state: absent register: cluster + ignore_errors: true diff --git a/test/integration/targets/gcp_dns_resource_record_set/tasks/main.yml b/test/integration/targets/gcp_dns_resource_record_set/tasks/main.yml index 5fd5876a0bd2f7..a0a63d0bf64cbd 100644 --- a/test/integration/targets/gcp_dns_resource_record_set/tasks/main.yml +++ b/test/integration/targets/gcp_dns_resource_record_set/tasks/main.yml @@ -144,6 +144,7 @@ - result.has_key('kind') == False #--------------------------------------------------------- # Post-test teardown +# If errors happen, don't crash the playbook! - name: delete a managed zone gcp_dns_managed_zone: name: "managedzone-rrs" @@ -154,3 +155,4 @@ service_account_file: "{{ gcp_cred_file }}" state: absent register: managed_zone + ignore_errors: true diff --git a/test/integration/targets/gcp_pubsub_subscription/tasks/main.yml b/test/integration/targets/gcp_pubsub_subscription/tasks/main.yml index 4c7fb9024be380..2b6607b12b7129 100644 --- a/test/integration/targets/gcp_pubsub_subscription/tasks/main.yml +++ b/test/integration/targets/gcp_pubsub_subscription/tasks/main.yml @@ -25,8 +25,6 @@ gcp_pubsub_subscription: name: "{{ resource_name }}" topic: "{{ topic }}" - push_config: - push_endpoint: https://myapp.graphite.cloudnativeapp.com/webhook/sub1 ack_deadline_seconds: 300 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" @@ -37,8 +35,6 @@ gcp_pubsub_subscription: name: "{{ resource_name }}" topic: "{{ topic }}" - push_config: - push_endpoint: https://myapp.graphite.cloudnativeapp.com/webhook/sub1 ack_deadline_seconds: 300 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" @@ -60,14 +56,12 @@ - name: verify that command succeeded assert: that: - - results['items'] | length >= 1 + - "\"{{resource_name}}\" in \"{{ results['items'] | map(attribute='name') | list }}\"" # ---------------------------------------------------------------------------- - name: create a subscription that already exists gcp_pubsub_subscription: name: "{{ resource_name }}" topic: "{{ topic }}" - push_config: - push_endpoint: https://myapp.graphite.cloudnativeapp.com/webhook/sub1 ack_deadline_seconds: 300 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" @@ -83,8 +77,6 @@ gcp_pubsub_subscription: name: "{{ resource_name }}" topic: "{{ topic }}" - push_config: - push_endpoint: https://myapp.graphite.cloudnativeapp.com/webhook/sub1 ack_deadline_seconds: 300 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" @@ -106,14 +98,12 @@ - name: verify that command succeeded assert: that: - - results['items'] | length == 0 + - "\"{{resource_name}}\" not in \"{{ results['items'] | map(attribute='name') | list }}\"" # ---------------------------------------------------------------------------- - name: delete a subscription that does not exist gcp_pubsub_subscription: name: "{{ resource_name }}" topic: "{{ topic }}" - push_config: - push_endpoint: https://myapp.graphite.cloudnativeapp.com/webhook/sub1 ack_deadline_seconds: 300 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" @@ -126,6 +116,7 @@ - result.changed == false #--------------------------------------------------------- # Post-test teardown +# If errors happen, don't crash the playbook! - name: delete a topic gcp_pubsub_topic: name: "topic-subscription" @@ -134,3 +125,4 @@ service_account_file: "{{ gcp_cred_file }}" state: absent register: topic + ignore_errors: true diff --git a/test/integration/targets/gcp_pubsub_topic/tasks/main.yml b/test/integration/targets/gcp_pubsub_topic/tasks/main.yml index 32b4bd9229a650..c26ecfbf96235a 100644 --- a/test/integration/targets/gcp_pubsub_topic/tasks/main.yml +++ b/test/integration/targets/gcp_pubsub_topic/tasks/main.yml @@ -44,7 +44,7 @@ - name: verify that command succeeded assert: that: - - results['items'] | length >= 1 + - "'test-topic1' in \"{{ results['items'] | map(attribute='name') | list }}\"" # ---------------------------------------------------------------------------- - name: create a topic that already exists gcp_pubsub_topic: @@ -82,7 +82,7 @@ - name: verify that command succeeded assert: that: - - results['items'] | length == 0 + - "'test-topic1' not in \"{{ results['items'] | map(attribute='name') | list }}\"" # ---------------------------------------------------------------------------- - name: delete a topic that does not exist gcp_pubsub_topic: diff --git a/test/integration/targets/gcp_spanner_database/tasks/main.yml b/test/integration/targets/gcp_spanner_database/tasks/main.yml index 92b28b7cd4b074..cc4b251db9383e 100644 --- a/test/integration/targets/gcp_spanner_database/tasks/main.yml +++ b/test/integration/targets/gcp_spanner_database/tasks/main.yml @@ -60,7 +60,7 @@ - name: verify that command succeeded assert: that: - - results['items'] | length >= 1 + - "'webstore' in \"{{ results['items'] | map(attribute='name') | list }}\"" # ---------------------------------------------------------------------------- - name: create a database that already exists gcp_spanner_database: @@ -101,7 +101,7 @@ - name: verify that command succeeded assert: that: - - results['items'] | length == 0 + - "'webstore' not in \"{{ results['items'] | map(attribute='name') | list }}\"" # ---------------------------------------------------------------------------- - name: delete a database that does not exist gcp_spanner_database: @@ -118,6 +118,7 @@ - result.changed == false #--------------------------------------------------------- # Post-test teardown +# If errors happen, don't crash the playbook! - name: delete a instance gcp_spanner_instance: name: "instance-database" @@ -131,3 +132,4 @@ service_account_file: "{{ gcp_cred_file }}" state: absent register: instance + ignore_errors: true diff --git a/test/integration/targets/gcp_spanner_instance/tasks/main.yml b/test/integration/targets/gcp_spanner_instance/tasks/main.yml index 0724eff6197379..e95b89073092dd 100644 --- a/test/integration/targets/gcp_spanner_instance/tasks/main.yml +++ b/test/integration/targets/gcp_spanner_instance/tasks/main.yml @@ -54,7 +54,7 @@ - name: verify that command succeeded assert: that: - - results['items'] | length >= 1 + - "\"{{resource_name}}\" in \"{{ results['items'] | map(attribute='name') | list }}\"" # ---------------------------------------------------------------------------- - name: create a instance that already exists gcp_spanner_instance: @@ -102,7 +102,7 @@ - name: verify that command succeeded assert: that: - - results['items'] | length == 0 + - "\"{{resource_name}}\" not in \"{{ results['items'] | map(attribute='name') | list }}\"" # ---------------------------------------------------------------------------- - name: delete a instance that does not exist gcp_spanner_instance: diff --git a/test/integration/targets/gcp_sql_database/tasks/main.yml b/test/integration/targets/gcp_sql_database/tasks/main.yml index aea8991e635d6e..a74f50f5f4b244 100644 --- a/test/integration/targets/gcp_sql_database/tasks/main.yml +++ b/test/integration/targets/gcp_sql_database/tasks/main.yml @@ -15,7 +15,7 @@ # Pre-test setup - name: create a instance gcp_sql_instance: - name: "instance-database" + name: "{{ resource_name }}" settings: ip_configuration: authorized_networks: @@ -129,9 +129,10 @@ - result.has_key('kind') == False #--------------------------------------------------------- # Post-test teardown +# If errors happen, don't crash the playbook! - name: delete a instance gcp_sql_instance: - name: "instance-database" + name: "{{ resource_name }}" settings: ip_configuration: authorized_networks: @@ -144,3 +145,4 @@ service_account_file: "{{ gcp_cred_file }}" state: absent register: instance + ignore_errors: true diff --git a/test/integration/targets/gcp_sql_user/tasks/main.yml b/test/integration/targets/gcp_sql_user/tasks/main.yml index 2434d04eb23e48..5d1bfeca0a2d32 100644 --- a/test/integration/targets/gcp_sql_user/tasks/main.yml +++ b/test/integration/targets/gcp_sql_user/tasks/main.yml @@ -15,7 +15,7 @@ # Pre-test setup - name: create a instance gcp_sql_instance: - name: "instance-user" + name: "{{ resource_name }}" settings: ip_configuration: authorized_networks: @@ -134,9 +134,10 @@ - result.has_key('kind') == False #--------------------------------------------------------- # Post-test teardown +# If errors happen, don't crash the playbook! - name: delete a instance gcp_sql_instance: - name: "instance-user" + name: "{{ resource_name }}" settings: ip_configuration: authorized_networks: @@ -149,3 +150,4 @@ service_account_file: "{{ gcp_cred_file }}" state: absent register: instance + ignore_errors: true diff --git a/test/integration/targets/gcp_storage_bucket_access_control/tasks/main.yml b/test/integration/targets/gcp_storage_bucket_access_control/tasks/main.yml index b9b9e763b0fc8e..446ca4ab9cf5da 100644 --- a/test/integration/targets/gcp_storage_bucket_access_control/tasks/main.yml +++ b/test/integration/targets/gcp_storage_bucket_access_control/tasks/main.yml @@ -96,6 +96,7 @@ - result.has_key('kind') == False #--------------------------------------------------------- # Post-test teardown +# If errors happen, don't crash the playbook! - name: delete a bucket gcp_storage_bucket: name: "bucket-bac" @@ -104,3 +105,4 @@ service_account_file: "{{ gcp_cred_file }}" state: absent register: bucket + ignore_errors: true From 3395f1482b86a4fd5404e26e8e06b0dd9dc64bed Mon Sep 17 00:00:00 2001 From: The Magician Date: Fri, 7 Dec 2018 10:16:51 -0800 Subject: [PATCH 075/144] Removing unused puppet code (#144) /cc @rambleraptor --- test/integration/targets/gcp_bigquery_table/tasks/main.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test/integration/targets/gcp_bigquery_table/tasks/main.yml b/test/integration/targets/gcp_bigquery_table/tasks/main.yml index 74a139a31ecc3a..c926621b483ac8 100644 --- a/test/integration/targets/gcp_bigquery_table/tasks/main.yml +++ b/test/integration/targets/gcp_bigquery_table/tasks/main.yml @@ -139,6 +139,7 @@ - result.has_key('kind') == False #--------------------------------------------------------- # Post-test teardown +# If errors happen, don't crash the playbook! - name: delete a dataset gcp_bigquery_dataset: name: example_dataset @@ -149,3 +150,4 @@ service_account_file: "{{ gcp_cred_file }}" state: absent register: dataset + ignore_errors: true From eacb7995a67da935ba83dc9952eb073187abd24f Mon Sep 17 00:00:00 2001 From: Chris Stephens Date: Sat, 8 Dec 2018 19:53:38 +0000 Subject: [PATCH 076/144] Allowing address to be settable --- .../modules/cloud/google/gcp_compute_global_address.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_global_address.py b/lib/ansible/modules/cloud/google/gcp_compute_global_address.py index 4d6861a90fe6a5..ad7b35053e28f4 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_global_address.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_global_address.py @@ -49,6 +49,11 @@ - present - absent default: present + address: + description: + - The static external IP address represented by this resource. + required: false + version_added: 2.8 description: description: - An optional description of this resource. @@ -170,6 +175,7 @@ def main(): module = GcpModule( argument_spec=dict( state=dict(default='present', choices=['present', 'absent'], type='str'), + address=dict(type='str'), description=dict(type='str'), name=dict(required=True, type='str'), ip_version=dict(type='str', choices=['IPV4', 'IPV6']), @@ -225,6 +231,7 @@ def delete(module, link, kind): def resource_to_request(module): request = { u'kind': 'compute#address', + u'address': module.params.get('address'), u'description': module.params.get('description'), u'name': module.params.get('name'), u'ipVersion': module.params.get('ip_version'), From 7d0eb7b7bc061437ca15518904be62b889744f63 Mon Sep 17 00:00:00 2001 From: The Magician Date: Fri, 14 Dec 2018 12:49:08 -0800 Subject: [PATCH 077/144] Ansible integration test fixes - pt 2 (#147) /cc @rambleraptor --- .../cloud/google/gcp_compute_vpn_tunnel.py | 4 ++-- .../cloud/google/gcp_iam_service_account.py | 4 +++- .../modules/cloud/google/gcp_sql_database.py | 2 +- .../modules/cloud/google/gcp_sql_instance.py | 2 +- .../modules/cloud/google/gcp_sql_user.py | 2 +- .../gcp_storage_bucket_access_control.py | 2 +- .../gcp_compute_vpn_tunnel/tasks/main.yml | 20 +++++++++---------- .../gcp_iam_service_account/tasks/main.yml | 20 ++++++++++++++----- .../targets/gcp_sql_database/tasks/main.yml | 4 ++-- .../targets/gcp_sql_instance/tasks/main.yml | 10 +++++----- .../targets/gcp_sql_user/tasks/main.yml | 4 ++-- .../tasks/main.yml | 4 ++-- 12 files changed, 45 insertions(+), 33 deletions(-) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_vpn_tunnel.py b/lib/ansible/modules/cloud/google/gcp_compute_vpn_tunnel.py index abd6749be90333..76d023059f599a 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_vpn_tunnel.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_vpn_tunnel.py @@ -162,8 +162,8 @@ state: present register: gateway -- name: create a vpn-tunnel - gcp_compute_vpn-tunnel: +- name: create a vpn tunnel + gcp_compute_vpn_tunnel: name: "test_object" region: us-west1 target_vpn_gateway: "{{ gateway }}" diff --git a/lib/ansible/modules/cloud/google/gcp_iam_service_account.py b/lib/ansible/modules/cloud/google/gcp_iam_service_account.py index 122c32b51157fc..07e337e63277b9 100644 --- a/lib/ansible/modules/cloud/google/gcp_iam_service_account.py +++ b/lib/ansible/modules/cloud/google/gcp_iam_service_account.py @@ -62,7 +62,9 @@ EXAMPLES = ''' - name: create a service account gcp_iam_service_account: - name: test-ansible@graphite-playground.google.com.iam.gserviceaccount.com + name: '"{{resource_name}}@{{gcp_project}}.google.com.iam.gserviceaccount.com" + + ' display_name: My Ansible test key project: "test_project" auth_kind: "serviceaccount" diff --git a/lib/ansible/modules/cloud/google/gcp_sql_database.py b/lib/ansible/modules/cloud/google/gcp_sql_database.py index f46435aeaf2223..5a1818104498be 100644 --- a/lib/ansible/modules/cloud/google/gcp_sql_database.py +++ b/lib/ansible/modules/cloud/google/gcp_sql_database.py @@ -76,7 +76,7 @@ EXAMPLES = ''' - name: create a instance gcp_sql_instance: - name: "{{ resource_name }}" + name: "{{resource_name}}-3" settings: ip_configuration: authorized_networks: diff --git a/lib/ansible/modules/cloud/google/gcp_sql_instance.py b/lib/ansible/modules/cloud/google/gcp_sql_instance.py index 161aa88976243f..7322d2bd7a36b4 100644 --- a/lib/ansible/modules/cloud/google/gcp_sql_instance.py +++ b/lib/ansible/modules/cloud/google/gcp_sql_instance.py @@ -273,7 +273,7 @@ EXAMPLES = ''' - name: create a instance gcp_sql_instance: - name: "test_object" + name: "{{resource_name}}-2" settings: ip_configuration: authorized_networks: diff --git a/lib/ansible/modules/cloud/google/gcp_sql_user.py b/lib/ansible/modules/cloud/google/gcp_sql_user.py index 8de5a07d571dbe..693c7465e9f297 100644 --- a/lib/ansible/modules/cloud/google/gcp_sql_user.py +++ b/lib/ansible/modules/cloud/google/gcp_sql_user.py @@ -77,7 +77,7 @@ EXAMPLES = ''' - name: create a instance gcp_sql_instance: - name: "{{ resource_name }}" + name: "{{resource_name}}-1" settings: ip_configuration: authorized_networks: diff --git a/lib/ansible/modules/cloud/google/gcp_storage_bucket_access_control.py b/lib/ansible/modules/cloud/google/gcp_storage_bucket_access_control.py index 09e141f4bc08e6..c64b4a90a40887 100644 --- a/lib/ansible/modules/cloud/google/gcp_storage_bucket_access_control.py +++ b/lib/ansible/modules/cloud/google/gcp_storage_bucket_access_control.py @@ -110,7 +110,7 @@ EXAMPLES = ''' - name: create a bucket gcp_storage_bucket: - name: "bucket-bac" + name: "{{ resource_name }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" diff --git a/test/integration/targets/gcp_compute_vpn_tunnel/tasks/main.yml b/test/integration/targets/gcp_compute_vpn_tunnel/tasks/main.yml index a46191a7246ffb..7cdd3de88a0a93 100644 --- a/test/integration/targets/gcp_compute_vpn_tunnel/tasks/main.yml +++ b/test/integration/targets/gcp_compute_vpn_tunnel/tasks/main.yml @@ -49,8 +49,8 @@ service_account_file: "{{ gcp_cred_file }}" state: present register: gateway -- name: delete a vpn-tunnel - gcp_compute_vpn-tunnel: +- name: delete a vpn tunnel + gcp_compute_vpn_tunnel: name: "{{ resource_name }}" region: us-west1 target_vpn_gateway: "{{ gateway }}" @@ -61,8 +61,8 @@ service_account_file: "{{ gcp_cred_file }}" state: absent #---------------------------------------------------------- -- name: create a vpn-tunnel - gcp_compute_vpn-tunnel: +- name: create a vpn tunnel + gcp_compute_vpn_tunnel: name: "{{ resource_name }}" region: us-west1 target_vpn_gateway: "{{ gateway }}" @@ -94,8 +94,8 @@ that: - results['items'] | length == 1 # ---------------------------------------------------------------------------- -- name: create a vpn-tunnel that already exists - gcp_compute_vpn-tunnel: +- name: create a vpn tunnel that already exists + gcp_compute_vpn_tunnel: name: "{{ resource_name }}" region: us-west1 target_vpn_gateway: "{{ gateway }}" @@ -112,8 +112,8 @@ - result.changed == false - "result.kind == 'compute#vpnTunnel'" #---------------------------------------------------------- -- name: delete a vpn-tunnel - gcp_compute_vpn-tunnel: +- name: delete a vpn tunnel + gcp_compute_vpn_tunnel: name: "{{ resource_name }}" region: us-west1 target_vpn_gateway: "{{ gateway }}" @@ -145,8 +145,8 @@ that: - results['items'] | length == 0 # ---------------------------------------------------------------------------- -- name: delete a vpn-tunnel that does not exist - gcp_compute_vpn-tunnel: +- name: delete a vpn tunnel that does not exist + gcp_compute_vpn_tunnel: name: "{{ resource_name }}" region: us-west1 target_vpn_gateway: "{{ gateway }}" diff --git a/test/integration/targets/gcp_iam_service_account/tasks/main.yml b/test/integration/targets/gcp_iam_service_account/tasks/main.yml index 519df9937f3b9a..2e06eb7f5d9cef 100644 --- a/test/integration/targets/gcp_iam_service_account/tasks/main.yml +++ b/test/integration/targets/gcp_iam_service_account/tasks/main.yml @@ -15,7 +15,9 @@ # Pre-test setup - name: delete a service account gcp_iam_service_account: - name: test-ansible@graphite-playground.google.com.iam.gserviceaccount.com + name: '"{{resource_name}}@{{gcp_project}}.google.com.iam.gserviceaccount.com" + + ' display_name: My Ansible test key project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" @@ -24,7 +26,9 @@ #---------------------------------------------------------- - name: create a service account gcp_iam_service_account: - name: test-ansible@graphite-playground.google.com.iam.gserviceaccount.com + name: '"{{resource_name}}@{{gcp_project}}.google.com.iam.gserviceaccount.com" + + ' display_name: My Ansible test key project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" @@ -50,7 +54,9 @@ # ---------------------------------------------------------------------------- - name: create a service account that already exists gcp_iam_service_account: - name: test-ansible@graphite-playground.google.com.iam.gserviceaccount.com + name: '"{{resource_name}}@{{gcp_project}}.google.com.iam.gserviceaccount.com" + + ' display_name: My Ansible test key project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" @@ -64,7 +70,9 @@ #---------------------------------------------------------- - name: delete a service account gcp_iam_service_account: - name: test-ansible@graphite-playground.google.com.iam.gserviceaccount.com + name: '"{{resource_name}}@{{gcp_project}}.google.com.iam.gserviceaccount.com" + + ' display_name: My Ansible test key project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" @@ -90,7 +98,9 @@ # ---------------------------------------------------------------------------- - name: delete a service account that does not exist gcp_iam_service_account: - name: test-ansible@graphite-playground.google.com.iam.gserviceaccount.com + name: '"{{resource_name}}@{{gcp_project}}.google.com.iam.gserviceaccount.com" + + ' display_name: My Ansible test key project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" diff --git a/test/integration/targets/gcp_sql_database/tasks/main.yml b/test/integration/targets/gcp_sql_database/tasks/main.yml index a74f50f5f4b244..a9dd18bdf4534e 100644 --- a/test/integration/targets/gcp_sql_database/tasks/main.yml +++ b/test/integration/targets/gcp_sql_database/tasks/main.yml @@ -15,7 +15,7 @@ # Pre-test setup - name: create a instance gcp_sql_instance: - name: "{{ resource_name }}" + name: "{{resource_name}}-3" settings: ip_configuration: authorized_networks: @@ -132,7 +132,7 @@ # If errors happen, don't crash the playbook! - name: delete a instance gcp_sql_instance: - name: "{{ resource_name }}" + name: "{{resource_name}}-3" settings: ip_configuration: authorized_networks: diff --git a/test/integration/targets/gcp_sql_instance/tasks/main.yml b/test/integration/targets/gcp_sql_instance/tasks/main.yml index 6fa18f2d0aa56b..fa7690c1e80c11 100644 --- a/test/integration/targets/gcp_sql_instance/tasks/main.yml +++ b/test/integration/targets/gcp_sql_instance/tasks/main.yml @@ -15,7 +15,7 @@ # Pre-test setup - name: delete a instance gcp_sql_instance: - name: "{{ resource_name }}" + name: "{{resource_name}}-2" settings: ip_configuration: authorized_networks: @@ -30,7 +30,7 @@ #---------------------------------------------------------- - name: create a instance gcp_sql_instance: - name: "{{ resource_name }}" + name: "{{resource_name}}-2" settings: ip_configuration: authorized_networks: @@ -63,7 +63,7 @@ # ---------------------------------------------------------------------------- - name: create a instance that already exists gcp_sql_instance: - name: "{{ resource_name }}" + name: "{{resource_name}}-2" settings: ip_configuration: authorized_networks: @@ -84,7 +84,7 @@ #---------------------------------------------------------- - name: delete a instance gcp_sql_instance: - name: "{{ resource_name }}" + name: "{{resource_name}}-2" settings: ip_configuration: authorized_networks: @@ -117,7 +117,7 @@ # ---------------------------------------------------------------------------- - name: delete a instance that does not exist gcp_sql_instance: - name: "{{ resource_name }}" + name: "{{resource_name}}-2" settings: ip_configuration: authorized_networks: diff --git a/test/integration/targets/gcp_sql_user/tasks/main.yml b/test/integration/targets/gcp_sql_user/tasks/main.yml index 5d1bfeca0a2d32..ac8f8b510e36fd 100644 --- a/test/integration/targets/gcp_sql_user/tasks/main.yml +++ b/test/integration/targets/gcp_sql_user/tasks/main.yml @@ -15,7 +15,7 @@ # Pre-test setup - name: create a instance gcp_sql_instance: - name: "{{ resource_name }}" + name: "{{resource_name}}-1" settings: ip_configuration: authorized_networks: @@ -137,7 +137,7 @@ # If errors happen, don't crash the playbook! - name: delete a instance gcp_sql_instance: - name: "{{ resource_name }}" + name: "{{resource_name}}-1" settings: ip_configuration: authorized_networks: diff --git a/test/integration/targets/gcp_storage_bucket_access_control/tasks/main.yml b/test/integration/targets/gcp_storage_bucket_access_control/tasks/main.yml index 446ca4ab9cf5da..c4a28f0c854b39 100644 --- a/test/integration/targets/gcp_storage_bucket_access_control/tasks/main.yml +++ b/test/integration/targets/gcp_storage_bucket_access_control/tasks/main.yml @@ -15,7 +15,7 @@ # Pre-test setup - name: create a bucket gcp_storage_bucket: - name: "bucket-bac" + name: "{{ resource_name }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" @@ -99,7 +99,7 @@ # If errors happen, don't crash the playbook! - name: delete a bucket gcp_storage_bucket: - name: "bucket-bac" + name: "{{ resource_name }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" From 07425f6e745673d4d0df9c2654b458bb7e5179f3 Mon Sep 17 00:00:00 2001 From: The Magician Date: Fri, 14 Dec 2018 13:00:18 -0800 Subject: [PATCH 078/144] Better resourceref flexibility (#149) /cc @rambleraptor --- lib/ansible/module_utils/gcp_utils.py | 10 +++- .../cloud/google/gcp_compute_address.py | 11 ++-- .../cloud/google/gcp_compute_address_facts.py | 2 +- .../google/gcp_compute_backend_service.py | 12 ++--- .../gcp_compute_backend_service_facts.py | 2 +- .../modules/cloud/google/gcp_compute_disk.py | 11 ++-- .../cloud/google/gcp_compute_disk_facts.py | 2 +- .../cloud/google/gcp_compute_firewall.py | 11 ++-- .../google/gcp_compute_firewall_facts.py | 2 +- .../google/gcp_compute_forwarding_rule.py | 45 ++++++++--------- .../gcp_compute_forwarding_rule_facts.py | 8 +-- .../gcp_compute_global_forwarding_rule.py | 34 ++++++------- ...cp_compute_global_forwarding_rule_facts.py | 6 +-- .../modules/cloud/google/gcp_compute_image.py | 11 ++-- .../cloud/google/gcp_compute_image_facts.py | 2 +- .../cloud/google/gcp_compute_instance.py | 46 ++++++++--------- .../google/gcp_compute_instance_facts.py | 8 +-- .../google/gcp_compute_instance_group.py | 24 ++++----- .../gcp_compute_instance_group_facts.py | 4 +- .../gcp_compute_instance_group_manager.py | 16 +++--- ...cp_compute_instance_group_manager_facts.py | 4 +- .../google/gcp_compute_instance_template.py | 50 +++++++++---------- .../gcp_compute_instance_template_facts.py | 8 +-- .../gcp_compute_interconnect_attachment.py | 11 ++-- ...p_compute_interconnect_attachment_facts.py | 2 +- .../cloud/google/gcp_compute_region_disk.py | 11 ++-- .../google/gcp_compute_region_disk_facts.py | 2 +- .../modules/cloud/google/gcp_compute_route.py | 11 ++-- .../cloud/google/gcp_compute_route_facts.py | 2 +- .../cloud/google/gcp_compute_router.py | 11 ++-- .../cloud/google/gcp_compute_router_facts.py | 2 +- .../cloud/google/gcp_compute_subnetwork.py | 11 ++-- .../google/gcp_compute_subnetwork_facts.py | 2 +- .../google/gcp_compute_target_http_proxy.py | 11 ++-- .../gcp_compute_target_http_proxy_facts.py | 2 +- .../google/gcp_compute_target_https_proxy.py | 24 ++++----- .../gcp_compute_target_https_proxy_facts.py | 4 +- .../cloud/google/gcp_compute_target_pool.py | 25 +++++----- .../google/gcp_compute_target_pool_facts.py | 4 +- .../google/gcp_compute_target_ssl_proxy.py | 25 +++++----- .../gcp_compute_target_ssl_proxy_facts.py | 4 +- .../google/gcp_compute_target_tcp_proxy.py | 12 ++--- .../gcp_compute_target_tcp_proxy_facts.py | 2 +- .../google/gcp_compute_target_vpn_gateway.py | 11 ++-- .../gcp_compute_target_vpn_gateway_facts.py | 2 +- .../cloud/google/gcp_compute_url_map.py | 50 +++++++++---------- .../cloud/google/gcp_compute_url_map_facts.py | 8 +-- .../cloud/google/gcp_compute_vpn_tunnel.py | 23 ++++----- .../google/gcp_compute_vpn_tunnel_facts.py | 4 +- .../cloud/google/gcp_container_node_pool.py | 11 ++-- .../google/gcp_container_node_pool_facts.py | 11 ++-- .../google/gcp_dns_resource_record_set.py | 11 ++-- .../gcp_dns_resource_record_set_facts.py | 11 ++-- .../google/gcp_iam_service_account_key.py | 11 ++-- .../cloud/google/gcp_pubsub_subscription.py | 11 ++-- .../google/gcp_pubsub_subscription_facts.py | 2 +- .../cloud/google/gcp_spanner_database.py | 11 ++-- .../google/gcp_spanner_database_facts.py | 11 ++-- .../modules/cloud/google/gcp_sql_database.py | 11 ++-- .../cloud/google/gcp_sql_database_facts.py | 11 ++-- .../modules/cloud/google/gcp_sql_user.py | 11 ++-- .../cloud/google/gcp_sql_user_facts.py | 11 ++-- .../cloud/google/gcp_storage_bucket.py | 22 ++++---- .../gcp_storage_bucket_access_control.py | 11 ++-- 64 files changed, 368 insertions(+), 404 deletions(-) diff --git a/lib/ansible/module_utils/gcp_utils.py b/lib/ansible/module_utils/gcp_utils.py index 7baeb2a71aef1b..8f6d47c3a9d2a5 100644 --- a/lib/ansible/module_utils/gcp_utils.py +++ b/lib/ansible/module_utils/gcp_utils.py @@ -19,6 +19,7 @@ from ansible.module_utils.basic import AnsibleModule, env_fallback from ansible.module_utils.six import string_types from ansible.module_utils._text import to_text +import ast import os @@ -60,8 +61,15 @@ def replace_resource_dict(item, value): else: if not item: return item - return item.get(value) + if isinstance(item, dict): + return item.get(value) + # Item could be a string or a string representing a dictionary. + try: + new_item = ast.literal_eval(item) + return replace_resource_dict(new_item, value) + except ValueError: + return new_item # Handles all authentation and HTTP sessions for GCP API calls. class GcpSession(object): diff --git a/lib/ansible/modules/cloud/google/gcp_compute_address.py b/lib/ansible/modules/cloud/google/gcp_compute_address.py index d42951084653eb..f93c8d450a3fe3 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_address.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_address.py @@ -102,10 +102,9 @@ - This field can only be used with INTERNAL type with GCE_ENDPOINT/DNS_RESOLVER purposes. - 'This field represents a link to a Subnetwork resource in GCP. It can be specified - in two ways. You can add `register: name-of-resource` to a gcp_compute_subnetwork - task and then set this subnetwork field to "{{ name-of-resource }}" Alternatively, - you can set this subnetwork to a dictionary with the selfLink key where the - value is the selfLink of your Subnetwork' + in two ways. First, you can place in the selfLink of the resource here as a + string Alternatively, you can add `register: name-of-resource` to a gcp_compute_subnetwork + task and then set this subnetwork field to "{{ name-of-resource }}"' required: false version_added: 2.7 region: @@ -183,7 +182,7 @@ - This field can only be used with INTERNAL type with GCE_ENDPOINT/DNS_RESOLVER purposes. returned: success - type: dict + type: str users: description: - The URLs of the resources that are using this address. @@ -221,7 +220,7 @@ def main(): description=dict(type='str'), name=dict(required=True, type='str'), network_tier=dict(type='str', choices=['PREMIUM', 'STANDARD']), - subnetwork=dict(type='dict'), + subnetwork=dict(), region=dict(required=True, type='str') ) ) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_address_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_address_facts.py index ba06eb409c6f35..d5b5140fe1889f 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_address_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_address_facts.py @@ -122,7 +122,7 @@ - This field can only be used with INTERNAL type with GCE_ENDPOINT/DNS_RESOLVER purposes. returned: success - type: dict + type: str users: description: - The URLs of the resources that are using this address. diff --git a/lib/ansible/modules/cloud/google/gcp_compute_backend_service.py b/lib/ansible/modules/cloud/google/gcp_compute_backend_service.py index 4716e96fceaac2..d2e23376c61517 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_backend_service.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_backend_service.py @@ -97,10 +97,10 @@ - When the BackendService has load balancing scheme INTERNAL, the instance group must be in a zone within the same region as the BackendService. - 'This field represents a link to a InstanceGroup resource in GCP. It can - be specified in two ways. You can add `register: name-of-resource` to a - gcp_compute_instance_group task and then set this group field to "{{ name-of-resource - }}" Alternatively, you can set this group to a dictionary with the selfLink - key where the value is the selfLink of your InstanceGroup' + be specified in two ways. First, you can place in the selfLink of the resource + here as a string Alternatively, you can add `register: name-of-resource` + to a gcp_compute_instance_group task and then set this group field to "{{ + name-of-resource }}"' required: false max_connections: description: @@ -387,7 +387,7 @@ - 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 - type: dict + type: str maxConnections: description: - The max number of simultaneous connections for the group. Can be used with @@ -626,7 +626,7 @@ def main(): balancing_mode=dict(type='str', choices=['UTILIZATION', 'RATE', 'CONNECTION']), capacity_scaler=dict(type='str'), description=dict(type='str'), - group=dict(type='dict'), + group=dict(), max_connections=dict(type='int'), max_connections_per_instance=dict(type='int'), max_rate=dict(type='int'), diff --git a/lib/ansible/modules/cloud/google/gcp_compute_backend_service_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_backend_service_facts.py index e6d7feaa914599..d714c80005ee00 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_backend_service_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_backend_service_facts.py @@ -115,7 +115,7 @@ - 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 - type: dict + type: str maxConnections: description: - The max number of simultaneous connections for the group. Can be used diff --git a/lib/ansible/modules/cloud/google/gcp_compute_disk.py b/lib/ansible/modules/cloud/google/gcp_compute_disk.py index 327313991a746c..7d9990d4b8727c 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_disk.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_disk.py @@ -157,10 +157,9 @@ - The source snapshot used to create this disk. You can provide this as a partial or full URL to the resource. - 'This field represents a link to a Snapshot resource in GCP. It can be specified - in two ways. You can add `register: name-of-resource` to a gcp_compute_snapshot - task and then set this source_snapshot field to "{{ name-of-resource }}" Alternatively, - you can set this source_snapshot to a dictionary with the selfLink key where - the value is the selfLink of your Snapshot' + in two ways. First, you can place in the selfLink of the resource here as a + string Alternatively, you can add `register: name-of-resource` to a gcp_compute_snapshot + task and then set this source_snapshot field to "{{ name-of-resource }}"' required: false source_snapshot_encryption_key: description: @@ -351,7 +350,7 @@ - The source snapshot used to create this disk. You can provide this as a partial or full URL to the resource. returned: success - type: dict + type: str sourceSnapshotEncryptionKey: description: - The customer-supplied encryption key of the source snapshot. Required if the source @@ -418,7 +417,7 @@ def main(): raw_key=dict(type='str'), sha256=dict(type='str') )), - source_snapshot=dict(type='dict'), + source_snapshot=dict(), source_snapshot_encryption_key=dict(type='dict', options=dict( raw_key=dict(type='str'), sha256=dict(type='str') diff --git a/lib/ansible/modules/cloud/google/gcp_compute_disk_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_disk_facts.py index bf5af4150cc839..cbf483fcd9025b 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_disk_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_disk_facts.py @@ -224,7 +224,7 @@ - The source snapshot used to create this disk. You can provide this as a partial or full URL to the resource. returned: success - type: dict + type: str sourceSnapshotEncryptionKey: description: - The customer-supplied encryption key of the source snapshot. Required if the diff --git a/lib/ansible/modules/cloud/google/gcp_compute_firewall.py b/lib/ansible/modules/cloud/google/gcp_compute_firewall.py index 0a91375152f986..75e9118ab3d12c 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_firewall.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_firewall.py @@ -147,10 +147,9 @@ networks/my-network projects/myproject/global/networks/my-network global/networks/default .' - 'This field represents a link to a Network resource in GCP. It can be specified - in two ways. You can add `register: name-of-resource` to a gcp_compute_network - task and then set this network field to "{{ name-of-resource }}" Alternatively, - you can set this network to a dictionary with the selfLink key where the value - is the selfLink of your Network' + in two ways. First, you can place in the selfLink of the resource here as a + string Alternatively, you can add `register: name-of-resource` to a gcp_compute_network + task and then set this network field to "{{ name-of-resource }}"' required: false default: selfLink: global/networks/default @@ -343,7 +342,7 @@ networks/my-network projects/myproject/global/networks/my-network global/networks/default .' returned: success - type: dict + type: str priority: description: - Priority for this rule. This is an integer between 0 and 65535, both inclusive. @@ -441,7 +440,7 @@ def main(): direction=dict(type='str', choices=['INGRESS', 'EGRESS']), disabled=dict(type='bool'), name=dict(required=True, type='str'), - network=dict(default={'selfLink': 'global/networks/default'}, type='dict'), + network=dict(default={'selfLink': 'global/networks/default'}), priority=dict(default=1000, type='int'), source_ranges=dict(type='list', elements='str'), source_service_accounts=dict(type='list', elements='str'), diff --git a/lib/ansible/modules/cloud/google/gcp_compute_firewall_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_firewall_facts.py index 1cc69b5d682d82..ae21847fd6ab92 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_firewall_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_firewall_facts.py @@ -170,7 +170,7 @@ networks/my-network projects/myproject/global/networks/my-network global/networks/default .' returned: success - type: dict + type: str priority: description: - Priority for this rule. This is an integer between 0 and 65535, both inclusive. diff --git a/lib/ansible/modules/cloud/google/gcp_compute_forwarding_rule.py b/lib/ansible/modules/cloud/google/gcp_compute_forwarding_rule.py index 192c73160b4f47..0c844e7ef09a1e 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_forwarding_rule.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_forwarding_rule.py @@ -96,10 +96,10 @@ - This is used for internal load balancing. - "(not used for external load balancing) ." - 'This field represents a link to a BackendService resource in GCP. It can be - specified in two ways. You can add `register: name-of-resource` to a gcp_compute_backend_service - task and then set this backend_service field to "{{ name-of-resource }}" Alternatively, - you can set this backend_service to a dictionary with the selfLink key where - the value is the selfLink of your BackendService' + specified in two ways. First, you can place in the selfLink of the resource + here as a string Alternatively, you can add `register: name-of-resource` to + a gcp_compute_backend_service task and then set this backend_service field to + "{{ name-of-resource }}"' required: false ip_version: description: @@ -136,10 +136,9 @@ specified, the default network will be used. - This field is not used for external load balancing. - 'This field represents a link to a Network resource in GCP. It can be specified - in two ways. You can add `register: name-of-resource` to a gcp_compute_network - task and then set this network field to "{{ name-of-resource }}" Alternatively, - you can set this network to a dictionary with the selfLink key where the value - is the selfLink of your Network' + in two ways. First, you can place in the selfLink of the resource here as a + string Alternatively, you can add `register: name-of-resource` to a gcp_compute_network + task and then set this network field to "{{ name-of-resource }}"' required: false port_range: description: @@ -172,10 +171,9 @@ if the network is in custom subnet mode, a subnetwork must be specified. - This field is not used for external load balancing. - 'This field represents a link to a Subnetwork resource in GCP. It can be specified - in two ways. You can add `register: name-of-resource` to a gcp_compute_subnetwork - task and then set this subnetwork field to "{{ name-of-resource }}" Alternatively, - you can set this subnetwork to a dictionary with the selfLink key where the - value is the selfLink of your Subnetwork' + in two ways. First, you can place in the selfLink of the resource here as a + string Alternatively, you can add `register: name-of-resource` to a gcp_compute_subnetwork + task and then set this subnetwork field to "{{ name-of-resource }}"' required: false target: description: @@ -186,10 +184,9 @@ target object. - This field is not used for internal load balancing. - 'This field represents a link to a TargetPool resource in GCP. It can be specified - in two ways. You can add `register: name-of-resource` to a gcp_compute_target_pool - task and then set this target field to "{{ name-of-resource }}" Alternatively, - you can set this target to a dictionary with the selfLink key where the value - is the selfLink of your TargetPool' + in two ways. First, you can place in the selfLink of the resource here as a + string Alternatively, you can add `register: name-of-resource` to a gcp_compute_target_pool + task and then set this target field to "{{ name-of-resource }}"' required: false version_added: 2.7 network_tier: @@ -301,7 +298,7 @@ - This is used for internal load balancing. - "(not used for external load balancing) ." returned: success - type: dict + type: str ipVersion: description: - The IP Version that will be used by this forwarding rule. Valid options are IPV4 @@ -334,7 +331,7 @@ the default network will be used. - This field is not used for external load balancing. returned: success - type: dict + type: str portRange: description: - This field is used along with the target field for TargetHttpProxy, TargetHttpsProxy, @@ -367,7 +364,7 @@ if the network is in custom subnet mode, a subnetwork must be specified. - This field is not used for external load balancing. returned: success - type: dict + type: str target: description: - A reference to a TargetPool resource to receive the matched traffic. @@ -377,7 +374,7 @@ target object. - This field is not used for internal load balancing. returned: success - type: dict + type: str networkTier: description: - 'The networking tier used for configuring this address. This field can take the @@ -415,15 +412,15 @@ def main(): description=dict(type='str'), ip_address=dict(type='str'), ip_protocol=dict(type='str', choices=['TCP', 'UDP', 'ESP', 'AH', 'SCTP', 'ICMP']), - backend_service=dict(type='dict'), + backend_service=dict(), ip_version=dict(type='str', choices=['IPV4', 'IPV6']), load_balancing_scheme=dict(type='str', choices=['INTERNAL', 'EXTERNAL']), name=dict(required=True, type='str'), - network=dict(type='dict'), + network=dict(), port_range=dict(type='str'), ports=dict(type='list', elements='str'), - subnetwork=dict(type='dict'), - target=dict(type='dict'), + subnetwork=dict(), + target=dict(), network_tier=dict(type='str', choices=['PREMIUM', 'STANDARD']), region=dict(required=True, type='str') ) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_forwarding_rule_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_forwarding_rule_facts.py index e5bd5fd37ee89e..0099c445d555f0 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_forwarding_rule_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_forwarding_rule_facts.py @@ -123,7 +123,7 @@ - This is used for internal load balancing. - "(not used for external load balancing) ." returned: success - type: dict + type: str ipVersion: description: - The IP Version that will be used by this forwarding rule. Valid options are @@ -156,7 +156,7 @@ specified, the default network will be used. - This field is not used for external load balancing. returned: success - type: dict + type: str portRange: description: - This field is used along with the target field for TargetHttpProxy, TargetHttpsProxy, @@ -191,7 +191,7 @@ if the network is in custom subnet mode, a subnetwork must be specified. - This field is not used for external load balancing. returned: success - type: dict + type: str target: description: - A reference to a TargetPool resource to receive the matched traffic. @@ -201,7 +201,7 @@ to the target object. - This field is not used for internal load balancing. returned: success - type: dict + type: str networkTier: description: - 'The networking tier used for configuring this address. This field can take diff --git a/lib/ansible/modules/cloud/google/gcp_compute_global_forwarding_rule.py b/lib/ansible/modules/cloud/google/gcp_compute_global_forwarding_rule.py index 21acb0c69ffd86..4420c59546aae6 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_global_forwarding_rule.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_global_forwarding_rule.py @@ -98,10 +98,10 @@ - This is used for internal load balancing. - "(not used for external load balancing) ." - 'This field represents a link to a BackendService resource in GCP. It can be - specified in two ways. You can add `register: name-of-resource` to a gcp_compute_backend_service - task and then set this backend_service field to "{{ name-of-resource }}" Alternatively, - you can set this backend_service to a dictionary with the selfLink key where - the value is the selfLink of your BackendService' + specified in two ways. First, you can place in the selfLink of the resource + here as a string Alternatively, you can add `register: name-of-resource` to + a gcp_compute_backend_service task and then set this backend_service field to + "{{ name-of-resource }}"' required: false ip_version: description: @@ -138,10 +138,9 @@ specified, the default network will be used. - This field is not used for external load balancing. - 'This field represents a link to a Network resource in GCP. It can be specified - in two ways. You can add `register: name-of-resource` to a gcp_compute_network - task and then set this network field to "{{ name-of-resource }}" Alternatively, - you can set this network to a dictionary with the selfLink key where the value - is the selfLink of your Network' + in two ways. First, you can place in the selfLink of the resource here as a + string Alternatively, you can add `register: name-of-resource` to a gcp_compute_network + task and then set this network field to "{{ name-of-resource }}"' required: false port_range: description: @@ -174,10 +173,9 @@ if the network is in custom subnet mode, a subnetwork must be specified. - This field is not used for external load balancing. - 'This field represents a link to a Subnetwork resource in GCP. It can be specified - in two ways. You can add `register: name-of-resource` to a gcp_compute_subnetwork - task and then set this subnetwork field to "{{ name-of-resource }}" Alternatively, - you can set this subnetwork to a dictionary with the selfLink key where the - value is the selfLink of your Subnetwork' + in two ways. First, you can place in the selfLink of the resource here as a + string Alternatively, you can add `register: name-of-resource` to a gcp_compute_subnetwork + task and then set this subnetwork field to "{{ name-of-resource }}"' required: false target: description: @@ -321,7 +319,7 @@ - This is used for internal load balancing. - "(not used for external load balancing) ." returned: success - type: dict + type: str ipVersion: description: - The IP Version that will be used by this forwarding rule. Valid options are IPV4 @@ -354,7 +352,7 @@ the default network will be used. - This field is not used for external load balancing. returned: success - type: dict + type: str portRange: description: - This field is used along with the target field for TargetHttpProxy, TargetHttpsProxy, @@ -387,7 +385,7 @@ if the network is in custom subnet mode, a subnetwork must be specified. - This field is not used for external load balancing. returned: success - type: dict + type: str region: description: - A reference to the region where the regional forwarding rule resides. @@ -425,14 +423,14 @@ def main(): description=dict(type='str'), ip_address=dict(type='str'), ip_protocol=dict(type='str', choices=['TCP', 'UDP', 'ESP', 'AH', 'SCTP', 'ICMP']), - backend_service=dict(type='dict'), + backend_service=dict(), ip_version=dict(type='str', choices=['IPV4', 'IPV6']), load_balancing_scheme=dict(type='str', choices=['INTERNAL', 'EXTERNAL']), name=dict(required=True, type='str'), - network=dict(type='dict'), + network=dict(), port_range=dict(type='str'), ports=dict(type='list', elements='str'), - subnetwork=dict(type='dict'), + subnetwork=dict(), target=dict(type='str') ) ) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_global_forwarding_rule_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_global_forwarding_rule_facts.py index 3e2a134007490c..525ef8def2cb64 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_global_forwarding_rule_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_global_forwarding_rule_facts.py @@ -117,7 +117,7 @@ - This is used for internal load balancing. - "(not used for external load balancing) ." returned: success - type: dict + type: str ipVersion: description: - The IP Version that will be used by this forwarding rule. Valid options are @@ -150,7 +150,7 @@ specified, the default network will be used. - This field is not used for external load balancing. returned: success - type: dict + type: str portRange: description: - This field is used along with the target field for TargetHttpProxy, TargetHttpsProxy, @@ -185,7 +185,7 @@ if the network is in custom subnet mode, a subnetwork must be specified. - This field is not used for external load balancing. returned: success - type: dict + type: str region: description: - A reference to the region where the regional forwarding rule resides. diff --git a/lib/ansible/modules/cloud/google/gcp_compute_image.py b/lib/ansible/modules/cloud/google/gcp_compute_image.py index 51385be535258e..6f7434b347639f 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_image.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_image.py @@ -153,10 +153,9 @@ - Refers to a gcompute_disk object You must provide either this property or the rawDisk.source property but not both to create an image. - 'This field represents a link to a Disk resource in GCP. It can be specified - in two ways. You can add `register: name-of-resource` to a gcp_compute_disk - task and then set this source_disk field to "{{ name-of-resource }}" Alternatively, - you can set this source_disk to a dictionary with the selfLink key where the - value is the selfLink of your Disk' + in two ways. First, you can place in the selfLink of the resource here as a + string Alternatively, you can add `register: name-of-resource` to a gcp_compute_disk + task and then set this source_disk field to "{{ name-of-resource }}"' required: false source_disk_encryption_key: description: @@ -375,7 +374,7 @@ - Refers to a gcompute_disk object You must provide either this property or the rawDisk.source property but not both to create an image. returned: success - type: dict + type: str sourceDiskEncryptionKey: description: - The customer-supplied encryption key of the source disk. Required if the source @@ -446,7 +445,7 @@ def main(): sha1_checksum=dict(type='str'), source=dict(type='str') )), - source_disk=dict(type='dict'), + source_disk=dict(), source_disk_encryption_key=dict(type='dict', options=dict( raw_key=dict(type='str'), sha256=dict(type='str') diff --git a/lib/ansible/modules/cloud/google/gcp_compute_image_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_image_facts.py index 22eede9405eec5..0e77c403254d9f 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_image_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_image_facts.py @@ -232,7 +232,7 @@ - Refers to a gcompute_disk object You must provide either this property or the rawDisk.source property but not both to create an image. returned: success - type: dict + type: str sourceDiskEncryptionKey: description: - The customer-supplied encryption key of the source disk. Required if the source diff --git a/lib/ansible/modules/cloud/google/gcp_compute_instance.py b/lib/ansible/modules/cloud/google/gcp_compute_instance.py index 8d000083467a53..df0bd94769b782 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_instance.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_instance.py @@ -182,10 +182,9 @@ - If desired, you can also attach existing non-root persistent disks using this property. This field is only applicable for persistent disks. - 'This field represents a link to a Disk resource in GCP. It can be specified - in two ways. You can add `register: name-of-resource` to a gcp_compute_disk - task and then set this source field to "{{ name-of-resource }}" Alternatively, - you can set this source to a dictionary with the selfLink key where the - value is the selfLink of your Disk' + in two ways. First, you can place in the selfLink of the resource here as + a string Alternatively, you can add `register: name-of-resource` to a gcp_compute_disk + task and then set this source field to "{{ name-of-resource }}"' required: false type: description: @@ -268,10 +267,10 @@ address pool. If you specify a static external IP address, it must live in the same region as the zone of the instance. - 'This field represents a link to a Address resource in GCP. It can be - specified in two ways. You can add `register: name-of-resource` to a - gcp_compute_address task and then set this nat_ip field to "{{ name-of-resource - }}" Alternatively, you can set this nat_ip to a dictionary with the - address key where the value is the address of your Address' + specified in two ways. First, you can place in the address of the resource + here as a string Alternatively, you can add `register: name-of-resource` + to a gcp_compute_address task and then set this nat_ip field to "{{ + name-of-resource }}"' required: false type: description: @@ -311,10 +310,9 @@ global/networks/default is used; if the network is not specified but the subnetwork is specified, the network is inferred. - 'This field represents a link to a Network resource in GCP. It can be specified - in two ways. You can add `register: name-of-resource` to a gcp_compute_network - task and then set this network field to "{{ name-of-resource }}" Alternatively, - you can set this network to a dictionary with the selfLink key where the - value is the selfLink of your Network' + in two ways. First, you can place in the selfLink of the resource here as + a string Alternatively, you can add `register: name-of-resource` to a gcp_compute_network + task and then set this network field to "{{ name-of-resource }}"' required: false network_ip: description: @@ -329,10 +327,10 @@ If the network is in auto subnet mode, providing the subnetwork is optional. If the network is in custom subnet mode, then this field should be specified. - 'This field represents a link to a Subnetwork resource in GCP. It can be - specified in two ways. You can add `register: name-of-resource` to a gcp_compute_subnetwork - task and then set this subnetwork field to "{{ name-of-resource }}" Alternatively, - you can set this subnetwork to a dictionary with the selfLink key where - the value is the selfLink of your Subnetwork' + specified in two ways. First, you can place in the selfLink of the resource + here as a string Alternatively, you can add `register: name-of-resource` + to a gcp_compute_subnetwork task and then set this subnetwork field to "{{ + name-of-resource }}"' required: false scheduling: description: @@ -630,7 +628,7 @@ - If desired, you can also attach existing non-root persistent disks using this property. This field is only applicable for persistent disks. returned: success - type: dict + type: str type: description: - Specifies the type of the disk, either SCRATCH or PERSISTENT. If not specified, @@ -726,7 +724,7 @@ address pool. If you specify a static external IP address, it must live in the same region as the zone of the instance. returned: success - type: dict + type: str type: description: - The type of configuration. The default and only option is ONE_TO_ONE_NAT. @@ -768,7 +766,7 @@ global/networks/default is used; if the network is not specified but the subnetwork is specified, the network is inferred. returned: success - type: dict + type: str networkIP: description: - An IPv4 internal network address to assign to the instance for this network @@ -783,7 +781,7 @@ the network is in auto subnet mode, providing the subnetwork is optional. If the network is in custom subnet mode, then this field should be specified. returned: success - type: dict + type: str scheduling: description: - Sets the scheduling options for this instance. @@ -915,7 +913,7 @@ def main(): )), interface=dict(type='str', choices=['SCSI', 'NVME']), mode=dict(type='str', choices=['READ_WRITE', 'READ_ONLY']), - source=dict(type='dict'), + source=dict(), type=dict(type='str', choices=['SCRATCH', 'PERSISTENT']) )), guest_accelerators=dict(type='list', elements='dict', options=dict( @@ -930,7 +928,7 @@ def main(): network_interfaces=dict(type='list', elements='dict', options=dict( access_configs=dict(type='list', elements='dict', options=dict( name=dict(required=True, type='str'), - nat_ip=dict(type='dict'), + nat_ip=dict(), type=dict(required=True, type='str', choices=['ONE_TO_ONE_NAT']) )), alias_ip_ranges=dict(type='list', elements='dict', options=dict( @@ -938,9 +936,9 @@ def main(): subnetwork_range_name=dict(type='str') )), name=dict(type='str'), - network=dict(type='dict'), + network=dict(), network_ip=dict(type='str'), - subnetwork=dict(type='dict') + subnetwork=dict() )), scheduling=dict(type='dict', options=dict( automatic_restart=dict(type='bool'), diff --git a/lib/ansible/modules/cloud/google/gcp_compute_instance_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_instance_facts.py index 9b6002698ca43c..336f4c64350a20 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_instance_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_instance_facts.py @@ -226,7 +226,7 @@ - If desired, you can also attach existing non-root persistent disks using this property. This field is only applicable for persistent disks. returned: success - type: dict + type: str type: description: - Specifies the type of the disk, either SCRATCH or PERSISTENT. If not specified, @@ -324,7 +324,7 @@ IP address pool. If you specify a static external IP address, it must live in the same region as the zone of the instance. returned: success - type: dict + type: str type: description: - The type of configuration. The default and only option is ONE_TO_ONE_NAT. @@ -366,7 +366,7 @@ default network global/networks/default is used; if the network is not specified but the subnetwork is specified, the network is inferred. returned: success - type: dict + type: str networkIP: description: - An IPv4 internal network address to assign to the instance for this network @@ -381,7 +381,7 @@ If the network is in auto subnet mode, providing the subnetwork is optional. If the network is in custom subnet mode, then this field should be specified. returned: success - type: dict + type: str scheduling: description: - Sets the scheduling options for this instance. diff --git a/lib/ansible/modules/cloud/google/gcp_compute_instance_group.py b/lib/ansible/modules/cloud/google/gcp_compute_instance_group.py index fb10003a3dd40b..b814cce4983ce1 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_instance_group.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_instance_group.py @@ -84,10 +84,9 @@ description: - The network to which all instances in the instance group belong. - 'This field represents a link to a Network resource in GCP. It can be specified - in two ways. You can add `register: name-of-resource` to a gcp_compute_network - task and then set this network field to "{{ name-of-resource }}" Alternatively, - you can set this network to a dictionary with the selfLink key where the value - is the selfLink of your Network' + in two ways. First, you can place in the selfLink of the resource here as a + string Alternatively, you can add `register: name-of-resource` to a gcp_compute_network + task and then set this network field to "{{ name-of-resource }}"' required: false region: description: @@ -97,10 +96,9 @@ description: - The subnetwork to which all instances in the instance group belong. - 'This field represents a link to a Subnetwork resource in GCP. It can be specified - in two ways. You can add `register: name-of-resource` to a gcp_compute_subnetwork - task and then set this subnetwork field to "{{ name-of-resource }}" Alternatively, - you can set this subnetwork to a dictionary with the selfLink key where the - value is the selfLink of your Subnetwork' + in two ways. First, you can place in the selfLink of the resource here as a + string Alternatively, you can add `register: name-of-resource` to a gcp_compute_subnetwork + task and then set this subnetwork field to "{{ name-of-resource }}"' required: false zone: description: @@ -191,7 +189,7 @@ description: - The network to which all instances in the instance group belong. returned: success - type: dict + type: str region: description: - The region where the instance group is located (for regional resources). @@ -201,7 +199,7 @@ description: - The subnetwork to which all instances in the instance group belong. returned: success - type: dict + type: str zone: description: - A reference to the zone where the instance group resides. @@ -244,11 +242,11 @@ def main(): name=dict(type='str'), port=dict(type='int') )), - network=dict(type='dict'), + network=dict(), region=dict(type='str'), - subnetwork=dict(type='dict'), + subnetwork=dict(), zone=dict(required=True, type='str'), - instances=dict(type='list', elements='dict') + instances=dict(type='list') ) ) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_instance_group_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_instance_group_facts.py index e634572c88c9e0..19b55fc5d1c99d 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_instance_group_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_instance_group_facts.py @@ -118,7 +118,7 @@ description: - The network to which all instances in the instance group belong. returned: success - type: dict + type: str region: description: - The region where the instance group is located (for regional resources). @@ -128,7 +128,7 @@ description: - The subnetwork to which all instances in the instance group belong. returned: success - type: dict + type: str zone: description: - A reference to the zone where the instance group resides. diff --git a/lib/ansible/modules/cloud/google/gcp_compute_instance_group_manager.py b/lib/ansible/modules/cloud/google/gcp_compute_instance_group_manager.py index d2b05b93dc55e5..77071a39bf977f 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_instance_group_manager.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_instance_group_manager.py @@ -71,10 +71,10 @@ group uses this template to create all new instances in the managed instance group. - 'This field represents a link to a InstanceTemplate resource in GCP. It can - be specified in two ways. You can add `register: name-of-resource` to a gcp_compute_instance_template - task and then set this instance_template field to "{{ name-of-resource }}" Alternatively, - you can set this instance_template to a dictionary with the selfLink key where - the value is the selfLink of your InstanceTemplate' + be specified in two ways. First, you can place in the selfLink of the resource + here as a string Alternatively, you can add `register: name-of-resource` to + a gcp_compute_instance_template task and then set this instance_template field + to "{{ name-of-resource }}"' required: true name: description: @@ -262,13 +262,13 @@ description: - The instance group being managed. returned: success - type: dict + type: str instanceTemplate: description: - The instance template that is specified for this managed instance group. The group uses this template to create all new instances in the managed instance group. returned: success - type: dict + type: str name: description: - The name of the managed instance group. The name must be 1-63 characters long, @@ -340,13 +340,13 @@ def main(): state=dict(default='present', choices=['present', 'absent'], type='str'), base_instance_name=dict(required=True, type='str'), description=dict(type='str'), - instance_template=dict(required=True, type='dict'), + instance_template=dict(required=True), name=dict(required=True, type='str'), named_ports=dict(type='list', elements='dict', options=dict( name=dict(type='str'), port=dict(type='int') )), - target_pools=dict(type='list', elements='dict'), + target_pools=dict(type='list'), target_size=dict(type='int'), zone=dict(required=True, type='str') ) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_instance_group_manager_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_instance_group_manager_facts.py index 243c41335a305a..e7914577e3bdd8 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_instance_group_manager_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_instance_group_manager_facts.py @@ -162,14 +162,14 @@ description: - The instance group being managed. returned: success - type: dict + type: str instanceTemplate: description: - The instance template that is specified for this managed instance group. The group uses this template to create all new instances in the managed instance group. returned: success - type: dict + type: str name: description: - The name of the managed instance group. The name must be 1-63 characters long, diff --git a/lib/ansible/modules/cloud/google/gcp_compute_instance_template.py b/lib/ansible/modules/cloud/google/gcp_compute_instance_template.py index e4ed9770dd7919..9f6da929c3f576 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_instance_template.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_instance_template.py @@ -212,10 +212,10 @@ - Note that for InstanceTemplate, specify the disk name, not the URL for the disk. - 'This field represents a link to a Disk resource in GCP. It can be specified - in two ways. You can add `register: name-of-resource` to a gcp_compute_disk - task and then set this source field to "{{ name-of-resource }}" Alternatively, - you can set this source to a dictionary with the name key where the - value is the name of your Disk' + in two ways. First, you can place in the name of the resource here as + a string Alternatively, you can add `register: name-of-resource` to + a gcp_compute_disk task and then set this source field to "{{ name-of-resource + }}"' required: false type: description: @@ -284,11 +284,10 @@ IP address pool. If you specify a static external IP address, it must live in the same region as the zone of the instance. - 'This field represents a link to a Address resource in GCP. It can - be specified in two ways. You can add `register: name-of-resource` - to a gcp_compute_address task and then set this nat_ip field to - "{{ name-of-resource }}" Alternatively, you can set this nat_ip - to a dictionary with the address key where the value is the address - of your Address' + be specified in two ways. First, you can place in the address of + the resource here as a string Alternatively, you can add `register: + name-of-resource` to a gcp_compute_address task and then set this + nat_ip field to "{{ name-of-resource }}"' required: false type: description: @@ -329,10 +328,10 @@ default network global/networks/default is used; if the network is not specified but the subnetwork is specified, the network is inferred. - 'This field represents a link to a Network resource in GCP. It can be - specified in two ways. You can add `register: name-of-resource` to a - gcp_compute_network task and then set this network field to "{{ name-of-resource - }}" Alternatively, you can set this network to a dictionary with the - selfLink key where the value is the selfLink of your Network' + specified in two ways. First, you can place in the selfLink of the resource + here as a string Alternatively, you can add `register: name-of-resource` + to a gcp_compute_network task and then set this network field to "{{ + name-of-resource }}"' required: false network_ip: description: @@ -347,11 +346,10 @@ If the network is in auto subnet mode, providing the subnetwork is optional. If the network is in custom subnet mode, then this field should be specified. - 'This field represents a link to a Subnetwork resource in GCP. It can - be specified in two ways. You can add `register: name-of-resource` to - a gcp_compute_subnetwork task and then set this subnetwork field to - "{{ name-of-resource }}" Alternatively, you can set this subnetwork - to a dictionary with the selfLink key where the value is the selfLink - of your Subnetwork' + be specified in two ways. First, you can place in the selfLink of the + resource here as a string Alternatively, you can add `register: name-of-resource` + to a gcp_compute_subnetwork task and then set this subnetwork field + to "{{ name-of-resource }}"' required: false scheduling: description: @@ -644,7 +642,7 @@ - Note that for InstanceTemplate, specify the disk name, not the URL for the disk. returned: success - type: dict + type: str type: description: - Specifies the type of the disk, either SCRATCH or PERSISTENT. If not specified, @@ -717,7 +715,7 @@ IP address pool. If you specify a static external IP address, it must live in the same region as the zone of the instance. returned: success - type: dict + type: str type: description: - The type of configuration. The default and only option is ONE_TO_ONE_NAT. @@ -759,7 +757,7 @@ default network global/networks/default is used; if the network is not specified but the subnetwork is specified, the network is inferred. returned: success - type: dict + type: str networkIP: description: - An IPv4 internal network address to assign to the instance for this network @@ -774,7 +772,7 @@ If the network is in auto subnet mode, providing the subnetwork is optional. If the network is in custom subnet mode, then this field should be specified. returned: success - type: dict + type: str scheduling: description: - Sets the scheduling options for this instance. @@ -894,7 +892,7 @@ def main(): )), interface=dict(type='str', choices=['SCSI', 'NVME']), mode=dict(type='str', choices=['READ_WRITE', 'READ_ONLY']), - source=dict(type='dict'), + source=dict(), type=dict(type='str', choices=['SCRATCH', 'PERSISTENT']) )), machine_type=dict(required=True, type='str'), @@ -907,7 +905,7 @@ def main(): network_interfaces=dict(type='list', elements='dict', options=dict( access_configs=dict(type='list', elements='dict', options=dict( name=dict(required=True, type='str'), - nat_ip=dict(type='dict'), + nat_ip=dict(), type=dict(required=True, type='str', choices=['ONE_TO_ONE_NAT']) )), alias_ip_ranges=dict(type='list', elements='dict', options=dict( @@ -915,9 +913,9 @@ def main(): subnetwork_range_name=dict(type='str') )), name=dict(type='str'), - network=dict(type='dict'), + network=dict(), network_ip=dict(type='str'), - subnetwork=dict(type='dict') + subnetwork=dict() )), scheduling=dict(type='dict', options=dict( automatic_restart=dict(type='bool'), diff --git a/lib/ansible/modules/cloud/google/gcp_compute_instance_template_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_instance_template_facts.py index bc6eb9398759df..e12b12c8d345e1 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_instance_template_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_instance_template_facts.py @@ -251,7 +251,7 @@ - Note that for InstanceTemplate, specify the disk name, not the URL for the disk. returned: success - type: dict + type: str type: description: - Specifies the type of the disk, either SCRATCH or PERSISTENT. If not @@ -327,7 +327,7 @@ ephemeral IP address pool. If you specify a static external IP address, it must live in the same region as the zone of the instance. returned: success - type: dict + type: str type: description: - The type of configuration. The default and only option is ONE_TO_ONE_NAT. @@ -371,7 +371,7 @@ the default network global/networks/default is used; if the network is not specified but the subnetwork is specified, the network is inferred. returned: success - type: dict + type: str networkIP: description: - An IPv4 internal network address to assign to the instance for this @@ -387,7 +387,7 @@ optional. If the network is in custom subnet mode, then this field should be specified. returned: success - type: dict + type: str scheduling: description: - Sets the scheduling options for this instance. diff --git a/lib/ansible/modules/cloud/google/gcp_compute_interconnect_attachment.py b/lib/ansible/modules/cloud/google/gcp_compute_interconnect_attachment.py index 0e0f130267ddd1..fbead26542e79d 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_interconnect_attachment.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_interconnect_attachment.py @@ -65,10 +65,9 @@ will automatically connect the Interconnect to the network & region within which the Cloud Router is configured. - 'This field represents a link to a Router resource in GCP. It can be specified - in two ways. You can add `register: name-of-resource` to a gcp_compute_router - task and then set this router field to "{{ name-of-resource }}" Alternatively, - you can set this router to a dictionary with the selfLink key where the value - is the selfLink of your Router' + in two ways. First, you can place in the selfLink of the resource here as a + string Alternatively, you can add `register: name-of-resource` to a gcp_compute_router + task and then set this router field to "{{ name-of-resource }}"' required: true name: description: @@ -150,7 +149,7 @@ automatically connect the Interconnect to the network & region within which the Cloud Router is configured. returned: success - type: dict + type: str creationTimestamp: description: - Creation timestamp in RFC3339 text format. @@ -200,7 +199,7 @@ def main(): state=dict(default='present', choices=['present', 'absent'], type='str'), interconnect=dict(required=True, type='str'), description=dict(type='str'), - router=dict(required=True, type='dict'), + router=dict(required=True), name=dict(required=True, type='str'), region=dict(required=True, type='str') ) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_interconnect_attachment_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_interconnect_attachment_facts.py index 3f8d3dcea4f61f..7a62962bd7da4b 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_interconnect_attachment_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_interconnect_attachment_facts.py @@ -119,7 +119,7 @@ will automatically connect the Interconnect to the network & region within which the Cloud Router is configured. returned: success - type: dict + type: str creationTimestamp: description: - Creation timestamp in RFC3339 text format. diff --git a/lib/ansible/modules/cloud/google/gcp_compute_region_disk.py b/lib/ansible/modules/cloud/google/gcp_compute_region_disk.py index 4b35852e88fb1c..378a6aa1cb3d0c 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_region_disk.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_region_disk.py @@ -129,10 +129,9 @@ - The source snapshot used to create this disk. You can provide this as a partial or full URL to the resource. - 'This field represents a link to a Snapshot resource in GCP. It can be specified - in two ways. You can add `register: name-of-resource` to a gcp_compute_snapshot - task and then set this source_snapshot field to "{{ name-of-resource }}" Alternatively, - you can set this source_snapshot to a dictionary with the selfLink key where - the value is the selfLink of your Snapshot' + in two ways. First, you can place in the selfLink of the resource here as a + string Alternatively, you can add `register: name-of-resource` to a gcp_compute_snapshot + task and then set this source_snapshot field to "{{ name-of-resource }}"' required: false source_snapshot_encryption_key: description: @@ -288,7 +287,7 @@ - The source snapshot used to create this disk. You can provide this as a partial or full URL to the resource. returned: success - type: dict + type: str sourceSnapshotEncryptionKey: description: - The customer-supplied encryption key of the source snapshot. Required if the source @@ -351,7 +350,7 @@ def main(): raw_key=dict(type='str'), sha256=dict(type='str') )), - source_snapshot=dict(type='dict'), + source_snapshot=dict(), source_snapshot_encryption_key=dict(type='dict', options=dict( raw_key=dict(type='str'), sha256=dict(type='str') diff --git a/lib/ansible/modules/cloud/google/gcp_compute_region_disk_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_region_disk_facts.py index 6d13a1eb7aaf89..69b3cb56b71d73 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_region_disk_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_region_disk_facts.py @@ -185,7 +185,7 @@ - The source snapshot used to create this disk. You can provide this as a partial or full URL to the resource. returned: success - type: dict + type: str sourceSnapshotEncryptionKey: description: - The customer-supplied encryption key of the source snapshot. Required if the diff --git a/lib/ansible/modules/cloud/google/gcp_compute_route.py b/lib/ansible/modules/cloud/google/gcp_compute_route.py index 703bd66ccc8a79..6638bf663a2234 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_route.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_route.py @@ -87,10 +87,9 @@ description: - The network that this route applies to. - 'This field represents a link to a Network resource in GCP. It can be specified - in two ways. You can add `register: name-of-resource` to a gcp_compute_network - task and then set this network field to "{{ name-of-resource }}" Alternatively, - you can set this network to a dictionary with the selfLink key where the value - is the selfLink of your Network' + in two ways. First, you can place in the selfLink of the resource here as a + string Alternatively, you can add `register: name-of-resource` to a gcp_compute_network + task and then set this network field to "{{ name-of-resource }}"' required: true priority: description: @@ -185,7 +184,7 @@ description: - The network that this route applies to. returned: success - type: dict + type: str priority: description: - The priority of this route. Priority is used to break ties in cases where there @@ -256,7 +255,7 @@ def main(): dest_range=dict(required=True, type='str'), description=dict(type='str'), name=dict(required=True, type='str'), - network=dict(required=True, type='dict'), + network=dict(required=True), priority=dict(type='int'), tags=dict(type='list', elements='str'), next_hop_gateway=dict(type='str'), diff --git a/lib/ansible/modules/cloud/google/gcp_compute_route_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_route_facts.py index 2e7f0dd2f4b66f..f4a487073ca025 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_route_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_route_facts.py @@ -91,7 +91,7 @@ description: - The network that this route applies to. returned: success - type: dict + type: str priority: description: - The priority of this route. Priority is used to break ties in cases where diff --git a/lib/ansible/modules/cloud/google/gcp_compute_router.py b/lib/ansible/modules/cloud/google/gcp_compute_router.py index 460371fb5274a7..6d8a9dc197b052 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_router.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_router.py @@ -64,10 +64,9 @@ description: - A reference to the network to which this router belongs. - 'This field represents a link to a Network resource in GCP. It can be specified - in two ways. You can add `register: name-of-resource` to a gcp_compute_network - task and then set this network field to "{{ name-of-resource }}" Alternatively, - you can set this network to a dictionary with the selfLink key where the value - is the selfLink of your Network' + in two ways. First, you can place in the selfLink of the resource here as a + string Alternatively, you can add `register: name-of-resource` to a gcp_compute_network + task and then set this network field to "{{ name-of-resource }}"' required: true bgp: description: @@ -183,7 +182,7 @@ description: - A reference to the network to which this router belongs. returned: success - type: dict + type: str bgp: description: - BGP information specific to this router. @@ -260,7 +259,7 @@ def main(): state=dict(default='present', choices=['present', 'absent'], type='str'), name=dict(required=True, type='str'), description=dict(type='str'), - network=dict(required=True, type='dict'), + network=dict(required=True), bgp=dict(type='dict', options=dict( asn=dict(required=True, type='int'), advertise_mode=dict(default='DEFAULT', type='str', choices=['DEFAULT', 'CUSTOM']), diff --git a/lib/ansible/modules/cloud/google/gcp_compute_router_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_router_facts.py index 50f61da2c1f5d7..2e9a5f4d94fb86 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_router_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_router_facts.py @@ -98,7 +98,7 @@ description: - A reference to the network to which this router belongs. returned: success - type: dict + type: str bgp: description: - BGP information specific to this router. diff --git a/lib/ansible/modules/cloud/google/gcp_compute_subnetwork.py b/lib/ansible/modules/cloud/google/gcp_compute_subnetwork.py index b56c5b69b91101..42d18bc7f5c25f 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_subnetwork.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_subnetwork.py @@ -90,10 +90,9 @@ - The network this subnet belongs to. - Only networks that are in the distributed mode can have subnetworks. - 'This field represents a link to a Network resource in GCP. It can be specified - in two ways. You can add `register: name-of-resource` to a gcp_compute_network - task and then set this network field to "{{ name-of-resource }}" Alternatively, - you can set this network to a dictionary with the selfLink key where the value - is the selfLink of your Network' + in two ways. First, you can place in the selfLink of the resource here as a + string Alternatively, you can add `register: name-of-resource` to a gcp_compute_network + task and then set this network field to "{{ name-of-resource }}"' required: true enable_flow_logs: description: @@ -208,7 +207,7 @@ - The network this subnet belongs to. - Only networks that are in the distributed mode can have subnetworks. returned: success - type: dict + type: str enableFlowLogs: description: - Whether to enable flow logging for this subnetwork. @@ -278,7 +277,7 @@ def main(): description=dict(type='str'), ip_cidr_range=dict(required=True, type='str'), name=dict(required=True, type='str'), - network=dict(required=True, type='dict'), + network=dict(required=True), enable_flow_logs=dict(type='bool'), secondary_ip_ranges=dict(type='list', elements='dict', options=dict( range_name=dict(required=True, type='str'), diff --git a/lib/ansible/modules/cloud/google/gcp_compute_subnetwork_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_subnetwork_facts.py index e6aa384bebd5dc..4cda40c2e4644c 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_subnetwork_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_subnetwork_facts.py @@ -115,7 +115,7 @@ - The network this subnet belongs to. - Only networks that are in the distributed mode can have subnetworks. returned: success - type: dict + type: str enableFlowLogs: description: - Whether to enable flow logging for this subnetwork. diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_http_proxy.py b/lib/ansible/modules/cloud/google/gcp_compute_target_http_proxy.py index 5dcd1864506dfa..7d99f19d4262fb 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_http_proxy.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_http_proxy.py @@ -67,10 +67,9 @@ - A reference to the UrlMap resource that defines the mapping from URL to the BackendService. - 'This field represents a link to a UrlMap resource in GCP. It can be specified - in two ways. You can add `register: name-of-resource` to a gcp_compute_url_map - task and then set this url_map field to "{{ name-of-resource }}" Alternatively, - you can set this url_map to a dictionary with the selfLink key where the value - is the selfLink of your UrlMap' + in two ways. First, you can place in the selfLink of the resource here as a + string Alternatively, you can add `register: name-of-resource` to a gcp_compute_url_map + task and then set this url_map field to "{{ name-of-resource }}"' required: true extends_documentation_fragment: gcp notes: @@ -166,7 +165,7 @@ description: - A reference to the UrlMap resource that defines the mapping from URL to the BackendService. returned: success - type: dict + type: str ''' ################################################################################ @@ -190,7 +189,7 @@ def main(): state=dict(default='present', choices=['present', 'absent'], type='str'), description=dict(type='str'), name=dict(required=True, type='str'), - url_map=dict(required=True, type='dict') + url_map=dict(required=True) ) ) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_http_proxy_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_target_http_proxy_facts.py index 7a558e0d9b078a..81df87fdd38b0b 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_http_proxy_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_http_proxy_facts.py @@ -95,7 +95,7 @@ - A reference to the UrlMap resource that defines the mapping from URL to the BackendService. returned: success - type: dict + type: str ''' ################################################################################ diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_https_proxy.py b/lib/ansible/modules/cloud/google/gcp_compute_target_https_proxy.py index c9882dcb95a722..0cc6706f8e39e3 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_https_proxy.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_https_proxy.py @@ -87,10 +87,9 @@ resource. If not set, the TargetHttpsProxy resource will not have any SSL policy configured. - 'This field represents a link to a SslPolicy resource in GCP. It can be specified - in two ways. You can add `register: name-of-resource` to a gcp_compute_ssl_policy - task and then set this ssl_policy field to "{{ name-of-resource }}" Alternatively, - you can set this ssl_policy to a dictionary with the selfLink key where the - value is the selfLink of your SslPolicy' + in two ways. First, you can place in the selfLink of the resource here as a + string Alternatively, you can add `register: name-of-resource` to a gcp_compute_ssl_policy + task and then set this ssl_policy field to "{{ name-of-resource }}"' required: false version_added: 2.8 url_map: @@ -98,10 +97,9 @@ - A reference to the UrlMap resource that defines the mapping from URL to the BackendService. - 'This field represents a link to a UrlMap resource in GCP. It can be specified - in two ways. You can add `register: name-of-resource` to a gcp_compute_url_map - task and then set this url_map field to "{{ name-of-resource }}" Alternatively, - you can set this url_map to a dictionary with the selfLink key where the value - is the selfLink of your UrlMap' + in two ways. First, you can place in the selfLink of the resource here as a + string Alternatively, you can add `register: name-of-resource` to a gcp_compute_url_map + task and then set this url_map field to "{{ name-of-resource }}"' required: true extends_documentation_fragment: gcp notes: @@ -250,12 +248,12 @@ resource. If not set, the TargetHttpsProxy resource will not have any SSL policy configured. returned: success - type: dict + type: str urlMap: description: - A reference to the UrlMap resource that defines the mapping from URL to the BackendService. returned: success - type: dict + type: str ''' ################################################################################ @@ -280,9 +278,9 @@ def main(): description=dict(type='str'), name=dict(required=True, type='str'), quic_override=dict(type='str', choices=['NONE', 'ENABLE', 'DISABLE']), - ssl_certificates=dict(required=True, type='list', elements='dict'), - ssl_policy=dict(type='dict'), - url_map=dict(required=True, type='dict') + ssl_certificates=dict(required=True, type='list'), + ssl_policy=dict(), + url_map=dict(required=True) ) ) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_https_proxy_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_target_https_proxy_facts.py index 5cfb46bfc0f61c..ab15ad25a38c2f 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_https_proxy_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_https_proxy_facts.py @@ -112,13 +112,13 @@ resource. If not set, the TargetHttpsProxy resource will not have any SSL policy configured. returned: success - type: dict + type: str urlMap: description: - A reference to the UrlMap resource that defines the mapping from URL to the BackendService. returned: success - type: dict + type: str ''' ################################################################################ diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_pool.py b/lib/ansible/modules/cloud/google/gcp_compute_target_pool.py index ddb94fccd25863..237b90fd842335 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_pool.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_pool.py @@ -62,10 +62,9 @@ pool in the "force" mode, where traffic will be spread to the healthy instances with the best effort, or to all instances when no instance is healthy. - 'This field represents a link to a TargetPool resource in GCP. It can be specified - in two ways. You can add `register: name-of-resource` to a gcp_compute_target_pool - task and then set this backup_pool field to "{{ name-of-resource }}" Alternatively, - you can set this backup_pool to a dictionary with the selfLink key where the - value is the selfLink of your TargetPool' + in two ways. First, you can place in the selfLink of the resource here as a + string Alternatively, you can add `register: name-of-resource` to a gcp_compute_target_pool + task and then set this backup_pool field to "{{ name-of-resource }}"' required: false description: description: @@ -92,10 +91,10 @@ checks pass. If not specified it means all member instances will be considered healthy at all times. - 'This field represents a link to a HttpHealthCheck resource in GCP. It can be - specified in two ways. You can add `register: name-of-resource` to a gcp_compute_http_health_check - task and then set this health_check field to "{{ name-of-resource }}" Alternatively, - you can set this health_check to a dictionary with the selfLink key where the - value is the selfLink of your HttpHealthCheck' + specified in two ways. First, you can place in the selfLink of the resource + here as a string Alternatively, you can add `register: name-of-resource` to + a gcp_compute_http_health_check task and then set this health_check field to + "{{ name-of-resource }}"' required: false instances: description: @@ -160,7 +159,7 @@ pool in the "force" mode, where traffic will be spread to the healthy instances with the best effort, or to all instances when no instance is healthy. returned: success - type: dict + type: str creationTimestamp: description: - Creation timestamp in RFC3339 text format. @@ -193,7 +192,7 @@ checks pass. If not specified it means all member instances will be considered healthy at all times. returned: success - type: dict + type: str id: description: - The unique identifier for the resource. @@ -251,11 +250,11 @@ def main(): module = GcpModule( argument_spec=dict( state=dict(default='present', choices=['present', 'absent'], type='str'), - backup_pool=dict(type='dict'), + backup_pool=dict(), description=dict(type='str'), failover_ratio=dict(type='str'), - health_check=dict(type='dict'), - instances=dict(type='list', elements='dict'), + health_check=dict(), + instances=dict(type='list'), name=dict(required=True, type='str'), session_affinity=dict(type='str', choices=['NONE', 'CLIENT_IP', 'CLIENT_IP_PROTO']), region=dict(required=True, type='str') diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_pool_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_target_pool_facts.py index 47db6275023123..17ca81e2706af7 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_pool_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_pool_facts.py @@ -84,7 +84,7 @@ primary pool in the "force" mode, where traffic will be spread to the healthy instances with the best effort, or to all instances when no instance is healthy. returned: success - type: dict + type: str creationTimestamp: description: - Creation timestamp in RFC3339 text format. @@ -117,7 +117,7 @@ checks pass. If not specified it means all member instances will be considered healthy at all times. returned: success - type: dict + type: str id: description: - The unique identifier for the resource. diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_ssl_proxy.py b/lib/ansible/modules/cloud/google/gcp_compute_target_ssl_proxy.py index 032d57ab6de6e4..8547cd9364f9d0 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_ssl_proxy.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_ssl_proxy.py @@ -74,10 +74,10 @@ description: - A reference to the BackendService resource. - 'This field represents a link to a BackendService resource in GCP. It can be - specified in two ways. You can add `register: name-of-resource` to a gcp_compute_backend_service - task and then set this service field to "{{ name-of-resource }}" Alternatively, - you can set this service to a dictionary with the selfLink key where the value - is the selfLink of your BackendService' + specified in two ways. First, you can place in the selfLink of the resource + here as a string Alternatively, you can add `register: name-of-resource` to + a gcp_compute_backend_service task and then set this service field to "{{ name-of-resource + }}"' required: true ssl_certificates: description: @@ -91,10 +91,9 @@ resource. If not set, the TargetSslProxy resource will not have any SSL policy configured. - 'This field represents a link to a SslPolicy resource in GCP. It can be specified - in two ways. You can add `register: name-of-resource` to a gcp_compute_ssl_policy - task and then set this ssl_policy field to "{{ name-of-resource }}" Alternatively, - you can set this ssl_policy to a dictionary with the selfLink key where the - value is the selfLink of your SslPolicy' + in two ways. First, you can place in the selfLink of the resource here as a + string Alternatively, you can add `register: name-of-resource` to a gcp_compute_ssl_policy + task and then set this ssl_policy field to "{{ name-of-resource }}"' required: false version_added: 2.8 extends_documentation_fragment: gcp @@ -227,7 +226,7 @@ description: - A reference to the BackendService resource. returned: success - type: dict + type: str sslCertificates: description: - A list of SslCertificate resources that are used to authenticate connections between @@ -240,7 +239,7 @@ resource. If not set, the TargetSslProxy resource will not have any SSL policy configured. returned: success - type: dict + type: str ''' ################################################################################ @@ -265,9 +264,9 @@ def main(): description=dict(type='str'), name=dict(required=True, type='str'), proxy_header=dict(type='str', choices=['NONE', 'PROXY_V1']), - service=dict(required=True, type='dict'), - ssl_certificates=dict(required=True, type='list', elements='dict'), - ssl_policy=dict(type='dict') + service=dict(required=True), + ssl_certificates=dict(required=True, type='list'), + ssl_policy=dict() ) ) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_ssl_proxy_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_target_ssl_proxy_facts.py index 69b2fbadcb62cb..193ae7982f5010 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_ssl_proxy_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_ssl_proxy_facts.py @@ -100,7 +100,7 @@ description: - A reference to the BackendService resource. returned: success - type: dict + type: str sslCertificates: description: - A list of SslCertificate resources that are used to authenticate connections @@ -114,7 +114,7 @@ resource. If not set, the TargetSslProxy resource will not have any SSL policy configured. returned: success - type: dict + type: str ''' ################################################################################ diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_tcp_proxy.py b/lib/ansible/modules/cloud/google/gcp_compute_target_tcp_proxy.py index 41dcf2a5dde907..9614281fb0722e 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_tcp_proxy.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_tcp_proxy.py @@ -74,10 +74,10 @@ description: - A reference to the BackendService resource. - 'This field represents a link to a BackendService resource in GCP. It can be - specified in two ways. You can add `register: name-of-resource` to a gcp_compute_backend_service - task and then set this service field to "{{ name-of-resource }}" Alternatively, - you can set this service to a dictionary with the selfLink key where the value - is the selfLink of your BackendService' + specified in two ways. First, you can place in the selfLink of the resource + here as a string Alternatively, you can add `register: name-of-resource` to + a gcp_compute_backend_service task and then set this service field to "{{ name-of-resource + }}"' required: true extends_documentation_fragment: gcp notes: @@ -174,7 +174,7 @@ description: - A reference to the BackendService resource. returned: success - type: dict + type: str ''' ################################################################################ @@ -199,7 +199,7 @@ def main(): description=dict(type='str'), name=dict(required=True, type='str'), proxy_header=dict(type='str', choices=['NONE', 'PROXY_V1']), - service=dict(required=True, type='dict') + service=dict(required=True) ) ) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_tcp_proxy_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_target_tcp_proxy_facts.py index cf6ca10f8db559..f29c7e7332653e 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_tcp_proxy_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_tcp_proxy_facts.py @@ -100,7 +100,7 @@ description: - A reference to the BackendService resource. returned: success - type: dict + type: str ''' ################################################################################ diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_vpn_gateway.py b/lib/ansible/modules/cloud/google/gcp_compute_target_vpn_gateway.py index 68721994a1594c..f54c3f6c468e4d 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_vpn_gateway.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_vpn_gateway.py @@ -66,10 +66,9 @@ description: - The network this VPN gateway is accepting traffic for. - 'This field represents a link to a Network resource in GCP. It can be specified - in two ways. You can add `register: name-of-resource` to a gcp_compute_network - task and then set this network field to "{{ name-of-resource }}" Alternatively, - you can set this network to a dictionary with the selfLink key where the value - is the selfLink of your Network' + in two ways. First, you can place in the selfLink of the resource here as a + string Alternatively, you can add `register: name-of-resource` to a gcp_compute_network + task and then set this network field to "{{ name-of-resource }}"' required: true region: description: @@ -141,7 +140,7 @@ description: - The network this VPN gateway is accepting traffic for. returned: success - type: dict + type: str tunnels: description: - A list of references to VpnTunnel resources associated to this VPN gateway. @@ -180,7 +179,7 @@ def main(): state=dict(default='present', choices=['present', 'absent'], type='str'), description=dict(type='str'), name=dict(required=True, type='str'), - network=dict(required=True, type='dict'), + network=dict(required=True), region=dict(required=True, type='str') ) ) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_vpn_gateway_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_target_vpn_gateway_facts.py index 2abbdcc6d4427f..47a5ebb8a9058f 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_vpn_gateway_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_vpn_gateway_facts.py @@ -99,7 +99,7 @@ description: - The network this VPN gateway is accepting traffic for. returned: success - type: dict + type: str tunnels: description: - A list of references to VpnTunnel resources associated to this VPN gateway. diff --git a/lib/ansible/modules/cloud/google/gcp_compute_url_map.py b/lib/ansible/modules/cloud/google/gcp_compute_url_map.py index fb557206db05fd..ddc027bcf997c7 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_url_map.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_url_map.py @@ -53,10 +53,10 @@ description: - A reference to BackendService resource if none of the hostRules match. - 'This field represents a link to a BackendService resource in GCP. It can be - specified in two ways. You can add `register: name-of-resource` to a gcp_compute_backend_service - task and then set this default_service field to "{{ name-of-resource }}" Alternatively, - you can set this default_service to a dictionary with the selfLink key where - the value is the selfLink of your BackendService' + specified in two ways. First, you can place in the selfLink of the resource + here as a string Alternatively, you can add `register: name-of-resource` to + a gcp_compute_backend_service task and then set this default_service field to + "{{ name-of-resource }}"' required: true description: description: @@ -103,11 +103,10 @@ - A reference to a BackendService resource. This will be used if none of the pathRules defined by this PathMatcher is matched by the URL's path portion. - 'This field represents a link to a BackendService resource in GCP. It can - be specified in two ways. You can add `register: name-of-resource` to a - gcp_compute_backend_service task and then set this default_service field - to "{{ name-of-resource }}" Alternatively, you can set this default_service - to a dictionary with the selfLink key where the value is the selfLink of - your BackendService' + be specified in two ways. First, you can place in the selfLink of the resource + here as a string Alternatively, you can add `register: name-of-resource` + to a gcp_compute_backend_service task and then set this default_service + field to "{{ name-of-resource }}"' required: true description: description: @@ -133,11 +132,10 @@ description: - A reference to the BackendService resource if this rule is matched. - 'This field represents a link to a BackendService resource in GCP. It - can be specified in two ways. You can add `register: name-of-resource` - to a gcp_compute_backend_service task and then set this service field - to "{{ name-of-resource }}" Alternatively, you can set this service - to a dictionary with the selfLink key where the value is the selfLink - of your BackendService' + can be specified in two ways. First, you can place in the selfLink of + the resource here as a string Alternatively, you can add `register: + name-of-resource` to a gcp_compute_backend_service task and then set + this service field to "{{ name-of-resource }}"' required: true tests: description: @@ -162,10 +160,10 @@ - A reference to expected BackendService resource the given URL should be mapped to. - 'This field represents a link to a BackendService resource in GCP. It can - be specified in two ways. You can add `register: name-of-resource` to a - gcp_compute_backend_service task and then set this service field to "{{ - name-of-resource }}" Alternatively, you can set this service to a dictionary - with the selfLink key where the value is the selfLink of your BackendService' + be specified in two ways. First, you can place in the selfLink of the resource + here as a string Alternatively, you can add `register: name-of-resource` + to a gcp_compute_backend_service task and then set this service field to + "{{ name-of-resource }}"' required: true extends_documentation_fragment: gcp ''' @@ -228,7 +226,7 @@ description: - A reference to BackendService resource if none of the hostRules match. returned: success - type: dict + type: str description: description: - An optional description of this resource. Provide this property when you create @@ -292,7 +290,7 @@ - A reference to a BackendService resource. This will be used if none of the pathRules defined by this PathMatcher is matched by the URL's path portion. returned: success - type: dict + type: str description: description: - An optional description of this resource. @@ -321,7 +319,7 @@ description: - A reference to the BackendService resource if this rule is matched. returned: success - type: dict + type: str tests: description: - The list of expected URL mappings. Requests to update this UrlMap will succeed @@ -349,7 +347,7 @@ - A reference to expected BackendService resource the given URL should be mapped to. returned: success - type: dict + type: str ''' ################################################################################ @@ -371,7 +369,7 @@ def main(): module = GcpModule( argument_spec=dict( state=dict(default='present', choices=['present', 'absent'], type='str'), - default_service=dict(required=True, type='dict'), + default_service=dict(required=True), description=dict(type='str'), host_rules=dict(type='list', elements='dict', options=dict( description=dict(type='str'), @@ -380,19 +378,19 @@ def main(): )), name=dict(required=True, type='str'), path_matchers=dict(type='list', elements='dict', options=dict( - default_service=dict(required=True, type='dict'), + default_service=dict(required=True), description=dict(type='str'), name=dict(required=True, type='str'), path_rules=dict(type='list', elements='dict', options=dict( paths=dict(required=True, type='list', elements='str'), - service=dict(required=True, type='dict') + service=dict(required=True) )) )), tests=dict(type='list', elements='dict', options=dict( description=dict(type='str'), host=dict(required=True, type='str'), path=dict(required=True, type='str'), - service=dict(required=True, type='dict') + service=dict(required=True) )) ) ) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_url_map_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_url_map_facts.py index 9c9d6c5f3ca06c..a3125c71d5e4d8 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_url_map_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_url_map_facts.py @@ -74,7 +74,7 @@ description: - A reference to BackendService resource if none of the hostRules match. returned: success - type: dict + type: str description: description: - An optional description of this resource. Provide this property when you create @@ -139,7 +139,7 @@ the pathRules defined by this PathMatcher is matched by the URL's path portion. returned: success - type: dict + type: str description: description: - An optional description of this resource. @@ -168,7 +168,7 @@ description: - A reference to the BackendService resource if this rule is matched. returned: success - type: dict + type: str tests: description: - The list of expected URL mappings. Requests to update this UrlMap will succeed @@ -196,7 +196,7 @@ - A reference to expected BackendService resource the given URL should be mapped to. returned: success - type: dict + type: str ''' ################################################################################ diff --git a/lib/ansible/modules/cloud/google/gcp_compute_vpn_tunnel.py b/lib/ansible/modules/cloud/google/gcp_compute_vpn_tunnel.py index 76d023059f599a..b694fae62b68dc 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_vpn_tunnel.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_vpn_tunnel.py @@ -64,19 +64,18 @@ description: - URL of the Target VPN gateway with which this VPN tunnel is associated. - 'This field represents a link to a TargetVpnGateway resource in GCP. It can - be specified in two ways. You can add `register: name-of-resource` to a gcp_compute_target_vpn_gateway - task and then set this target_vpn_gateway field to "{{ name-of-resource }}" - Alternatively, you can set this target_vpn_gateway to a dictionary with the - selfLink key where the value is the selfLink of your TargetVpnGateway' + be specified in two ways. First, you can place in the selfLink of the resource + here as a string Alternatively, you can add `register: name-of-resource` to + a gcp_compute_target_vpn_gateway task and then set this target_vpn_gateway field + to "{{ name-of-resource }}"' required: true router: description: - URL of router resource to be used for dynamic routing. - 'This field represents a link to a Router resource in GCP. It can be specified - in two ways. You can add `register: name-of-resource` to a gcp_compute_router - task and then set this router field to "{{ name-of-resource }}" Alternatively, - you can set this router to a dictionary with the selfLink key where the value - is the selfLink of your Router' + in two ways. First, you can place in the selfLink of the resource here as a + string Alternatively, you can add `register: name-of-resource` to a gcp_compute_router + task and then set this router field to "{{ name-of-resource }}"' required: false peer_ip: description: @@ -199,12 +198,12 @@ description: - URL of the Target VPN gateway with which this VPN tunnel is associated. returned: success - type: dict + type: str router: description: - URL of router resource to be used for dynamic routing. returned: success - type: dict + type: str peerIp: description: - IP address of the peer VPN gateway. Only IPv4 is supported. @@ -282,8 +281,8 @@ def main(): state=dict(default='present', choices=['present', 'absent'], type='str'), name=dict(required=True, type='str'), description=dict(type='str'), - target_vpn_gateway=dict(required=True, type='dict'), - router=dict(type='dict'), + target_vpn_gateway=dict(required=True), + router=dict(), peer_ip=dict(required=True, type='str'), shared_secret=dict(required=True, type='str'), ike_version=dict(default=2, type='int'), diff --git a/lib/ansible/modules/cloud/google/gcp_compute_vpn_tunnel_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_vpn_tunnel_facts.py index 0141d1a82f66f5..d51235ecdfc1ee 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_vpn_tunnel_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_vpn_tunnel_facts.py @@ -93,12 +93,12 @@ description: - URL of the Target VPN gateway with which this VPN tunnel is associated. returned: success - type: dict + type: str router: description: - URL of router resource to be used for dynamic routing. returned: success - type: dict + type: str peerIp: description: - IP address of the peer VPN gateway. Only IPv4 is supported. diff --git a/lib/ansible/modules/cloud/google/gcp_container_node_pool.py b/lib/ansible/modules/cloud/google/gcp_container_node_pool.py index adaac831d57a66..d6cc42d6b7bbe8 100644 --- a/lib/ansible/modules/cloud/google/gcp_container_node_pool.py +++ b/lib/ansible/modules/cloud/google/gcp_container_node_pool.py @@ -204,10 +204,9 @@ description: - The cluster this node pool belongs to. - 'This field represents a link to a Cluster resource in GCP. It can be specified - in two ways. You can add `register: name-of-resource` to a gcp_container_cluster - task and then set this cluster field to "{{ name-of-resource }}" Alternatively, - you can set this cluster to a dictionary with the name key where the value is - the name of your Cluster' + in two ways. First, you can place in the name of the resource here as a string + Alternatively, you can add `register: name-of-resource` to a gcp_container_cluster + task and then set this cluster field to "{{ name-of-resource }}"' required: true zone: description: @@ -416,7 +415,7 @@ description: - The cluster this node pool belongs to. returned: success - type: dict + type: str zone: description: - The zone where the node pool is deployed. @@ -470,7 +469,7 @@ def main(): description=dict(type='str') )) )), - cluster=dict(required=True, type='dict'), + cluster=dict(required=True), zone=dict(required=True, type='str') ) ) diff --git a/lib/ansible/modules/cloud/google/gcp_container_node_pool_facts.py b/lib/ansible/modules/cloud/google/gcp_container_node_pool_facts.py index 343f7f8d3a61b1..48b33c2a2b9cab 100644 --- a/lib/ansible/modules/cloud/google/gcp_container_node_pool_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_container_node_pool_facts.py @@ -49,10 +49,9 @@ description: - The cluster this node pool belongs to. - 'This field represents a link to a Cluster resource in GCP. It can be specified - in two ways. You can add `register: name-of-resource` to a gcp_container_cluster - task and then set this cluster field to "{{ name-of-resource }}" Alternatively, - you can set this cluster to a dictionary with the name key where the value is - the name of your Cluster' + in two ways. First, you can place in the name of the resource here as a string + Alternatively, you can add `register: name-of-resource` to a gcp_container_cluster + task and then set this cluster field to "{{ name-of-resource }}"' required: true extends_documentation_fragment: gcp ''' @@ -249,7 +248,7 @@ description: - The cluster this node pool belongs to. returned: success - type: dict + type: str zone: description: - The zone where the node pool is deployed. @@ -272,7 +271,7 @@ def main(): module = GcpModule( argument_spec=dict( zone=dict(required=True, type='str'), - cluster=dict(required=True, type='dict') + cluster=dict(required=True) ) ) diff --git a/lib/ansible/modules/cloud/google/gcp_dns_resource_record_set.py b/lib/ansible/modules/cloud/google/gcp_dns_resource_record_set.py index fd933ed6aae6a9..e57770486c9d57 100644 --- a/lib/ansible/modules/cloud/google/gcp_dns_resource_record_set.py +++ b/lib/ansible/modules/cloud/google/gcp_dns_resource_record_set.py @@ -86,10 +86,9 @@ - Identifies the managed zone addressed by this request. - Can be the managed zone name or id. - 'This field represents a link to a ManagedZone resource in GCP. It can be specified - in two ways. You can add `register: name-of-resource` to a gcp_dns_managed_zone - task and then set this managed_zone field to "{{ name-of-resource }}" Alternatively, - you can set this managed_zone to a dictionary with the name key where the value - is the name of your ManagedZone' + in two ways. First, you can place in the name of the resource here as a string + Alternatively, you can add `register: name-of-resource` to a gcp_dns_managed_zone + task and then set this managed_zone field to "{{ name-of-resource }}"' required: true extends_documentation_fragment: gcp ''' @@ -147,7 +146,7 @@ - Identifies the managed zone addressed by this request. - Can be the managed zone name or id. returned: success - type: dict + type: str ''' ################################################################################ @@ -175,7 +174,7 @@ def main(): type=dict(required=True, type='str', choices=['A', 'AAAA', 'CAA', 'CNAME', 'MX', 'NAPTR', 'NS', 'PTR', 'SOA', 'SPF', 'SRV', 'TXT']), ttl=dict(type='int'), target=dict(type='list', elements='str'), - managed_zone=dict(required=True, type='dict') + managed_zone=dict(required=True) ) ) diff --git a/lib/ansible/modules/cloud/google/gcp_dns_resource_record_set_facts.py b/lib/ansible/modules/cloud/google/gcp_dns_resource_record_set_facts.py index f5fd0c37cfe4f3..7727f87b5a78e6 100644 --- a/lib/ansible/modules/cloud/google/gcp_dns_resource_record_set_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_dns_resource_record_set_facts.py @@ -46,10 +46,9 @@ - Identifies the managed zone addressed by this request. - Can be the managed zone name or id. - 'This field represents a link to a ManagedZone resource in GCP. It can be specified - in two ways. You can add `register: name-of-resource` to a gcp_dns_managed_zone - task and then set this managed_zone field to "{{ name-of-resource }}" Alternatively, - you can set this managed_zone to a dictionary with the name key where the value - is the name of your ManagedZone' + in two ways. First, you can place in the name of the resource here as a string + Alternatively, you can add `register: name-of-resource` to a gcp_dns_managed_zone + task and then set this managed_zone field to "{{ name-of-resource }}"' required: true extends_documentation_fragment: gcp ''' @@ -94,7 +93,7 @@ - Identifies the managed zone addressed by this request. - Can be the managed zone name or id. returned: success - type: dict + type: str ''' ################################################################################ @@ -111,7 +110,7 @@ def main(): module = GcpModule( argument_spec=dict( - managed_zone=dict(required=True, type='dict') + managed_zone=dict(required=True) ) ) diff --git a/lib/ansible/modules/cloud/google/gcp_iam_service_account_key.py b/lib/ansible/modules/cloud/google/gcp_iam_service_account_key.py index a5882f6615f533..c84261539fe86e 100644 --- a/lib/ansible/modules/cloud/google/gcp_iam_service_account_key.py +++ b/lib/ansible/modules/cloud/google/gcp_iam_service_account_key.py @@ -68,10 +68,9 @@ description: - The name of the serviceAccount. - 'This field represents a link to a ServiceAccount resource in GCP. It can be - specified in two ways. You can add `register: name-of-resource` to a gcp_iam_service_account - task and then set this service_account field to "{{ name-of-resource }}" Alternatively, - you can set this service_account to a dictionary with the name key where the - value is the name of your ServiceAccount' + specified in two ways. First, you can place in the name of the resource here + as a string Alternatively, you can add `register: name-of-resource` to a gcp_iam_service_account + task and then set this service_account field to "{{ name-of-resource }}"' required: false path: description: @@ -144,7 +143,7 @@ description: - The name of the serviceAccount. returned: success - type: dict + type: str path: description: - The full name of the file that will hold the service account private key. The @@ -178,7 +177,7 @@ def main(): state=dict(default='present', choices=['present', 'absent'], type='str'), private_key_type=dict(type='str', choices=['TYPE_UNSPECIFIED', 'TYPE_PKCS12_FILE', 'TYPE_GOOGLE_CREDENTIALS_FILE']), key_algorithm=dict(type='str', choices=['KEY_ALG_UNSPECIFIED', 'KEY_ALG_RSA_1024', 'KEY_ALG_RSA_2048']), - service_account=dict(type='dict'), + service_account=dict(), path=dict(type='path') ) ) diff --git a/lib/ansible/modules/cloud/google/gcp_pubsub_subscription.py b/lib/ansible/modules/cloud/google/gcp_pubsub_subscription.py index 205738a25e1a54..157bc3a7224dd3 100644 --- a/lib/ansible/modules/cloud/google/gcp_pubsub_subscription.py +++ b/lib/ansible/modules/cloud/google/gcp_pubsub_subscription.py @@ -57,10 +57,9 @@ description: - A reference to a Topic resource. - 'This field represents a link to a Topic resource in GCP. It can be specified - in two ways. You can add `register: name-of-resource` to a gcp_pubsub_topic - task and then set this topic field to "{{ name-of-resource }}" Alternatively, - you can set this topic to a dictionary with the name key where the value is - the name of your Topic' + in two ways. First, you can place in the name of the resource here as a string + Alternatively, you can add `register: name-of-resource` to a gcp_pubsub_topic + task and then set this topic field to "{{ name-of-resource }}"' required: false push_config: description: @@ -125,7 +124,7 @@ description: - A reference to a Topic resource. returned: success - type: dict + type: str pushConfig: description: - If push delivery is used with this subscription, this field is used to configure @@ -179,7 +178,7 @@ def main(): argument_spec=dict( state=dict(default='present', choices=['present', 'absent'], type='str'), name=dict(type='str'), - topic=dict(type='dict'), + topic=dict(), push_config=dict(type='dict', options=dict( push_endpoint=dict(type='str') )), diff --git a/lib/ansible/modules/cloud/google/gcp_pubsub_subscription_facts.py b/lib/ansible/modules/cloud/google/gcp_pubsub_subscription_facts.py index ea1f16dd7dc137..50272b74c37c91 100644 --- a/lib/ansible/modules/cloud/google/gcp_pubsub_subscription_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_pubsub_subscription_facts.py @@ -67,7 +67,7 @@ description: - A reference to a Topic resource. returned: success - type: dict + type: str pushConfig: description: - If push delivery is used with this subscription, this field is used to configure diff --git a/lib/ansible/modules/cloud/google/gcp_spanner_database.py b/lib/ansible/modules/cloud/google/gcp_spanner_database.py index 00bf487c43c47e..1435fc4d87819b 100644 --- a/lib/ansible/modules/cloud/google/gcp_spanner_database.py +++ b/lib/ansible/modules/cloud/google/gcp_spanner_database.py @@ -65,10 +65,9 @@ description: - The instance to create the database on. - 'This field represents a link to a Instance resource in GCP. It can be specified - in two ways. You can add `register: name-of-resource` to a gcp_spanner_instance - task and then set this instance field to "{{ name-of-resource }}" Alternatively, - you can set this instance to a dictionary with the name key where the value - is the name of your Instance' + in two ways. First, you can place in the name of the resource here as a string + Alternatively, you can add `register: name-of-resource` to a gcp_spanner_instance + task and then set this instance field to "{{ name-of-resource }}"' required: true extends_documentation_fragment: gcp ''' @@ -118,7 +117,7 @@ description: - The instance to create the database on. returned: success - type: dict + type: str ''' ################################################################################ @@ -141,7 +140,7 @@ def main(): state=dict(default='present', choices=['present', 'absent'], type='str'), name=dict(type='str'), extra_statements=dict(type='list', elements='str'), - instance=dict(required=True, type='dict') + instance=dict(required=True) ) ) diff --git a/lib/ansible/modules/cloud/google/gcp_spanner_database_facts.py b/lib/ansible/modules/cloud/google/gcp_spanner_database_facts.py index 87e866a5e1b884..d781a9e9925585 100644 --- a/lib/ansible/modules/cloud/google/gcp_spanner_database_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_spanner_database_facts.py @@ -45,10 +45,9 @@ description: - The instance to create the database on. - 'This field represents a link to a Instance resource in GCP. It can be specified - in two ways. You can add `register: name-of-resource` to a gcp_spanner_instance - task and then set this instance field to "{{ name-of-resource }}" Alternatively, - you can set this instance to a dictionary with the name key where the value - is the name of your Instance' + in two ways. First, you can place in the name of the resource here as a string + Alternatively, you can add `register: name-of-resource` to a gcp_spanner_instance + task and then set this instance field to "{{ name-of-resource }}"' required: true extends_documentation_fragment: gcp ''' @@ -87,7 +86,7 @@ description: - The instance to create the database on. returned: success - type: dict + type: str ''' ################################################################################ @@ -104,7 +103,7 @@ def main(): module = GcpModule( argument_spec=dict( - instance=dict(required=True, type='dict') + instance=dict(required=True) ) ) diff --git a/lib/ansible/modules/cloud/google/gcp_sql_database.py b/lib/ansible/modules/cloud/google/gcp_sql_database.py index 5a1818104498be..d19b6c7865f831 100644 --- a/lib/ansible/modules/cloud/google/gcp_sql_database.py +++ b/lib/ansible/modules/cloud/google/gcp_sql_database.py @@ -65,10 +65,9 @@ description: - The name of the Cloud SQL instance. This does not include the project ID. - 'This field represents a link to a Instance resource in GCP. It can be specified - in two ways. You can add `register: name-of-resource` to a gcp_sql_instance - task and then set this instance field to "{{ name-of-resource }}" Alternatively, - you can set this instance to a dictionary with the name key where the value - is the name of your Instance' + in two ways. First, you can place in the name of the resource here as a string + Alternatively, you can add `register: name-of-resource` to a gcp_sql_instance + task and then set this instance field to "{{ name-of-resource }}"' required: true extends_documentation_fragment: gcp ''' @@ -122,7 +121,7 @@ description: - The name of the Cloud SQL instance. This does not include the project ID. returned: success - type: dict + type: str ''' ################################################################################ @@ -147,7 +146,7 @@ def main(): charset=dict(type='str'), collation=dict(type='str'), name=dict(type='str'), - instance=dict(required=True, type='dict') + instance=dict(required=True) ) ) diff --git a/lib/ansible/modules/cloud/google/gcp_sql_database_facts.py b/lib/ansible/modules/cloud/google/gcp_sql_database_facts.py index bebaf9cd732c6d..cc4e6bb9377c91 100644 --- a/lib/ansible/modules/cloud/google/gcp_sql_database_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_sql_database_facts.py @@ -45,10 +45,9 @@ description: - The name of the Cloud SQL instance. This does not include the project ID. - 'This field represents a link to a Instance resource in GCP. It can be specified - in two ways. You can add `register: name-of-resource` to a gcp_sql_instance - task and then set this instance field to "{{ name-of-resource }}" Alternatively, - you can set this instance to a dictionary with the name key where the value - is the name of your Instance' + in two ways. First, you can place in the name of the resource here as a string + Alternatively, you can add `register: name-of-resource` to a gcp_sql_instance + task and then set this instance field to "{{ name-of-resource }}"' required: true extends_documentation_fragment: gcp ''' @@ -88,7 +87,7 @@ description: - The name of the Cloud SQL instance. This does not include the project ID. returned: success - type: dict + type: str ''' ################################################################################ @@ -105,7 +104,7 @@ def main(): module = GcpModule( argument_spec=dict( - instance=dict(required=True, type='dict') + instance=dict(required=True) ) ) diff --git a/lib/ansible/modules/cloud/google/gcp_sql_user.py b/lib/ansible/modules/cloud/google/gcp_sql_user.py index 693c7465e9f297..54f7a4ff4b3d7a 100644 --- a/lib/ansible/modules/cloud/google/gcp_sql_user.py +++ b/lib/ansible/modules/cloud/google/gcp_sql_user.py @@ -62,10 +62,9 @@ description: - The name of the Cloud SQL instance. This does not include the project ID. - 'This field represents a link to a Instance resource in GCP. It can be specified - in two ways. You can add `register: name-of-resource` to a gcp_sql_instance - task and then set this instance field to "{{ name-of-resource }}" Alternatively, - you can set this instance to a dictionary with the name key where the value - is the name of your Instance' + in two ways. First, you can place in the name of the resource here as a string + Alternatively, you can add `register: name-of-resource` to a gcp_sql_instance + task and then set this instance field to "{{ name-of-resource }}"' required: true password: description: @@ -120,7 +119,7 @@ description: - The name of the Cloud SQL instance. This does not include the project ID. returned: success - type: dict + type: str password: description: - The password for the user. @@ -149,7 +148,7 @@ def main(): state=dict(default='present', choices=['present', 'absent'], type='str'), host=dict(required=True, type='str'), name=dict(required=True, type='str'), - instance=dict(required=True, type='dict'), + instance=dict(required=True), password=dict(type='str') ) ) diff --git a/lib/ansible/modules/cloud/google/gcp_sql_user_facts.py b/lib/ansible/modules/cloud/google/gcp_sql_user_facts.py index 9e89835b5e4993..462efcb22c396c 100644 --- a/lib/ansible/modules/cloud/google/gcp_sql_user_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_sql_user_facts.py @@ -45,10 +45,9 @@ description: - The name of the Cloud SQL instance. This does not include the project ID. - 'This field represents a link to a Instance resource in GCP. It can be specified - in two ways. You can add `register: name-of-resource` to a gcp_sql_instance - task and then set this instance field to "{{ name-of-resource }}" Alternatively, - you can set this instance to a dictionary with the name key where the value - is the name of your Instance' + in two ways. First, you can place in the name of the resource here as a string + Alternatively, you can add `register: name-of-resource` to a gcp_sql_instance + task and then set this instance field to "{{ name-of-resource }}"' required: true extends_documentation_fragment: gcp ''' @@ -84,7 +83,7 @@ description: - The name of the Cloud SQL instance. This does not include the project ID. returned: success - type: dict + type: str password: description: - The password for the user. @@ -106,7 +105,7 @@ def main(): module = GcpModule( argument_spec=dict( - instance=dict(required=True, type='dict') + instance=dict(required=True) ) ) diff --git a/lib/ansible/modules/cloud/google/gcp_storage_bucket.py b/lib/ansible/modules/cloud/google/gcp_storage_bucket.py index 3c00e92ad11b4a..6c432a9bd75059 100644 --- a/lib/ansible/modules/cloud/google/gcp_storage_bucket.py +++ b/lib/ansible/modules/cloud/google/gcp_storage_bucket.py @@ -62,10 +62,9 @@ description: - The name of the bucket. - 'This field represents a link to a Bucket resource in GCP. It can be specified - in two ways. You can add `register: name-of-resource` to a gcp_storage_bucket - task and then set this bucket field to "{{ name-of-resource }}" Alternatively, - you can set this bucket to a dictionary with the name key where the value - is the name of your Bucket' + in two ways. First, you can place in the name of the resource here as a + string Alternatively, you can add `register: name-of-resource` to a gcp_storage_bucket + task and then set this bucket field to "{{ name-of-resource }}"' required: true domain: description: @@ -154,10 +153,9 @@ description: - The name of the bucket. - 'This field represents a link to a Bucket resource in GCP. It can be specified - in two ways. You can add `register: name-of-resource` to a gcp_storage_bucket - task and then set this bucket field to "{{ name-of-resource }}" Alternatively, - you can set this bucket to a dictionary with the name key where the value - is the name of your Bucket' + in two ways. First, you can place in the name of the resource here as a + string Alternatively, you can add `register: name-of-resource` to a gcp_storage_bucket + task and then set this bucket field to "{{ name-of-resource }}"' required: true domain: description: @@ -415,7 +413,7 @@ description: - The name of the bucket. returned: success - type: dict + type: str domain: description: - The domain associated with the entity. @@ -509,7 +507,7 @@ description: - The name of the bucket. returned: success - type: dict + type: str domain: description: - The domain associated with the entity. @@ -793,7 +791,7 @@ def main(): argument_spec=dict( state=dict(default='present', choices=['present', 'absent'], type='str'), acl=dict(type='list', elements='dict', options=dict( - bucket=dict(required=True, type='dict'), + bucket=dict(required=True), domain=dict(type='str'), email=dict(type='str'), entity=dict(required=True, type='str'), @@ -812,7 +810,7 @@ def main(): response_header=dict(type='list', elements='str') )), default_object_acl=dict(type='list', elements='dict', options=dict( - bucket=dict(required=True, type='dict'), + bucket=dict(required=True), domain=dict(type='str'), email=dict(type='str'), entity=dict(required=True, type='str'), diff --git a/lib/ansible/modules/cloud/google/gcp_storage_bucket_access_control.py b/lib/ansible/modules/cloud/google/gcp_storage_bucket_access_control.py index c64b4a90a40887..6a7defa7a10600 100644 --- a/lib/ansible/modules/cloud/google/gcp_storage_bucket_access_control.py +++ b/lib/ansible/modules/cloud/google/gcp_storage_bucket_access_control.py @@ -61,10 +61,9 @@ description: - The name of the bucket. - 'This field represents a link to a Bucket resource in GCP. It can be specified - in two ways. You can add `register: name-of-resource` to a gcp_storage_bucket - task and then set this bucket field to "{{ name-of-resource }}" Alternatively, - you can set this bucket to a dictionary with the name key where the value is - the name of your Bucket' + in two ways. First, you can place in the name of the resource here as a string + Alternatively, you can add `register: name-of-resource` to a gcp_storage_bucket + task and then set this bucket field to "{{ name-of-resource }}"' required: true entity: description: @@ -133,7 +132,7 @@ description: - The name of the bucket. returned: success - type: dict + type: str domain: description: - The domain associated with the entity. @@ -205,7 +204,7 @@ def main(): module = GcpModule( argument_spec=dict( state=dict(default='present', choices=['present', 'absent'], type='str'), - bucket=dict(required=True, type='dict'), + bucket=dict(required=True), entity=dict(required=True, type='str'), entity_id=dict(type='str'), project_team=dict(type='dict', options=dict( From 8aff6fc91050d17bad53bbe50128fd3c2292d3f2 Mon Sep 17 00:00:00 2001 From: The Magician Date: Wed, 19 Dec 2018 13:23:16 -0800 Subject: [PATCH 079/144] Misc. typo fixes (#150) --- .../modules/cloud/google/gcp_compute_instance.py | 2 +- .../cloud/google/gcp_compute_instance_template.py | 2 +- .../modules/cloud/google/gcp_container_cluster.py | 4 ++-- .../cloud/google/gcp_container_cluster_facts.py | 2 +- .../modules/cloud/google/gcp_container_node_pool.py | 4 ++-- .../cloud/google/gcp_container_node_pool_facts.py | 2 +- lib/ansible/modules/cloud/google/gcp_sql_instance.py | 12 ++++++------ .../modules/cloud/google/gcp_sql_instance_facts.py | 6 +++--- 8 files changed, 17 insertions(+), 17 deletions(-) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_instance.py b/lib/ansible/modules/cloud/google/gcp_compute_instance.py index df0bd94769b782..3bc3dc23c68ce5 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_instance.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_instance.py @@ -1198,7 +1198,7 @@ def decode_response(response, module): return response -# TODO(alexstephen): Implement updating metadata on exsiting resources. +# TODO(alexstephen): Implement updating metadata on existing resources. # Expose instance 'metadata' as a simple name/value pair hash. However the API # defines metadata as a NestedObject with the following layout: diff --git a/lib/ansible/modules/cloud/google/gcp_compute_instance_template.py b/lib/ansible/modules/cloud/google/gcp_compute_instance_template.py index 9f6da929c3f576..680f8ced724191 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_instance_template.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_instance_template.py @@ -1118,7 +1118,7 @@ def decode_response(response, module): return response -# TODO(alexstephen): Implement updating metadata on exsiting resources. +# TODO(alexstephen): Implement updating metadata on existing resources. # Expose instance 'metadata' as a simple name/value pair hash. However the API # defines metadata as a NestedObject with the following layout: diff --git a/lib/ansible/modules/cloud/google/gcp_container_cluster.py b/lib/ansible/modules/cloud/google/gcp_container_cluster.py index 4e71d4363e33a0..3ed8cda9f40bf6 100644 --- a/lib/ansible/modules/cloud/google/gcp_container_cluster.py +++ b/lib/ansible/modules/cloud/google/gcp_container_cluster.py @@ -153,7 +153,7 @@ preemptible: description: - 'Whether the nodes are created as preemptible VM instances. See: U(https://cloud.google.com/compute/docs/instances/preemptible) - for more inforamtion about preemptible VM instances.' + for more information about preemptible VM instances.' required: false type: bool master_auth: @@ -403,7 +403,7 @@ preemptible: description: - 'Whether the nodes are created as preemptible VM instances. See: U(https://cloud.google.com/compute/docs/instances/preemptible) - for more inforamtion about preemptible VM instances.' + for more information about preemptible VM instances.' returned: success type: bool masterAuth: diff --git a/lib/ansible/modules/cloud/google/gcp_container_cluster_facts.py b/lib/ansible/modules/cloud/google/gcp_container_cluster_facts.py index c9db24c02b0142..db925dafc422ca 100644 --- a/lib/ansible/modules/cloud/google/gcp_container_cluster_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_container_cluster_facts.py @@ -181,7 +181,7 @@ preemptible: description: - 'Whether the nodes are created as preemptible VM instances. See: U(https://cloud.google.com/compute/docs/instances/preemptible) - for more inforamtion about preemptible VM instances.' + for more information about preemptible VM instances.' returned: success type: bool masterAuth: diff --git a/lib/ansible/modules/cloud/google/gcp_container_node_pool.py b/lib/ansible/modules/cloud/google/gcp_container_node_pool.py index d6cc42d6b7bbe8..a2c9fa3445d620 100644 --- a/lib/ansible/modules/cloud/google/gcp_container_node_pool.py +++ b/lib/ansible/modules/cloud/google/gcp_container_node_pool.py @@ -136,7 +136,7 @@ preemptible: description: - 'Whether the nodes are created as preemptible VM instances. See: U(https://cloud.google.com/compute/docs/instances/preemptible) - for more inforamtion about preemptible VM instances.' + for more information about preemptible VM instances.' required: false type: bool initial_node_count: @@ -335,7 +335,7 @@ preemptible: description: - 'Whether the nodes are created as preemptible VM instances. See: U(https://cloud.google.com/compute/docs/instances/preemptible) - for more inforamtion about preemptible VM instances.' + for more information about preemptible VM instances.' returned: success type: bool initialNodeCount: diff --git a/lib/ansible/modules/cloud/google/gcp_container_node_pool_facts.py b/lib/ansible/modules/cloud/google/gcp_container_node_pool_facts.py index 48b33c2a2b9cab..8f3eece3a675e7 100644 --- a/lib/ansible/modules/cloud/google/gcp_container_node_pool_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_container_node_pool_facts.py @@ -167,7 +167,7 @@ preemptible: description: - 'Whether the nodes are created as preemptible VM instances. See: U(https://cloud.google.com/compute/docs/instances/preemptible) - for more inforamtion about preemptible VM instances.' + for more information about preemptible VM instances.' returned: success type: bool initialNodeCount: diff --git a/lib/ansible/modules/cloud/google/gcp_sql_instance.py b/lib/ansible/modules/cloud/google/gcp_sql_instance.py index 7322d2bd7a36b4..df4a46ef75e993 100644 --- a/lib/ansible/modules/cloud/google/gcp_sql_instance.py +++ b/lib/ansible/modules/cloud/google/gcp_sql_instance.py @@ -87,7 +87,7 @@ description: - The availability status of the failover replica. A false status indicates that the failover replica is out of sync. The master can only failover to - the falover replica when the status is true. + the failover replica when the status is true. required: false type: bool name: @@ -163,8 +163,8 @@ required: false client_key: description: - - PEM representation of the slave's private key. The corresponsing public - key is encoded in the client's asf asd certificate. + - PEM representation of the slave's private key. The corresponding public + key is encoded in the client's certificate. required: false connect_retry_interval: description: @@ -320,7 +320,7 @@ description: - The availability status of the failover replica. A false status indicates that the failover replica is out of sync. The master can only failover to - the falover replica when the status is true. + the failover replica when the status is true. returned: success type: bool name: @@ -427,8 +427,8 @@ type: str clientKey: description: - - PEM representation of the slave's private key. The corresponsing public - key is encoded in the client's asf asd certificate. + - PEM representation of the slave's private key. The corresponding public + key is encoded in the client's certificate. returned: success type: str connectRetryInterval: diff --git a/lib/ansible/modules/cloud/google/gcp_sql_instance_facts.py b/lib/ansible/modules/cloud/google/gcp_sql_instance_facts.py index fdde60aabce84e..55842f9f72c660 100644 --- a/lib/ansible/modules/cloud/google/gcp_sql_instance_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_sql_instance_facts.py @@ -90,7 +90,7 @@ description: - The availability status of the failover replica. A false status indicates that the failover replica is out of sync. The master can only failover - to the falover replica when the status is true. + to the failover replica when the status is true. returned: success type: bool name: @@ -200,8 +200,8 @@ type: str clientKey: description: - - PEM representation of the slave's private key. The corresponsing public - key is encoded in the client's asf asd certificate. + - PEM representation of the slave's private key. The corresponding public + key is encoded in the client's certificate. returned: success type: str connectRetryInterval: From 9c530e9a9f4f82709b5b5b45fec3ea1f723d22df Mon Sep 17 00:00:00 2001 From: Dana Hoffman Date: Sat, 29 Dec 2018 01:05:05 +0000 Subject: [PATCH 080/144] add vpntunnel resourcerefs --- lib/ansible/modules/cloud/google/gcp_compute_route.py | 10 +++++++--- .../cloud/google/gcp_compute_target_vpn_gateway.py | 5 +++-- .../google/gcp_compute_target_vpn_gateway_facts.py | 6 +++--- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_route.py b/lib/ansible/modules/cloud/google/gcp_compute_route.py index 6638bf663a2234..b0c6d43d2249fe 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_route.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_route.py @@ -125,6 +125,10 @@ next_hop_vpn_tunnel: description: - URL to a VpnTunnel that should handle matching packets. + - 'This field represents a link to a VpnTunnel resource in GCP. It can be specified + in two ways. First, you can place in the selfLink of the resource here as a + string Alternatively, you can add `register: name-of-resource` to a gcp_compute_vpn_tunnel + task and then set this next_hop_vpn_tunnel field to "{{ name-of-resource }}"' required: false extends_documentation_fragment: gcp notes: @@ -261,7 +265,7 @@ def main(): next_hop_gateway=dict(type='str'), next_hop_instance=dict(type='str'), next_hop_ip=dict(type='str'), - next_hop_vpn_tunnel=dict(type='str') + next_hop_vpn_tunnel=dict() ) ) @@ -322,7 +326,7 @@ def resource_to_request(module): u'nextHopGateway': module.params.get('next_hop_gateway'), u'nextHopInstance': module.params.get('next_hop_instance'), u'nextHopIp': module.params.get('next_hop_ip'), - u'nextHopVpnTunnel': module.params.get('next_hop_vpn_tunnel') + u'nextHopVpnTunnel': replace_resource_dict(module.params.get(u'next_hop_vpn_tunnel', {}), 'selfLink') } return_vals = {} for k, v in request.items(): @@ -397,7 +401,7 @@ def response_to_hash(module, response): u'nextHopGateway': module.params.get('next_hop_gateway'), u'nextHopInstance': module.params.get('next_hop_instance'), u'nextHopIp': module.params.get('next_hop_ip'), - u'nextHopVpnTunnel': module.params.get('next_hop_vpn_tunnel'), + u'nextHopVpnTunnel': replace_resource_dict(module.params.get(u'next_hop_vpn_tunnel', {}), 'selfLink'), u'nextHopNetwork': response.get(u'nextHopNetwork') } diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_vpn_gateway.py b/lib/ansible/modules/cloud/google/gcp_compute_target_vpn_gateway.py index f54c3f6c468e4d..a9a9c9218e3bd0 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_vpn_gateway.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_vpn_gateway.py @@ -143,12 +143,13 @@ type: str tunnels: description: - - A list of references to VpnTunnel resources associated to this VPN gateway. + - A list of references to VpnTunnel resources associated with this VPN gateway. returned: success type: list forwardingRules: description: - - A list of references to the ForwardingRule resources associated to this VPN gateway. + - A list of references to the ForwardingRule resources associated with this VPN + gateway. returned: success type: list region: diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_vpn_gateway_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_target_vpn_gateway_facts.py index 47a5ebb8a9058f..b31ede95fb9021 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_vpn_gateway_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_vpn_gateway_facts.py @@ -102,13 +102,13 @@ type: str tunnels: description: - - A list of references to VpnTunnel resources associated to this VPN gateway. + - A list of references to VpnTunnel resources associated with this VPN gateway. returned: success type: list forwardingRules: description: - - A list of references to the ForwardingRule resources associated to this VPN - gateway. + - A list of references to the ForwardingRule resources associated with this + VPN gateway. returned: success type: list region: From 8263c829815ed1a05b60e90d787075cf959d7a23 Mon Sep 17 00:00:00 2001 From: The Magician Date: Wed, 2 Jan 2019 16:05:31 -0800 Subject: [PATCH 081/144] Initial addition of generated Image to Terraform. (#151) --- .../modules/cloud/google/gcp_compute_image.py | 53 +++++++++++++++++-- .../cloud/google/gcp_compute_image_facts.py | 11 ++++ 2 files changed, 59 insertions(+), 5 deletions(-) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_image.py b/lib/ansible/modules/cloud/google/gcp_compute_image.py index 6f7434b347639f..277a73cfe91f65 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_image.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_image.py @@ -112,6 +112,11 @@ - The RFC 4648 base64 encoded SHA-256 hash of the customer-supplied encryption key that protects this resource. required: false + labels: + description: + - Labels to apply to this Image. + required: false + version_added: 2.8 licenses: description: - Any applicable license URI. @@ -147,7 +152,7 @@ description: - The full Google Cloud Storage URL where disk storage is stored You must provide either this property or the sourceDisk property but not both. - required: false + required: true source_disk: description: - Refers to a gcompute_disk object You must provide either this property or the @@ -187,6 +192,9 @@ choices: - RAW extends_documentation_fragment: gcp +notes: +- 'API Reference: U(https://cloud.google.com/compute/docs/reference/latest/images)' +- 'Official Documentation: U(https://cloud.google.com/compute/docs/images)' ''' EXAMPLES = ''' @@ -329,6 +337,17 @@ key that protects this resource. returned: success type: str +labels: + description: + - Labels to apply to this Image. + returned: success + type: dict +labelFingerprint: + description: + - The fingerprint used for optimistic locking of this resource. Used internally + during updates. + returned: success + type: str licenses: description: - Any applicable license URI. @@ -438,12 +457,13 @@ def main(): raw_key=dict(type='str'), sha256=dict(type='str') )), + labels=dict(type='dict'), licenses=dict(type='list', elements='str'), name=dict(required=True, type='str'), raw_disk=dict(type='dict', options=dict( container_type=dict(type='str', choices=['TAR']), sha1_checksum=dict(type='str'), - source=dict(type='str') + source=dict(required=True, type='str') )), source_disk=dict(), source_disk_encryption_key=dict(type='dict', options=dict( @@ -467,7 +487,7 @@ def main(): if fetch: if state == 'present': if is_different(module, fetch): - update(module, self_link(module), kind) + update(module, self_link(module), kind, fetch) fetch = fetch_resource(module, self_link(module), kind) changed = True else: @@ -491,9 +511,29 @@ def create(module, link, kind): return wait_for_operation(module, auth.post(link, resource_to_request(module))) -def update(module, link, kind): +def update(module, link, kind, fetch): + update_fields(module, resource_to_request(module), + response_to_hash(module, fetch)) + return fetch_resource(module, self_link(module), kind) + + +def update_fields(module, request, response): + if response.get('labels') != request.get('labels'): + labels_update(module, request, response) + + +def labels_update(module, request, response): auth = GcpSession(module, 'compute') - return wait_for_operation(module, auth.put(link, resource_to_request(module))) + auth.post( + ''.join([ + "https://www.googleapis.com/compute/v1/", + "projects/{project}/global/images/{name}/setLabels" + ]).format(**module.params), + { + u'labels': module.params.get('labels'), + u'labelFingerprint': response.get('labelFingerprint') + } + ) def delete(module, link, kind): @@ -509,6 +549,7 @@ def resource_to_request(module): u'family': module.params.get('family'), u'guestOsFeatures': ImageGuestosfeaturesArray(module.params.get('guest_os_features', []), module).to_request(), u'imageEncryptionKey': ImageImageencryptionkey(module.params.get('image_encryption_key', {}), module).to_request(), + u'labels': module.params.get('labels'), u'licenses': module.params.get('licenses'), u'name': module.params.get('name'), u'rawDisk': ImageRawdisk(module.params.get('raw_disk', {}), module).to_request(), @@ -590,6 +631,8 @@ def response_to_hash(module, response): u'guestOsFeatures': ImageGuestosfeaturesArray(response.get(u'guestOsFeatures', []), module).from_response(), u'id': response.get(u'id'), u'imageEncryptionKey': ImageImageencryptionkey(response.get(u'imageEncryptionKey', {}), module).from_response(), + u'labels': response.get(u'labels'), + u'labelFingerprint': response.get(u'labelFingerprint'), u'licenses': response.get(u'licenses'), u'name': response.get(u'name'), u'rawDisk': ImageRawdisk(response.get(u'rawDisk', {}), module).from_response(), diff --git a/lib/ansible/modules/cloud/google/gcp_compute_image_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_image_facts.py index 0e77c403254d9f..bb9fe4420973ee 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_image_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_image_facts.py @@ -187,6 +187,17 @@ key that protects this resource. returned: success type: str + labels: + description: + - Labels to apply to this Image. + returned: success + type: dict + labelFingerprint: + description: + - The fingerprint used for optimistic locking of this resource. Used internally + during updates. + returned: success + type: str licenses: description: - Any applicable license URI. From 6c806829f26924b160c38a717df880e827c55783 Mon Sep 17 00:00:00 2001 From: The Magician Date: Thu, 3 Jan 2019 14:31:19 -0800 Subject: [PATCH 082/144] fixing module utils (#153) /cc @rambleraptor --- lib/ansible/module_utils/gcp_utils.py | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/lib/ansible/module_utils/gcp_utils.py b/lib/ansible/module_utils/gcp_utils.py index 8f6d47c3a9d2a5..9649468b4abb84 100644 --- a/lib/ansible/module_utils/gcp_utils.py +++ b/lib/ansible/module_utils/gcp_utils.py @@ -71,6 +71,7 @@ def replace_resource_dict(item, value): except ValueError: return new_item + # Handles all authentation and HTTP sessions for GCP API calls. class GcpSession(object): def __init__(self, module, product): @@ -85,16 +86,25 @@ def get(self, url, body=None, **kwargs): except getattr(requests.exceptions, 'RequestException') as inst: self.module.fail_json(msg=inst.message) - def post(self, url, body=None, headers={}, **kwargs): - kwargs.update({'json': body, 'headers': self._merge_dictionaries(headers, self._headers())}) + def post(self, url, body=None, headers=None, **kwargs): + if headers: + headers = self.merge_dictionaries(headers, self._headers()) + else: + headers = self._headers() + try: - return self.session().post(url, json=body, headers=self._headers()) + return self.session().post(url, json=body, headers=headers) except getattr(requests.exceptions, 'RequestException') as inst: self.module.fail_json(msg=inst.message) - def post_contents(self, url, file_contents=None, headers={}, **kwargs): + def post_contents(self, url, file_contents=None, headers=None, **kwargs): + if headers: + headers = self.merge_dictionaries(headers, self._headers()) + else: + headers = self._headers() + try: - return self.session().post(url, data=file_contents, headers=self._headers()) + return self.session().post(url, data=file_contents, headers=headers) except getattr(requests.exceptions, 'RequestException') as inst: self.module.fail_json(msg=inst.message) From d980c997b7114d475b6006d07eef85f883810984 Mon Sep 17 00:00:00 2001 From: The Magician Date: Fri, 4 Jan 2019 11:24:01 -0800 Subject: [PATCH 083/144] Add ResourceRefs for Compute Route. (#155) /cc @rileykarson --- .../modules/cloud/google/gcp_compute_route.py | 20 +++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_route.py b/lib/ansible/modules/cloud/google/gcp_compute_route.py index 6638bf663a2234..ebb0dbc8859f40 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_route.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_route.py @@ -117,6 +117,10 @@ - 'You can specify this as a full or partial URL. For example: * U(https://www.googleapis.com/compute/v1/projects/project/zones/zone/) instances/instance * projects/project/zones/zone/instances/instance * zones/zone/instances/instance .' + - 'This field represents a link to a Instance resource in GCP. It can be specified + in two ways. First, you can place in the selfLink of the resource here as a + string Alternatively, you can add `register: name-of-resource` to a gcp_compute_instance + task and then set this next_hop_instance field to "{{ name-of-resource }}"' required: false next_hop_ip: description: @@ -125,6 +129,10 @@ next_hop_vpn_tunnel: description: - URL to a VpnTunnel that should handle matching packets. + - 'This field represents a link to a VpnTunnel resource in GCP. It can be specified + in two ways. First, you can place in the selfLink of the resource here as a + string Alternatively, you can add `register: name-of-resource` to a gcp_compute_vpn_tunnel + task and then set this next_hop_vpn_tunnel field to "{{ name-of-resource }}"' required: false extends_documentation_fragment: gcp notes: @@ -259,9 +267,9 @@ def main(): priority=dict(type='int'), tags=dict(type='list', elements='str'), next_hop_gateway=dict(type='str'), - next_hop_instance=dict(type='str'), + next_hop_instance=dict(), next_hop_ip=dict(type='str'), - next_hop_vpn_tunnel=dict(type='str') + next_hop_vpn_tunnel=dict() ) ) @@ -320,9 +328,9 @@ def resource_to_request(module): u'priority': module.params.get('priority'), u'tags': module.params.get('tags'), u'nextHopGateway': module.params.get('next_hop_gateway'), - u'nextHopInstance': module.params.get('next_hop_instance'), + u'nextHopInstance': replace_resource_dict(module.params.get(u'next_hop_instance', {}), 'selfLink'), u'nextHopIp': module.params.get('next_hop_ip'), - u'nextHopVpnTunnel': module.params.get('next_hop_vpn_tunnel') + u'nextHopVpnTunnel': replace_resource_dict(module.params.get(u'next_hop_vpn_tunnel', {}), 'selfLink') } return_vals = {} for k, v in request.items(): @@ -395,9 +403,9 @@ def response_to_hash(module, response): u'priority': module.params.get('priority'), u'tags': module.params.get('tags'), u'nextHopGateway': module.params.get('next_hop_gateway'), - u'nextHopInstance': module.params.get('next_hop_instance'), + u'nextHopInstance': replace_resource_dict(module.params.get(u'next_hop_instance', {}), 'selfLink'), u'nextHopIp': module.params.get('next_hop_ip'), - u'nextHopVpnTunnel': module.params.get('next_hop_vpn_tunnel'), + u'nextHopVpnTunnel': replace_resource_dict(module.params.get(u'next_hop_vpn_tunnel', {}), 'selfLink'), u'nextHopNetwork': response.get(u'nextHopNetwork') } From c4cdbe72c190b062163289b09a942c4d6a87c98b Mon Sep 17 00:00:00 2001 From: The Magician Date: Wed, 9 Jan 2019 18:46:36 -0800 Subject: [PATCH 084/144] No-op docs tweak. (#161) Signed-off-by: Modular Magician --- .../cloud/google/gcp_compute_interconnect_attachment.py | 4 ++-- .../cloud/google/gcp_compute_interconnect_attachment_facts.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_interconnect_attachment.py b/lib/ansible/modules/cloud/google/gcp_compute_interconnect_attachment.py index fbead26542e79d..d69182ab98ce2c 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_interconnect_attachment.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_interconnect_attachment.py @@ -56,7 +56,7 @@ required: true description: description: - - An optional description of this resource. . + - An optional description of this resource. required: false router: description: @@ -120,7 +120,7 @@ type: str description: description: - - An optional description of this resource. . + - An optional description of this resource. returned: success type: str privateInterconnectInfo: diff --git a/lib/ansible/modules/cloud/google/gcp_compute_interconnect_attachment_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_interconnect_attachment_facts.py index 7a62962bd7da4b..90af8b96884ad9 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_interconnect_attachment_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_interconnect_attachment_facts.py @@ -90,7 +90,7 @@ type: str description: description: - - An optional description of this resource. . + - An optional description of this resource. returned: success type: str privateInterconnectInfo: From 739240015000131daabcea9950f4aee40385e5e0 Mon Sep 17 00:00:00 2001 From: The Magician Date: Thu, 10 Jan 2019 08:33:27 -0800 Subject: [PATCH 085/144] Remove old gcompute wording (#163) Signed-off-by: Modular Magician --- .../modules/cloud/google/gcp_compute_image.py | 10 +++-- .../cloud/google/gcp_compute_image_facts.py | 5 ++- .../cloud/google/gcp_compute_instance.py | 32 +++++++-------- .../google/gcp_compute_instance_facts.py | 18 ++++----- .../google/gcp_compute_instance_template.py | 40 +++++++++---------- .../gcp_compute_instance_template_facts.py | 20 +++++----- .../cloud/google/gcp_container_cluster.py | 4 -- .../google/gcp_container_cluster_facts.py | 2 - 8 files changed, 64 insertions(+), 67 deletions(-) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_image.py b/lib/ansible/modules/cloud/google/gcp_compute_image.py index 277a73cfe91f65..fec986d9f89587 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_image.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_image.py @@ -155,8 +155,9 @@ required: true source_disk: description: - - Refers to a gcompute_disk object You must provide either this property or the - rawDisk.source property but not both to create an image. + - The source disk to create this image based on. + - You must provide either this property or the rawDisk.source property but not + both to create an image. - 'This field represents a link to a Disk resource in GCP. It can be specified in two ways. First, you can place in the selfLink of the resource here as a string Alternatively, you can add `register: name-of-resource` to a gcp_compute_disk @@ -390,8 +391,9 @@ type: str sourceDisk: description: - - Refers to a gcompute_disk object You must provide either this property or the - rawDisk.source property but not both to create an image. + - The source disk to create this image based on. + - You must provide either this property or the rawDisk.source property but not both + to create an image. returned: success type: str sourceDiskEncryptionKey: diff --git a/lib/ansible/modules/cloud/google/gcp_compute_image_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_image_facts.py index bb9fe4420973ee..680c56aca0758c 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_image_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_image_facts.py @@ -240,8 +240,9 @@ type: str sourceDisk: description: - - Refers to a gcompute_disk object You must provide either this property or - the rawDisk.source property but not both to create an image. + - The source disk to create this image based on. + - You must provide either this property or the rawDisk.source property but not + both to create an image. returned: success type: str sourceDiskEncryptionKey: diff --git a/lib/ansible/modules/cloud/google/gcp_compute_instance.py b/lib/ansible/modules/cloud/google/gcp_compute_instance.py index 3bc3dc23c68ce5..5c389a75ebee9a 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_instance.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_instance.py @@ -127,7 +127,7 @@ required: false disk_type: description: - - Reference to a gcompute_disk_type resource. + - Reference to a disk type. - Specifies the disk type to use to create the instance. - If not specified, the default is pd-standard. required: false @@ -177,8 +177,8 @@ - READ_ONLY source: description: - - Reference to a gcompute_disk resource. When creating a new instance, one - of initializeParams.sourceImage or disks.source is required. + - Reference to a disk. When creating a new instance, one of initializeParams.sourceImage + or disks.source is required. - If desired, you can also attach existing non-root persistent disks using this property. This field is only applicable for persistent disks. - 'This field represents a link to a Disk resource in GCP. It can be specified @@ -260,7 +260,7 @@ required: true nat_ip: description: - - Specifies the title of a gcompute_address. + - Reference to an address. - An external IP address associated with this instance. - Specify an unused static external IP address available to the project or leave this field undefined to use an IP from a shared ephemeral IP @@ -305,8 +305,8 @@ required: false network: description: - - Specifies the title of an existing gcompute_network. When creating an instance, - if neither the network nor the subnetwork is specified, the default network + - Specifies the title of an existing network. When creating an instance, if + neither the network nor the subnetwork is specified, the default network global/networks/default is used; if the network is not specified but the subnetwork is specified, the network is inferred. - 'This field represents a link to a Network resource in GCP. It can be specified @@ -322,7 +322,7 @@ required: false subnetwork: description: - - Reference to a gcompute_subnetwork resource. + - Reference to a VPC network. - If the network resource is in legacy mode, do not provide this property. If the network is in auto subnet mode, providing the subnetwork is optional. If the network is in custom subnet mode, then this field should be specified. @@ -572,7 +572,7 @@ type: int diskType: description: - - Reference to a gcompute_disk_type resource. + - Reference to a disk type. - Specifies the disk type to use to create the instance. - If not specified, the default is pd-standard. returned: success @@ -623,8 +623,8 @@ type: str source: description: - - Reference to a gcompute_disk resource. When creating a new instance, one of - initializeParams.sourceImage or disks.source is required. + - Reference to a disk. When creating a new instance, one of initializeParams.sourceImage + or disks.source is required. - If desired, you can also attach existing non-root persistent disks using this property. This field is only applicable for persistent disks. returned: success @@ -717,7 +717,7 @@ type: str natIP: description: - - Specifies the title of a gcompute_address. + - Reference to an address. - An external IP address associated with this instance. - Specify an unused static external IP address available to the project or leave this field undefined to use an IP from a shared ephemeral IP @@ -761,10 +761,10 @@ type: str network: description: - - Specifies the title of an existing gcompute_network. When creating an instance, - if neither the network nor the subnetwork is specified, the default network - global/networks/default is used; if the network is not specified but the subnetwork - is specified, the network is inferred. + - Specifies the title of an existing network. When creating an instance, if + neither the network nor the subnetwork is specified, the default network global/networks/default + is used; if the network is not specified but the subnetwork is specified, + the network is inferred. returned: success type: str networkIP: @@ -776,7 +776,7 @@ type: str subnetwork: description: - - Reference to a gcompute_subnetwork resource. + - Reference to a VPC network. - If the network resource is in legacy mode, do not provide this property. If the network is in auto subnet mode, providing the subnetwork is optional. If the network is in custom subnet mode, then this field should be specified. diff --git a/lib/ansible/modules/cloud/google/gcp_compute_instance_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_instance_facts.py index 336f4c64350a20..0a32d8fd6229f3 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_instance_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_instance_facts.py @@ -169,7 +169,7 @@ type: int diskType: description: - - Reference to a gcompute_disk_type resource. + - Reference to a disk type. - Specifies the disk type to use to create the instance. - If not specified, the default is pd-standard. returned: success @@ -221,8 +221,8 @@ type: str source: description: - - Reference to a gcompute_disk resource. When creating a new instance, one - of initializeParams.sourceImage or disks.source is required. + - Reference to a disk. When creating a new instance, one of initializeParams.sourceImage + or disks.source is required. - If desired, you can also attach existing non-root persistent disks using this property. This field is only applicable for persistent disks. returned: success @@ -317,7 +317,7 @@ type: str natIP: description: - - Specifies the title of a gcompute_address. + - Reference to an address. - An external IP address associated with this instance. - Specify an unused static external IP address available to the project or leave this field undefined to use an IP from a shared ephemeral @@ -361,10 +361,10 @@ type: str network: description: - - Specifies the title of an existing gcompute_network. When creating an - instance, if neither the network nor the subnetwork is specified, the - default network global/networks/default is used; if the network is not - specified but the subnetwork is specified, the network is inferred. + - Specifies the title of an existing network. When creating an instance, + if neither the network nor the subnetwork is specified, the default network + global/networks/default is used; if the network is not specified but the + subnetwork is specified, the network is inferred. returned: success type: str networkIP: @@ -376,7 +376,7 @@ type: str subnetwork: description: - - Reference to a gcompute_subnetwork resource. + - Reference to a VPC network. - If the network resource is in legacy mode, do not provide this property. If the network is in auto subnet mode, providing the subnetwork is optional. If the network is in custom subnet mode, then this field should be specified. diff --git a/lib/ansible/modules/cloud/google/gcp_compute_instance_template.py b/lib/ansible/modules/cloud/google/gcp_compute_instance_template.py index 680f8ced724191..eab2b9b170c6c7 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_instance_template.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_instance_template.py @@ -154,7 +154,7 @@ required: false disk_type: description: - - Reference to a gcompute_disk_type resource. + - Reference to a disk type. - Specifies the disk type to use to create the instance. - If not specified, the default is pd-standard. required: false @@ -205,8 +205,8 @@ - READ_ONLY source: description: - - Reference to a gcompute_disk resource. When creating a new instance, - one of initializeParams.sourceImage or disks.source is required. + - Reference to a disk. When creating a new instance, one of initializeParams.sourceImage + or disks.source is required. - If desired, you can also attach existing non-root persistent disks using this property. This field is only applicable for persistent disks. - Note that for InstanceTemplate, specify the disk name, not the URL for @@ -227,7 +227,7 @@ - PERSISTENT machine_type: description: - - Reference to a gcompute_machine_type resource. + - The machine type to use in the VM instance template. required: true min_cpu_platform: description: @@ -277,7 +277,7 @@ required: true nat_ip: description: - - Specifies the title of a gcompute_address. + - Reference to an address. - An external IP address associated with this instance. - Specify an unused static external IP address available to the project or leave this field undefined to use an IP from a shared ephemeral @@ -323,10 +323,10 @@ required: false network: description: - - Specifies the title of an existing gcompute_network. When creating an - instance, if neither the network nor the subnetwork is specified, the - default network global/networks/default is used; if the network is not - specified but the subnetwork is specified, the network is inferred. + - Specifies the title of an existing network. When creating an instance, + if neither the network nor the subnetwork is specified, the default + network global/networks/default is used; if the network is not specified + but the subnetwork is specified, the network is inferred. - 'This field represents a link to a Network resource in GCP. It can be specified in two ways. First, you can place in the selfLink of the resource here as a string Alternatively, you can add `register: name-of-resource` @@ -341,7 +341,7 @@ required: false subnetwork: description: - - Reference to a gcompute_subnetwork resource. + - Reference to a VPC network. - If the network resource is in legacy mode, do not provide this property. If the network is in auto subnet mode, providing the subnetwork is optional. If the network is in custom subnet mode, then this field should be specified. @@ -583,7 +583,7 @@ type: int diskType: description: - - Reference to a gcompute_disk_type resource. + - Reference to a disk type. - Specifies the disk type to use to create the instance. - If not specified, the default is pd-standard. returned: success @@ -635,8 +635,8 @@ type: str source: description: - - Reference to a gcompute_disk resource. When creating a new instance, one - of initializeParams.sourceImage or disks.source is required. + - Reference to a disk. When creating a new instance, one of initializeParams.sourceImage + or disks.source is required. - If desired, you can also attach existing non-root persistent disks using this property. This field is only applicable for persistent disks. - Note that for InstanceTemplate, specify the disk name, not the URL for @@ -651,7 +651,7 @@ type: str machineType: description: - - Reference to a gcompute_machine_type resource. + - The machine type to use in the VM instance template. returned: success type: str minCpuPlatform: @@ -708,7 +708,7 @@ type: str natIP: description: - - Specifies the title of a gcompute_address. + - Reference to an address. - An external IP address associated with this instance. - Specify an unused static external IP address available to the project or leave this field undefined to use an IP from a shared ephemeral @@ -752,10 +752,10 @@ type: str network: description: - - Specifies the title of an existing gcompute_network. When creating an - instance, if neither the network nor the subnetwork is specified, the - default network global/networks/default is used; if the network is not - specified but the subnetwork is specified, the network is inferred. + - Specifies the title of an existing network. When creating an instance, + if neither the network nor the subnetwork is specified, the default network + global/networks/default is used; if the network is not specified but the + subnetwork is specified, the network is inferred. returned: success type: str networkIP: @@ -767,7 +767,7 @@ type: str subnetwork: description: - - Reference to a gcompute_subnetwork resource. + - Reference to a VPC network. - If the network resource is in legacy mode, do not provide this property. If the network is in auto subnet mode, providing the subnetwork is optional. If the network is in custom subnet mode, then this field should be specified. diff --git a/lib/ansible/modules/cloud/google/gcp_compute_instance_template_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_instance_template_facts.py index e12b12c8d345e1..5465814d82173e 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_instance_template_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_instance_template_facts.py @@ -190,7 +190,7 @@ type: int diskType: description: - - Reference to a gcompute_disk_type resource. + - Reference to a disk type. - Specifies the disk type to use to create the instance. - If not specified, the default is pd-standard. returned: success @@ -243,8 +243,8 @@ type: str source: description: - - Reference to a gcompute_disk resource. When creating a new instance, - one of initializeParams.sourceImage or disks.source is required. + - Reference to a disk. When creating a new instance, one of initializeParams.sourceImage + or disks.source is required. - If desired, you can also attach existing non-root persistent disks using this property. This field is only applicable for persistent disks. @@ -260,7 +260,7 @@ type: str machineType: description: - - Reference to a gcompute_machine_type resource. + - The machine type to use in the VM instance template. returned: success type: str minCpuPlatform: @@ -320,7 +320,7 @@ type: str natIP: description: - - Specifies the title of a gcompute_address. + - Reference to an address. - An external IP address associated with this instance. - Specify an unused static external IP address available to the project or leave this field undefined to use an IP from a shared @@ -366,10 +366,10 @@ type: str network: description: - - Specifies the title of an existing gcompute_network. When creating - an instance, if neither the network nor the subnetwork is specified, - the default network global/networks/default is used; if the network - is not specified but the subnetwork is specified, the network is inferred. + - Specifies the title of an existing network. When creating an instance, + if neither the network nor the subnetwork is specified, the default + network global/networks/default is used; if the network is not specified + but the subnetwork is specified, the network is inferred. returned: success type: str networkIP: @@ -381,7 +381,7 @@ type: str subnetwork: description: - - Reference to a gcompute_subnetwork resource. + - Reference to a VPC network. - If the network resource is in legacy mode, do not provide this property. If the network is in auto subnet mode, providing the subnetwork is optional. If the network is in custom subnet mode, then this field diff --git a/lib/ansible/modules/cloud/google/gcp_container_cluster.py b/lib/ansible/modules/cloud/google/gcp_container_cluster.py index 3ed8cda9f40bf6..c88addf0efe84b 100644 --- a/lib/ansible/modules/cloud/google/gcp_container_cluster.py +++ b/lib/ansible/modules/cloud/google/gcp_container_cluster.py @@ -210,8 +210,6 @@ description: - The name of the Google Compute Engine network to which the cluster is connected. If left unspecified, the default network will be used. - - To ensure it exists and it is operations, configure the network using 'gcompute_network' - resource. required: false cluster_ipv4_cidr: description: @@ -462,8 +460,6 @@ description: - The name of the Google Compute Engine network to which the cluster is connected. If left unspecified, the default network will be used. - - To ensure it exists and it is operations, configure the network using 'gcompute_network' - resource. returned: success type: str clusterIpv4Cidr: diff --git a/lib/ansible/modules/cloud/google/gcp_container_cluster_facts.py b/lib/ansible/modules/cloud/google/gcp_container_cluster_facts.py index db925dafc422ca..8dcca826651b4d 100644 --- a/lib/ansible/modules/cloud/google/gcp_container_cluster_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_container_cluster_facts.py @@ -240,8 +240,6 @@ description: - The name of the Google Compute Engine network to which the cluster is connected. If left unspecified, the default network will be used. - - To ensure it exists and it is operations, configure the network using 'gcompute_network' - resource. returned: success type: str clusterIpv4Cidr: From 56c372daf68d64d3b94a57828b541df1eafbcc16 Mon Sep 17 00:00:00 2001 From: The Magician Date: Mon, 14 Jan 2019 16:07:24 -0800 Subject: [PATCH 086/144] Formatting changes related to upstream code generator cleanup. (#162) Signed-off-by: Modular Magician --- .../cloud/google/gcp_bigquery_dataset.py | 107 ++-- .../google/gcp_bigquery_dataset_facts.py | 14 +- .../cloud/google/gcp_bigquery_table.py | 537 +++++++++--------- .../cloud/google/gcp_bigquery_table_facts.py | 15 +- .../cloud/google/gcp_compute_address.py | 11 +- .../cloud/google/gcp_compute_address_facts.py | 16 +- .../google/gcp_compute_backend_bucket.py | 11 +- .../gcp_compute_backend_bucket_facts.py | 15 +- .../google/gcp_compute_backend_service.py | 204 +++---- .../gcp_compute_backend_service_facts.py | 15 +- .../modules/cloud/google/gcp_compute_disk.py | 76 +-- .../cloud/google/gcp_compute_disk_facts.py | 16 +- .../cloud/google/gcp_compute_firewall.py | 62 +- .../google/gcp_compute_firewall_facts.py | 15 +- .../google/gcp_compute_forwarding_rule.py | 23 +- .../gcp_compute_forwarding_rule_facts.py | 16 +- .../google/gcp_compute_global_address.py | 11 +- .../gcp_compute_global_address_facts.py | 15 +- .../gcp_compute_global_forwarding_rule.py | 11 +- ...cp_compute_global_forwarding_rule_facts.py | 15 +- .../cloud/google/gcp_compute_health_check.py | 219 +++---- .../google/gcp_compute_health_check_facts.py | 15 +- .../google/gcp_compute_http_health_check.py | 11 +- .../gcp_compute_http_health_check_facts.py | 15 +- .../google/gcp_compute_https_health_check.py | 11 +- .../gcp_compute_https_health_check_facts.py | 15 +- .../modules/cloud/google/gcp_compute_image.py | 123 ++-- .../cloud/google/gcp_compute_image_facts.py | 15 +- .../cloud/google/gcp_compute_instance.py | 360 +++++------- .../google/gcp_compute_instance_facts.py | 16 +- .../google/gcp_compute_instance_group.py | 33 +- .../gcp_compute_instance_group_facts.py | 16 +- .../gcp_compute_instance_group_manager.py | 70 ++- ...cp_compute_instance_group_manager_facts.py | 16 +- .../google/gcp_compute_instance_template.py | 430 +++++++------- .../gcp_compute_instance_template_facts.py | 15 +- .../gcp_compute_interconnect_attachment.py | 19 +- ...p_compute_interconnect_attachment_facts.py | 16 +- .../cloud/google/gcp_compute_network.py | 23 +- .../cloud/google/gcp_compute_network_facts.py | 15 +- .../cloud/google/gcp_compute_region_disk.py | 61 +- .../google/gcp_compute_region_disk_facts.py | 16 +- .../modules/cloud/google/gcp_compute_route.py | 11 +- .../cloud/google/gcp_compute_route_facts.py | 15 +- .../cloud/google/gcp_compute_router.py | 67 ++- .../cloud/google/gcp_compute_router_facts.py | 16 +- .../google/gcp_compute_ssl_certificate.py | 11 +- .../gcp_compute_ssl_certificate_facts.py | 15 +- .../cloud/google/gcp_compute_ssl_policy.py | 21 +- .../google/gcp_compute_ssl_policy_facts.py | 15 +- .../cloud/google/gcp_compute_subnetwork.py | 60 +- .../google/gcp_compute_subnetwork_facts.py | 16 +- .../google/gcp_compute_target_http_proxy.py | 23 +- .../gcp_compute_target_http_proxy_facts.py | 15 +- .../google/gcp_compute_target_https_proxy.py | 50 +- .../gcp_compute_target_https_proxy_facts.py | 15 +- .../cloud/google/gcp_compute_target_pool.py | 11 +- .../google/gcp_compute_target_pool_facts.py | 16 +- .../google/gcp_compute_target_ssl_proxy.py | 50 +- .../gcp_compute_target_ssl_proxy_facts.py | 15 +- .../google/gcp_compute_target_tcp_proxy.py | 32 +- .../gcp_compute_target_tcp_proxy_facts.py | 15 +- .../google/gcp_compute_target_vpn_gateway.py | 11 +- .../gcp_compute_target_vpn_gateway_facts.py | 16 +- .../cloud/google/gcp_compute_url_map.py | 128 ++--- .../cloud/google/gcp_compute_url_map_facts.py | 15 +- .../cloud/google/gcp_compute_vpn_tunnel.py | 24 +- .../google/gcp_compute_vpn_tunnel_facts.py | 16 +- .../cloud/google/gcp_container_cluster.py | 194 ++++--- .../google/gcp_container_cluster_facts.py | 15 +- .../cloud/google/gcp_container_node_pool.py | 174 +++--- .../google/gcp_container_node_pool_facts.py | 22 +- .../cloud/google/gcp_dns_managed_zone.py | 24 +- .../google/gcp_dns_managed_zone_facts.py | 15 +- .../google/gcp_dns_resource_record_set.py | 83 +-- .../gcp_dns_resource_record_set_facts.py | 20 +- .../cloud/google/gcp_iam_service_account.py | 23 +- .../google/gcp_iam_service_account_facts.py | 14 +- .../google/gcp_iam_service_account_key.py | 17 +- .../cloud/google/gcp_pubsub_subscription.py | 29 +- .../google/gcp_pubsub_subscription_facts.py | 14 +- .../modules/cloud/google/gcp_pubsub_topic.py | 23 +- .../cloud/google/gcp_pubsub_topic_facts.py | 14 +- .../google/gcp_resourcemanager_project.py | 26 +- .../gcp_resourcemanager_project_facts.py | 14 +- .../cloud/google/gcp_spanner_database.py | 28 +- .../google/gcp_spanner_database_facts.py | 20 +- .../cloud/google/gcp_spanner_instance.py | 33 +- .../google/gcp_spanner_instance_facts.py | 14 +- .../modules/cloud/google/gcp_sql_database.py | 26 +- .../cloud/google/gcp_sql_database_facts.py | 20 +- .../modules/cloud/google/gcp_sql_instance.py | 248 ++++---- .../cloud/google/gcp_sql_instance_facts.py | 14 +- .../modules/cloud/google/gcp_sql_user.py | 35 +- .../cloud/google/gcp_sql_user_facts.py | 20 +- .../cloud/google/gcp_storage_bucket.py | 406 +++++++------ .../gcp_storage_bucket_access_control.py | 26 +- .../cloud/google/gcp_storage_object.py | 9 +- 98 files changed, 2126 insertions(+), 2928 deletions(-) diff --git a/lib/ansible/modules/cloud/google/gcp_bigquery_dataset.py b/lib/ansible/modules/cloud/google/gcp_bigquery_dataset.py index cd6eb1e9e34401..ed1d7172f82b3b 100644 --- a/lib/ansible/modules/cloud/google/gcp_bigquery_dataset.py +++ b/lib/ansible/modules/cloud/google/gcp_bigquery_dataset.py @@ -18,15 +18,14 @@ # ---------------------------------------------------------------------------- from __future__ import absolute_import, division, print_function + __metaclass__ = type ################################################################################ # Documentation ################################################################################ -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ["preview"], - 'supported_by': 'community'} +ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ["preview"], 'supported_by': 'community'} DOCUMENTATION = ''' --- @@ -306,27 +305,29 @@ def main(): argument_spec=dict( state=dict(default='present', choices=['present', 'absent'], type='str'), name=dict(type='str'), - access=dict(type='list', elements='dict', options=dict( - domain=dict(type='str'), - group_by_email=dict(type='str'), - role=dict(type='str', choices=['READER', 'WRITER', 'OWNER']), - special_group=dict(type='str'), - user_by_email=dict(type='str'), - view=dict(type='dict', options=dict( - dataset_id=dict(required=True, type='str'), - project_id=dict(required=True, type='str'), - table_id=dict(required=True, type='str') - )) - )), - dataset_reference=dict(required=True, type='dict', options=dict( - dataset_id=dict(required=True, type='str'), - project_id=dict(type='str') - )), + access=dict( + type='list', + elements='dict', + options=dict( + domain=dict(type='str'), + group_by_email=dict(type='str'), + role=dict(type='str', choices=['READER', 'WRITER', 'OWNER']), + special_group=dict(type='str'), + user_by_email=dict(type='str'), + view=dict( + type='dict', + options=dict( + dataset_id=dict(required=True, type='str'), project_id=dict(required=True, type='str'), table_id=dict(required=True, type='str') + ), + ), + ), + ), + dataset_reference=dict(required=True, type='dict', options=dict(dataset_id=dict(required=True, type='str'), project_id=dict(type='str'))), default_table_expiration_ms=dict(type='int'), description=dict(type='str'), friendly_name=dict(type='str'), labels=dict(type='dict'), - location=dict(default='US', type='str') + location=dict(default='US', type='str'), ) ) @@ -386,7 +387,7 @@ def resource_to_request(module): u'description': module.params.get('description'), u'friendlyName': module.params.get('friendly_name'), u'labels': module.params.get('labels'), - u'location': module.params.get('location') + u'location': module.params.get('location'), } return_vals = {} for k, v in request.items(): @@ -462,7 +463,7 @@ def response_to_hash(module, response): u'id': response.get(u'id'), u'labels': response.get(u'labels'), u'lastModifiedTime': response.get(u'lastModifiedTime'), - u'location': response.get(u'location') + u'location': response.get(u'location'), } @@ -487,24 +488,28 @@ def from_response(self): return items def _request_for_item(self, item): - return remove_nones_from_dict({ - u'domain': item.get('domain'), - u'groupByEmail': item.get('group_by_email'), - u'role': item.get('role'), - u'specialGroup': item.get('special_group'), - u'userByEmail': item.get('user_by_email'), - u'view': DatasetView(item.get('view', {}), self.module).to_request() - }) + return remove_nones_from_dict( + { + u'domain': item.get('domain'), + u'groupByEmail': item.get('group_by_email'), + u'role': item.get('role'), + u'specialGroup': item.get('special_group'), + u'userByEmail': item.get('user_by_email'), + u'view': DatasetView(item.get('view', {}), self.module).to_request(), + } + ) def _response_from_item(self, item): - return remove_nones_from_dict({ - u'domain': item.get(u'domain'), - u'groupByEmail': item.get(u'groupByEmail'), - u'role': item.get(u'role'), - u'specialGroup': item.get(u'specialGroup'), - u'userByEmail': item.get(u'userByEmail'), - u'view': DatasetView(item.get(u'view', {}), self.module).from_response() - }) + return remove_nones_from_dict( + { + u'domain': item.get(u'domain'), + u'groupByEmail': item.get(u'groupByEmail'), + u'role': item.get(u'role'), + u'specialGroup': item.get(u'specialGroup'), + u'userByEmail': item.get(u'userByEmail'), + u'view': DatasetView(item.get(u'view', {}), self.module).from_response(), + } + ) class DatasetView(object): @@ -516,18 +521,14 @@ def __init__(self, request, module): self.request = {} def to_request(self): - return remove_nones_from_dict({ - u'datasetId': self.request.get('dataset_id'), - u'projectId': self.request.get('project_id'), - u'tableId': self.request.get('table_id') - }) + return remove_nones_from_dict( + {u'datasetId': self.request.get('dataset_id'), u'projectId': self.request.get('project_id'), u'tableId': self.request.get('table_id')} + ) def from_response(self): - return remove_nones_from_dict({ - u'datasetId': self.request.get(u'datasetId'), - u'projectId': self.request.get(u'projectId'), - u'tableId': self.request.get(u'tableId') - }) + return remove_nones_from_dict( + {u'datasetId': self.request.get(u'datasetId'), u'projectId': self.request.get(u'projectId'), u'tableId': self.request.get(u'tableId')} + ) class DatasetDatasetreference(object): @@ -539,16 +540,10 @@ def __init__(self, request, module): self.request = {} def to_request(self): - return remove_nones_from_dict({ - u'datasetId': self.request.get('dataset_id'), - u'projectId': self.request.get('project_id') - }) + return remove_nones_from_dict({u'datasetId': self.request.get('dataset_id'), u'projectId': self.request.get('project_id')}) def from_response(self): - return remove_nones_from_dict({ - u'datasetId': self.request.get(u'datasetId'), - u'projectId': self.request.get(u'projectId') - }) + return remove_nones_from_dict({u'datasetId': self.request.get(u'datasetId'), u'projectId': self.request.get(u'projectId')}) if __name__ == '__main__': diff --git a/lib/ansible/modules/cloud/google/gcp_bigquery_dataset_facts.py b/lib/ansible/modules/cloud/google/gcp_bigquery_dataset_facts.py index e390bd9aa5fbd9..8c2e1e0e9e7871 100644 --- a/lib/ansible/modules/cloud/google/gcp_bigquery_dataset_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_bigquery_dataset_facts.py @@ -18,15 +18,14 @@ # ---------------------------------------------------------------------------- from __future__ import absolute_import, division, print_function + __metaclass__ = type ################################################################################ # Documentation ################################################################################ -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ["preview"], - 'supported_by': 'community'} +ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ["preview"], 'supported_by': 'community'} DOCUMENTATION = ''' --- @@ -199,10 +198,7 @@ def main(): - module = GcpModule( - argument_spec=dict( - ) - ) + module = GcpModule(argument_spec=dict()) if not module.params['scopes']: module.params['scopes'] = ['https://www.googleapis.com/auth/bigquery'] @@ -212,9 +208,7 @@ def main(): items = items.get('datasets') else: items = [] - return_value = { - 'items': items - } + return_value = {'items': items} module.exit_json(**return_value) diff --git a/lib/ansible/modules/cloud/google/gcp_bigquery_table.py b/lib/ansible/modules/cloud/google/gcp_bigquery_table.py index 7517c4613bdd99..bb36a6981c8879 100644 --- a/lib/ansible/modules/cloud/google/gcp_bigquery_table.py +++ b/lib/ansible/modules/cloud/google/gcp_bigquery_table.py @@ -18,15 +18,14 @@ # ---------------------------------------------------------------------------- from __future__ import absolute_import, division, print_function + __metaclass__ = type ################################################################################ # Documentation ################################################################################ -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ["preview"], - 'supported_by': 'community'} +ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ["preview"], 'supported_by': 'community'} DOCUMENTATION = ''' --- @@ -904,85 +903,107 @@ def main(): module = GcpModule( argument_spec=dict( state=dict(default='present', choices=['present', 'absent'], type='str'), - table_reference=dict(type='dict', options=dict( - dataset_id=dict(type='str'), - project_id=dict(type='str'), - table_id=dict(type='str') - )), + table_reference=dict(type='dict', options=dict(dataset_id=dict(type='str'), project_id=dict(type='str'), table_id=dict(type='str'))), description=dict(type='str'), friendly_name=dict(type='str'), labels=dict(type='dict'), name=dict(type='str'), - view=dict(type='dict', options=dict( - use_legacy_sql=dict(type='bool'), - user_defined_function_resources=dict(type='list', elements='dict', options=dict( - inline_code=dict(type='str'), - resource_uri=dict(type='str') - )) - )), - time_partitioning=dict(type='dict', options=dict( - expiration_ms=dict(type='int'), - type=dict(type='str', choices=['DAY']) - )), - schema=dict(type='dict', options=dict( - fields=dict(type='list', elements='dict', options=dict( - description=dict(type='str'), - fields=dict(type='list', elements='str'), - mode=dict(type='str', choices=['NULLABLE', 'REQUIRED', 'REPEATED']), - name=dict(type='str'), - type=dict(type='str', choices=['STRING', 'BYTES', 'INTEGER', 'FLOAT', 'TIMESTAMP', 'DATE', 'TIME', 'DATETIME', 'RECORD']) - )) - )), - encryption_configuration=dict(type='dict', options=dict( - kms_key_name=dict(type='str') - )), + view=dict( + type='dict', + options=dict( + use_legacy_sql=dict(type='bool'), + user_defined_function_resources=dict( + type='list', elements='dict', options=dict(inline_code=dict(type='str'), resource_uri=dict(type='str')) + ), + ), + ), + time_partitioning=dict(type='dict', options=dict(expiration_ms=dict(type='int'), type=dict(type='str', choices=['DAY']))), + schema=dict( + type='dict', + options=dict( + fields=dict( + type='list', + elements='dict', + options=dict( + description=dict(type='str'), + fields=dict(type='list', elements='str'), + mode=dict(type='str', choices=['NULLABLE', 'REQUIRED', 'REPEATED']), + name=dict(type='str'), + type=dict(type='str', choices=['STRING', 'BYTES', 'INTEGER', 'FLOAT', 'TIMESTAMP', 'DATE', 'TIME', 'DATETIME', 'RECORD']), + ), + ) + ), + ), + encryption_configuration=dict(type='dict', options=dict(kms_key_name=dict(type='str'))), expiration_time=dict(type='int'), - external_data_configuration=dict(type='dict', options=dict( - autodetect=dict(type='bool'), - compression=dict(type='str', choices=['GZIP', 'NONE']), - ignore_unknown_values=dict(type='bool'), - max_bad_records=dict(default=0, type='int'), - source_format=dict(type='str', choices=['CSV', 'GOOGLE_SHEETS', 'NEWLINE_DELIMITED_JSON', 'AVRO', 'DATASTORE_BACKUP', 'BIGTABLE']), - source_uris=dict(type='list', elements='str'), - schema=dict(type='dict', options=dict( - fields=dict(type='list', elements='dict', options=dict( - description=dict(type='str'), - fields=dict(type='list', elements='str'), - mode=dict(type='str', choices=['NULLABLE', 'REQUIRED', 'REPEATED']), - name=dict(type='str'), - type=dict(type='str', choices=['STRING', 'BYTES', 'INTEGER', 'FLOAT', 'TIMESTAMP', 'DATE', 'TIME', 'DATETIME', 'RECORD']) - )) - )), - google_sheets_options=dict(type='dict', options=dict( - skip_leading_rows=dict(default=0, type='int') - )), - csv_options=dict(type='dict', options=dict( - allow_jagged_rows=dict(type='bool'), - allow_quoted_newlines=dict(type='bool'), - encoding=dict(type='str', choices=['UTF-8', 'ISO-8859-1']), - field_delimiter=dict(type='str'), - quote=dict(type='str'), - skip_leading_rows=dict(default=0, type='int') - )), - bigtable_options=dict(type='dict', options=dict( - ignore_unspecified_column_families=dict(type='bool'), - read_rowkey_as_string=dict(type='bool'), - column_families=dict(type='list', elements='dict', options=dict( - columns=dict(type='list', elements='dict', options=dict( - encoding=dict(type='str', choices=['TEXT', 'BINARY']), - field_name=dict(type='str'), - only_read_latest=dict(type='bool'), - qualifier_string=dict(required=True, type='str'), - type=dict(type='str', choices=['BYTES', 'STRING', 'INTEGER', 'FLOAT', 'BOOLEAN']) - )), - encoding=dict(type='str', choices=['TEXT', 'BINARY']), - family_id=dict(type='str'), - only_read_latest=dict(type='bool'), - type=dict(type='str', choices=['BYTES', 'STRING', 'INTEGER', 'FLOAT', 'BOOLEAN']) - )) - )) - )), - dataset=dict(type='str') + external_data_configuration=dict( + type='dict', + options=dict( + autodetect=dict(type='bool'), + compression=dict(type='str', choices=['GZIP', 'NONE']), + ignore_unknown_values=dict(type='bool'), + max_bad_records=dict(default=0, type='int'), + source_format=dict(type='str', choices=['CSV', 'GOOGLE_SHEETS', 'NEWLINE_DELIMITED_JSON', 'AVRO', 'DATASTORE_BACKUP', 'BIGTABLE']), + source_uris=dict(type='list', elements='str'), + schema=dict( + type='dict', + options=dict( + fields=dict( + type='list', + elements='dict', + options=dict( + description=dict(type='str'), + fields=dict(type='list', elements='str'), + mode=dict(type='str', choices=['NULLABLE', 'REQUIRED', 'REPEATED']), + name=dict(type='str'), + type=dict(type='str', choices=['STRING', 'BYTES', 'INTEGER', 'FLOAT', 'TIMESTAMP', 'DATE', 'TIME', 'DATETIME', 'RECORD']), + ), + ) + ), + ), + google_sheets_options=dict(type='dict', options=dict(skip_leading_rows=dict(default=0, type='int'))), + csv_options=dict( + type='dict', + options=dict( + allow_jagged_rows=dict(type='bool'), + allow_quoted_newlines=dict(type='bool'), + encoding=dict(type='str', choices=['UTF-8', 'ISO-8859-1']), + field_delimiter=dict(type='str'), + quote=dict(type='str'), + skip_leading_rows=dict(default=0, type='int'), + ), + ), + bigtable_options=dict( + type='dict', + options=dict( + ignore_unspecified_column_families=dict(type='bool'), + read_rowkey_as_string=dict(type='bool'), + column_families=dict( + type='list', + elements='dict', + options=dict( + columns=dict( + type='list', + elements='dict', + options=dict( + encoding=dict(type='str', choices=['TEXT', 'BINARY']), + field_name=dict(type='str'), + only_read_latest=dict(type='bool'), + qualifier_string=dict(required=True, type='str'), + type=dict(type='str', choices=['BYTES', 'STRING', 'INTEGER', 'FLOAT', 'BOOLEAN']), + ), + ), + encoding=dict(type='str', choices=['TEXT', 'BINARY']), + family_id=dict(type='str'), + only_read_latest=dict(type='bool'), + type=dict(type='str', choices=['BYTES', 'STRING', 'INTEGER', 'FLOAT', 'BOOLEAN']), + ), + ), + ), + ), + ), + ), + dataset=dict(type='str'), ) ) @@ -1045,7 +1066,7 @@ def resource_to_request(module): u'schema': TableSchema(module.params.get('schema', {}), module).to_request(), u'encryptionConfiguration': TableEncryptionconfiguration(module.params.get('encryption_configuration', {}), module).to_request(), u'expirationTime': module.params.get('expiration_time'), - u'externalDataConfiguration': TableExternaldataconfiguration(module.params.get('external_data_configuration', {}), module).to_request() + u'externalDataConfiguration': TableExternaldataconfiguration(module.params.get('external_data_configuration', {}), module).to_request(), } return_vals = {} for k, v in request.items(): @@ -1130,7 +1151,7 @@ def response_to_hash(module, response): u'schema': TableSchema(response.get(u'schema', {}), module).from_response(), u'encryptionConfiguration': TableEncryptionconfiguration(response.get(u'encryptionConfiguration', {}), module).from_response(), u'expirationTime': response.get(u'expirationTime'), - u'externalDataConfiguration': TableExternaldataconfiguration(response.get(u'externalDataConfiguration', {}), module).from_response() + u'externalDataConfiguration': TableExternaldataconfiguration(response.get(u'externalDataConfiguration', {}), module).from_response(), } @@ -1143,18 +1164,14 @@ def __init__(self, request, module): self.request = {} def to_request(self): - return remove_nones_from_dict({ - u'datasetId': self.request.get('dataset_id'), - u'projectId': self.request.get('project_id'), - u'tableId': self.request.get('table_id') - }) + return remove_nones_from_dict( + {u'datasetId': self.request.get('dataset_id'), u'projectId': self.request.get('project_id'), u'tableId': self.request.get('table_id')} + ) def from_response(self): - return remove_nones_from_dict({ - u'datasetId': self.request.get(u'datasetId'), - u'projectId': self.request.get(u'projectId'), - u'tableId': self.request.get(u'tableId') - }) + return remove_nones_from_dict( + {u'datasetId': self.request.get(u'datasetId'), u'projectId': self.request.get(u'projectId'), u'tableId': self.request.get(u'tableId')} + ) class TableView(object): @@ -1166,18 +1183,24 @@ def __init__(self, request, module): self.request = {} def to_request(self): - return remove_nones_from_dict({ - u'useLegacySql': self.request.get('use_legacy_sql'), - u'userDefinedFunctionResources': - TableUserdefinedfunctionresourcesArray(self.request.get('user_defined_function_resources', []), self.module).to_request() - }) + return remove_nones_from_dict( + { + u'useLegacySql': self.request.get('use_legacy_sql'), + u'userDefinedFunctionResources': TableUserdefinedfunctionresourcesArray( + self.request.get('user_defined_function_resources', []), self.module + ).to_request(), + } + ) def from_response(self): - return remove_nones_from_dict({ - u'useLegacySql': self.request.get(u'useLegacySql'), - u'userDefinedFunctionResources': - TableUserdefinedfunctionresourcesArray(self.request.get(u'userDefinedFunctionResources', []), self.module).from_response() - }) + return remove_nones_from_dict( + { + u'useLegacySql': self.request.get(u'useLegacySql'), + u'userDefinedFunctionResources': TableUserdefinedfunctionresourcesArray( + self.request.get(u'userDefinedFunctionResources', []), self.module + ).from_response(), + } + ) class TableUserdefinedfunctionresourcesArray(object): @@ -1201,16 +1224,10 @@ def from_response(self): return items def _request_for_item(self, item): - return remove_nones_from_dict({ - u'inlineCode': item.get('inline_code'), - u'resourceUri': item.get('resource_uri') - }) + return remove_nones_from_dict({u'inlineCode': item.get('inline_code'), u'resourceUri': item.get('resource_uri')}) def _response_from_item(self, item): - return remove_nones_from_dict({ - u'inlineCode': item.get(u'inlineCode'), - u'resourceUri': item.get(u'resourceUri') - }) + return remove_nones_from_dict({u'inlineCode': item.get(u'inlineCode'), u'resourceUri': item.get(u'resourceUri')}) class TableTimepartitioning(object): @@ -1222,16 +1239,10 @@ def __init__(self, request, module): self.request = {} def to_request(self): - return remove_nones_from_dict({ - u'expirationMs': self.request.get('expiration_ms'), - u'type': self.request.get('type') - }) + return remove_nones_from_dict({u'expirationMs': self.request.get('expiration_ms'), u'type': self.request.get('type')}) def from_response(self): - return remove_nones_from_dict({ - u'expirationMs': self.request.get(u'expirationMs'), - u'type': self.request.get(u'type') - }) + return remove_nones_from_dict({u'expirationMs': self.request.get(u'expirationMs'), u'type': self.request.get(u'type')}) class TableStreamingbuffer(object): @@ -1243,18 +1254,22 @@ def __init__(self, request, module): self.request = {} def to_request(self): - return remove_nones_from_dict({ - u'estimatedBytes': self.request.get('estimated_bytes'), - u'estimatedRows': self.request.get('estimated_rows'), - u'oldestEntryTime': self.request.get('oldest_entry_time') - }) + return remove_nones_from_dict( + { + u'estimatedBytes': self.request.get('estimated_bytes'), + u'estimatedRows': self.request.get('estimated_rows'), + u'oldestEntryTime': self.request.get('oldest_entry_time'), + } + ) def from_response(self): - return remove_nones_from_dict({ - u'estimatedBytes': self.request.get(u'estimatedBytes'), - u'estimatedRows': self.request.get(u'estimatedRows'), - u'oldestEntryTime': self.request.get(u'oldestEntryTime') - }) + return remove_nones_from_dict( + { + u'estimatedBytes': self.request.get(u'estimatedBytes'), + u'estimatedRows': self.request.get(u'estimatedRows'), + u'oldestEntryTime': self.request.get(u'oldestEntryTime'), + } + ) class TableSchema(object): @@ -1266,14 +1281,10 @@ def __init__(self, request, module): self.request = {} def to_request(self): - return remove_nones_from_dict({ - u'fields': TableFieldsArray(self.request.get('fields', []), self.module).to_request() - }) + return remove_nones_from_dict({u'fields': TableFieldsArray(self.request.get('fields', []), self.module).to_request()}) def from_response(self): - return remove_nones_from_dict({ - u'fields': TableFieldsArray(self.request.get(u'fields', []), self.module).from_response() - }) + return remove_nones_from_dict({u'fields': TableFieldsArray(self.request.get(u'fields', []), self.module).from_response()}) class TableFieldsArray(object): @@ -1297,22 +1308,26 @@ def from_response(self): return items def _request_for_item(self, item): - return remove_nones_from_dict({ - u'description': item.get('description'), - u'fields': item.get('fields'), - u'mode': item.get('mode'), - u'name': item.get('name'), - u'type': item.get('type') - }) + return remove_nones_from_dict( + { + u'description': item.get('description'), + u'fields': item.get('fields'), + u'mode': item.get('mode'), + u'name': item.get('name'), + u'type': item.get('type'), + } + ) def _response_from_item(self, item): - return remove_nones_from_dict({ - u'description': item.get(u'description'), - u'fields': item.get(u'fields'), - u'mode': item.get(u'mode'), - u'name': item.get(u'name'), - u'type': item.get(u'type') - }) + return remove_nones_from_dict( + { + u'description': item.get(u'description'), + u'fields': item.get(u'fields'), + u'mode': item.get(u'mode'), + u'name': item.get(u'name'), + u'type': item.get(u'type'), + } + ) class TableEncryptionconfiguration(object): @@ -1324,14 +1339,10 @@ def __init__(self, request, module): self.request = {} def to_request(self): - return remove_nones_from_dict({ - u'kmsKeyName': self.request.get('kms_key_name') - }) + return remove_nones_from_dict({u'kmsKeyName': self.request.get('kms_key_name')}) def from_response(self): - return remove_nones_from_dict({ - u'kmsKeyName': self.request.get(u'kmsKeyName') - }) + return remove_nones_from_dict({u'kmsKeyName': self.request.get(u'kmsKeyName')}) class TableExternaldataconfiguration(object): @@ -1343,32 +1354,36 @@ def __init__(self, request, module): self.request = {} def to_request(self): - return remove_nones_from_dict({ - u'autodetect': self.request.get('autodetect'), - u'compression': self.request.get('compression'), - u'ignoreUnknownValues': self.request.get('ignore_unknown_values'), - u'maxBadRecords': self.request.get('max_bad_records'), - u'sourceFormat': self.request.get('source_format'), - u'sourceUris': self.request.get('source_uris'), - u'schema': TableSchema(self.request.get('schema', {}), self.module).to_request(), - u'googleSheetsOptions': TableGooglesheetsoptions(self.request.get('google_sheets_options', {}), self.module).to_request(), - u'csvOptions': TableCsvoptions(self.request.get('csv_options', {}), self.module).to_request(), - u'bigtableOptions': TableBigtableoptions(self.request.get('bigtable_options', {}), self.module).to_request() - }) + return remove_nones_from_dict( + { + u'autodetect': self.request.get('autodetect'), + u'compression': self.request.get('compression'), + u'ignoreUnknownValues': self.request.get('ignore_unknown_values'), + u'maxBadRecords': self.request.get('max_bad_records'), + u'sourceFormat': self.request.get('source_format'), + u'sourceUris': self.request.get('source_uris'), + u'schema': TableSchema(self.request.get('schema', {}), self.module).to_request(), + u'googleSheetsOptions': TableGooglesheetsoptions(self.request.get('google_sheets_options', {}), self.module).to_request(), + u'csvOptions': TableCsvoptions(self.request.get('csv_options', {}), self.module).to_request(), + u'bigtableOptions': TableBigtableoptions(self.request.get('bigtable_options', {}), self.module).to_request(), + } + ) def from_response(self): - return remove_nones_from_dict({ - u'autodetect': self.request.get(u'autodetect'), - u'compression': self.request.get(u'compression'), - u'ignoreUnknownValues': self.request.get(u'ignoreUnknownValues'), - u'maxBadRecords': self.request.get(u'maxBadRecords'), - u'sourceFormat': self.request.get(u'sourceFormat'), - u'sourceUris': self.request.get(u'sourceUris'), - u'schema': TableSchema(self.request.get(u'schema', {}), self.module).from_response(), - u'googleSheetsOptions': TableGooglesheetsoptions(self.request.get(u'googleSheetsOptions', {}), self.module).from_response(), - u'csvOptions': TableCsvoptions(self.request.get(u'csvOptions', {}), self.module).from_response(), - u'bigtableOptions': TableBigtableoptions(self.request.get(u'bigtableOptions', {}), self.module).from_response() - }) + return remove_nones_from_dict( + { + u'autodetect': self.request.get(u'autodetect'), + u'compression': self.request.get(u'compression'), + u'ignoreUnknownValues': self.request.get(u'ignoreUnknownValues'), + u'maxBadRecords': self.request.get(u'maxBadRecords'), + u'sourceFormat': self.request.get(u'sourceFormat'), + u'sourceUris': self.request.get(u'sourceUris'), + u'schema': TableSchema(self.request.get(u'schema', {}), self.module).from_response(), + u'googleSheetsOptions': TableGooglesheetsoptions(self.request.get(u'googleSheetsOptions', {}), self.module).from_response(), + u'csvOptions': TableCsvoptions(self.request.get(u'csvOptions', {}), self.module).from_response(), + u'bigtableOptions': TableBigtableoptions(self.request.get(u'bigtableOptions', {}), self.module).from_response(), + } + ) class TableSchema(object): @@ -1380,14 +1395,10 @@ def __init__(self, request, module): self.request = {} def to_request(self): - return remove_nones_from_dict({ - u'fields': TableFieldsArray(self.request.get('fields', []), self.module).to_request() - }) + return remove_nones_from_dict({u'fields': TableFieldsArray(self.request.get('fields', []), self.module).to_request()}) def from_response(self): - return remove_nones_from_dict({ - u'fields': TableFieldsArray(self.request.get(u'fields', []), self.module).from_response() - }) + return remove_nones_from_dict({u'fields': TableFieldsArray(self.request.get(u'fields', []), self.module).from_response()}) class TableFieldsArray(object): @@ -1411,22 +1422,26 @@ def from_response(self): return items def _request_for_item(self, item): - return remove_nones_from_dict({ - u'description': item.get('description'), - u'fields': item.get('fields'), - u'mode': item.get('mode'), - u'name': item.get('name'), - u'type': item.get('type') - }) + return remove_nones_from_dict( + { + u'description': item.get('description'), + u'fields': item.get('fields'), + u'mode': item.get('mode'), + u'name': item.get('name'), + u'type': item.get('type'), + } + ) def _response_from_item(self, item): - return remove_nones_from_dict({ - u'description': item.get(u'description'), - u'fields': item.get(u'fields'), - u'mode': item.get(u'mode'), - u'name': item.get(u'name'), - u'type': item.get(u'type') - }) + return remove_nones_from_dict( + { + u'description': item.get(u'description'), + u'fields': item.get(u'fields'), + u'mode': item.get(u'mode'), + u'name': item.get(u'name'), + u'type': item.get(u'type'), + } + ) class TableGooglesheetsoptions(object): @@ -1438,14 +1453,10 @@ def __init__(self, request, module): self.request = {} def to_request(self): - return remove_nones_from_dict({ - u'skipLeadingRows': self.request.get('skip_leading_rows') - }) + return remove_nones_from_dict({u'skipLeadingRows': self.request.get('skip_leading_rows')}) def from_response(self): - return remove_nones_from_dict({ - u'skipLeadingRows': self.request.get(u'skipLeadingRows') - }) + return remove_nones_from_dict({u'skipLeadingRows': self.request.get(u'skipLeadingRows')}) class TableCsvoptions(object): @@ -1457,24 +1468,28 @@ def __init__(self, request, module): self.request = {} def to_request(self): - return remove_nones_from_dict({ - u'allowJaggedRows': self.request.get('allow_jagged_rows'), - u'allowQuotedNewlines': self.request.get('allow_quoted_newlines'), - u'encoding': self.request.get('encoding'), - u'fieldDelimiter': self.request.get('field_delimiter'), - u'quote': self.request.get('quote'), - u'skipLeadingRows': self.request.get('skip_leading_rows') - }) + return remove_nones_from_dict( + { + u'allowJaggedRows': self.request.get('allow_jagged_rows'), + u'allowQuotedNewlines': self.request.get('allow_quoted_newlines'), + u'encoding': self.request.get('encoding'), + u'fieldDelimiter': self.request.get('field_delimiter'), + u'quote': self.request.get('quote'), + u'skipLeadingRows': self.request.get('skip_leading_rows'), + } + ) def from_response(self): - return remove_nones_from_dict({ - u'allowJaggedRows': self.request.get(u'allowJaggedRows'), - u'allowQuotedNewlines': self.request.get(u'allowQuotedNewlines'), - u'encoding': self.request.get(u'encoding'), - u'fieldDelimiter': self.request.get(u'fieldDelimiter'), - u'quote': self.request.get(u'quote'), - u'skipLeadingRows': self.request.get(u'skipLeadingRows') - }) + return remove_nones_from_dict( + { + u'allowJaggedRows': self.request.get(u'allowJaggedRows'), + u'allowQuotedNewlines': self.request.get(u'allowQuotedNewlines'), + u'encoding': self.request.get(u'encoding'), + u'fieldDelimiter': self.request.get(u'fieldDelimiter'), + u'quote': self.request.get(u'quote'), + u'skipLeadingRows': self.request.get(u'skipLeadingRows'), + } + ) class TableBigtableoptions(object): @@ -1486,18 +1501,22 @@ def __init__(self, request, module): self.request = {} def to_request(self): - return remove_nones_from_dict({ - u'ignoreUnspecifiedColumnFamilies': self.request.get('ignore_unspecified_column_families'), - u'readRowkeyAsString': self.request.get('read_rowkey_as_string'), - u'columnFamilies': TableColumnfamiliesArray(self.request.get('column_families', []), self.module).to_request() - }) + return remove_nones_from_dict( + { + u'ignoreUnspecifiedColumnFamilies': self.request.get('ignore_unspecified_column_families'), + u'readRowkeyAsString': self.request.get('read_rowkey_as_string'), + u'columnFamilies': TableColumnfamiliesArray(self.request.get('column_families', []), self.module).to_request(), + } + ) def from_response(self): - return remove_nones_from_dict({ - u'ignoreUnspecifiedColumnFamilies': self.request.get(u'ignoreUnspecifiedColumnFamilies'), - u'readRowkeyAsString': self.request.get(u'readRowkeyAsString'), - u'columnFamilies': TableColumnfamiliesArray(self.request.get(u'columnFamilies', []), self.module).from_response() - }) + return remove_nones_from_dict( + { + u'ignoreUnspecifiedColumnFamilies': self.request.get(u'ignoreUnspecifiedColumnFamilies'), + u'readRowkeyAsString': self.request.get(u'readRowkeyAsString'), + u'columnFamilies': TableColumnfamiliesArray(self.request.get(u'columnFamilies', []), self.module).from_response(), + } + ) class TableColumnfamiliesArray(object): @@ -1521,22 +1540,26 @@ def from_response(self): return items def _request_for_item(self, item): - return remove_nones_from_dict({ - u'columns': TableColumnsArray(item.get('columns', []), self.module).to_request(), - u'encoding': item.get('encoding'), - u'familyId': item.get('family_id'), - u'onlyReadLatest': item.get('only_read_latest'), - u'type': item.get('type') - }) + return remove_nones_from_dict( + { + u'columns': TableColumnsArray(item.get('columns', []), self.module).to_request(), + u'encoding': item.get('encoding'), + u'familyId': item.get('family_id'), + u'onlyReadLatest': item.get('only_read_latest'), + u'type': item.get('type'), + } + ) def _response_from_item(self, item): - return remove_nones_from_dict({ - u'columns': TableColumnsArray(item.get(u'columns', []), self.module).from_response(), - u'encoding': item.get(u'encoding'), - u'familyId': item.get(u'familyId'), - u'onlyReadLatest': item.get(u'onlyReadLatest'), - u'type': item.get(u'type') - }) + return remove_nones_from_dict( + { + u'columns': TableColumnsArray(item.get(u'columns', []), self.module).from_response(), + u'encoding': item.get(u'encoding'), + u'familyId': item.get(u'familyId'), + u'onlyReadLatest': item.get(u'onlyReadLatest'), + u'type': item.get(u'type'), + } + ) class TableColumnsArray(object): @@ -1560,22 +1583,26 @@ def from_response(self): return items def _request_for_item(self, item): - return remove_nones_from_dict({ - u'encoding': item.get('encoding'), - u'fieldName': item.get('field_name'), - u'onlyReadLatest': item.get('only_read_latest'), - u'qualifierString': item.get('qualifier_string'), - u'type': item.get('type') - }) + return remove_nones_from_dict( + { + u'encoding': item.get('encoding'), + u'fieldName': item.get('field_name'), + u'onlyReadLatest': item.get('only_read_latest'), + u'qualifierString': item.get('qualifier_string'), + u'type': item.get('type'), + } + ) def _response_from_item(self, item): - return remove_nones_from_dict({ - u'encoding': item.get(u'encoding'), - u'fieldName': item.get(u'fieldName'), - u'onlyReadLatest': item.get(u'onlyReadLatest'), - u'qualifierString': item.get(u'qualifierString'), - u'type': item.get(u'type') - }) + return remove_nones_from_dict( + { + u'encoding': item.get(u'encoding'), + u'fieldName': item.get(u'fieldName'), + u'onlyReadLatest': item.get(u'onlyReadLatest'), + u'qualifierString': item.get(u'qualifierString'), + u'type': item.get(u'type'), + } + ) if __name__ == '__main__': diff --git a/lib/ansible/modules/cloud/google/gcp_bigquery_table_facts.py b/lib/ansible/modules/cloud/google/gcp_bigquery_table_facts.py index ba495767c6623d..c19ccb0c576a25 100644 --- a/lib/ansible/modules/cloud/google/gcp_bigquery_table_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_bigquery_table_facts.py @@ -18,15 +18,14 @@ # ---------------------------------------------------------------------------- from __future__ import absolute_import, division, print_function + __metaclass__ = type ################################################################################ # Documentation ################################################################################ -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ["preview"], - 'supported_by': 'community'} +ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ["preview"], 'supported_by': 'community'} DOCUMENTATION = ''' --- @@ -513,11 +512,7 @@ def main(): - module = GcpModule( - argument_spec=dict( - dataset=dict(type='str') - ) - ) + module = GcpModule(argument_spec=dict(dataset=dict(type='str'))) if not module.params['scopes']: module.params['scopes'] = ['https://www.googleapis.com/auth/bigquery'] @@ -527,9 +522,7 @@ def main(): items = items.get('tables') else: items = [] - return_value = { - 'items': items - } + return_value = {'items': items} module.exit_json(**return_value) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_address.py b/lib/ansible/modules/cloud/google/gcp_compute_address.py index f93c8d450a3fe3..61c256c635c246 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_address.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_address.py @@ -18,15 +18,14 @@ # ---------------------------------------------------------------------------- from __future__ import absolute_import, division, print_function + __metaclass__ = type ################################################################################ # Documentation ################################################################################ -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ["preview"], - 'supported_by': 'community'} +ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ["preview"], 'supported_by': 'community'} DOCUMENTATION = ''' --- @@ -221,7 +220,7 @@ def main(): name=dict(required=True, type='str'), network_tier=dict(type='str', choices=['PREMIUM', 'STANDARD']), subnetwork=dict(), - region=dict(required=True, type='str') + region=dict(required=True, type='str'), ) ) @@ -278,7 +277,7 @@ def resource_to_request(module): u'description': module.params.get('description'), u'name': module.params.get('name'), u'networkTier': module.params.get('network_tier'), - u'subnetwork': replace_resource_dict(module.params.get(u'subnetwork', {}), 'selfLink') + u'subnetwork': replace_resource_dict(module.params.get(u'subnetwork', {}), 'selfLink'), } return_vals = {} for k, v in request.items(): @@ -352,7 +351,7 @@ def response_to_hash(module, response): u'name': response.get(u'name'), u'networkTier': response.get(u'networkTier'), u'subnetwork': response.get(u'subnetwork'), - u'users': response.get(u'users') + u'users': response.get(u'users'), } diff --git a/lib/ansible/modules/cloud/google/gcp_compute_address_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_address_facts.py index d5b5140fe1889f..e423a0306f97e6 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_address_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_address_facts.py @@ -18,15 +18,14 @@ # ---------------------------------------------------------------------------- from __future__ import absolute_import, division, print_function + __metaclass__ = type ################################################################################ # Documentation ################################################################################ -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ["preview"], - 'supported_by': 'community'} +ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ["preview"], 'supported_by': 'community'} DOCUMENTATION = ''' --- @@ -148,12 +147,7 @@ def main(): - module = GcpModule( - argument_spec=dict( - filters=dict(type='list', elements='str'), - region=dict(required=True, type='str') - ) - ) + module = GcpModule(argument_spec=dict(filters=dict(type='list', elements='str'), region=dict(required=True, type='str'))) if not module.params['scopes']: module.params['scopes'] = ['https://www.googleapis.com/auth/compute'] @@ -163,9 +157,7 @@ def main(): items = items.get('items') else: items = [] - return_value = { - 'items': items - } + return_value = {'items': items} module.exit_json(**return_value) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_backend_bucket.py b/lib/ansible/modules/cloud/google/gcp_compute_backend_bucket.py index 711baac99e8c18..7c84fd2675d2c2 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_backend_bucket.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_backend_bucket.py @@ -18,15 +18,14 @@ # ---------------------------------------------------------------------------- from __future__ import absolute_import, division, print_function + __metaclass__ = type ################################################################################ # Documentation ################################################################################ -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ["preview"], - 'supported_by': 'community'} +ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ["preview"], 'supported_by': 'community'} DOCUMENTATION = ''' --- @@ -164,7 +163,7 @@ def main(): bucket_name=dict(required=True, type='str'), description=dict(type='str'), enable_cdn=dict(type='bool'), - name=dict(required=True, type='str') + name=dict(required=True, type='str'), ) ) @@ -220,7 +219,7 @@ def resource_to_request(module): u'bucketName': module.params.get('bucket_name'), u'description': module.params.get('description'), u'enableCdn': module.params.get('enable_cdn'), - u'name': module.params.get('name') + u'name': module.params.get('name'), } return_vals = {} for k, v in request.items(): @@ -291,7 +290,7 @@ def response_to_hash(module, response): u'description': response.get(u'description'), u'enableCdn': response.get(u'enableCdn'), u'id': response.get(u'id'), - u'name': module.params.get('name') + u'name': module.params.get('name'), } diff --git a/lib/ansible/modules/cloud/google/gcp_compute_backend_bucket_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_backend_bucket_facts.py index 9e607bf6ef30cf..f53b46d5158571 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_backend_bucket_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_backend_bucket_facts.py @@ -18,15 +18,14 @@ # ---------------------------------------------------------------------------- from __future__ import absolute_import, division, print_function + __metaclass__ = type ################################################################################ # Documentation ################################################################################ -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ["preview"], - 'supported_by': 'community'} +ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ["preview"], 'supported_by': 'community'} DOCUMENTATION = ''' --- @@ -115,11 +114,7 @@ def main(): - module = GcpModule( - argument_spec=dict( - filters=dict(type='list', elements='str') - ) - ) + module = GcpModule(argument_spec=dict(filters=dict(type='list', elements='str'))) if not module.params['scopes']: module.params['scopes'] = ['https://www.googleapis.com/auth/compute'] @@ -129,9 +124,7 @@ def main(): items = items.get('items') else: items = [] - return_value = { - 'items': items - } + return_value = {'items': items} module.exit_json(**return_value) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_backend_service.py b/lib/ansible/modules/cloud/google/gcp_compute_backend_service.py index d2e23376c61517..7c625485c3bdfe 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_backend_service.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_backend_service.py @@ -18,15 +18,14 @@ # ---------------------------------------------------------------------------- from __future__ import absolute_import, division, print_function + __metaclass__ = type ################################################################################ # Documentation ################################################################################ -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ["preview"], - 'supported_by': 'community'} +ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ["preview"], 'supported_by': 'community'} DOCUMENTATION = ''' --- @@ -622,45 +621,56 @@ def main(): argument_spec=dict( state=dict(default='present', choices=['present', 'absent'], type='str'), affinity_cookie_ttl_sec=dict(type='int'), - backends=dict(type='list', elements='dict', options=dict( - balancing_mode=dict(type='str', choices=['UTILIZATION', 'RATE', 'CONNECTION']), - capacity_scaler=dict(type='str'), - description=dict(type='str'), - group=dict(), - max_connections=dict(type='int'), - max_connections_per_instance=dict(type='int'), - max_rate=dict(type='int'), - max_rate_per_instance=dict(type='str'), - max_utilization=dict(type='str') - )), - cdn_policy=dict(type='dict', options=dict( - cache_key_policy=dict(type='dict', options=dict( - include_host=dict(type='bool'), - include_protocol=dict(type='bool'), - include_query_string=dict(type='bool'), - query_string_blacklist=dict(type='list', elements='str'), - query_string_whitelist=dict(type='list', elements='str') - )) - )), - connection_draining=dict(type='dict', options=dict( - draining_timeout_sec=dict(type='int') - )), + backends=dict( + type='list', + elements='dict', + options=dict( + balancing_mode=dict(type='str', choices=['UTILIZATION', 'RATE', 'CONNECTION']), + capacity_scaler=dict(type='str'), + description=dict(type='str'), + group=dict(), + max_connections=dict(type='int'), + max_connections_per_instance=dict(type='int'), + max_rate=dict(type='int'), + max_rate_per_instance=dict(type='str'), + max_utilization=dict(type='str'), + ), + ), + cdn_policy=dict( + type='dict', + options=dict( + cache_key_policy=dict( + type='dict', + options=dict( + include_host=dict(type='bool'), + include_protocol=dict(type='bool'), + include_query_string=dict(type='bool'), + query_string_blacklist=dict(type='list', elements='str'), + query_string_whitelist=dict(type='list', elements='str'), + ), + ) + ), + ), + connection_draining=dict(type='dict', options=dict(draining_timeout_sec=dict(type='int'))), description=dict(type='str'), enable_cdn=dict(type='bool'), health_checks=dict(type='list', elements='str'), - iap=dict(type='dict', options=dict( - enabled=dict(type='bool'), - oauth2_client_id=dict(type='str'), - oauth2_client_secret=dict(type='str'), - oauth2_client_secret_sha256=dict(type='str') - )), + iap=dict( + type='dict', + options=dict( + enabled=dict(type='bool'), + oauth2_client_id=dict(type='str'), + oauth2_client_secret=dict(type='str'), + oauth2_client_secret_sha256=dict(type='str'), + ), + ), load_balancing_scheme=dict(type='str', choices=['INTERNAL', 'EXTERNAL']), name=dict(type='str'), port_name=dict(type='str'), protocol=dict(type='str', choices=['HTTP', 'HTTPS', 'TCP', 'SSL']), region=dict(type='str'), session_affinity=dict(type='str', choices=['NONE', 'CLIENT_IP', 'GENERATED_COOKIE', 'CLIENT_IP_PROTO', 'CLIENT_IP_PORT_PROTO']), - timeout_sec=dict(type='int', aliases=['timeout_seconds']) + timeout_sec=dict(type='int', aliases=['timeout_seconds']), ) ) @@ -727,7 +737,7 @@ def resource_to_request(module): u'protocol': module.params.get('protocol'), u'region': region_selflink(module.params.get('region'), module.params), u'sessionAffinity': module.params.get('session_affinity'), - u'timeoutSec': module.params.get('timeout_sec') + u'timeoutSec': module.params.get('timeout_sec'), } return_vals = {} for k, v in request.items(): @@ -809,7 +819,7 @@ def response_to_hash(module, response): u'protocol': response.get(u'protocol'), u'region': response.get(u'region'), u'sessionAffinity': response.get(u'sessionAffinity'), - u'timeoutSec': response.get(u'timeoutSec') + u'timeoutSec': response.get(u'timeoutSec'), } @@ -878,30 +888,34 @@ def from_response(self): return items def _request_for_item(self, item): - return remove_nones_from_dict({ - u'balancingMode': item.get('balancing_mode'), - u'capacityScaler': item.get('capacity_scaler'), - u'description': item.get('description'), - u'group': replace_resource_dict(item.get(u'group', {}), 'selfLink'), - u'maxConnections': item.get('max_connections'), - u'maxConnectionsPerInstance': item.get('max_connections_per_instance'), - u'maxRate': item.get('max_rate'), - u'maxRatePerInstance': item.get('max_rate_per_instance'), - u'maxUtilization': item.get('max_utilization') - }) + return remove_nones_from_dict( + { + u'balancingMode': item.get('balancing_mode'), + u'capacityScaler': item.get('capacity_scaler'), + u'description': item.get('description'), + u'group': replace_resource_dict(item.get(u'group', {}), 'selfLink'), + u'maxConnections': item.get('max_connections'), + u'maxConnectionsPerInstance': item.get('max_connections_per_instance'), + u'maxRate': item.get('max_rate'), + u'maxRatePerInstance': item.get('max_rate_per_instance'), + u'maxUtilization': item.get('max_utilization'), + } + ) def _response_from_item(self, item): - return remove_nones_from_dict({ - u'balancingMode': item.get(u'balancingMode'), - u'capacityScaler': item.get(u'capacityScaler'), - u'description': item.get(u'description'), - u'group': item.get(u'group'), - u'maxConnections': item.get(u'maxConnections'), - u'maxConnectionsPerInstance': item.get(u'maxConnectionsPerInstance'), - u'maxRate': item.get(u'maxRate'), - u'maxRatePerInstance': item.get(u'maxRatePerInstance'), - u'maxUtilization': item.get(u'maxUtilization') - }) + return remove_nones_from_dict( + { + u'balancingMode': item.get(u'balancingMode'), + u'capacityScaler': item.get(u'capacityScaler'), + u'description': item.get(u'description'), + u'group': item.get(u'group'), + u'maxConnections': item.get(u'maxConnections'), + u'maxConnectionsPerInstance': item.get(u'maxConnectionsPerInstance'), + u'maxRate': item.get(u'maxRate'), + u'maxRatePerInstance': item.get(u'maxRatePerInstance'), + u'maxUtilization': item.get(u'maxUtilization'), + } + ) class BackendServiceCdnpolicy(object): @@ -913,14 +927,10 @@ def __init__(self, request, module): self.request = {} def to_request(self): - return remove_nones_from_dict({ - u'cacheKeyPolicy': BackendServiceCachekeypolicy(self.request.get('cache_key_policy', {}), self.module).to_request() - }) + return remove_nones_from_dict({u'cacheKeyPolicy': BackendServiceCachekeypolicy(self.request.get('cache_key_policy', {}), self.module).to_request()}) def from_response(self): - return remove_nones_from_dict({ - u'cacheKeyPolicy': BackendServiceCachekeypolicy(self.request.get(u'cacheKeyPolicy', {}), self.module).from_response() - }) + return remove_nones_from_dict({u'cacheKeyPolicy': BackendServiceCachekeypolicy(self.request.get(u'cacheKeyPolicy', {}), self.module).from_response()}) class BackendServiceCachekeypolicy(object): @@ -932,22 +942,26 @@ def __init__(self, request, module): self.request = {} def to_request(self): - return remove_nones_from_dict({ - u'includeHost': self.request.get('include_host'), - u'includeProtocol': self.request.get('include_protocol'), - u'includeQueryString': self.request.get('include_query_string'), - u'queryStringBlacklist': self.request.get('query_string_blacklist'), - u'queryStringWhitelist': self.request.get('query_string_whitelist') - }) + return remove_nones_from_dict( + { + u'includeHost': self.request.get('include_host'), + u'includeProtocol': self.request.get('include_protocol'), + u'includeQueryString': self.request.get('include_query_string'), + u'queryStringBlacklist': self.request.get('query_string_blacklist'), + u'queryStringWhitelist': self.request.get('query_string_whitelist'), + } + ) def from_response(self): - return remove_nones_from_dict({ - u'includeHost': self.request.get(u'includeHost'), - u'includeProtocol': self.request.get(u'includeProtocol'), - u'includeQueryString': self.request.get(u'includeQueryString'), - u'queryStringBlacklist': self.request.get(u'queryStringBlacklist'), - u'queryStringWhitelist': self.request.get(u'queryStringWhitelist') - }) + return remove_nones_from_dict( + { + u'includeHost': self.request.get(u'includeHost'), + u'includeProtocol': self.request.get(u'includeProtocol'), + u'includeQueryString': self.request.get(u'includeQueryString'), + u'queryStringBlacklist': self.request.get(u'queryStringBlacklist'), + u'queryStringWhitelist': self.request.get(u'queryStringWhitelist'), + } + ) class BackendServiceConnectiondraining(object): @@ -959,14 +973,10 @@ def __init__(self, request, module): self.request = {} def to_request(self): - return remove_nones_from_dict({ - u'drainingTimeoutSec': self.request.get('draining_timeout_sec') - }) + return remove_nones_from_dict({u'drainingTimeoutSec': self.request.get('draining_timeout_sec')}) def from_response(self): - return remove_nones_from_dict({ - u'drainingTimeoutSec': self.request.get(u'drainingTimeoutSec') - }) + return remove_nones_from_dict({u'drainingTimeoutSec': self.request.get(u'drainingTimeoutSec')}) class BackendServiceIap(object): @@ -978,20 +988,24 @@ def __init__(self, request, module): self.request = {} def to_request(self): - return remove_nones_from_dict({ - u'enabled': self.request.get('enabled'), - u'oauth2ClientId': self.request.get('oauth2_client_id'), - u'oauth2ClientSecret': self.request.get('oauth2_client_secret'), - u'oauth2ClientSecretSha256': self.request.get('oauth2_client_secret_sha256') - }) + return remove_nones_from_dict( + { + u'enabled': self.request.get('enabled'), + u'oauth2ClientId': self.request.get('oauth2_client_id'), + u'oauth2ClientSecret': self.request.get('oauth2_client_secret'), + u'oauth2ClientSecretSha256': self.request.get('oauth2_client_secret_sha256'), + } + ) def from_response(self): - return remove_nones_from_dict({ - u'enabled': self.request.get(u'enabled'), - u'oauth2ClientId': self.request.get(u'oauth2ClientId'), - u'oauth2ClientSecret': self.request.get(u'oauth2ClientSecret'), - u'oauth2ClientSecretSha256': self.request.get(u'oauth2ClientSecretSha256') - }) + return remove_nones_from_dict( + { + u'enabled': self.request.get(u'enabled'), + u'oauth2ClientId': self.request.get(u'oauth2ClientId'), + u'oauth2ClientSecret': self.request.get(u'oauth2ClientSecret'), + u'oauth2ClientSecretSha256': self.request.get(u'oauth2ClientSecretSha256'), + } + ) if __name__ == '__main__': diff --git a/lib/ansible/modules/cloud/google/gcp_compute_backend_service_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_backend_service_facts.py index d714c80005ee00..6916604b931905 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_backend_service_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_backend_service_facts.py @@ -18,15 +18,14 @@ # ---------------------------------------------------------------------------- from __future__ import absolute_import, division, print_function + __metaclass__ = type ################################################################################ # Documentation ################################################################################ -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ["preview"], - 'supported_by': 'community'} +ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ["preview"], 'supported_by': 'community'} DOCUMENTATION = ''' --- @@ -341,11 +340,7 @@ def main(): - module = GcpModule( - argument_spec=dict( - filters=dict(type='list', elements='str') - ) - ) + module = GcpModule(argument_spec=dict(filters=dict(type='list', elements='str'))) if not module.params['scopes']: module.params['scopes'] = ['https://www.googleapis.com/auth/compute'] @@ -355,9 +350,7 @@ def main(): items = items.get('items') else: items = [] - return_value = { - 'items': items - } + return_value = {'items': items} module.exit_json(**return_value) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_disk.py b/lib/ansible/modules/cloud/google/gcp_compute_disk.py index 7d9990d4b8727c..7998ab4a7300e8 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_disk.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_disk.py @@ -18,15 +18,14 @@ # ---------------------------------------------------------------------------- from __future__ import absolute_import, division, print_function + __metaclass__ = type ################################################################################ # Documentation ################################################################################ -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ["preview"], - 'supported_by': 'community'} +ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ["preview"], 'supported_by': 'community'} DOCUMENTATION = ''' --- @@ -409,19 +408,10 @@ def main(): type=dict(type='str'), source_image=dict(type='str'), zone=dict(required=True, type='str'), - source_image_encryption_key=dict(type='dict', options=dict( - raw_key=dict(type='str'), - sha256=dict(type='str') - )), - disk_encryption_key=dict(type='dict', options=dict( - raw_key=dict(type='str'), - sha256=dict(type='str') - )), + source_image_encryption_key=dict(type='dict', options=dict(raw_key=dict(type='str'), sha256=dict(type='str'))), + disk_encryption_key=dict(type='dict', options=dict(raw_key=dict(type='str'), sha256=dict(type='str'))), source_snapshot=dict(), - source_snapshot_encryption_key=dict(type='dict', options=dict( - raw_key=dict(type='str'), - sha256=dict(type='str') - )) + source_snapshot_encryption_key=dict(type='dict', options=dict(raw_key=dict(type='str'), sha256=dict(type='str'))), ) ) @@ -462,8 +452,7 @@ def create(module, link, kind): def update(module, link, kind, fetch): - update_fields(module, resource_to_request(module), - response_to_hash(module, fetch)) + update_fields(module, resource_to_request(module), response_to_hash(module, fetch)) return fetch_resource(module, self_link(module), kind) @@ -477,27 +466,16 @@ def update_fields(module, request, response): def label_fingerprint_update(module, request, response): auth = GcpSession(module, 'compute') auth.post( - ''.join([ - "https://www.googleapis.com/compute/v1/", - "projects/{project}/zones/{zone}/disks/{name}/setLabels" - ]).format(**module.params), - { - u'labelFingerprint': response.get('labelFingerprint'), - u'labels': module.params.get('labels') - } + ''.join(["https://www.googleapis.com/compute/v1/", "projects/{project}/zones/{zone}/disks/{name}/setLabels"]).format(**module.params), + {u'labelFingerprint': response.get('labelFingerprint'), u'labels': module.params.get('labels')}, ) def size_gb_update(module, request, response): auth = GcpSession(module, 'compute') auth.post( - ''.join([ - "https://www.googleapis.com/compute/v1/", - "projects/{project}/zones/{zone}/disks/{name}/resize" - ]).format(**module.params), - { - u'sizeGb': module.params.get('size_gb') - } + ''.join(["https://www.googleapis.com/compute/v1/", "projects/{project}/zones/{zone}/disks/{name}/resize"]).format(**module.params), + {u'sizeGb': module.params.get('size_gb')}, ) @@ -518,7 +496,7 @@ def resource_to_request(module): u'name': module.params.get('name'), u'sizeGb': module.params.get('size_gb'), u'type': disk_type_selflink(module.params.get('type'), module.params), - u'sourceImage': module.params.get('source_image') + u'sourceImage': module.params.get('source_image'), } return_vals = {} for k, v in request.items(): @@ -596,7 +574,7 @@ def response_to_hash(module, response): u'sizeGb': response.get(u'sizeGb'), u'users': response.get(u'users'), u'type': response.get(u'type'), - u'sourceImage': module.params.get('source_image') + u'sourceImage': module.params.get('source_image'), } @@ -653,16 +631,10 @@ def __init__(self, request, module): self.request = {} def to_request(self): - return remove_nones_from_dict({ - u'rawKey': self.request.get('raw_key'), - u'sha256': self.request.get('sha256') - }) + return remove_nones_from_dict({u'rawKey': self.request.get('raw_key'), u'sha256': self.request.get('sha256')}) def from_response(self): - return remove_nones_from_dict({ - u'rawKey': self.request.get(u'rawKey'), - u'sha256': self.request.get(u'sha256') - }) + return remove_nones_from_dict({u'rawKey': self.request.get(u'rawKey'), u'sha256': self.request.get(u'sha256')}) class DiskDiskencryptionkey(object): @@ -674,16 +646,10 @@ def __init__(self, request, module): self.request = {} def to_request(self): - return remove_nones_from_dict({ - u'rawKey': self.request.get('raw_key'), - u'sha256': self.request.get('sha256') - }) + return remove_nones_from_dict({u'rawKey': self.request.get('raw_key'), u'sha256': self.request.get('sha256')}) def from_response(self): - return remove_nones_from_dict({ - u'rawKey': self.request.get(u'rawKey'), - u'sha256': self.request.get(u'sha256') - }) + return remove_nones_from_dict({u'rawKey': self.request.get(u'rawKey'), u'sha256': self.request.get(u'sha256')}) class DiskSourcesnapshotencryptionkey(object): @@ -695,16 +661,10 @@ def __init__(self, request, module): self.request = {} def to_request(self): - return remove_nones_from_dict({ - u'rawKey': self.request.get('raw_key'), - u'sha256': self.request.get('sha256') - }) + return remove_nones_from_dict({u'rawKey': self.request.get('raw_key'), u'sha256': self.request.get('sha256')}) def from_response(self): - return remove_nones_from_dict({ - u'rawKey': self.request.get(u'rawKey'), - u'sha256': self.request.get(u'sha256') - }) + return remove_nones_from_dict({u'rawKey': self.request.get(u'rawKey'), u'sha256': self.request.get(u'sha256')}) if __name__ == '__main__': diff --git a/lib/ansible/modules/cloud/google/gcp_compute_disk_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_disk_facts.py index cbf483fcd9025b..5a62b425f94f5d 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_disk_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_disk_facts.py @@ -18,15 +18,14 @@ # ---------------------------------------------------------------------------- from __future__ import absolute_import, division, print_function + __metaclass__ = type ################################################################################ # Documentation ################################################################################ -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ["preview"], - 'supported_by': 'community'} +ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ["preview"], 'supported_by': 'community'} DOCUMENTATION = ''' --- @@ -267,12 +266,7 @@ def main(): - module = GcpModule( - argument_spec=dict( - filters=dict(type='list', elements='str'), - zone=dict(required=True, type='str') - ) - ) + module = GcpModule(argument_spec=dict(filters=dict(type='list', elements='str'), zone=dict(required=True, type='str'))) if not module.params['scopes']: module.params['scopes'] = ['https://www.googleapis.com/auth/compute'] @@ -282,9 +276,7 @@ def main(): items = items.get('items') else: items = [] - return_value = { - 'items': items - } + return_value = {'items': items} module.exit_json(**return_value) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_firewall.py b/lib/ansible/modules/cloud/google/gcp_compute_firewall.py index 75e9118ab3d12c..18212ce0e57edb 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_firewall.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_firewall.py @@ -18,15 +18,14 @@ # ---------------------------------------------------------------------------- from __future__ import absolute_import, division, print_function + __metaclass__ = type ################################################################################ # Documentation ################################################################################ -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ["preview"], - 'supported_by': 'community'} +ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ["preview"], 'supported_by': 'community'} DOCUMENTATION = ''' --- @@ -427,14 +426,8 @@ def main(): module = GcpModule( argument_spec=dict( state=dict(default='present', choices=['present', 'absent'], type='str'), - allowed=dict(type='list', elements='dict', options=dict( - ip_protocol=dict(required=True, type='str'), - ports=dict(type='list', elements='str') - )), - denied=dict(type='list', elements='dict', options=dict( - ip_protocol=dict(required=True, type='str'), - ports=dict(type='list', elements='str') - )), + allowed=dict(type='list', elements='dict', options=dict(ip_protocol=dict(required=True, type='str'), ports=dict(type='list', elements='str'))), + denied=dict(type='list', elements='dict', options=dict(ip_protocol=dict(required=True, type='str'), ports=dict(type='list', elements='str'))), description=dict(type='str'), destination_ranges=dict(type='list', elements='str'), direction=dict(type='str', choices=['INGRESS', 'EGRESS']), @@ -446,15 +439,17 @@ def main(): source_service_accounts=dict(type='list', elements='str'), source_tags=dict(type='list', elements='str'), target_service_accounts=dict(type='list', elements='str'), - target_tags=dict(type='list', elements='str') + target_tags=dict(type='list', elements='str'), ), - mutually_exclusive=[['allowed', 'denied'], - ['destination_ranges', 'source_ranges', 'source_tags'], - ['destination_ranges', 'source_ranges'], - ['source_service_accounts', 'source_tags', 'target_tags'], - ['destination_ranges', 'source_service_accounts', 'source_tags', 'target_service_accounts'], - ['source_tags', 'target_service_accounts', 'target_tags'], - ['source_service_accounts', 'target_service_accounts', 'target_tags']] + mutually_exclusive=[ + ['allowed', 'denied'], + ['destination_ranges', 'source_ranges', 'source_tags'], + ['destination_ranges', 'source_ranges'], + ['source_service_accounts', 'source_tags', 'target_tags'], + ['destination_ranges', 'source_service_accounts', 'source_tags', 'target_service_accounts'], + ['source_tags', 'target_service_accounts', 'target_tags'], + ['source_service_accounts', 'target_service_accounts', 'target_tags'], + ], ) if not module.params['scopes']: @@ -519,7 +514,7 @@ def resource_to_request(module): u'sourceServiceAccounts': module.params.get('source_service_accounts'), u'sourceTags': module.params.get('source_tags'), u'targetServiceAccounts': module.params.get('target_service_accounts'), - u'targetTags': module.params.get('target_tags') + u'targetTags': module.params.get('target_tags'), } request = encode_request(request, module) return_vals = {} @@ -601,7 +596,7 @@ def response_to_hash(module, response): u'sourceServiceAccounts': response.get(u'sourceServiceAccounts'), u'sourceTags': response.get(u'sourceTags'), u'targetServiceAccounts': response.get(u'targetServiceAccounts'), - u'targetTags': response.get(u'targetTags') + u'targetTags': response.get(u'targetTags'), } @@ -643,8 +638,9 @@ def raise_if_errors(response, err_path, module): def encode_request(request, module): if 'network' in request and request['network'] is not None: if not re.match(r'https://www.googleapis.com/compute/v1/projects/.*', request['network']): - request['network'] = 'https://www.googleapis.com/compute/v1/projects/{project}/{network}'.format(project=module.params['project'], - network=request['network']) + request['network'] = 'https://www.googleapis.com/compute/v1/projects/{project}/{network}'.format( + project=module.params['project'], network=request['network'] + ) return request @@ -670,16 +666,10 @@ def from_response(self): return items def _request_for_item(self, item): - return remove_nones_from_dict({ - u'IPProtocol': item.get('ip_protocol'), - u'ports': item.get('ports') - }) + return remove_nones_from_dict({u'IPProtocol': item.get('ip_protocol'), u'ports': item.get('ports')}) def _response_from_item(self, item): - return remove_nones_from_dict({ - u'IPProtocol': item.get(u'ip_protocol'), - u'ports': item.get(u'ports') - }) + return remove_nones_from_dict({u'IPProtocol': item.get(u'ip_protocol'), u'ports': item.get(u'ports')}) class FirewallDeniedArray(object): @@ -703,16 +693,10 @@ def from_response(self): return items def _request_for_item(self, item): - return remove_nones_from_dict({ - u'IPProtocol': item.get('ip_protocol'), - u'ports': item.get('ports') - }) + return remove_nones_from_dict({u'IPProtocol': item.get('ip_protocol'), u'ports': item.get('ports')}) def _response_from_item(self, item): - return remove_nones_from_dict({ - u'IPProtocol': item.get(u'ip_protocol'), - u'ports': item.get(u'ports') - }) + return remove_nones_from_dict({u'IPProtocol': item.get(u'ip_protocol'), u'ports': item.get(u'ports')}) if __name__ == '__main__': diff --git a/lib/ansible/modules/cloud/google/gcp_compute_firewall_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_firewall_facts.py index ae21847fd6ab92..d20437654940be 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_firewall_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_firewall_facts.py @@ -18,15 +18,14 @@ # ---------------------------------------------------------------------------- from __future__ import absolute_import, division, print_function + __metaclass__ = type ################################################################################ # Documentation ################################################################################ -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ["preview"], - 'supported_by': 'community'} +ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ["preview"], 'supported_by': 'community'} DOCUMENTATION = ''' --- @@ -248,11 +247,7 @@ def main(): - module = GcpModule( - argument_spec=dict( - filters=dict(type='list', elements='str') - ) - ) + module = GcpModule(argument_spec=dict(filters=dict(type='list', elements='str'))) if not module.params['scopes']: module.params['scopes'] = ['https://www.googleapis.com/auth/compute'] @@ -262,9 +257,7 @@ def main(): items = items.get('items') else: items = [] - return_value = { - 'items': items - } + return_value = {'items': items} module.exit_json(**return_value) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_forwarding_rule.py b/lib/ansible/modules/cloud/google/gcp_compute_forwarding_rule.py index 0c844e7ef09a1e..fe4c122b048381 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_forwarding_rule.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_forwarding_rule.py @@ -18,15 +18,14 @@ # ---------------------------------------------------------------------------- from __future__ import absolute_import, division, print_function + __metaclass__ = type ################################################################################ # Documentation ################################################################################ -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ["preview"], - 'supported_by': 'community'} +ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ["preview"], 'supported_by': 'community'} DOCUMENTATION = ''' --- @@ -422,7 +421,7 @@ def main(): subnetwork=dict(), target=dict(), network_tier=dict(type='str', choices=['PREMIUM', 'STANDARD']), - region=dict(required=True, type='str') + region=dict(required=True, type='str'), ) ) @@ -463,8 +462,7 @@ def create(module, link, kind): def update(module, link, kind, fetch): - update_fields(module, resource_to_request(module), - response_to_hash(module, fetch)) + update_fields(module, resource_to_request(module), response_to_hash(module, fetch)) return fetch_resource(module, self_link(module), kind) @@ -476,13 +474,8 @@ def update_fields(module, request, response): def target_update(module, request, response): auth = GcpSession(module, 'compute') auth.post( - ''.join([ - "https://www.googleapis.com/compute/v1/", - "projects/{project}/regions/{region}/forwardingRules/{name}/setTarget" - ]).format(**module.params), - { - u'target': replace_resource_dict(module.params.get(u'target', {}), 'selfLink') - } + ''.join(["https://www.googleapis.com/compute/v1/", "projects/{project}/regions/{region}/forwardingRules/{name}/setTarget"]).format(**module.params), + {u'target': replace_resource_dict(module.params.get(u'target', {}), 'selfLink')}, ) @@ -506,7 +499,7 @@ def resource_to_request(module): u'ports': module.params.get('ports'), u'subnetwork': replace_resource_dict(module.params.get(u'subnetwork', {}), 'selfLink'), u'target': replace_resource_dict(module.params.get(u'target', {}), 'selfLink'), - u'networkTier': module.params.get('network_tier') + u'networkTier': module.params.get('network_tier'), } return_vals = {} for k, v in request.items(): @@ -586,7 +579,7 @@ def response_to_hash(module, response): u'ports': response.get(u'ports'), u'subnetwork': response.get(u'subnetwork'), u'target': response.get(u'target'), - u'networkTier': module.params.get('network_tier') + u'networkTier': module.params.get('network_tier'), } diff --git a/lib/ansible/modules/cloud/google/gcp_compute_forwarding_rule_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_forwarding_rule_facts.py index 0099c445d555f0..7a4f749e28318a 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_forwarding_rule_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_forwarding_rule_facts.py @@ -18,15 +18,14 @@ # ---------------------------------------------------------------------------- from __future__ import absolute_import, division, print_function + __metaclass__ = type ################################################################################ # Documentation ################################################################################ -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ["preview"], - 'supported_by': 'community'} +ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ["preview"], 'supported_by': 'community'} DOCUMENTATION = ''' --- @@ -229,12 +228,7 @@ def main(): - module = GcpModule( - argument_spec=dict( - filters=dict(type='list', elements='str'), - region=dict(required=True, type='str') - ) - ) + module = GcpModule(argument_spec=dict(filters=dict(type='list', elements='str'), region=dict(required=True, type='str'))) if not module.params['scopes']: module.params['scopes'] = ['https://www.googleapis.com/auth/compute'] @@ -244,9 +238,7 @@ def main(): items = items.get('items') else: items = [] - return_value = { - 'items': items - } + return_value = {'items': items} module.exit_json(**return_value) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_global_address.py b/lib/ansible/modules/cloud/google/gcp_compute_global_address.py index ad7b35053e28f4..09b276cf3baa08 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_global_address.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_global_address.py @@ -18,15 +18,14 @@ # ---------------------------------------------------------------------------- from __future__ import absolute_import, division, print_function + __metaclass__ = type ################################################################################ # Documentation ################################################################################ -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ["preview"], - 'supported_by': 'community'} +ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ["preview"], 'supported_by': 'community'} DOCUMENTATION = ''' --- @@ -179,7 +178,7 @@ def main(): description=dict(type='str'), name=dict(required=True, type='str'), ip_version=dict(type='str', choices=['IPV4', 'IPV6']), - address_type=dict(default='EXTERNAL', type='str', choices=['EXTERNAL', 'INTERNAL']) + address_type=dict(default='EXTERNAL', type='str', choices=['EXTERNAL', 'INTERNAL']), ) ) @@ -235,7 +234,7 @@ def resource_to_request(module): u'description': module.params.get('description'), u'name': module.params.get('name'), u'ipVersion': module.params.get('ip_version'), - u'addressType': module.params.get('address_type') + u'addressType': module.params.get('address_type'), } return_vals = {} for k, v in request.items(): @@ -308,7 +307,7 @@ def response_to_hash(module, response): u'name': response.get(u'name'), u'ipVersion': response.get(u'ipVersion'), u'region': response.get(u'region'), - u'addressType': response.get(u'addressType') + u'addressType': response.get(u'addressType'), } diff --git a/lib/ansible/modules/cloud/google/gcp_compute_global_address_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_global_address_facts.py index 2fb5e2e7e97c4e..c326c9fb81bcb1 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_global_address_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_global_address_facts.py @@ -18,15 +18,14 @@ # ---------------------------------------------------------------------------- from __future__ import absolute_import, division, print_function + __metaclass__ = type ################################################################################ # Documentation ################################################################################ -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ["preview"], - 'supported_by': 'community'} +ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ["preview"], 'supported_by': 'community'} DOCUMENTATION = ''' --- @@ -129,11 +128,7 @@ def main(): - module = GcpModule( - argument_spec=dict( - filters=dict(type='list', elements='str') - ) - ) + module = GcpModule(argument_spec=dict(filters=dict(type='list', elements='str'))) if not module.params['scopes']: module.params['scopes'] = ['https://www.googleapis.com/auth/compute'] @@ -143,9 +138,7 @@ def main(): items = items.get('items') else: items = [] - return_value = { - 'items': items - } + return_value = {'items': items} module.exit_json(**return_value) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_global_forwarding_rule.py b/lib/ansible/modules/cloud/google/gcp_compute_global_forwarding_rule.py index 4420c59546aae6..dab4f47c07f57b 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_global_forwarding_rule.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_global_forwarding_rule.py @@ -18,15 +18,14 @@ # ---------------------------------------------------------------------------- from __future__ import absolute_import, division, print_function + __metaclass__ = type ################################################################################ # Documentation ################################################################################ -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ["preview"], - 'supported_by': 'community'} +ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ["preview"], 'supported_by': 'community'} DOCUMENTATION = ''' --- @@ -431,7 +430,7 @@ def main(): port_range=dict(type='str'), ports=dict(type='list', elements='str'), subnetwork=dict(), - target=dict(type='str') + target=dict(type='str'), ) ) @@ -495,7 +494,7 @@ def resource_to_request(module): u'portRange': module.params.get('port_range'), u'ports': module.params.get('ports'), u'subnetwork': replace_resource_dict(module.params.get(u'subnetwork', {}), 'selfLink'), - u'target': module.params.get('target') + u'target': module.params.get('target'), } return_vals = {} for k, v in request.items(): @@ -575,7 +574,7 @@ def response_to_hash(module, response): u'ports': response.get(u'ports'), u'subnetwork': response.get(u'subnetwork'), u'region': response.get(u'region'), - u'target': response.get(u'target') + u'target': response.get(u'target'), } diff --git a/lib/ansible/modules/cloud/google/gcp_compute_global_forwarding_rule_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_global_forwarding_rule_facts.py index 525ef8def2cb64..f5076f79210cd2 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_global_forwarding_rule_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_global_forwarding_rule_facts.py @@ -18,15 +18,14 @@ # ---------------------------------------------------------------------------- from __future__ import absolute_import, division, print_function + __metaclass__ = type ################################################################################ # Documentation ################################################################################ -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ["preview"], - 'supported_by': 'community'} +ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ["preview"], 'supported_by': 'community'} DOCUMENTATION = ''' --- @@ -213,11 +212,7 @@ def main(): - module = GcpModule( - argument_spec=dict( - filters=dict(type='list', elements='str') - ) - ) + module = GcpModule(argument_spec=dict(filters=dict(type='list', elements='str'))) if not module.params['scopes']: module.params['scopes'] = ['https://www.googleapis.com/auth/compute'] @@ -227,9 +222,7 @@ def main(): items = items.get('items') else: items = [] - return_value = { - 'items': items - } + return_value = {'items': items} module.exit_json(**return_value) 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 7d957db291a821..924f9f8771e35f 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_health_check.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_health_check.py @@ -18,15 +18,14 @@ # ---------------------------------------------------------------------------- from __future__ import absolute_import, division, print_function + __metaclass__ = type ################################################################################ # Documentation ################################################################################ -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ["preview"], - 'supported_by': 'community'} +ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ["preview"], 'supported_by': 'community'} DOCUMENTATION = ''' --- @@ -537,38 +536,50 @@ def main(): timeout_sec=dict(default=5, type='int', aliases=['timeout_seconds']), unhealthy_threshold=dict(default=2, type='int'), type=dict(type='str', choices=['TCP', 'SSL', 'HTTP', 'HTTPS']), - 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']) - )), - 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']) - )), - tcp_health_check=dict(type='dict', options=dict( - request=dict(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']) - )), - ssl_health_check=dict(type='dict', options=dict( - request=dict(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']) - )) + 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']), + ), + ), + 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']), + ), + ), + tcp_health_check=dict( + type='dict', + options=dict( + request=dict(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']), + ), + ), + ssl_health_check=dict( + type='dict', + options=dict( + request=dict(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']), + ), + ), ), - mutually_exclusive=[['http_health_check', 'https_health_check', 'ssl_health_check', 'tcp_health_check']] + mutually_exclusive=[['http_health_check', 'https_health_check', 'ssl_health_check', 'tcp_health_check']], ) if not module.params['scopes']: @@ -630,7 +641,7 @@ def resource_to_request(module): u'httpHealthCheck': HealthCheckHttphealthcheck(module.params.get('http_health_check', {}), module).to_request(), u'httpsHealthCheck': HealthCheckHttpshealthcheck(module.params.get('https_health_check', {}), module).to_request(), u'tcpHealthCheck': HealthCheckTcphealthcheck(module.params.get('tcp_health_check', {}), module).to_request(), - u'sslHealthCheck': HealthCheckSslhealthcheck(module.params.get('ssl_health_check', {}), module).to_request() + u'sslHealthCheck': HealthCheckSslhealthcheck(module.params.get('ssl_health_check', {}), module).to_request(), } return_vals = {} for k, v in request.items(): @@ -708,7 +719,7 @@ def response_to_hash(module, response): u'httpHealthCheck': HealthCheckHttphealthcheck(response.get(u'httpHealthCheck', {}), module).from_response(), u'httpsHealthCheck': HealthCheckHttpshealthcheck(response.get(u'httpsHealthCheck', {}), module).from_response(), u'tcpHealthCheck': HealthCheckTcphealthcheck(response.get(u'tcpHealthCheck', {}), module).from_response(), - u'sslHealthCheck': HealthCheckSslhealthcheck(response.get(u'sslHealthCheck', {}), module).from_response() + u'sslHealthCheck': HealthCheckSslhealthcheck(response.get(u'sslHealthCheck', {}), module).from_response(), } @@ -756,24 +767,28 @@ def __init__(self, request, module): self.request = {} 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') - }) + 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'), + } + ) 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') - }) + 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'), + } + ) class HealthCheckHttpshealthcheck(object): @@ -785,24 +800,28 @@ def __init__(self, request, module): self.request = {} 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') - }) + 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'), + } + ) 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') - }) + 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'), + } + ) class HealthCheckTcphealthcheck(object): @@ -814,22 +833,26 @@ def __init__(self, request, module): self.request = {} def to_request(self): - return remove_nones_from_dict({ - u'request': self.request.get('request'), - 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') - }) + return remove_nones_from_dict( + { + u'request': self.request.get('request'), + 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'), + } + ) def from_response(self): - return remove_nones_from_dict({ - u'request': self.request.get(u'request'), - 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') - }) + return remove_nones_from_dict( + { + u'request': self.request.get(u'request'), + 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'), + } + ) class HealthCheckSslhealthcheck(object): @@ -841,22 +864,26 @@ def __init__(self, request, module): self.request = {} def to_request(self): - return remove_nones_from_dict({ - u'request': self.request.get('request'), - 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') - }) + return remove_nones_from_dict( + { + u'request': self.request.get('request'), + 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'), + } + ) def from_response(self): - return remove_nones_from_dict({ - u'request': self.request.get(u'request'), - 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') - }) + return remove_nones_from_dict( + { + u'request': self.request.get(u'request'), + 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'), + } + ) if __name__ == '__main__': 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 41dbf5735d111e..1635466a8225c8 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 @@ -18,15 +18,14 @@ # ---------------------------------------------------------------------------- from __future__ import absolute_import, division, print_function + __metaclass__ = type ################################################################################ # Documentation ################################################################################ -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ["preview"], - 'supported_by': 'community'} +ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ["preview"], 'supported_by': 'community'} DOCUMENTATION = ''' --- @@ -303,11 +302,7 @@ def main(): - module = GcpModule( - argument_spec=dict( - filters=dict(type='list', elements='str') - ) - ) + module = GcpModule(argument_spec=dict(filters=dict(type='list', elements='str'))) if not module.params['scopes']: module.params['scopes'] = ['https://www.googleapis.com/auth/compute'] @@ -317,9 +312,7 @@ def main(): items = items.get('items') else: items = [] - return_value = { - 'items': items - } + return_value = {'items': items} module.exit_json(**return_value) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_http_health_check.py b/lib/ansible/modules/cloud/google/gcp_compute_http_health_check.py index bb6ca8b2322f9b..387e692be9f898 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_http_health_check.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_http_health_check.py @@ -18,15 +18,14 @@ # ---------------------------------------------------------------------------- from __future__ import absolute_import, division, print_function + __metaclass__ = type ################################################################################ # Documentation ################################################################################ -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ["preview"], - 'supported_by': 'community'} +ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ["preview"], 'supported_by': 'community'} DOCUMENTATION = ''' --- @@ -223,7 +222,7 @@ def main(): port=dict(type='int'), request_path=dict(type='str'), timeout_sec=dict(type='int', aliases=['timeout_seconds']), - unhealthy_threshold=dict(type='int') + unhealthy_threshold=dict(type='int'), ) ) @@ -284,7 +283,7 @@ def resource_to_request(module): u'port': module.params.get('port'), u'requestPath': module.params.get('request_path'), u'timeoutSec': module.params.get('timeout_sec'), - u'unhealthyThreshold': module.params.get('unhealthy_threshold') + u'unhealthyThreshold': module.params.get('unhealthy_threshold'), } return_vals = {} for k, v in request.items(): @@ -360,7 +359,7 @@ def response_to_hash(module, response): u'port': response.get(u'port'), u'requestPath': response.get(u'requestPath'), u'timeoutSec': response.get(u'timeoutSec'), - u'unhealthyThreshold': response.get(u'unhealthyThreshold') + u'unhealthyThreshold': response.get(u'unhealthyThreshold'), } diff --git a/lib/ansible/modules/cloud/google/gcp_compute_http_health_check_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_http_health_check_facts.py index bb78b4b9473f49..1bbea3f6333b65 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_http_health_check_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_http_health_check_facts.py @@ -18,15 +18,14 @@ # ---------------------------------------------------------------------------- from __future__ import absolute_import, division, print_function + __metaclass__ = type ################################################################################ # Documentation ################################################################################ -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ["preview"], - 'supported_by': 'community'} +ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ["preview"], 'supported_by': 'community'} DOCUMENTATION = ''' --- @@ -149,11 +148,7 @@ def main(): - module = GcpModule( - argument_spec=dict( - filters=dict(type='list', elements='str') - ) - ) + module = GcpModule(argument_spec=dict(filters=dict(type='list', elements='str'))) if not module.params['scopes']: module.params['scopes'] = ['https://www.googleapis.com/auth/compute'] @@ -163,9 +158,7 @@ def main(): items = items.get('items') else: items = [] - return_value = { - 'items': items - } + return_value = {'items': items} module.exit_json(**return_value) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_https_health_check.py b/lib/ansible/modules/cloud/google/gcp_compute_https_health_check.py index 84054f37a61b9d..6635209bc9927f 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_https_health_check.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_https_health_check.py @@ -18,15 +18,14 @@ # ---------------------------------------------------------------------------- from __future__ import absolute_import, division, print_function + __metaclass__ = type ################################################################################ # Documentation ################################################################################ -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ["preview"], - 'supported_by': 'community'} +ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ["preview"], 'supported_by': 'community'} DOCUMENTATION = ''' --- @@ -220,7 +219,7 @@ def main(): port=dict(type='int'), request_path=dict(type='str'), timeout_sec=dict(type='int', aliases=['timeout_seconds']), - unhealthy_threshold=dict(type='int') + unhealthy_threshold=dict(type='int'), ) ) @@ -281,7 +280,7 @@ def resource_to_request(module): u'port': module.params.get('port'), u'requestPath': module.params.get('request_path'), u'timeoutSec': module.params.get('timeout_sec'), - u'unhealthyThreshold': module.params.get('unhealthy_threshold') + u'unhealthyThreshold': module.params.get('unhealthy_threshold'), } return_vals = {} for k, v in request.items(): @@ -357,7 +356,7 @@ def response_to_hash(module, response): u'port': response.get(u'port'), u'requestPath': response.get(u'requestPath'), u'timeoutSec': response.get(u'timeoutSec'), - u'unhealthyThreshold': response.get(u'unhealthyThreshold') + u'unhealthyThreshold': response.get(u'unhealthyThreshold'), } diff --git a/lib/ansible/modules/cloud/google/gcp_compute_https_health_check_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_https_health_check_facts.py index ca015c068b6f54..47605bfe9c8950 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_https_health_check_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_https_health_check_facts.py @@ -18,15 +18,14 @@ # ---------------------------------------------------------------------------- from __future__ import absolute_import, division, print_function + __metaclass__ = type ################################################################################ # Documentation ################################################################################ -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ["preview"], - 'supported_by': 'community'} +ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ["preview"], 'supported_by': 'community'} DOCUMENTATION = ''' --- @@ -149,11 +148,7 @@ def main(): - module = GcpModule( - argument_spec=dict( - filters=dict(type='list', elements='str') - ) - ) + module = GcpModule(argument_spec=dict(filters=dict(type='list', elements='str'))) if not module.params['scopes']: module.params['scopes'] = ['https://www.googleapis.com/auth/compute'] @@ -163,9 +158,7 @@ def main(): items = items.get('items') else: items = [] - return_value = { - 'items': items - } + return_value = {'items': items} module.exit_json(**return_value) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_image.py b/lib/ansible/modules/cloud/google/gcp_compute_image.py index fec986d9f89587..1b51f58014ee49 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_image.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_image.py @@ -18,15 +18,14 @@ # ---------------------------------------------------------------------------- from __future__ import absolute_import, division, print_function + __metaclass__ = type ################################################################################ # Documentation ################################################################################ -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ["preview"], - 'supported_by': 'community'} +ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ["preview"], 'supported_by': 'community'} DOCUMENTATION = ''' --- @@ -452,28 +451,19 @@ def main(): description=dict(type='str'), disk_size_gb=dict(type='int'), family=dict(type='str'), - guest_os_features=dict(type='list', elements='dict', options=dict( - type=dict(type='str', choices=['VIRTIO_SCSI_MULTIQUEUE']) - )), - image_encryption_key=dict(type='dict', options=dict( - raw_key=dict(type='str'), - sha256=dict(type='str') - )), + guest_os_features=dict(type='list', elements='dict', options=dict(type=dict(type='str', choices=['VIRTIO_SCSI_MULTIQUEUE']))), + image_encryption_key=dict(type='dict', options=dict(raw_key=dict(type='str'), sha256=dict(type='str'))), labels=dict(type='dict'), licenses=dict(type='list', elements='str'), name=dict(required=True, type='str'), - raw_disk=dict(type='dict', options=dict( - container_type=dict(type='str', choices=['TAR']), - sha1_checksum=dict(type='str'), - source=dict(required=True, type='str') - )), + raw_disk=dict( + type='dict', + options=dict(container_type=dict(type='str', choices=['TAR']), sha1_checksum=dict(type='str'), source=dict(required=True, type='str')), + ), source_disk=dict(), - source_disk_encryption_key=dict(type='dict', options=dict( - raw_key=dict(type='str'), - sha256=dict(type='str') - )), + source_disk_encryption_key=dict(type='dict', options=dict(raw_key=dict(type='str'), sha256=dict(type='str'))), source_disk_id=dict(type='str'), - source_type=dict(type='str', choices=['RAW']) + source_type=dict(type='str', choices=['RAW']), ) ) @@ -514,8 +504,7 @@ def create(module, link, kind): def update(module, link, kind, fetch): - update_fields(module, resource_to_request(module), - response_to_hash(module, fetch)) + update_fields(module, resource_to_request(module), response_to_hash(module, fetch)) return fetch_resource(module, self_link(module), kind) @@ -527,14 +516,8 @@ def update_fields(module, request, response): def labels_update(module, request, response): auth = GcpSession(module, 'compute') auth.post( - ''.join([ - "https://www.googleapis.com/compute/v1/", - "projects/{project}/global/images/{name}/setLabels" - ]).format(**module.params), - { - u'labels': module.params.get('labels'), - u'labelFingerprint': response.get('labelFingerprint') - } + ''.join(["https://www.googleapis.com/compute/v1/", "projects/{project}/global/images/{name}/setLabels"]).format(**module.params), + {u'labels': module.params.get('labels'), u'labelFingerprint': response.get('labelFingerprint')}, ) @@ -558,7 +541,7 @@ def resource_to_request(module): u'sourceDisk': replace_resource_dict(module.params.get(u'source_disk', {}), 'selfLink'), u'sourceDiskEncryptionKey': ImageSourcediskencryptionkey(module.params.get('source_disk_encryption_key', {}), module).to_request(), u'sourceDiskId': module.params.get('source_disk_id'), - u'sourceType': module.params.get('source_type') + u'sourceType': module.params.get('source_type'), } return_vals = {} for k, v in request.items(): @@ -641,7 +624,7 @@ def response_to_hash(module, response): u'sourceDisk': response.get(u'sourceDisk'), u'sourceDiskEncryptionKey': ImageSourcediskencryptionkey(response.get(u'sourceDiskEncryptionKey', {}), module).from_response(), u'sourceDiskId': response.get(u'sourceDiskId'), - u'sourceType': response.get(u'sourceType') + u'sourceType': response.get(u'sourceType'), } @@ -689,22 +672,26 @@ def __init__(self, request, module): self.request = {} def to_request(self): - return remove_nones_from_dict({ - u'deleted': self.request.get('deleted'), - u'deprecated': self.request.get('deprecated'), - u'obsolete': self.request.get('obsolete'), - u'replacement': self.request.get('replacement'), - u'state': self.request.get('state') - }) + return remove_nones_from_dict( + { + u'deleted': self.request.get('deleted'), + u'deprecated': self.request.get('deprecated'), + u'obsolete': self.request.get('obsolete'), + u'replacement': self.request.get('replacement'), + u'state': self.request.get('state'), + } + ) def from_response(self): - return remove_nones_from_dict({ - u'deleted': self.request.get(u'deleted'), - u'deprecated': self.request.get(u'deprecated'), - u'obsolete': self.request.get(u'obsolete'), - u'replacement': self.request.get(u'replacement'), - u'state': self.request.get(u'state') - }) + return remove_nones_from_dict( + { + u'deleted': self.request.get(u'deleted'), + u'deprecated': self.request.get(u'deprecated'), + u'obsolete': self.request.get(u'obsolete'), + u'replacement': self.request.get(u'replacement'), + u'state': self.request.get(u'state'), + } + ) class ImageGuestosfeaturesArray(object): @@ -728,14 +715,10 @@ def from_response(self): return items def _request_for_item(self, item): - return remove_nones_from_dict({ - u'type': item.get('type') - }) + return remove_nones_from_dict({u'type': item.get('type')}) def _response_from_item(self, item): - return remove_nones_from_dict({ - u'type': item.get(u'type') - }) + return remove_nones_from_dict({u'type': item.get(u'type')}) class ImageImageencryptionkey(object): @@ -747,16 +730,10 @@ def __init__(self, request, module): self.request = {} def to_request(self): - return remove_nones_from_dict({ - u'rawKey': self.request.get('raw_key'), - u'sha256': self.request.get('sha256') - }) + return remove_nones_from_dict({u'rawKey': self.request.get('raw_key'), u'sha256': self.request.get('sha256')}) def from_response(self): - return remove_nones_from_dict({ - u'rawKey': self.request.get(u'rawKey'), - u'sha256': self.request.get(u'sha256') - }) + return remove_nones_from_dict({u'rawKey': self.request.get(u'rawKey'), u'sha256': self.request.get(u'sha256')}) class ImageRawdisk(object): @@ -768,18 +745,14 @@ def __init__(self, request, module): self.request = {} def to_request(self): - return remove_nones_from_dict({ - u'containerType': self.request.get('container_type'), - u'sha1Checksum': self.request.get('sha1_checksum'), - u'source': self.request.get('source') - }) + return remove_nones_from_dict( + {u'containerType': self.request.get('container_type'), u'sha1Checksum': self.request.get('sha1_checksum'), u'source': self.request.get('source')} + ) def from_response(self): - return remove_nones_from_dict({ - u'containerType': self.request.get(u'containerType'), - u'sha1Checksum': self.request.get(u'sha1Checksum'), - u'source': self.request.get(u'source') - }) + return remove_nones_from_dict( + {u'containerType': self.request.get(u'containerType'), u'sha1Checksum': self.request.get(u'sha1Checksum'), u'source': self.request.get(u'source')} + ) class ImageSourcediskencryptionkey(object): @@ -791,16 +764,10 @@ def __init__(self, request, module): self.request = {} def to_request(self): - return remove_nones_from_dict({ - u'rawKey': self.request.get('raw_key'), - u'sha256': self.request.get('sha256') - }) + return remove_nones_from_dict({u'rawKey': self.request.get('raw_key'), u'sha256': self.request.get('sha256')}) def from_response(self): - return remove_nones_from_dict({ - u'rawKey': self.request.get(u'rawKey'), - u'sha256': self.request.get(u'sha256') - }) + return remove_nones_from_dict({u'rawKey': self.request.get(u'rawKey'), u'sha256': self.request.get(u'sha256')}) if __name__ == '__main__': diff --git a/lib/ansible/modules/cloud/google/gcp_compute_image_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_image_facts.py index 680c56aca0758c..a9b67bf847786c 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_image_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_image_facts.py @@ -18,15 +18,14 @@ # ---------------------------------------------------------------------------- from __future__ import absolute_import, division, print_function + __metaclass__ = type ################################################################################ # Documentation ################################################################################ -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ["preview"], - 'supported_by': 'community'} +ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ["preview"], 'supported_by': 'community'} DOCUMENTATION = ''' --- @@ -291,11 +290,7 @@ def main(): - module = GcpModule( - argument_spec=dict( - filters=dict(type='list', elements='str') - ) - ) + module = GcpModule(argument_spec=dict(filters=dict(type='list', elements='str'))) if not module.params['scopes']: module.params['scopes'] = ['https://www.googleapis.com/auth/compute'] @@ -305,9 +300,7 @@ def main(): items = items.get('items') else: items = [] - return_value = { - 'items': items - } + return_value = {'items': items} module.exit_json(**return_value) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_instance.py b/lib/ansible/modules/cloud/google/gcp_compute_instance.py index 5c389a75ebee9a..4ea36bdb66b2e7 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_instance.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_instance.py @@ -18,15 +18,14 @@ # ---------------------------------------------------------------------------- from __future__ import absolute_import, division, print_function + __metaclass__ = type ################################################################################ # Documentation ################################################################################ -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ["preview"], - 'supported_by': 'community'} +ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ["preview"], 'supported_by': 'community'} DOCUMENTATION = ''' --- @@ -891,70 +890,60 @@ def main(): argument_spec=dict( state=dict(default='present', choices=['present', 'absent'], type='str'), can_ip_forward=dict(type='bool'), - disks=dict(type='list', elements='dict', options=dict( - auto_delete=dict(type='bool'), - boot=dict(type='bool'), - device_name=dict(type='str'), - disk_encryption_key=dict(type='dict', options=dict( - raw_key=dict(type='str'), - rsa_encrypted_key=dict(type='str'), - sha256=dict(type='str') - )), - index=dict(type='int'), - initialize_params=dict(type='dict', options=dict( - disk_name=dict(type='str'), - disk_size_gb=dict(type='int'), - disk_type=dict(type='str'), - source_image=dict(type='str'), - source_image_encryption_key=dict(type='dict', options=dict( - raw_key=dict(type='str'), - sha256=dict(type='str') - )) - )), - interface=dict(type='str', choices=['SCSI', 'NVME']), - mode=dict(type='str', choices=['READ_WRITE', 'READ_ONLY']), - source=dict(), - type=dict(type='str', choices=['SCRATCH', 'PERSISTENT']) - )), - guest_accelerators=dict(type='list', elements='dict', options=dict( - accelerator_count=dict(type='int'), - accelerator_type=dict(type='str') - )), + disks=dict( + type='list', + elements='dict', + options=dict( + auto_delete=dict(type='bool'), + boot=dict(type='bool'), + device_name=dict(type='str'), + disk_encryption_key=dict(type='dict', options=dict(raw_key=dict(type='str'), rsa_encrypted_key=dict(type='str'), sha256=dict(type='str'))), + index=dict(type='int'), + initialize_params=dict( + type='dict', + options=dict( + disk_name=dict(type='str'), + disk_size_gb=dict(type='int'), + disk_type=dict(type='str'), + source_image=dict(type='str'), + source_image_encryption_key=dict(type='dict', options=dict(raw_key=dict(type='str'), sha256=dict(type='str'))), + ), + ), + interface=dict(type='str', choices=['SCSI', 'NVME']), + mode=dict(type='str', choices=['READ_WRITE', 'READ_ONLY']), + source=dict(), + type=dict(type='str', choices=['SCRATCH', 'PERSISTENT']), + ), + ), + guest_accelerators=dict(type='list', elements='dict', options=dict(accelerator_count=dict(type='int'), accelerator_type=dict(type='str'))), label_fingerprint=dict(type='str'), metadata=dict(type='dict'), machine_type=dict(type='str'), min_cpu_platform=dict(type='str'), name=dict(type='str'), - network_interfaces=dict(type='list', elements='dict', options=dict( - access_configs=dict(type='list', elements='dict', options=dict( - name=dict(required=True, type='str'), - nat_ip=dict(), - type=dict(required=True, type='str', choices=['ONE_TO_ONE_NAT']) - )), - alias_ip_ranges=dict(type='list', elements='dict', options=dict( - ip_cidr_range=dict(type='str'), - subnetwork_range_name=dict(type='str') - )), - name=dict(type='str'), - network=dict(), - network_ip=dict(type='str'), - subnetwork=dict() - )), - scheduling=dict(type='dict', options=dict( - automatic_restart=dict(type='bool'), - on_host_maintenance=dict(type='str'), - preemptible=dict(type='bool') - )), - service_accounts=dict(type='list', elements='dict', options=dict( - email=dict(type='str'), - scopes=dict(type='list', elements='str') - )), + network_interfaces=dict( + type='list', + elements='dict', + options=dict( + access_configs=dict( + type='list', + elements='dict', + options=dict(name=dict(required=True, type='str'), nat_ip=dict(), type=dict(required=True, type='str', choices=['ONE_TO_ONE_NAT'])), + ), + alias_ip_ranges=dict(type='list', elements='dict', options=dict(ip_cidr_range=dict(type='str'), subnetwork_range_name=dict(type='str'))), + name=dict(type='str'), + network=dict(), + network_ip=dict(type='str'), + subnetwork=dict(), + ), + ), + scheduling=dict( + type='dict', options=dict(automatic_restart=dict(type='bool'), on_host_maintenance=dict(type='str'), preemptible=dict(type='bool')) + ), + service_accounts=dict(type='list', elements='dict', options=dict(email=dict(type='str'), scopes=dict(type='list', elements='str'))), status=dict(type='str', choices=['PROVISIONING', 'STAGING', 'RUNNING', 'STOPPING', 'SUSPENDING', 'SUSPENDED', 'TERMINATED']), - tags=dict(type='dict', options=dict( - fingerprint=dict(type='str'), - items=dict(type='list', elements='str') - )), - zone=dict(required=True, type='str') + tags=dict(type='dict', options=dict(fingerprint=dict(type='str'), items=dict(type='list', elements='str'))), + zone=dict(required=True, type='str'), ) ) @@ -1000,8 +989,7 @@ def create(module, link, kind): def update(module, link, kind, fetch): - update_fields(module, resource_to_request(module), - response_to_hash(module, fetch)) + update_fields(module, resource_to_request(module), response_to_hash(module, fetch)) return fetch_resource(module, self_link(module), kind) @@ -1013,13 +1001,8 @@ def update_fields(module, request, response): def machine_type_update(module, request, response): auth = GcpSession(module, 'compute') auth.post( - ''.join([ - "https://www.googleapis.com/compute/v1/", - "projects/{project}/zones/{zone}/instances/{name}/setMachineType" - ]).format(**module.params), - { - u'machineType': machine_type_selflink(module.params.get('machine_type'), module.params) - } + ''.join(["https://www.googleapis.com/compute/v1/", "projects/{project}/zones/{zone}/instances/{name}/setMachineType"]).format(**module.params), + {u'machineType': machine_type_selflink(module.params.get('machine_type'), module.params)}, ) @@ -1043,7 +1026,7 @@ def resource_to_request(module): u'scheduling': InstanceScheduling(module.params.get('scheduling', {}), module).to_request(), u'serviceAccounts': InstanceServiceaccountsArray(module.params.get('service_accounts', []), module).to_request(), u'status': module.params.get('status'), - u'tags': InstanceTags(module.params.get('tags', {}), module).to_request() + u'tags': InstanceTags(module.params.get('tags', {}), module).to_request(), } request = encode_request(request, module) return_vals = {} @@ -1129,7 +1112,7 @@ def response_to_hash(module, response): u'serviceAccounts': InstanceServiceaccountsArray(response.get(u'serviceAccounts', []), module).from_response(), u'status': response.get(u'status'), u'statusMessage': response.get(u'statusMessage'), - u'tags': InstanceTags(response.get(u'tags', {}), module).from_response() + u'tags': InstanceTags(response.get(u'tags', {}), module).from_response(), } @@ -1218,13 +1201,8 @@ def metadata_encoder(metadata): metadata_new = [] for key in metadata: value = metadata[key] - metadata_new.append({ - "key": key, - "value": value - }) - return { - 'items': metadata_new - } + metadata_new.append({"key": key, "value": value}) + return {'items': metadata_new} # Map metadata.items[]{key:,value:} => metadata[key]=value @@ -1290,32 +1268,36 @@ def from_response(self): return items def _request_for_item(self, item): - return remove_nones_from_dict({ - u'autoDelete': item.get('auto_delete'), - u'boot': item.get('boot'), - u'deviceName': item.get('device_name'), - u'diskEncryptionKey': InstanceDiskencryptionkey(item.get('disk_encryption_key', {}), self.module).to_request(), - u'index': item.get('index'), - u'initializeParams': InstanceInitializeparams(item.get('initialize_params', {}), self.module).to_request(), - u'interface': item.get('interface'), - u'mode': item.get('mode'), - u'source': replace_resource_dict(item.get(u'source', {}), 'selfLink'), - u'type': item.get('type') - }) + return remove_nones_from_dict( + { + u'autoDelete': item.get('auto_delete'), + u'boot': item.get('boot'), + u'deviceName': item.get('device_name'), + u'diskEncryptionKey': InstanceDiskencryptionkey(item.get('disk_encryption_key', {}), self.module).to_request(), + u'index': item.get('index'), + u'initializeParams': InstanceInitializeparams(item.get('initialize_params', {}), self.module).to_request(), + u'interface': item.get('interface'), + u'mode': item.get('mode'), + u'source': replace_resource_dict(item.get(u'source', {}), 'selfLink'), + u'type': item.get('type'), + } + ) def _response_from_item(self, item): - return remove_nones_from_dict({ - u'autoDelete': item.get(u'autoDelete'), - u'boot': item.get(u'boot'), - u'deviceName': item.get(u'deviceName'), - u'diskEncryptionKey': InstanceDiskencryptionkey(item.get(u'diskEncryptionKey', {}), self.module).from_response(), - u'index': item.get(u'index'), - u'initializeParams': InstanceInitializeparams(self.module.params.get('initialize_params', {}), self.module).to_request(), - u'interface': item.get(u'interface'), - u'mode': item.get(u'mode'), - u'source': item.get(u'source'), - u'type': item.get(u'type') - }) + return remove_nones_from_dict( + { + u'autoDelete': item.get(u'autoDelete'), + u'boot': item.get(u'boot'), + u'deviceName': item.get(u'deviceName'), + u'diskEncryptionKey': InstanceDiskencryptionkey(item.get(u'diskEncryptionKey', {}), self.module).from_response(), + u'index': item.get(u'index'), + u'initializeParams': InstanceInitializeparams(self.module.params.get('initialize_params', {}), self.module).to_request(), + u'interface': item.get(u'interface'), + u'mode': item.get(u'mode'), + u'source': item.get(u'source'), + u'type': item.get(u'type'), + } + ) class InstanceDiskencryptionkey(object): @@ -1327,18 +1309,14 @@ def __init__(self, request, module): self.request = {} def to_request(self): - return remove_nones_from_dict({ - u'rawKey': self.request.get('raw_key'), - u'rsaEncryptedKey': self.request.get('rsa_encrypted_key'), - u'sha256': self.request.get('sha256') - }) + return remove_nones_from_dict( + {u'rawKey': self.request.get('raw_key'), u'rsaEncryptedKey': self.request.get('rsa_encrypted_key'), u'sha256': self.request.get('sha256')} + ) def from_response(self): - return remove_nones_from_dict({ - u'rawKey': self.request.get(u'rawKey'), - u'rsaEncryptedKey': self.request.get(u'rsaEncryptedKey'), - u'sha256': self.request.get(u'sha256') - }) + return remove_nones_from_dict( + {u'rawKey': self.request.get(u'rawKey'), u'rsaEncryptedKey': self.request.get(u'rsaEncryptedKey'), u'sha256': self.request.get(u'sha256')} + ) class InstanceInitializeparams(object): @@ -1350,22 +1328,26 @@ def __init__(self, request, module): self.request = {} def to_request(self): - return remove_nones_from_dict({ - u'diskName': self.request.get('disk_name'), - u'diskSizeGb': self.request.get('disk_size_gb'), - u'diskType': disk_type_selflink(self.request.get('disk_type'), self.module.params), - u'sourceImage': self.request.get('source_image'), - u'sourceImageEncryptionKey': InstanceSourceimageencryptionkey(self.request.get('source_image_encryption_key', {}), self.module).to_request() - }) + return remove_nones_from_dict( + { + u'diskName': self.request.get('disk_name'), + u'diskSizeGb': self.request.get('disk_size_gb'), + u'diskType': disk_type_selflink(self.request.get('disk_type'), self.module.params), + u'sourceImage': self.request.get('source_image'), + u'sourceImageEncryptionKey': InstanceSourceimageencryptionkey(self.request.get('source_image_encryption_key', {}), self.module).to_request(), + } + ) def from_response(self): - return remove_nones_from_dict({ - u'diskName': self.request.get(u'diskName'), - u'diskSizeGb': self.request.get(u'diskSizeGb'), - u'diskType': self.request.get(u'diskType'), - u'sourceImage': self.request.get(u'sourceImage'), - u'sourceImageEncryptionKey': InstanceSourceimageencryptionkey(self.request.get(u'sourceImageEncryptionKey', {}), self.module).from_response() - }) + return remove_nones_from_dict( + { + u'diskName': self.request.get(u'diskName'), + u'diskSizeGb': self.request.get(u'diskSizeGb'), + u'diskType': self.request.get(u'diskType'), + u'sourceImage': self.request.get(u'sourceImage'), + u'sourceImageEncryptionKey': InstanceSourceimageencryptionkey(self.request.get(u'sourceImageEncryptionKey', {}), self.module).from_response(), + } + ) class InstanceSourceimageencryptionkey(object): @@ -1377,16 +1359,10 @@ def __init__(self, request, module): self.request = {} def to_request(self): - return remove_nones_from_dict({ - u'rawKey': self.request.get('raw_key'), - u'sha256': self.request.get('sha256') - }) + return remove_nones_from_dict({u'rawKey': self.request.get('raw_key'), u'sha256': self.request.get('sha256')}) def from_response(self): - return remove_nones_from_dict({ - u'rawKey': self.request.get(u'rawKey'), - u'sha256': self.request.get(u'sha256') - }) + return remove_nones_from_dict({u'rawKey': self.request.get(u'rawKey'), u'sha256': self.request.get(u'sha256')}) class InstanceGuestacceleratorsArray(object): @@ -1410,16 +1386,10 @@ def from_response(self): return items def _request_for_item(self, item): - return remove_nones_from_dict({ - u'acceleratorCount': item.get('accelerator_count'), - u'acceleratorType': item.get('accelerator_type') - }) + return remove_nones_from_dict({u'acceleratorCount': item.get('accelerator_count'), u'acceleratorType': item.get('accelerator_type')}) def _response_from_item(self, item): - return remove_nones_from_dict({ - u'acceleratorCount': item.get(u'acceleratorCount'), - u'acceleratorType': item.get(u'acceleratorType') - }) + return remove_nones_from_dict({u'acceleratorCount': item.get(u'acceleratorCount'), u'acceleratorType': item.get(u'acceleratorType')}) class InstanceNetworkinterfacesArray(object): @@ -1443,24 +1413,28 @@ def from_response(self): return items def _request_for_item(self, item): - return remove_nones_from_dict({ - u'accessConfigs': InstanceAccessconfigsArray(item.get('access_configs', []), self.module).to_request(), - u'aliasIpRanges': InstanceAliasiprangesArray(item.get('alias_ip_ranges', []), self.module).to_request(), - u'name': item.get('name'), - u'network': replace_resource_dict(item.get(u'network', {}), 'selfLink'), - u'networkIP': item.get('network_ip'), - u'subnetwork': replace_resource_dict(item.get(u'subnetwork', {}), 'selfLink') - }) + return remove_nones_from_dict( + { + u'accessConfigs': InstanceAccessconfigsArray(item.get('access_configs', []), self.module).to_request(), + u'aliasIpRanges': InstanceAliasiprangesArray(item.get('alias_ip_ranges', []), self.module).to_request(), + u'name': item.get('name'), + u'network': replace_resource_dict(item.get(u'network', {}), 'selfLink'), + u'networkIP': item.get('network_ip'), + u'subnetwork': replace_resource_dict(item.get(u'subnetwork', {}), 'selfLink'), + } + ) def _response_from_item(self, item): - return remove_nones_from_dict({ - u'accessConfigs': InstanceAccessconfigsArray(item.get(u'accessConfigs', []), self.module).from_response(), - u'aliasIpRanges': InstanceAliasiprangesArray(item.get(u'aliasIpRanges', []), self.module).from_response(), - u'name': item.get(u'name'), - u'network': item.get(u'network'), - u'networkIP': item.get(u'networkIP'), - u'subnetwork': item.get(u'subnetwork') - }) + return remove_nones_from_dict( + { + u'accessConfigs': InstanceAccessconfigsArray(item.get(u'accessConfigs', []), self.module).from_response(), + u'aliasIpRanges': InstanceAliasiprangesArray(item.get(u'aliasIpRanges', []), self.module).from_response(), + u'name': item.get(u'name'), + u'network': item.get(u'network'), + u'networkIP': item.get(u'networkIP'), + u'subnetwork': item.get(u'subnetwork'), + } + ) class InstanceAccessconfigsArray(object): @@ -1484,18 +1458,12 @@ def from_response(self): return items def _request_for_item(self, item): - return remove_nones_from_dict({ - u'name': item.get('name'), - u'natIP': replace_resource_dict(item.get(u'nat_ip', {}), 'address'), - u'type': item.get('type') - }) + return remove_nones_from_dict( + {u'name': item.get('name'), u'natIP': replace_resource_dict(item.get(u'nat_ip', {}), 'address'), u'type': item.get('type')} + ) def _response_from_item(self, item): - return remove_nones_from_dict({ - u'name': item.get(u'name'), - u'natIP': item.get(u'natIP'), - u'type': item.get(u'type') - }) + return remove_nones_from_dict({u'name': item.get(u'name'), u'natIP': item.get(u'natIP'), u'type': item.get(u'type')}) class InstanceAliasiprangesArray(object): @@ -1519,16 +1487,10 @@ def from_response(self): return items def _request_for_item(self, item): - return remove_nones_from_dict({ - u'ipCidrRange': item.get('ip_cidr_range'), - u'subnetworkRangeName': item.get('subnetwork_range_name') - }) + return remove_nones_from_dict({u'ipCidrRange': item.get('ip_cidr_range'), u'subnetworkRangeName': item.get('subnetwork_range_name')}) def _response_from_item(self, item): - return remove_nones_from_dict({ - u'ipCidrRange': item.get(u'ipCidrRange'), - u'subnetworkRangeName': item.get(u'subnetworkRangeName') - }) + return remove_nones_from_dict({u'ipCidrRange': item.get(u'ipCidrRange'), u'subnetworkRangeName': item.get(u'subnetworkRangeName')}) class InstanceScheduling(object): @@ -1540,18 +1502,22 @@ def __init__(self, request, module): self.request = {} def to_request(self): - return remove_nones_from_dict({ - u'automaticRestart': self.request.get('automatic_restart'), - u'onHostMaintenance': self.request.get('on_host_maintenance'), - u'preemptible': self.request.get('preemptible') - }) + return remove_nones_from_dict( + { + u'automaticRestart': self.request.get('automatic_restart'), + u'onHostMaintenance': self.request.get('on_host_maintenance'), + u'preemptible': self.request.get('preemptible'), + } + ) def from_response(self): - return remove_nones_from_dict({ - u'automaticRestart': self.request.get(u'automaticRestart'), - u'onHostMaintenance': self.request.get(u'onHostMaintenance'), - u'preemptible': self.request.get(u'preemptible') - }) + return remove_nones_from_dict( + { + u'automaticRestart': self.request.get(u'automaticRestart'), + u'onHostMaintenance': self.request.get(u'onHostMaintenance'), + u'preemptible': self.request.get(u'preemptible'), + } + ) class InstanceServiceaccountsArray(object): @@ -1575,16 +1541,10 @@ def from_response(self): return items def _request_for_item(self, item): - return remove_nones_from_dict({ - u'email': item.get('email'), - u'scopes': item.get('scopes') - }) + return remove_nones_from_dict({u'email': item.get('email'), u'scopes': item.get('scopes')}) def _response_from_item(self, item): - return remove_nones_from_dict({ - u'email': item.get(u'email'), - u'scopes': item.get(u'scopes') - }) + return remove_nones_from_dict({u'email': item.get(u'email'), u'scopes': item.get(u'scopes')}) class InstanceTags(object): @@ -1596,16 +1556,10 @@ def __init__(self, request, module): self.request = {} def to_request(self): - return remove_nones_from_dict({ - u'fingerprint': self.request.get('fingerprint'), - u'items': self.request.get('items') - }) + return remove_nones_from_dict({u'fingerprint': self.request.get('fingerprint'), u'items': self.request.get('items')}) def from_response(self): - return remove_nones_from_dict({ - u'fingerprint': self.request.get(u'fingerprint'), - u'items': self.request.get(u'items') - }) + return remove_nones_from_dict({u'fingerprint': self.request.get(u'fingerprint'), u'items': self.request.get(u'items')}) if __name__ == '__main__': diff --git a/lib/ansible/modules/cloud/google/gcp_compute_instance_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_instance_facts.py index 0a32d8fd6229f3..7840d6b4414303 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_instance_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_instance_facts.py @@ -18,15 +18,14 @@ # ---------------------------------------------------------------------------- from __future__ import absolute_import, division, print_function + __metaclass__ = type ################################################################################ # Documentation ################################################################################ -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ["preview"], - 'supported_by': 'community'} +ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ["preview"], 'supported_by': 'community'} DOCUMENTATION = ''' --- @@ -484,12 +483,7 @@ def main(): - module = GcpModule( - argument_spec=dict( - filters=dict(type='list', elements='str'), - zone=dict(required=True, type='str') - ) - ) + module = GcpModule(argument_spec=dict(filters=dict(type='list', elements='str'), zone=dict(required=True, type='str'))) if not module.params['scopes']: module.params['scopes'] = ['https://www.googleapis.com/auth/compute'] @@ -499,9 +493,7 @@ def main(): items = items.get('items') else: items = [] - return_value = { - 'items': items - } + return_value = {'items': items} module.exit_json(**return_value) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_instance_group.py b/lib/ansible/modules/cloud/google/gcp_compute_instance_group.py index b814cce4983ce1..a7ae235641087b 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_instance_group.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_instance_group.py @@ -18,15 +18,14 @@ # ---------------------------------------------------------------------------- from __future__ import absolute_import, division, print_function + __metaclass__ = type ################################################################################ # Documentation ################################################################################ -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ["preview"], - 'supported_by': 'community'} +ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ["preview"], 'supported_by': 'community'} DOCUMENTATION = ''' --- @@ -238,15 +237,12 @@ def main(): state=dict(default='present', choices=['present', 'absent'], type='str'), description=dict(type='str'), name=dict(type='str'), - named_ports=dict(type='list', elements='dict', options=dict( - name=dict(type='str'), - port=dict(type='int') - )), + named_ports=dict(type='list', elements='dict', options=dict(name=dict(type='str'), port=dict(type='int'))), network=dict(), region=dict(type='str'), subnetwork=dict(), zone=dict(required=True, type='str'), - instances=dict(type='list') + instances=dict(type='list'), ) ) @@ -308,7 +304,7 @@ def resource_to_request(module): u'namedPorts': InstanceGroupNamedportsArray(module.params.get('named_ports', []), module).to_request(), u'network': replace_resource_dict(module.params.get(u'network', {}), 'selfLink'), u'region': region_selflink(module.params.get('region'), module.params), - u'subnetwork': replace_resource_dict(module.params.get(u'subnetwork', {}), 'selfLink') + u'subnetwork': replace_resource_dict(module.params.get(u'subnetwork', {}), 'selfLink'), } return_vals = {} for k, v in request.items(): @@ -381,7 +377,7 @@ def response_to_hash(module, response): u'namedPorts': InstanceGroupNamedportsArray(response.get(u'namedPorts', []), module).from_response(), u'network': response.get(u'network'), u'region': response.get(u'region'), - u'subnetwork': response.get(u'subnetwork') + u'subnetwork': response.get(u'subnetwork'), } @@ -454,8 +450,7 @@ def run(self): def list_instances(self): auth = GcpSession(self.module, 'compute') - response = return_if_object(self.module, auth.post(self._list_instances_url(), {'instanceState': 'ALL'}), - 'compute#instanceGroupsListInstances') + response = return_if_object(self.module, auth.post(self._list_instances_url(), {'instanceState': 'ALL'}), 'compute#instanceGroupsListInstances') # Transform instance list into a list of selfLinks for diffing with module parameters instances = [] @@ -481,9 +476,7 @@ def _add_instances_url(self): return "https://www.googleapis.com/compute/v1/projects/{project}/zones/{zone}/instanceGroups/{name}/addInstances".format(**self.module.params) def _build_request(self, instances): - request = { - 'instances': [] - } + request = {'instances': []} for instance in instances: request['instances'].append({'instance': instance}) return request @@ -510,16 +503,10 @@ def from_response(self): return items def _request_for_item(self, item): - return remove_nones_from_dict({ - u'name': item.get('name'), - u'port': item.get('port') - }) + return remove_nones_from_dict({u'name': item.get('name'), u'port': item.get('port')}) def _response_from_item(self, item): - return remove_nones_from_dict({ - u'name': item.get(u'name'), - u'port': item.get(u'port') - }) + return remove_nones_from_dict({u'name': item.get(u'name'), u'port': item.get(u'port')}) if __name__ == '__main__': diff --git a/lib/ansible/modules/cloud/google/gcp_compute_instance_group_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_instance_group_facts.py index 19b55fc5d1c99d..0486890a0ed506 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_instance_group_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_instance_group_facts.py @@ -18,15 +18,14 @@ # ---------------------------------------------------------------------------- from __future__ import absolute_import, division, print_function + __metaclass__ = type ################################################################################ # Documentation ################################################################################ -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ["preview"], - 'supported_by': 'community'} +ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ["preview"], 'supported_by': 'community'} DOCUMENTATION = ''' --- @@ -157,12 +156,7 @@ def main(): - module = GcpModule( - argument_spec=dict( - filters=dict(type='list', elements='str'), - zone=dict(required=True, type='str') - ) - ) + module = GcpModule(argument_spec=dict(filters=dict(type='list', elements='str'), zone=dict(required=True, type='str'))) if not module.params['scopes']: module.params['scopes'] = ['https://www.googleapis.com/auth/compute'] @@ -172,9 +166,7 @@ def main(): items = items.get('items') else: items = [] - return_value = { - 'items': items - } + return_value = {'items': items} module.exit_json(**return_value) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_instance_group_manager.py b/lib/ansible/modules/cloud/google/gcp_compute_instance_group_manager.py index 77071a39bf977f..4a78ed487e2df0 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_instance_group_manager.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_instance_group_manager.py @@ -18,15 +18,14 @@ # ---------------------------------------------------------------------------- from __future__ import absolute_import, division, print_function + __metaclass__ = type ################################################################################ # Documentation ################################################################################ -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ["preview"], - 'supported_by': 'community'} +ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ["preview"], 'supported_by': 'community'} DOCUMENTATION = ''' --- @@ -342,13 +341,10 @@ def main(): description=dict(type='str'), instance_template=dict(required=True), name=dict(required=True, type='str'), - named_ports=dict(type='list', elements='dict', options=dict( - name=dict(type='str'), - port=dict(type='int') - )), + named_ports=dict(type='list', elements='dict', options=dict(name=dict(type='str'), port=dict(type='int'))), target_pools=dict(type='list'), target_size=dict(type='int'), - zone=dict(required=True, type='str') + zone=dict(required=True, type='str'), ) ) @@ -407,7 +403,7 @@ def resource_to_request(module): u'name': module.params.get('name'), u'namedPorts': InstanceGroupManagerNamedportsArray(module.params.get('named_ports', []), module).to_request(), u'targetPools': replace_resource_dict(module.params.get('target_pools', []), 'selfLink'), - u'targetSize': module.params.get('target_size') + u'targetSize': module.params.get('target_size'), } return_vals = {} for k, v in request.items(): @@ -484,7 +480,7 @@ def response_to_hash(module, response): u'namedPorts': InstanceGroupManagerNamedportsArray(response.get(u'namedPorts', []), module).from_response(), u'region': response.get(u'region'), u'targetPools': response.get(u'targetPools'), - u'targetSize': response.get(u'targetSize') + u'targetSize': response.get(u'targetSize'), } @@ -541,28 +537,32 @@ def __init__(self, request, module): self.request = {} def to_request(self): - return remove_nones_from_dict({ - u'abandoning': self.request.get('abandoning'), - u'creating': self.request.get('creating'), - u'creatingWithoutRetries': self.request.get('creating_without_retries'), - u'deleting': self.request.get('deleting'), - u'none': self.request.get('none'), - u'recreating': self.request.get('recreating'), - u'refreshing': self.request.get('refreshing'), - u'restarting': self.request.get('restarting') - }) + return remove_nones_from_dict( + { + u'abandoning': self.request.get('abandoning'), + u'creating': self.request.get('creating'), + u'creatingWithoutRetries': self.request.get('creating_without_retries'), + u'deleting': self.request.get('deleting'), + u'none': self.request.get('none'), + u'recreating': self.request.get('recreating'), + u'refreshing': self.request.get('refreshing'), + u'restarting': self.request.get('restarting'), + } + ) def from_response(self): - return remove_nones_from_dict({ - u'abandoning': self.request.get(u'abandoning'), - u'creating': self.request.get(u'creating'), - u'creatingWithoutRetries': self.request.get(u'creatingWithoutRetries'), - u'deleting': self.request.get(u'deleting'), - u'none': self.request.get(u'none'), - u'recreating': self.request.get(u'recreating'), - u'refreshing': self.request.get(u'refreshing'), - u'restarting': self.request.get(u'restarting') - }) + return remove_nones_from_dict( + { + u'abandoning': self.request.get(u'abandoning'), + u'creating': self.request.get(u'creating'), + u'creatingWithoutRetries': self.request.get(u'creatingWithoutRetries'), + u'deleting': self.request.get(u'deleting'), + u'none': self.request.get(u'none'), + u'recreating': self.request.get(u'recreating'), + u'refreshing': self.request.get(u'refreshing'), + u'restarting': self.request.get(u'restarting'), + } + ) class InstanceGroupManagerNamedportsArray(object): @@ -586,16 +586,10 @@ def from_response(self): return items def _request_for_item(self, item): - return remove_nones_from_dict({ - u'name': item.get('name'), - u'port': item.get('port') - }) + return remove_nones_from_dict({u'name': item.get('name'), u'port': item.get('port')}) def _response_from_item(self, item): - return remove_nones_from_dict({ - u'name': item.get(u'name'), - u'port': item.get(u'port') - }) + return remove_nones_from_dict({u'name': item.get(u'name'), u'port': item.get(u'port')}) if __name__ == '__main__': diff --git a/lib/ansible/modules/cloud/google/gcp_compute_instance_group_manager_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_instance_group_manager_facts.py index e7914577e3bdd8..03f2caee85085d 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_instance_group_manager_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_instance_group_manager_facts.py @@ -18,15 +18,14 @@ # ---------------------------------------------------------------------------- from __future__ import absolute_import, division, print_function + __metaclass__ = type ################################################################################ # Documentation ################################################################################ -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ["preview"], - 'supported_by': 'community'} +ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ["preview"], 'supported_by': 'community'} DOCUMENTATION = ''' --- @@ -232,12 +231,7 @@ def main(): - module = GcpModule( - argument_spec=dict( - filters=dict(type='list', elements='str'), - zone=dict(required=True, type='str') - ) - ) + module = GcpModule(argument_spec=dict(filters=dict(type='list', elements='str'), zone=dict(required=True, type='str'))) if not module.params['scopes']: module.params['scopes'] = ['https://www.googleapis.com/auth/compute'] @@ -247,9 +241,7 @@ def main(): items = items.get('items') else: items = [] - return_value = { - 'items': items - } + return_value = {'items': items} module.exit_json(**return_value) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_instance_template.py b/lib/ansible/modules/cloud/google/gcp_compute_instance_template.py index eab2b9b170c6c7..e194c471d9028c 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_instance_template.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_instance_template.py @@ -18,15 +18,14 @@ # ---------------------------------------------------------------------------- from __future__ import absolute_import, division, print_function + __metaclass__ = type ################################################################################ # Documentation ################################################################################ -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ["preview"], - 'supported_by': 'community'} +ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ["preview"], 'supported_by': 'community'} DOCUMENTATION = ''' --- @@ -867,70 +866,69 @@ def main(): state=dict(default='present', choices=['present', 'absent'], type='str'), description=dict(type='str'), name=dict(required=True, type='str'), - properties=dict(type='dict', options=dict( - can_ip_forward=dict(type='bool'), - description=dict(type='str'), - disks=dict(type='list', elements='dict', options=dict( - auto_delete=dict(type='bool'), - boot=dict(type='bool'), - device_name=dict(type='str'), - disk_encryption_key=dict(type='dict', options=dict( - raw_key=dict(type='str'), - rsa_encrypted_key=dict(type='str'), - sha256=dict(type='str') - )), - index=dict(type='int'), - initialize_params=dict(type='dict', options=dict( - disk_name=dict(type='str'), - disk_size_gb=dict(type='int'), - disk_type=dict(type='str'), - source_image=dict(type='str'), - source_image_encryption_key=dict(type='dict', options=dict( - raw_key=dict(type='str'), - sha256=dict(type='str') - )) - )), - interface=dict(type='str', choices=['SCSI', 'NVME']), - mode=dict(type='str', choices=['READ_WRITE', 'READ_ONLY']), - source=dict(), - type=dict(type='str', choices=['SCRATCH', 'PERSISTENT']) - )), - machine_type=dict(required=True, type='str'), - min_cpu_platform=dict(type='str'), - metadata=dict(type='dict'), - guest_accelerators=dict(type='list', elements='dict', options=dict( - accelerator_count=dict(type='int'), - accelerator_type=dict(type='str') - )), - network_interfaces=dict(type='list', elements='dict', options=dict( - access_configs=dict(type='list', elements='dict', options=dict( - name=dict(required=True, type='str'), - nat_ip=dict(), - type=dict(required=True, type='str', choices=['ONE_TO_ONE_NAT']) - )), - alias_ip_ranges=dict(type='list', elements='dict', options=dict( - ip_cidr_range=dict(type='str'), - subnetwork_range_name=dict(type='str') - )), - name=dict(type='str'), - network=dict(), - network_ip=dict(type='str'), - subnetwork=dict() - )), - scheduling=dict(type='dict', options=dict( - automatic_restart=dict(type='bool'), - on_host_maintenance=dict(type='str'), - preemptible=dict(type='bool') - )), - service_accounts=dict(type='list', elements='dict', options=dict( - email=dict(type='str'), - scopes=dict(type='list', elements='str') - )), - tags=dict(type='dict', options=dict( - fingerprint=dict(type='str'), - items=dict(type='list', elements='str') - )) - )) + properties=dict( + type='dict', + options=dict( + can_ip_forward=dict(type='bool'), + description=dict(type='str'), + disks=dict( + type='list', + elements='dict', + options=dict( + auto_delete=dict(type='bool'), + boot=dict(type='bool'), + device_name=dict(type='str'), + disk_encryption_key=dict( + type='dict', options=dict(raw_key=dict(type='str'), rsa_encrypted_key=dict(type='str'), sha256=dict(type='str')) + ), + index=dict(type='int'), + initialize_params=dict( + type='dict', + options=dict( + disk_name=dict(type='str'), + disk_size_gb=dict(type='int'), + disk_type=dict(type='str'), + source_image=dict(type='str'), + source_image_encryption_key=dict(type='dict', options=dict(raw_key=dict(type='str'), sha256=dict(type='str'))), + ), + ), + interface=dict(type='str', choices=['SCSI', 'NVME']), + mode=dict(type='str', choices=['READ_WRITE', 'READ_ONLY']), + source=dict(), + type=dict(type='str', choices=['SCRATCH', 'PERSISTENT']), + ), + ), + machine_type=dict(required=True, type='str'), + min_cpu_platform=dict(type='str'), + metadata=dict(type='dict'), + guest_accelerators=dict(type='list', elements='dict', options=dict(accelerator_count=dict(type='int'), accelerator_type=dict(type='str'))), + network_interfaces=dict( + type='list', + elements='dict', + options=dict( + access_configs=dict( + type='list', + elements='dict', + options=dict( + name=dict(required=True, type='str'), nat_ip=dict(), type=dict(required=True, type='str', choices=['ONE_TO_ONE_NAT']) + ), + ), + alias_ip_ranges=dict( + type='list', elements='dict', options=dict(ip_cidr_range=dict(type='str'), subnetwork_range_name=dict(type='str')) + ), + name=dict(type='str'), + network=dict(), + network_ip=dict(type='str'), + subnetwork=dict(), + ), + ), + scheduling=dict( + type='dict', options=dict(automatic_restart=dict(type='bool'), on_host_maintenance=dict(type='str'), preemptible=dict(type='bool')) + ), + service_accounts=dict(type='list', elements='dict', options=dict(email=dict(type='str'), scopes=dict(type='list', elements='str'))), + tags=dict(type='dict', options=dict(fingerprint=dict(type='str'), items=dict(type='list', elements='str'))), + ), + ), ) ) @@ -984,7 +982,7 @@ def resource_to_request(module): u'kind': 'compute#instanceTemplate', u'description': module.params.get('description'), u'name': module.params.get('name'), - u'properties': InstanceTemplateProperties(module.params.get('properties', {}), module).to_request() + u'properties': InstanceTemplateProperties(module.params.get('properties', {}), module).to_request(), } request = encode_request(request, module) return_vals = {} @@ -1058,7 +1056,7 @@ def response_to_hash(module, response): u'description': response.get(u'description'), u'id': response.get(u'id'), u'name': response.get(u'name'), - u'properties': InstanceTemplateProperties(response.get(u'properties', {}), module).from_response() + u'properties': InstanceTemplateProperties(response.get(u'properties', {}), module).from_response(), } @@ -1138,13 +1136,8 @@ def metadata_encoder(metadata): metadata_new = [] for key in metadata: value = metadata[key] - metadata_new.append({ - "key": key, - "value": value - }) - return { - 'items': metadata_new - } + metadata_new.append({"key": key, "value": value}) + return {'items': metadata_new} # Map metadata.items[]{key:,value:} => metadata[key]=value @@ -1166,34 +1159,38 @@ def __init__(self, request, module): self.request = {} def to_request(self): - return remove_nones_from_dict({ - u'canIpForward': self.request.get('can_ip_forward'), - u'description': self.request.get('description'), - u'disks': InstanceTemplateDisksArray(self.request.get('disks', []), self.module).to_request(), - u'machineType': self.request.get('machine_type'), - u'minCpuPlatform': self.request.get('min_cpu_platform'), - u'metadata': self.request.get('metadata'), - u'guestAccelerators': InstanceTemplateGuestacceleratorsArray(self.request.get('guest_accelerators', []), self.module).to_request(), - u'networkInterfaces': InstanceTemplateNetworkinterfacesArray(self.request.get('network_interfaces', []), self.module).to_request(), - u'scheduling': InstanceTemplateScheduling(self.request.get('scheduling', {}), self.module).to_request(), - u'serviceAccounts': InstanceTemplateServiceaccountsArray(self.request.get('service_accounts', []), self.module).to_request(), - u'tags': InstanceTemplateTags(self.request.get('tags', {}), self.module).to_request() - }) + return remove_nones_from_dict( + { + u'canIpForward': self.request.get('can_ip_forward'), + u'description': self.request.get('description'), + u'disks': InstanceTemplateDisksArray(self.request.get('disks', []), self.module).to_request(), + u'machineType': self.request.get('machine_type'), + u'minCpuPlatform': self.request.get('min_cpu_platform'), + u'metadata': self.request.get('metadata'), + u'guestAccelerators': InstanceTemplateGuestacceleratorsArray(self.request.get('guest_accelerators', []), self.module).to_request(), + u'networkInterfaces': InstanceTemplateNetworkinterfacesArray(self.request.get('network_interfaces', []), self.module).to_request(), + u'scheduling': InstanceTemplateScheduling(self.request.get('scheduling', {}), self.module).to_request(), + u'serviceAccounts': InstanceTemplateServiceaccountsArray(self.request.get('service_accounts', []), self.module).to_request(), + u'tags': InstanceTemplateTags(self.request.get('tags', {}), self.module).to_request(), + } + ) def from_response(self): - return remove_nones_from_dict({ - u'canIpForward': self.request.get(u'canIpForward'), - u'description': self.request.get(u'description'), - u'disks': InstanceTemplateDisksArray(self.request.get(u'disks', []), self.module).from_response(), - u'machineType': self.request.get(u'machineType'), - u'minCpuPlatform': self.request.get(u'minCpuPlatform'), - u'metadata': self.request.get(u'metadata'), - u'guestAccelerators': InstanceTemplateGuestacceleratorsArray(self.request.get(u'guestAccelerators', []), self.module).from_response(), - u'networkInterfaces': InstanceTemplateNetworkinterfacesArray(self.request.get(u'networkInterfaces', []), self.module).from_response(), - u'scheduling': InstanceTemplateScheduling(self.request.get(u'scheduling', {}), self.module).from_response(), - u'serviceAccounts': InstanceTemplateServiceaccountsArray(self.request.get(u'serviceAccounts', []), self.module).from_response(), - u'tags': InstanceTemplateTags(self.request.get(u'tags', {}), self.module).from_response() - }) + return remove_nones_from_dict( + { + u'canIpForward': self.request.get(u'canIpForward'), + u'description': self.request.get(u'description'), + u'disks': InstanceTemplateDisksArray(self.request.get(u'disks', []), self.module).from_response(), + u'machineType': self.request.get(u'machineType'), + u'minCpuPlatform': self.request.get(u'minCpuPlatform'), + u'metadata': self.request.get(u'metadata'), + u'guestAccelerators': InstanceTemplateGuestacceleratorsArray(self.request.get(u'guestAccelerators', []), self.module).from_response(), + u'networkInterfaces': InstanceTemplateNetworkinterfacesArray(self.request.get(u'networkInterfaces', []), self.module).from_response(), + u'scheduling': InstanceTemplateScheduling(self.request.get(u'scheduling', {}), self.module).from_response(), + u'serviceAccounts': InstanceTemplateServiceaccountsArray(self.request.get(u'serviceAccounts', []), self.module).from_response(), + u'tags': InstanceTemplateTags(self.request.get(u'tags', {}), self.module).from_response(), + } + ) class InstanceTemplateDisksArray(object): @@ -1217,32 +1214,36 @@ def from_response(self): return items def _request_for_item(self, item): - return remove_nones_from_dict({ - u'autoDelete': item.get('auto_delete'), - u'boot': item.get('boot'), - u'deviceName': item.get('device_name'), - u'diskEncryptionKey': InstanceTemplateDiskencryptionkey(item.get('disk_encryption_key', {}), self.module).to_request(), - u'index': item.get('index'), - u'initializeParams': InstanceTemplateInitializeparams(item.get('initialize_params', {}), self.module).to_request(), - u'interface': item.get('interface'), - u'mode': item.get('mode'), - u'source': replace_resource_dict(item.get(u'source', {}), 'name'), - u'type': item.get('type') - }) + return remove_nones_from_dict( + { + u'autoDelete': item.get('auto_delete'), + u'boot': item.get('boot'), + u'deviceName': item.get('device_name'), + u'diskEncryptionKey': InstanceTemplateDiskencryptionkey(item.get('disk_encryption_key', {}), self.module).to_request(), + u'index': item.get('index'), + u'initializeParams': InstanceTemplateInitializeparams(item.get('initialize_params', {}), self.module).to_request(), + u'interface': item.get('interface'), + u'mode': item.get('mode'), + u'source': replace_resource_dict(item.get(u'source', {}), 'name'), + u'type': item.get('type'), + } + ) def _response_from_item(self, item): - return remove_nones_from_dict({ - u'autoDelete': item.get(u'autoDelete'), - u'boot': item.get(u'boot'), - u'deviceName': item.get(u'deviceName'), - u'diskEncryptionKey': InstanceTemplateDiskencryptionkey(item.get(u'diskEncryptionKey', {}), self.module).from_response(), - u'index': item.get(u'index'), - u'initializeParams': InstanceTemplateInitializeparams(self.module.params.get('initialize_params', {}), self.module).to_request(), - u'interface': item.get(u'interface'), - u'mode': item.get(u'mode'), - u'source': item.get(u'source'), - u'type': item.get(u'type') - }) + return remove_nones_from_dict( + { + u'autoDelete': item.get(u'autoDelete'), + u'boot': item.get(u'boot'), + u'deviceName': item.get(u'deviceName'), + u'diskEncryptionKey': InstanceTemplateDiskencryptionkey(item.get(u'diskEncryptionKey', {}), self.module).from_response(), + u'index': item.get(u'index'), + u'initializeParams': InstanceTemplateInitializeparams(self.module.params.get('initialize_params', {}), self.module).to_request(), + u'interface': item.get(u'interface'), + u'mode': item.get(u'mode'), + u'source': item.get(u'source'), + u'type': item.get(u'type'), + } + ) class InstanceTemplateDiskencryptionkey(object): @@ -1254,18 +1255,14 @@ def __init__(self, request, module): self.request = {} def to_request(self): - return remove_nones_from_dict({ - u'rawKey': self.request.get('raw_key'), - u'rsaEncryptedKey': self.request.get('rsa_encrypted_key'), - u'sha256': self.request.get('sha256') - }) + return remove_nones_from_dict( + {u'rawKey': self.request.get('raw_key'), u'rsaEncryptedKey': self.request.get('rsa_encrypted_key'), u'sha256': self.request.get('sha256')} + ) def from_response(self): - return remove_nones_from_dict({ - u'rawKey': self.request.get(u'rawKey'), - u'rsaEncryptedKey': self.request.get(u'rsaEncryptedKey'), - u'sha256': self.request.get(u'sha256') - }) + return remove_nones_from_dict( + {u'rawKey': self.request.get(u'rawKey'), u'rsaEncryptedKey': self.request.get(u'rsaEncryptedKey'), u'sha256': self.request.get(u'sha256')} + ) class InstanceTemplateInitializeparams(object): @@ -1277,23 +1274,30 @@ def __init__(self, request, module): self.request = {} def to_request(self): - return remove_nones_from_dict({ - u'diskName': self.request.get('disk_name'), - u'diskSizeGb': self.request.get('disk_size_gb'), - u'diskType': disk_type_selflink(self.request.get('disk_type'), self.module.params), - u'sourceImage': self.request.get('source_image'), - u'sourceImageEncryptionKey': InstanceTemplateSourceimageencryptionkey(self.request.get('source_image_encryption_key', {}), self.module).to_request() - }) + return remove_nones_from_dict( + { + u'diskName': self.request.get('disk_name'), + u'diskSizeGb': self.request.get('disk_size_gb'), + u'diskType': disk_type_selflink(self.request.get('disk_type'), self.module.params), + u'sourceImage': self.request.get('source_image'), + u'sourceImageEncryptionKey': InstanceTemplateSourceimageencryptionkey( + self.request.get('source_image_encryption_key', {}), self.module + ).to_request(), + } + ) def from_response(self): - return remove_nones_from_dict({ - u'diskName': self.request.get(u'diskName'), - u'diskSizeGb': self.request.get(u'diskSizeGb'), - u'diskType': self.request.get(u'diskType'), - u'sourceImage': self.request.get(u'sourceImage'), - u'sourceImageEncryptionKey': - InstanceTemplateSourceimageencryptionkey(self.request.get(u'sourceImageEncryptionKey', {}), self.module).from_response() - }) + return remove_nones_from_dict( + { + u'diskName': self.request.get(u'diskName'), + u'diskSizeGb': self.request.get(u'diskSizeGb'), + u'diskType': self.request.get(u'diskType'), + u'sourceImage': self.request.get(u'sourceImage'), + u'sourceImageEncryptionKey': InstanceTemplateSourceimageencryptionkey( + self.request.get(u'sourceImageEncryptionKey', {}), self.module + ).from_response(), + } + ) class InstanceTemplateSourceimageencryptionkey(object): @@ -1305,16 +1309,10 @@ def __init__(self, request, module): self.request = {} def to_request(self): - return remove_nones_from_dict({ - u'rawKey': self.request.get('raw_key'), - u'sha256': self.request.get('sha256') - }) + return remove_nones_from_dict({u'rawKey': self.request.get('raw_key'), u'sha256': self.request.get('sha256')}) def from_response(self): - return remove_nones_from_dict({ - u'rawKey': self.request.get(u'rawKey'), - u'sha256': self.request.get(u'sha256') - }) + return remove_nones_from_dict({u'rawKey': self.request.get(u'rawKey'), u'sha256': self.request.get(u'sha256')}) class InstanceTemplateGuestacceleratorsArray(object): @@ -1338,16 +1336,10 @@ def from_response(self): return items def _request_for_item(self, item): - return remove_nones_from_dict({ - u'acceleratorCount': item.get('accelerator_count'), - u'acceleratorType': item.get('accelerator_type') - }) + return remove_nones_from_dict({u'acceleratorCount': item.get('accelerator_count'), u'acceleratorType': item.get('accelerator_type')}) def _response_from_item(self, item): - return remove_nones_from_dict({ - u'acceleratorCount': item.get(u'acceleratorCount'), - u'acceleratorType': item.get(u'acceleratorType') - }) + return remove_nones_from_dict({u'acceleratorCount': item.get(u'acceleratorCount'), u'acceleratorType': item.get(u'acceleratorType')}) class InstanceTemplateNetworkinterfacesArray(object): @@ -1371,24 +1363,28 @@ def from_response(self): return items def _request_for_item(self, item): - return remove_nones_from_dict({ - u'accessConfigs': InstanceTemplateAccessconfigsArray(item.get('access_configs', []), self.module).to_request(), - u'aliasIpRanges': InstanceTemplateAliasiprangesArray(item.get('alias_ip_ranges', []), self.module).to_request(), - u'name': item.get('name'), - u'network': replace_resource_dict(item.get(u'network', {}), 'selfLink'), - u'networkIP': item.get('network_ip'), - u'subnetwork': replace_resource_dict(item.get(u'subnetwork', {}), 'selfLink') - }) + return remove_nones_from_dict( + { + u'accessConfigs': InstanceTemplateAccessconfigsArray(item.get('access_configs', []), self.module).to_request(), + u'aliasIpRanges': InstanceTemplateAliasiprangesArray(item.get('alias_ip_ranges', []), self.module).to_request(), + u'name': item.get('name'), + u'network': replace_resource_dict(item.get(u'network', {}), 'selfLink'), + u'networkIP': item.get('network_ip'), + u'subnetwork': replace_resource_dict(item.get(u'subnetwork', {}), 'selfLink'), + } + ) def _response_from_item(self, item): - return remove_nones_from_dict({ - u'accessConfigs': InstanceTemplateAccessconfigsArray(item.get(u'accessConfigs', []), self.module).from_response(), - u'aliasIpRanges': InstanceTemplateAliasiprangesArray(item.get(u'aliasIpRanges', []), self.module).from_response(), - u'name': item.get(u'name'), - u'network': item.get(u'network'), - u'networkIP': item.get(u'networkIP'), - u'subnetwork': item.get(u'subnetwork') - }) + return remove_nones_from_dict( + { + u'accessConfigs': InstanceTemplateAccessconfigsArray(item.get(u'accessConfigs', []), self.module).from_response(), + u'aliasIpRanges': InstanceTemplateAliasiprangesArray(item.get(u'aliasIpRanges', []), self.module).from_response(), + u'name': item.get(u'name'), + u'network': item.get(u'network'), + u'networkIP': item.get(u'networkIP'), + u'subnetwork': item.get(u'subnetwork'), + } + ) class InstanceTemplateAccessconfigsArray(object): @@ -1412,18 +1408,12 @@ def from_response(self): return items def _request_for_item(self, item): - return remove_nones_from_dict({ - u'name': item.get('name'), - u'natIP': replace_resource_dict(item.get(u'nat_ip', {}), 'address'), - u'type': item.get('type') - }) + return remove_nones_from_dict( + {u'name': item.get('name'), u'natIP': replace_resource_dict(item.get(u'nat_ip', {}), 'address'), u'type': item.get('type')} + ) def _response_from_item(self, item): - return remove_nones_from_dict({ - u'name': item.get(u'name'), - u'natIP': item.get(u'natIP'), - u'type': item.get(u'type') - }) + return remove_nones_from_dict({u'name': item.get(u'name'), u'natIP': item.get(u'natIP'), u'type': item.get(u'type')}) class InstanceTemplateAliasiprangesArray(object): @@ -1447,16 +1437,10 @@ def from_response(self): return items def _request_for_item(self, item): - return remove_nones_from_dict({ - u'ipCidrRange': item.get('ip_cidr_range'), - u'subnetworkRangeName': item.get('subnetwork_range_name') - }) + return remove_nones_from_dict({u'ipCidrRange': item.get('ip_cidr_range'), u'subnetworkRangeName': item.get('subnetwork_range_name')}) def _response_from_item(self, item): - return remove_nones_from_dict({ - u'ipCidrRange': item.get(u'ipCidrRange'), - u'subnetworkRangeName': item.get(u'subnetworkRangeName') - }) + return remove_nones_from_dict({u'ipCidrRange': item.get(u'ipCidrRange'), u'subnetworkRangeName': item.get(u'subnetworkRangeName')}) class InstanceTemplateScheduling(object): @@ -1468,18 +1452,22 @@ def __init__(self, request, module): self.request = {} def to_request(self): - return remove_nones_from_dict({ - u'automaticRestart': self.request.get('automatic_restart'), - u'onHostMaintenance': self.request.get('on_host_maintenance'), - u'preemptible': self.request.get('preemptible') - }) + return remove_nones_from_dict( + { + u'automaticRestart': self.request.get('automatic_restart'), + u'onHostMaintenance': self.request.get('on_host_maintenance'), + u'preemptible': self.request.get('preemptible'), + } + ) def from_response(self): - return remove_nones_from_dict({ - u'automaticRestart': self.request.get(u'automaticRestart'), - u'onHostMaintenance': self.request.get(u'onHostMaintenance'), - u'preemptible': self.request.get(u'preemptible') - }) + return remove_nones_from_dict( + { + u'automaticRestart': self.request.get(u'automaticRestart'), + u'onHostMaintenance': self.request.get(u'onHostMaintenance'), + u'preemptible': self.request.get(u'preemptible'), + } + ) class InstanceTemplateServiceaccountsArray(object): @@ -1503,16 +1491,10 @@ def from_response(self): return items def _request_for_item(self, item): - return remove_nones_from_dict({ - u'email': item.get('email'), - u'scopes': item.get('scopes') - }) + return remove_nones_from_dict({u'email': item.get('email'), u'scopes': item.get('scopes')}) def _response_from_item(self, item): - return remove_nones_from_dict({ - u'email': item.get(u'email'), - u'scopes': item.get(u'scopes') - }) + return remove_nones_from_dict({u'email': item.get(u'email'), u'scopes': item.get(u'scopes')}) class InstanceTemplateTags(object): @@ -1524,16 +1506,10 @@ def __init__(self, request, module): self.request = {} def to_request(self): - return remove_nones_from_dict({ - u'fingerprint': self.request.get('fingerprint'), - u'items': self.request.get('items') - }) + return remove_nones_from_dict({u'fingerprint': self.request.get('fingerprint'), u'items': self.request.get('items')}) def from_response(self): - return remove_nones_from_dict({ - u'fingerprint': self.request.get(u'fingerprint'), - u'items': self.request.get(u'items') - }) + return remove_nones_from_dict({u'fingerprint': self.request.get(u'fingerprint'), u'items': self.request.get(u'items')}) if __name__ == '__main__': diff --git a/lib/ansible/modules/cloud/google/gcp_compute_instance_template_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_instance_template_facts.py index 5465814d82173e..190c4b3ee5493c 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_instance_template_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_instance_template_facts.py @@ -18,15 +18,14 @@ # ---------------------------------------------------------------------------- from __future__ import absolute_import, division, print_function + __metaclass__ = type ################################################################################ # Documentation ################################################################################ -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ["preview"], - 'supported_by': 'community'} +ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ["preview"], 'supported_by': 'community'} DOCUMENTATION = ''' --- @@ -473,11 +472,7 @@ def main(): - module = GcpModule( - argument_spec=dict( - filters=dict(type='list', elements='str') - ) - ) + module = GcpModule(argument_spec=dict(filters=dict(type='list', elements='str'))) if not module.params['scopes']: module.params['scopes'] = ['https://www.googleapis.com/auth/compute'] @@ -487,9 +482,7 @@ def main(): items = items.get('items') else: items = [] - return_value = { - 'items': items - } + return_value = {'items': items} module.exit_json(**return_value) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_interconnect_attachment.py b/lib/ansible/modules/cloud/google/gcp_compute_interconnect_attachment.py index d69182ab98ce2c..bb352b16391c93 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_interconnect_attachment.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_interconnect_attachment.py @@ -18,15 +18,14 @@ # ---------------------------------------------------------------------------- from __future__ import absolute_import, division, print_function + __metaclass__ = type ################################################################################ # Documentation ################################################################################ -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ["preview"], - 'supported_by': 'community'} +ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ["preview"], 'supported_by': 'community'} DOCUMENTATION = ''' --- @@ -201,7 +200,7 @@ def main(): description=dict(type='str'), router=dict(required=True), name=dict(required=True, type='str'), - region=dict(required=True, type='str') + region=dict(required=True, type='str'), ) ) @@ -256,7 +255,7 @@ def resource_to_request(module): u'interconnect': module.params.get('interconnect'), u'description': module.params.get('description'), u'router': replace_resource_dict(module.params.get(u'router', {}), 'selfLink'), - u'name': module.params.get('name') + u'name': module.params.get('name'), } return_vals = {} for k, v in request.items(): @@ -331,7 +330,7 @@ def response_to_hash(module, response): u'router': response.get(u'router'), u'creationTimestamp': response.get(u'creationTimestamp'), u'id': response.get(u'id'), - u'name': response.get(u'name') + u'name': response.get(u'name'), } @@ -388,14 +387,10 @@ def __init__(self, request, module): self.request = {} def to_request(self): - return remove_nones_from_dict({ - u'tag8021q': self.request.get('tag8021q') - }) + return remove_nones_from_dict({u'tag8021q': self.request.get('tag8021q')}) def from_response(self): - return remove_nones_from_dict({ - u'tag8021q': self.request.get(u'tag8021q') - }) + return remove_nones_from_dict({u'tag8021q': self.request.get(u'tag8021q')}) if __name__ == '__main__': diff --git a/lib/ansible/modules/cloud/google/gcp_compute_interconnect_attachment_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_interconnect_attachment_facts.py index 90af8b96884ad9..69a3bc215e56c9 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_interconnect_attachment_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_interconnect_attachment_facts.py @@ -18,15 +18,14 @@ # ---------------------------------------------------------------------------- from __future__ import absolute_import, division, print_function + __metaclass__ = type ################################################################################ # Documentation ################################################################################ -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ["preview"], - 'supported_by': 'community'} +ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ["preview"], 'supported_by': 'community'} DOCUMENTATION = ''' --- @@ -160,12 +159,7 @@ def main(): - module = GcpModule( - argument_spec=dict( - filters=dict(type='list', elements='str'), - region=dict(required=True, type='str') - ) - ) + module = GcpModule(argument_spec=dict(filters=dict(type='list', elements='str'), region=dict(required=True, type='str'))) if not module.params['scopes']: module.params['scopes'] = ['https://www.googleapis.com/auth/compute'] @@ -175,9 +169,7 @@ def main(): items = items.get('items') else: items = [] - return_value = { - 'items': items - } + return_value = {'items': items} module.exit_json(**return_value) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_network.py b/lib/ansible/modules/cloud/google/gcp_compute_network.py index e48b798b80de51..b9078dcdf008bd 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_network.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_network.py @@ -18,15 +18,14 @@ # ---------------------------------------------------------------------------- from __future__ import absolute_import, division, print_function + __metaclass__ = type ################################################################################ # Documentation ################################################################################ -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ["preview"], - 'supported_by': 'community'} +ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ["preview"], 'supported_by': 'community'} DOCUMENTATION = ''' --- @@ -216,11 +215,9 @@ def main(): ipv4_range=dict(type='str'), name=dict(required=True, type='str'), auto_create_subnetworks=dict(type='bool'), - routing_config=dict(type='dict', options=dict( - routing_mode=dict(required=True, type='str', choices=['REGIONAL', 'GLOBAL']) - )) + routing_config=dict(type='dict', options=dict(routing_mode=dict(required=True, type='str', choices=['REGIONAL', 'GLOBAL']))), ), - mutually_exclusive=[['auto_create_subnetworks', 'ipv4_range']] + mutually_exclusive=[['auto_create_subnetworks', 'ipv4_range']], ) if not module.params['scopes']: @@ -276,7 +273,7 @@ def resource_to_request(module): u'IPv4Range': module.params.get('ipv4_range'), u'name': module.params.get('name'), u'autoCreateSubnetworks': module.params.get('auto_create_subnetworks'), - u'routingConfig': NetworkRoutingconfig(module.params.get('routing_config', {}), module).to_request() + u'routingConfig': NetworkRoutingconfig(module.params.get('routing_config', {}), module).to_request(), } return_vals = {} for k, v in request.items(): @@ -350,7 +347,7 @@ def response_to_hash(module, response): u'subnetworks': response.get(u'subnetworks'), u'autoCreateSubnetworks': module.params.get('auto_create_subnetworks'), u'creationTimestamp': response.get(u'creationTimestamp'), - u'routingConfig': NetworkRoutingconfig(response.get(u'routingConfig', {}), module).from_response() + u'routingConfig': NetworkRoutingconfig(response.get(u'routingConfig', {}), module).from_response(), } @@ -398,14 +395,10 @@ def __init__(self, request, module): self.request = {} def to_request(self): - return remove_nones_from_dict({ - u'routingMode': self.request.get('routing_mode') - }) + return remove_nones_from_dict({u'routingMode': self.request.get('routing_mode')}) def from_response(self): - return remove_nones_from_dict({ - u'routingMode': self.request.get(u'routingMode') - }) + return remove_nones_from_dict({u'routingMode': self.request.get(u'routingMode')}) if __name__ == '__main__': diff --git a/lib/ansible/modules/cloud/google/gcp_compute_network_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_network_facts.py index d54dad6c80eb1c..6a61d555713652 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_network_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_network_facts.py @@ -18,15 +18,14 @@ # ---------------------------------------------------------------------------- from __future__ import absolute_import, division, print_function + __metaclass__ = type ################################################################################ # Documentation ################################################################################ -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ["preview"], - 'supported_by': 'community'} +ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ["preview"], 'supported_by': 'community'} DOCUMENTATION = ''' --- @@ -148,11 +147,7 @@ def main(): - module = GcpModule( - argument_spec=dict( - filters=dict(type='list', elements='str') - ) - ) + module = GcpModule(argument_spec=dict(filters=dict(type='list', elements='str'))) if not module.params['scopes']: module.params['scopes'] = ['https://www.googleapis.com/auth/compute'] @@ -162,9 +157,7 @@ def main(): items = items.get('items') else: items = [] - return_value = { - 'items': items - } + return_value = {'items': items} module.exit_json(**return_value) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_region_disk.py b/lib/ansible/modules/cloud/google/gcp_compute_region_disk.py index 378a6aa1cb3d0c..da28b945abe7ac 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_region_disk.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_region_disk.py @@ -18,15 +18,14 @@ # ---------------------------------------------------------------------------- from __future__ import absolute_import, division, print_function + __metaclass__ = type ################################################################################ # Documentation ################################################################################ -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ["preview"], - 'supported_by': 'community'} +ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ["preview"], 'supported_by': 'community'} DOCUMENTATION = ''' --- @@ -346,15 +345,9 @@ def main(): replica_zones=dict(required=True, type='list', elements='str'), type=dict(type='str'), region=dict(required=True, type='str'), - disk_encryption_key=dict(type='dict', options=dict( - raw_key=dict(type='str'), - sha256=dict(type='str') - )), + disk_encryption_key=dict(type='dict', options=dict(raw_key=dict(type='str'), sha256=dict(type='str'))), source_snapshot=dict(), - source_snapshot_encryption_key=dict(type='dict', options=dict( - raw_key=dict(type='str'), - sha256=dict(type='str') - )) + source_snapshot_encryption_key=dict(type='dict', options=dict(raw_key=dict(type='str'), sha256=dict(type='str'))), ) ) @@ -395,8 +388,7 @@ def create(module, link, kind): def update(module, link, kind, fetch): - update_fields(module, resource_to_request(module), - response_to_hash(module, fetch)) + update_fields(module, resource_to_request(module), response_to_hash(module, fetch)) return fetch_resource(module, self_link(module), kind) @@ -410,27 +402,16 @@ def update_fields(module, request, response): def label_fingerprint_update(module, request, response): auth = GcpSession(module, 'compute') auth.post( - ''.join([ - "https://www.googleapis.com/compute/v1/", - "projects/{project}/regions/{region}/disks/{name}/setLabels" - ]).format(**module.params), - { - u'labelFingerprint': response.get('labelFingerprint'), - u'labels': module.params.get('labels') - } + ''.join(["https://www.googleapis.com/compute/v1/", "projects/{project}/regions/{region}/disks/{name}/setLabels"]).format(**module.params), + {u'labelFingerprint': response.get('labelFingerprint'), u'labels': module.params.get('labels')}, ) def size_gb_update(module, request, response): auth = GcpSession(module, 'compute') auth.post( - ''.join([ - "https://www.googleapis.com/compute/v1/", - "projects/{project}/regions/{region}/disks/{name}/resize" - ]).format(**module.params), - { - u'sizeGb': module.params.get('size_gb') - } + ''.join(["https://www.googleapis.com/compute/v1/", "projects/{project}/regions/{region}/disks/{name}/resize"]).format(**module.params), + {u'sizeGb': module.params.get('size_gb')}, ) @@ -450,7 +431,7 @@ def resource_to_request(module): u'name': module.params.get('name'), u'sizeGb': module.params.get('size_gb'), u'replicaZones': module.params.get('replica_zones'), - u'type': region_disk_type_selflink(module.params.get('type'), module.params) + u'type': region_disk_type_selflink(module.params.get('type'), module.params), } return_vals = {} for k, v in request.items(): @@ -528,7 +509,7 @@ def response_to_hash(module, response): u'sizeGb': response.get(u'sizeGb'), u'users': response.get(u'users'), u'replicaZones': response.get(u'replicaZones'), - u'type': response.get(u'type') + u'type': response.get(u'type'), } @@ -594,16 +575,10 @@ def __init__(self, request, module): self.request = {} def to_request(self): - return remove_nones_from_dict({ - u'rawKey': self.request.get('raw_key'), - u'sha256': self.request.get('sha256') - }) + return remove_nones_from_dict({u'rawKey': self.request.get('raw_key'), u'sha256': self.request.get('sha256')}) def from_response(self): - return remove_nones_from_dict({ - u'rawKey': self.request.get(u'rawKey'), - u'sha256': self.request.get(u'sha256') - }) + return remove_nones_from_dict({u'rawKey': self.request.get(u'rawKey'), u'sha256': self.request.get(u'sha256')}) class RegionDiskSourcesnapshotencryptionkey(object): @@ -615,16 +590,10 @@ def __init__(self, request, module): self.request = {} def to_request(self): - return remove_nones_from_dict({ - u'rawKey': self.request.get('raw_key'), - u'sha256': self.request.get('sha256') - }) + return remove_nones_from_dict({u'rawKey': self.request.get('raw_key'), u'sha256': self.request.get('sha256')}) def from_response(self): - return remove_nones_from_dict({ - u'rawKey': self.request.get(u'rawKey'), - u'sha256': self.request.get(u'sha256') - }) + return remove_nones_from_dict({u'rawKey': self.request.get(u'rawKey'), u'sha256': self.request.get(u'sha256')}) if __name__ == '__main__': diff --git a/lib/ansible/modules/cloud/google/gcp_compute_region_disk_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_region_disk_facts.py index 69b3cb56b71d73..9d7d15b2e3302b 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_region_disk_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_region_disk_facts.py @@ -18,15 +18,14 @@ # ---------------------------------------------------------------------------- from __future__ import absolute_import, division, print_function + __metaclass__ = type ################################################################################ # Documentation ################################################################################ -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ["preview"], - 'supported_by': 'community'} +ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ["preview"], 'supported_by': 'community'} DOCUMENTATION = ''' --- @@ -228,12 +227,7 @@ def main(): - module = GcpModule( - argument_spec=dict( - filters=dict(type='list', elements='str'), - region=dict(required=True, type='str') - ) - ) + module = GcpModule(argument_spec=dict(filters=dict(type='list', elements='str'), region=dict(required=True, type='str'))) if not module.params['scopes']: module.params['scopes'] = ['https://www.googleapis.com/auth/compute'] @@ -243,9 +237,7 @@ def main(): items = items.get('items') else: items = [] - return_value = { - 'items': items - } + return_value = {'items': items} module.exit_json(**return_value) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_route.py b/lib/ansible/modules/cloud/google/gcp_compute_route.py index ebb0dbc8859f40..5eb0721fd77850 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_route.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_route.py @@ -18,15 +18,14 @@ # ---------------------------------------------------------------------------- from __future__ import absolute_import, division, print_function + __metaclass__ = type ################################################################################ # Documentation ################################################################################ -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ["preview"], - 'supported_by': 'community'} +ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ["preview"], 'supported_by': 'community'} DOCUMENTATION = ''' --- @@ -269,7 +268,7 @@ def main(): next_hop_gateway=dict(type='str'), next_hop_instance=dict(), next_hop_ip=dict(type='str'), - next_hop_vpn_tunnel=dict() + next_hop_vpn_tunnel=dict(), ) ) @@ -330,7 +329,7 @@ def resource_to_request(module): u'nextHopGateway': module.params.get('next_hop_gateway'), u'nextHopInstance': replace_resource_dict(module.params.get(u'next_hop_instance', {}), 'selfLink'), u'nextHopIp': module.params.get('next_hop_ip'), - u'nextHopVpnTunnel': replace_resource_dict(module.params.get(u'next_hop_vpn_tunnel', {}), 'selfLink') + u'nextHopVpnTunnel': replace_resource_dict(module.params.get(u'next_hop_vpn_tunnel', {}), 'selfLink'), } return_vals = {} for k, v in request.items(): @@ -406,7 +405,7 @@ def response_to_hash(module, response): u'nextHopInstance': replace_resource_dict(module.params.get(u'next_hop_instance', {}), 'selfLink'), u'nextHopIp': module.params.get('next_hop_ip'), u'nextHopVpnTunnel': replace_resource_dict(module.params.get(u'next_hop_vpn_tunnel', {}), 'selfLink'), - u'nextHopNetwork': response.get(u'nextHopNetwork') + u'nextHopNetwork': response.get(u'nextHopNetwork'), } diff --git a/lib/ansible/modules/cloud/google/gcp_compute_route_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_route_facts.py index f4a487073ca025..65fc91b225163b 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_route_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_route_facts.py @@ -18,15 +18,14 @@ # ---------------------------------------------------------------------------- from __future__ import absolute_import, division, print_function + __metaclass__ = type ################################################################################ # Documentation ################################################################################ -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ["preview"], - 'supported_by': 'community'} +ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ["preview"], 'supported_by': 'community'} DOCUMENTATION = ''' --- @@ -152,11 +151,7 @@ def main(): - module = GcpModule( - argument_spec=dict( - filters=dict(type='list', elements='str') - ) - ) + module = GcpModule(argument_spec=dict(filters=dict(type='list', elements='str'))) if not module.params['scopes']: module.params['scopes'] = ['https://www.googleapis.com/auth/compute'] @@ -166,9 +161,7 @@ def main(): items = items.get('items') else: items = [] - return_value = { - 'items': items - } + return_value = {'items': items} module.exit_json(**return_value) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_router.py b/lib/ansible/modules/cloud/google/gcp_compute_router.py index 6d8a9dc197b052..8d08b8b7d46dc6 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_router.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_router.py @@ -18,15 +18,14 @@ # ---------------------------------------------------------------------------- from __future__ import absolute_import, division, print_function + __metaclass__ = type ################################################################################ # Documentation ################################################################################ -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ["preview"], - 'supported_by': 'community'} +ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ["preview"], 'supported_by': 'community'} DOCUMENTATION = ''' --- @@ -260,16 +259,16 @@ def main(): name=dict(required=True, type='str'), description=dict(type='str'), network=dict(required=True), - bgp=dict(type='dict', options=dict( - asn=dict(required=True, type='int'), - advertise_mode=dict(default='DEFAULT', type='str', choices=['DEFAULT', 'CUSTOM']), - advertised_groups=dict(type='list', elements='str'), - advertised_ip_ranges=dict(type='list', elements='dict', options=dict( - range=dict(type='str'), - description=dict(type='str') - )) - )), - region=dict(required=True, type='str') + bgp=dict( + type='dict', + options=dict( + asn=dict(required=True, type='int'), + advertise_mode=dict(default='DEFAULT', type='str', choices=['DEFAULT', 'CUSTOM']), + advertised_groups=dict(type='list', elements='str'), + advertised_ip_ranges=dict(type='list', elements='dict', options=dict(range=dict(type='str'), description=dict(type='str'))), + ), + ), + region=dict(required=True, type='str'), ) ) @@ -326,7 +325,7 @@ def resource_to_request(module): u'name': module.params.get('name'), u'description': module.params.get('description'), u'network': replace_resource_dict(module.params.get(u'network', {}), 'selfLink'), - u'bgp': RouterBgp(module.params.get('bgp', {}), module).to_request() + u'bgp': RouterBgp(module.params.get('bgp', {}), module).to_request(), } return_vals = {} for k, v in request.items(): @@ -397,7 +396,7 @@ def response_to_hash(module, response): u'name': module.params.get('name'), u'description': response.get(u'description'), u'network': replace_resource_dict(module.params.get(u'network', {}), 'selfLink'), - u'bgp': RouterBgp(response.get(u'bgp', {}), module).from_response() + u'bgp': RouterBgp(response.get(u'bgp', {}), module).from_response(), } @@ -445,20 +444,24 @@ def __init__(self, request, module): self.request = {} def to_request(self): - return remove_nones_from_dict({ - u'asn': self.request.get('asn'), - u'advertiseMode': self.request.get('advertise_mode'), - u'advertisedGroups': self.request.get('advertised_groups'), - u'advertisedIpRanges': RouterAdvertisediprangesArray(self.request.get('advertised_ip_ranges', []), self.module).to_request() - }) + return remove_nones_from_dict( + { + u'asn': self.request.get('asn'), + u'advertiseMode': self.request.get('advertise_mode'), + u'advertisedGroups': self.request.get('advertised_groups'), + u'advertisedIpRanges': RouterAdvertisediprangesArray(self.request.get('advertised_ip_ranges', []), self.module).to_request(), + } + ) def from_response(self): - return remove_nones_from_dict({ - u'asn': self.request.get(u'asn'), - u'advertiseMode': self.request.get(u'advertiseMode'), - u'advertisedGroups': self.request.get(u'advertisedGroups'), - u'advertisedIpRanges': RouterAdvertisediprangesArray(self.request.get(u'advertisedIpRanges', []), self.module).from_response() - }) + return remove_nones_from_dict( + { + u'asn': self.request.get(u'asn'), + u'advertiseMode': self.request.get(u'advertiseMode'), + u'advertisedGroups': self.request.get(u'advertisedGroups'), + u'advertisedIpRanges': RouterAdvertisediprangesArray(self.request.get(u'advertisedIpRanges', []), self.module).from_response(), + } + ) class RouterAdvertisediprangesArray(object): @@ -482,16 +485,10 @@ def from_response(self): return items def _request_for_item(self, item): - return remove_nones_from_dict({ - u'range': item.get('range'), - u'description': item.get('description') - }) + return remove_nones_from_dict({u'range': item.get('range'), u'description': item.get('description')}) def _response_from_item(self, item): - return remove_nones_from_dict({ - u'range': item.get(u'range'), - u'description': item.get(u'description') - }) + return remove_nones_from_dict({u'range': item.get(u'range'), u'description': item.get(u'description')}) if __name__ == '__main__': diff --git a/lib/ansible/modules/cloud/google/gcp_compute_router_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_router_facts.py index 2e9a5f4d94fb86..2d142c7346a3f9 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_router_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_router_facts.py @@ -18,15 +18,14 @@ # ---------------------------------------------------------------------------- from __future__ import absolute_import, division, print_function + __metaclass__ = type ################################################################################ # Documentation ################################################################################ -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ["preview"], - 'supported_by': 'community'} +ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ["preview"], 'supported_by': 'community'} DOCUMENTATION = ''' --- @@ -167,12 +166,7 @@ def main(): - module = GcpModule( - argument_spec=dict( - filters=dict(type='list', elements='str'), - region=dict(required=True, type='str') - ) - ) + module = GcpModule(argument_spec=dict(filters=dict(type='list', elements='str'), region=dict(required=True, type='str'))) if not module.params['scopes']: module.params['scopes'] = ['https://www.googleapis.com/auth/compute'] @@ -182,9 +176,7 @@ def main(): items = items.get('items') else: items = [] - return_value = { - 'items': items - } + return_value = {'items': items} module.exit_json(**return_value) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_ssl_certificate.py b/lib/ansible/modules/cloud/google/gcp_compute_ssl_certificate.py index f5faf874c24673..f5f600fc42ab5f 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_ssl_certificate.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_ssl_certificate.py @@ -18,15 +18,14 @@ # ---------------------------------------------------------------------------- from __future__ import absolute_import, division, print_function + __metaclass__ = type ################################################################################ # Documentation ################################################################################ -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ["preview"], - 'supported_by': 'community'} +ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ["preview"], 'supported_by': 'community'} DOCUMENTATION = ''' --- @@ -176,7 +175,7 @@ def main(): certificate=dict(required=True, type='str'), description=dict(type='str'), name=dict(type='str'), - private_key=dict(required=True, type='str') + private_key=dict(required=True, type='str'), ) ) @@ -231,7 +230,7 @@ def resource_to_request(module): u'certificate': module.params.get('certificate'), u'description': module.params.get('description'), u'name': module.params.get('name'), - u'privateKey': module.params.get('private_key') + u'privateKey': module.params.get('private_key'), } return_vals = {} for k, v in request.items(): @@ -302,7 +301,7 @@ def response_to_hash(module, response): u'description': response.get(u'description'), u'id': response.get(u'id'), u'name': response.get(u'name'), - u'privateKey': module.params.get('private_key') + u'privateKey': module.params.get('private_key'), } diff --git a/lib/ansible/modules/cloud/google/gcp_compute_ssl_certificate_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_ssl_certificate_facts.py index e82ed7db546b55..12463218cf78a3 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_ssl_certificate_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_ssl_certificate_facts.py @@ -18,15 +18,14 @@ # ---------------------------------------------------------------------------- from __future__ import absolute_import, division, print_function + __metaclass__ = type ################################################################################ # Documentation ################################################################################ -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ["preview"], - 'supported_by': 'community'} +ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ["preview"], 'supported_by': 'community'} DOCUMENTATION = ''' --- @@ -116,11 +115,7 @@ def main(): - module = GcpModule( - argument_spec=dict( - filters=dict(type='list', elements='str') - ) - ) + module = GcpModule(argument_spec=dict(filters=dict(type='list', elements='str'))) if not module.params['scopes']: module.params['scopes'] = ['https://www.googleapis.com/auth/compute'] @@ -130,9 +125,7 @@ def main(): items = items.get('items') else: items = [] - return_value = { - 'items': items - } + return_value = {'items': items} module.exit_json(**return_value) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_ssl_policy.py b/lib/ansible/modules/cloud/google/gcp_compute_ssl_policy.py index 6425b0564b5986..ff3bb66e8eaafe 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_ssl_policy.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_ssl_policy.py @@ -18,15 +18,14 @@ # ---------------------------------------------------------------------------- from __future__ import absolute_import, division, print_function + __metaclass__ = type ################################################################################ # Documentation ################################################################################ -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ["preview"], - 'supported_by': 'community'} +ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ["preview"], 'supported_by': 'community'} DOCUMENTATION = ''' --- @@ -212,7 +211,7 @@ def main(): name=dict(required=True, type='str'), profile=dict(type='str', choices=['COMPATIBLE', 'MODERN', 'RESTRICTED', 'CUSTOM']), min_tls_version=dict(type='str', choices=['TLS_1_0', 'TLS_1_1', 'TLS_1_2']), - custom_features=dict(type='list', elements='str') + custom_features=dict(type='list', elements='str'), ) ) @@ -269,7 +268,7 @@ def resource_to_request(module): u'name': module.params.get('name'), u'profile': module.params.get('profile'), u'minTlsVersion': module.params.get('min_tls_version'), - u'customFeatures': module.params.get('custom_features') + u'customFeatures': module.params.get('custom_features'), } return_vals = {} for k, v in request.items(): @@ -344,7 +343,7 @@ def response_to_hash(module, response): u'enabledFeatures': response.get(u'enabledFeatures'), u'customFeatures': response.get(u'customFeatures'), u'fingerprint': response.get(u'fingerprint'), - u'warnings': SslPolicyWarningsArray(response.get(u'warnings', []), module).from_response() + u'warnings': SslPolicyWarningsArray(response.get(u'warnings', []), module).from_response(), } @@ -404,16 +403,10 @@ def from_response(self): return items def _request_for_item(self, item): - return remove_nones_from_dict({ - u'code': item.get('code'), - u'message': item.get('message') - }) + return remove_nones_from_dict({u'code': item.get('code'), u'message': item.get('message')}) def _response_from_item(self, item): - return remove_nones_from_dict({ - u'code': item.get(u'code'), - u'message': item.get(u'message') - }) + return remove_nones_from_dict({u'code': item.get(u'code'), u'message': item.get(u'message')}) if __name__ == '__main__': diff --git a/lib/ansible/modules/cloud/google/gcp_compute_ssl_policy_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_ssl_policy_facts.py index fffd3c62d09daa..62c1c3fcc7ad65 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_ssl_policy_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_ssl_policy_facts.py @@ -18,15 +18,14 @@ # ---------------------------------------------------------------------------- from __future__ import absolute_import, division, print_function + __metaclass__ = type ################################################################################ # Documentation ################################################################################ -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ["preview"], - 'supported_by': 'community'} +ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ["preview"], 'supported_by': 'community'} DOCUMENTATION = ''' --- @@ -154,11 +153,7 @@ def main(): - module = GcpModule( - argument_spec=dict( - filters=dict(type='list', elements='str') - ) - ) + module = GcpModule(argument_spec=dict(filters=dict(type='list', elements='str'))) if not module.params['scopes']: module.params['scopes'] = ['https://www.googleapis.com/auth/compute'] @@ -168,9 +163,7 @@ def main(): items = items.get('items') else: items = [] - return_value = { - 'items': items - } + return_value = {'items': items} module.exit_json(**return_value) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_subnetwork.py b/lib/ansible/modules/cloud/google/gcp_compute_subnetwork.py index 42d18bc7f5c25f..65eb844db5a01b 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_subnetwork.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_subnetwork.py @@ -18,15 +18,14 @@ # ---------------------------------------------------------------------------- from __future__ import absolute_import, division, print_function + __metaclass__ = type ################################################################################ # Documentation ################################################################################ -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ["preview"], - 'supported_by': 'community'} +ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ["preview"], 'supported_by': 'community'} DOCUMENTATION = ''' --- @@ -279,12 +278,11 @@ def main(): name=dict(required=True, type='str'), network=dict(required=True), enable_flow_logs=dict(type='bool'), - secondary_ip_ranges=dict(type='list', elements='dict', options=dict( - range_name=dict(required=True, type='str'), - ip_cidr_range=dict(required=True, type='str') - )), + secondary_ip_ranges=dict( + type='list', elements='dict', options=dict(range_name=dict(required=True, type='str'), ip_cidr_range=dict(required=True, type='str')) + ), private_ip_google_access=dict(type='bool'), - region=dict(required=True, type='str') + region=dict(required=True, type='str'), ) ) @@ -325,8 +323,7 @@ def create(module, link, kind): def update(module, link, kind, fetch): - update_fields(module, resource_to_request(module), - response_to_hash(module, fetch)) + update_fields(module, resource_to_request(module), response_to_hash(module, fetch)) return fetch_resource(module, self_link(module), kind) @@ -342,41 +339,30 @@ def update_fields(module, request, response): def ip_cidr_range_update(module, request, response): auth = GcpSession(module, 'compute') auth.post( - ''.join([ - "https://www.googleapis.com/compute/v1/", - "projects/{project}/regions/{region}/subnetworks/{name}/expandIpCidrRange" - ]).format(**module.params), - { - u'ipCidrRange': module.params.get('ip_cidr_range') - } + ''.join(["https://www.googleapis.com/compute/v1/", "projects/{project}/regions/{region}/subnetworks/{name}/expandIpCidrRange"]).format(**module.params), + {u'ipCidrRange': module.params.get('ip_cidr_range')}, ) def enable_flow_logs_update(module, request, response): auth = GcpSession(module, 'compute') auth.patch( - ''.join([ - "https://www.googleapis.com/compute/v1/", - "projects/{project}/regions/{region}/subnetworks/{name}" - ]).format(**module.params), + ''.join(["https://www.googleapis.com/compute/v1/", "projects/{project}/regions/{region}/subnetworks/{name}"]).format(**module.params), { u'enableFlowLogs': module.params.get('enable_flow_logs'), u'fingerprint': response.get('fingerprint'), - u'secondaryIpRanges': SubnetworkSecondaryiprangesArray(module.params.get('secondary_ip_ranges', []), module).to_request() - } + u'secondaryIpRanges': SubnetworkSecondaryiprangesArray(module.params.get('secondary_ip_ranges', []), module).to_request(), + }, ) def private_ip_google_access_update(module, request, response): auth = GcpSession(module, 'compute') auth.post( - ''.join([ - "https://www.googleapis.com/compute/v1/", - "projects/{project}/regions/{region}/subnetworks/{name}/setPrivateIpGoogleAccess" - ]).format(**module.params), - { - u'privateIpGoogleAccess': module.params.get('private_ip_google_access') - } + ''.join(["https://www.googleapis.com/compute/v1/", "projects/{project}/regions/{region}/subnetworks/{name}/setPrivateIpGoogleAccess"]).format( + **module.params + ), + {u'privateIpGoogleAccess': module.params.get('private_ip_google_access')}, ) @@ -395,7 +381,7 @@ def resource_to_request(module): u'enableFlowLogs': module.params.get('enable_flow_logs'), u'secondaryIpRanges': SubnetworkSecondaryiprangesArray(module.params.get('secondary_ip_ranges', []), module).to_request(), u'privateIpGoogleAccess': module.params.get('private_ip_google_access'), - u'region': module.params.get('region') + u'region': module.params.get('region'), } return_vals = {} for k, v in request.items(): @@ -472,7 +458,7 @@ def response_to_hash(module, response): u'fingerprint': response.get(u'fingerprint'), u'secondaryIpRanges': SubnetworkSecondaryiprangesArray(response.get(u'secondaryIpRanges', []), module).from_response(), u'privateIpGoogleAccess': response.get(u'privateIpGoogleAccess'), - u'region': module.params.get('region') + u'region': module.params.get('region'), } @@ -532,16 +518,10 @@ def from_response(self): return items def _request_for_item(self, item): - return remove_nones_from_dict({ - u'rangeName': item.get('range_name'), - u'ipCidrRange': item.get('ip_cidr_range') - }) + return remove_nones_from_dict({u'rangeName': item.get('range_name'), u'ipCidrRange': item.get('ip_cidr_range')}) def _response_from_item(self, item): - return remove_nones_from_dict({ - u'rangeName': item.get(u'rangeName'), - u'ipCidrRange': item.get(u'ipCidrRange') - }) + return remove_nones_from_dict({u'rangeName': item.get(u'rangeName'), u'ipCidrRange': item.get(u'ipCidrRange')}) if __name__ == '__main__': diff --git a/lib/ansible/modules/cloud/google/gcp_compute_subnetwork_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_subnetwork_facts.py index 4cda40c2e4644c..746448d60ca87e 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_subnetwork_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_subnetwork_facts.py @@ -18,15 +18,14 @@ # ---------------------------------------------------------------------------- from __future__ import absolute_import, division, print_function + __metaclass__ = type ################################################################################ # Documentation ################################################################################ -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ["preview"], - 'supported_by': 'community'} +ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ["preview"], 'supported_by': 'community'} DOCUMENTATION = ''' --- @@ -176,12 +175,7 @@ def main(): - module = GcpModule( - argument_spec=dict( - filters=dict(type='list', elements='str'), - region=dict(required=True, type='str') - ) - ) + module = GcpModule(argument_spec=dict(filters=dict(type='list', elements='str'), region=dict(required=True, type='str'))) if not module.params['scopes']: module.params['scopes'] = ['https://www.googleapis.com/auth/compute'] @@ -191,9 +185,7 @@ def main(): items = items.get('items') else: items = [] - return_value = { - 'items': items - } + return_value = {'items': items} module.exit_json(**return_value) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_http_proxy.py b/lib/ansible/modules/cloud/google/gcp_compute_target_http_proxy.py index 7d99f19d4262fb..676feee4496195 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_http_proxy.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_http_proxy.py @@ -18,15 +18,14 @@ # ---------------------------------------------------------------------------- from __future__ import absolute_import, division, print_function + __metaclass__ = type ################################################################################ # Documentation ################################################################################ -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ["preview"], - 'supported_by': 'community'} +ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ["preview"], 'supported_by': 'community'} DOCUMENTATION = ''' --- @@ -189,7 +188,7 @@ def main(): state=dict(default='present', choices=['present', 'absent'], type='str'), description=dict(type='str'), name=dict(required=True, type='str'), - url_map=dict(required=True) + url_map=dict(required=True), ) ) @@ -230,8 +229,7 @@ def create(module, link, kind): def update(module, link, kind, fetch): - update_fields(module, resource_to_request(module), - response_to_hash(module, fetch)) + update_fields(module, resource_to_request(module), response_to_hash(module, fetch)) return fetch_resource(module, self_link(module), kind) @@ -243,13 +241,8 @@ def update_fields(module, request, response): def url_map_update(module, request, response): auth = GcpSession(module, 'compute') auth.post( - ''.join([ - "https://www.googleapis.com/compute/v1/", - "projects/{project}/targetHttpProxies/{name}/setUrlMap" - ]).format(**module.params), - { - u'urlMap': replace_resource_dict(module.params.get(u'url_map', {}), 'selfLink') - } + ''.join(["https://www.googleapis.com/compute/v1/", "projects/{project}/targetHttpProxies/{name}/setUrlMap"]).format(**module.params), + {u'urlMap': replace_resource_dict(module.params.get(u'url_map', {}), 'selfLink')}, ) @@ -263,7 +256,7 @@ def resource_to_request(module): u'kind': 'compute#targetHttpProxy', u'description': module.params.get('description'), u'name': module.params.get('name'), - u'urlMap': replace_resource_dict(module.params.get(u'url_map', {}), 'selfLink') + u'urlMap': replace_resource_dict(module.params.get(u'url_map', {}), 'selfLink'), } return_vals = {} for k, v in request.items(): @@ -333,7 +326,7 @@ def response_to_hash(module, response): u'description': response.get(u'description'), u'id': response.get(u'id'), u'name': response.get(u'name'), - u'urlMap': response.get(u'urlMap') + u'urlMap': response.get(u'urlMap'), } diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_http_proxy_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_target_http_proxy_facts.py index 81df87fdd38b0b..ea39b5241e4bec 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_http_proxy_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_http_proxy_facts.py @@ -18,15 +18,14 @@ # ---------------------------------------------------------------------------- from __future__ import absolute_import, division, print_function + __metaclass__ = type ################################################################################ # Documentation ################################################################################ -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ["preview"], - 'supported_by': 'community'} +ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ["preview"], 'supported_by': 'community'} DOCUMENTATION = ''' --- @@ -110,11 +109,7 @@ def main(): - module = GcpModule( - argument_spec=dict( - filters=dict(type='list', elements='str') - ) - ) + module = GcpModule(argument_spec=dict(filters=dict(type='list', elements='str'))) if not module.params['scopes']: module.params['scopes'] = ['https://www.googleapis.com/auth/compute'] @@ -124,9 +119,7 @@ def main(): items = items.get('items') else: items = [] - return_value = { - 'items': items - } + return_value = {'items': items} module.exit_json(**return_value) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_https_proxy.py b/lib/ansible/modules/cloud/google/gcp_compute_target_https_proxy.py index 0cc6706f8e39e3..da990efc17b6fb 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_https_proxy.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_https_proxy.py @@ -18,15 +18,14 @@ # ---------------------------------------------------------------------------- from __future__ import absolute_import, division, print_function + __metaclass__ = type ################################################################################ # Documentation ################################################################################ -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ["preview"], - 'supported_by': 'community'} +ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ["preview"], 'supported_by': 'community'} DOCUMENTATION = ''' --- @@ -280,7 +279,7 @@ def main(): quic_override=dict(type='str', choices=['NONE', 'ENABLE', 'DISABLE']), ssl_certificates=dict(required=True, type='list'), ssl_policy=dict(), - url_map=dict(required=True) + url_map=dict(required=True), ) ) @@ -321,8 +320,7 @@ def create(module, link, kind): def update(module, link, kind, fetch): - update_fields(module, resource_to_request(module), - response_to_hash(module, fetch)) + update_fields(module, resource_to_request(module), response_to_hash(module, fetch)) return fetch_resource(module, self_link(module), kind) @@ -340,52 +338,32 @@ def update_fields(module, request, response): def quic_override_update(module, request, response): auth = GcpSession(module, 'compute') auth.post( - ''.join([ - "https://www.googleapis.com/compute/v1/", - "projects/{project}/global/targetHttpsProxies/{name}/setQuicOverride" - ]).format(**module.params), - { - u'quicOverride': module.params.get('quic_override') - } + ''.join(["https://www.googleapis.com/compute/v1/", "projects/{project}/global/targetHttpsProxies/{name}/setQuicOverride"]).format(**module.params), + {u'quicOverride': module.params.get('quic_override')}, ) def ssl_certificates_update(module, request, response): auth = GcpSession(module, 'compute') auth.post( - ''.join([ - "https://www.googleapis.com/compute/v1/", - "projects/{project}/targetHttpsProxies/{name}/setSslCertificates" - ]).format(**module.params), - { - u'sslCertificates': replace_resource_dict(module.params.get('ssl_certificates', []), 'selfLink') - } + ''.join(["https://www.googleapis.com/compute/v1/", "projects/{project}/targetHttpsProxies/{name}/setSslCertificates"]).format(**module.params), + {u'sslCertificates': replace_resource_dict(module.params.get('ssl_certificates', []), 'selfLink')}, ) def ssl_policy_update(module, request, response): auth = GcpSession(module, 'compute') auth.post( - ''.join([ - "https://www.googleapis.com/compute/v1/", - "projects/{project}/global/targetHttpsProxies/{name}/setSslPolicy" - ]).format(**module.params), - { - u'sslPolicy': replace_resource_dict(module.params.get(u'ssl_policy', {}), 'selfLink') - } + ''.join(["https://www.googleapis.com/compute/v1/", "projects/{project}/global/targetHttpsProxies/{name}/setSslPolicy"]).format(**module.params), + {u'sslPolicy': replace_resource_dict(module.params.get(u'ssl_policy', {}), 'selfLink')}, ) def url_map_update(module, request, response): auth = GcpSession(module, 'compute') auth.post( - ''.join([ - "https://www.googleapis.com/compute/v1/", - "projects/{project}/targetHttpsProxies/{name}/setUrlMap" - ]).format(**module.params), - { - u'urlMap': replace_resource_dict(module.params.get(u'url_map', {}), 'selfLink') - } + ''.join(["https://www.googleapis.com/compute/v1/", "projects/{project}/targetHttpsProxies/{name}/setUrlMap"]).format(**module.params), + {u'urlMap': replace_resource_dict(module.params.get(u'url_map', {}), 'selfLink')}, ) @@ -402,7 +380,7 @@ def resource_to_request(module): u'quicOverride': module.params.get('quic_override'), u'sslCertificates': replace_resource_dict(module.params.get('ssl_certificates', []), 'selfLink'), u'sslPolicy': replace_resource_dict(module.params.get(u'ssl_policy', {}), 'selfLink'), - u'urlMap': replace_resource_dict(module.params.get(u'url_map', {}), 'selfLink') + u'urlMap': replace_resource_dict(module.params.get(u'url_map', {}), 'selfLink'), } return_vals = {} for k, v in request.items(): @@ -475,7 +453,7 @@ def response_to_hash(module, response): u'quicOverride': response.get(u'quicOverride'), u'sslCertificates': response.get(u'sslCertificates'), u'sslPolicy': response.get(u'sslPolicy'), - u'urlMap': response.get(u'urlMap') + u'urlMap': response.get(u'urlMap'), } diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_https_proxy_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_target_https_proxy_facts.py index ab15ad25a38c2f..d579b36412b8df 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_https_proxy_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_https_proxy_facts.py @@ -18,15 +18,14 @@ # ---------------------------------------------------------------------------- from __future__ import absolute_import, division, print_function + __metaclass__ = type ################################################################################ # Documentation ################################################################################ -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ["preview"], - 'supported_by': 'community'} +ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ["preview"], 'supported_by': 'community'} DOCUMENTATION = ''' --- @@ -133,11 +132,7 @@ def main(): - module = GcpModule( - argument_spec=dict( - filters=dict(type='list', elements='str') - ) - ) + module = GcpModule(argument_spec=dict(filters=dict(type='list', elements='str'))) if not module.params['scopes']: module.params['scopes'] = ['https://www.googleapis.com/auth/compute'] @@ -147,9 +142,7 @@ def main(): items = items.get('items') else: items = [] - return_value = { - 'items': items - } + return_value = {'items': items} module.exit_json(**return_value) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_pool.py b/lib/ansible/modules/cloud/google/gcp_compute_target_pool.py index 237b90fd842335..a7a30a84061621 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_pool.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_pool.py @@ -18,15 +18,14 @@ # ---------------------------------------------------------------------------- from __future__ import absolute_import, division, print_function + __metaclass__ = type ################################################################################ # Documentation ################################################################################ -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ["preview"], - 'supported_by': 'community'} +ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ["preview"], 'supported_by': 'community'} DOCUMENTATION = ''' --- @@ -257,7 +256,7 @@ def main(): instances=dict(type='list'), name=dict(required=True, type='str'), session_affinity=dict(type='str', choices=['NONE', 'CLIENT_IP', 'CLIENT_IP_PROTO']), - region=dict(required=True, type='str') + region=dict(required=True, type='str'), ) ) @@ -316,7 +315,7 @@ def resource_to_request(module): u'healthCheck': replace_resource_dict(module.params.get(u'health_check', {}), 'selfLink'), u'instances': replace_resource_dict(module.params.get('instances', []), 'selfLink'), u'name': module.params.get('name'), - u'sessionAffinity': module.params.get('session_affinity') + u'sessionAffinity': module.params.get('session_affinity'), } request = encode_request(request, module) return_vals = {} @@ -394,7 +393,7 @@ def response_to_hash(module, response): u'id': response.get(u'id'), u'instances': response.get(u'instances'), u'name': module.params.get('name'), - u'sessionAffinity': module.params.get('session_affinity') + u'sessionAffinity': module.params.get('session_affinity'), } diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_pool_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_target_pool_facts.py index 17ca81e2706af7..146495f7e8fb3b 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_pool_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_pool_facts.py @@ -18,15 +18,14 @@ # ---------------------------------------------------------------------------- from __future__ import absolute_import, division, print_function + __metaclass__ = type ################################################################################ # Documentation ################################################################################ -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ["preview"], - 'supported_by': 'community'} +ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ["preview"], 'supported_by': 'community'} DOCUMENTATION = ''' --- @@ -168,12 +167,7 @@ def main(): - module = GcpModule( - argument_spec=dict( - filters=dict(type='list', elements='str'), - region=dict(required=True, type='str') - ) - ) + module = GcpModule(argument_spec=dict(filters=dict(type='list', elements='str'), region=dict(required=True, type='str'))) if not module.params['scopes']: module.params['scopes'] = ['https://www.googleapis.com/auth/compute'] @@ -183,9 +177,7 @@ def main(): items = items.get('items') else: items = [] - return_value = { - 'items': items - } + return_value = {'items': items} module.exit_json(**return_value) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_ssl_proxy.py b/lib/ansible/modules/cloud/google/gcp_compute_target_ssl_proxy.py index 8547cd9364f9d0..ba9a1fc1f9440b 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_ssl_proxy.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_ssl_proxy.py @@ -18,15 +18,14 @@ # ---------------------------------------------------------------------------- from __future__ import absolute_import, division, print_function + __metaclass__ = type ################################################################################ # Documentation ################################################################################ -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ["preview"], - 'supported_by': 'community'} +ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ["preview"], 'supported_by': 'community'} DOCUMENTATION = ''' --- @@ -266,7 +265,7 @@ def main(): proxy_header=dict(type='str', choices=['NONE', 'PROXY_V1']), service=dict(required=True), ssl_certificates=dict(required=True, type='list'), - ssl_policy=dict() + ssl_policy=dict(), ) ) @@ -307,8 +306,7 @@ def create(module, link, kind): def update(module, link, kind, fetch): - update_fields(module, resource_to_request(module), - response_to_hash(module, fetch)) + update_fields(module, resource_to_request(module), response_to_hash(module, fetch)) return fetch_resource(module, self_link(module), kind) @@ -326,52 +324,32 @@ def update_fields(module, request, response): def proxy_header_update(module, request, response): auth = GcpSession(module, 'compute') auth.post( - ''.join([ - "https://www.googleapis.com/compute/v1/", - "projects/{project}/global/targetSslProxies/{name}/setProxyHeader" - ]).format(**module.params), - { - u'proxyHeader': module.params.get('proxy_header') - } + ''.join(["https://www.googleapis.com/compute/v1/", "projects/{project}/global/targetSslProxies/{name}/setProxyHeader"]).format(**module.params), + {u'proxyHeader': module.params.get('proxy_header')}, ) def service_update(module, request, response): auth = GcpSession(module, 'compute') auth.post( - ''.join([ - "https://www.googleapis.com/compute/v1/", - "projects/{project}/global/targetSslProxies/{name}/setBackendService" - ]).format(**module.params), - { - u'service': replace_resource_dict(module.params.get(u'service', {}), 'selfLink') - } + ''.join(["https://www.googleapis.com/compute/v1/", "projects/{project}/global/targetSslProxies/{name}/setBackendService"]).format(**module.params), + {u'service': replace_resource_dict(module.params.get(u'service', {}), 'selfLink')}, ) def ssl_certificates_update(module, request, response): auth = GcpSession(module, 'compute') auth.post( - ''.join([ - "https://www.googleapis.com/compute/v1/", - "projects/{project}/global/targetSslProxies/{name}/setSslCertificates" - ]).format(**module.params), - { - u'sslCertificates': replace_resource_dict(module.params.get('ssl_certificates', []), 'selfLink') - } + ''.join(["https://www.googleapis.com/compute/v1/", "projects/{project}/global/targetSslProxies/{name}/setSslCertificates"]).format(**module.params), + {u'sslCertificates': replace_resource_dict(module.params.get('ssl_certificates', []), 'selfLink')}, ) def ssl_policy_update(module, request, response): auth = GcpSession(module, 'compute') auth.post( - ''.join([ - "https://www.googleapis.com/compute/v1/", - "projects/{project}/global/targetSslProxies/{name}/setSslPolicy" - ]).format(**module.params), - { - u'sslPolicy': replace_resource_dict(module.params.get(u'ssl_policy', {}), 'selfLink') - } + ''.join(["https://www.googleapis.com/compute/v1/", "projects/{project}/global/targetSslProxies/{name}/setSslPolicy"]).format(**module.params), + {u'sslPolicy': replace_resource_dict(module.params.get(u'ssl_policy', {}), 'selfLink')}, ) @@ -388,7 +366,7 @@ def resource_to_request(module): u'proxyHeader': module.params.get('proxy_header'), u'service': replace_resource_dict(module.params.get(u'service', {}), 'selfLink'), u'sslCertificates': replace_resource_dict(module.params.get('ssl_certificates', []), 'selfLink'), - u'sslPolicy': replace_resource_dict(module.params.get(u'ssl_policy', {}), 'selfLink') + u'sslPolicy': replace_resource_dict(module.params.get(u'ssl_policy', {}), 'selfLink'), } return_vals = {} for k, v in request.items(): @@ -461,7 +439,7 @@ def response_to_hash(module, response): u'proxyHeader': response.get(u'proxyHeader'), u'service': response.get(u'service'), u'sslCertificates': response.get(u'sslCertificates'), - u'sslPolicy': response.get(u'sslPolicy') + u'sslPolicy': response.get(u'sslPolicy'), } diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_ssl_proxy_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_target_ssl_proxy_facts.py index 193ae7982f5010..4b6bc30312ce99 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_ssl_proxy_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_ssl_proxy_facts.py @@ -18,15 +18,14 @@ # ---------------------------------------------------------------------------- from __future__ import absolute_import, division, print_function + __metaclass__ = type ################################################################################ # Documentation ################################################################################ -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ["preview"], - 'supported_by': 'community'} +ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ["preview"], 'supported_by': 'community'} DOCUMENTATION = ''' --- @@ -129,11 +128,7 @@ def main(): - module = GcpModule( - argument_spec=dict( - filters=dict(type='list', elements='str') - ) - ) + module = GcpModule(argument_spec=dict(filters=dict(type='list', elements='str'))) if not module.params['scopes']: module.params['scopes'] = ['https://www.googleapis.com/auth/compute'] @@ -143,9 +138,7 @@ def main(): items = items.get('items') else: items = [] - return_value = { - 'items': items - } + return_value = {'items': items} module.exit_json(**return_value) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_tcp_proxy.py b/lib/ansible/modules/cloud/google/gcp_compute_target_tcp_proxy.py index 9614281fb0722e..3616220ecd581c 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_tcp_proxy.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_tcp_proxy.py @@ -18,15 +18,14 @@ # ---------------------------------------------------------------------------- from __future__ import absolute_import, division, print_function + __metaclass__ = type ################################################################################ # Documentation ################################################################################ -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ["preview"], - 'supported_by': 'community'} +ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ["preview"], 'supported_by': 'community'} DOCUMENTATION = ''' --- @@ -199,7 +198,7 @@ def main(): description=dict(type='str'), name=dict(required=True, type='str'), proxy_header=dict(type='str', choices=['NONE', 'PROXY_V1']), - service=dict(required=True) + service=dict(required=True), ) ) @@ -240,8 +239,7 @@ def create(module, link, kind): def update(module, link, kind, fetch): - update_fields(module, resource_to_request(module), - response_to_hash(module, fetch)) + update_fields(module, resource_to_request(module), response_to_hash(module, fetch)) return fetch_resource(module, self_link(module), kind) @@ -255,26 +253,16 @@ def update_fields(module, request, response): def proxy_header_update(module, request, response): auth = GcpSession(module, 'compute') auth.post( - ''.join([ - "https://www.googleapis.com/compute/v1/", - "projects/{project}/global/targetTcpProxies/{name}/setProxyHeader" - ]).format(**module.params), - { - u'proxyHeader': module.params.get('proxy_header') - } + ''.join(["https://www.googleapis.com/compute/v1/", "projects/{project}/global/targetTcpProxies/{name}/setProxyHeader"]).format(**module.params), + {u'proxyHeader': module.params.get('proxy_header')}, ) def service_update(module, request, response): auth = GcpSession(module, 'compute') auth.post( - ''.join([ - "https://www.googleapis.com/compute/v1/", - "projects/{project}/global/targetTcpProxies/{name}/setBackendService" - ]).format(**module.params), - { - u'service': replace_resource_dict(module.params.get(u'service', {}), 'selfLink') - } + ''.join(["https://www.googleapis.com/compute/v1/", "projects/{project}/global/targetTcpProxies/{name}/setBackendService"]).format(**module.params), + {u'service': replace_resource_dict(module.params.get(u'service', {}), 'selfLink')}, ) @@ -289,7 +277,7 @@ def resource_to_request(module): u'description': module.params.get('description'), u'name': module.params.get('name'), u'proxyHeader': module.params.get('proxy_header'), - u'service': replace_resource_dict(module.params.get(u'service', {}), 'selfLink') + u'service': replace_resource_dict(module.params.get(u'service', {}), 'selfLink'), } return_vals = {} for k, v in request.items(): @@ -360,7 +348,7 @@ def response_to_hash(module, response): u'id': response.get(u'id'), u'name': module.params.get('name'), u'proxyHeader': response.get(u'proxyHeader'), - u'service': response.get(u'service') + u'service': response.get(u'service'), } diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_tcp_proxy_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_target_tcp_proxy_facts.py index f29c7e7332653e..2ffcedc028f4b2 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_tcp_proxy_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_tcp_proxy_facts.py @@ -18,15 +18,14 @@ # ---------------------------------------------------------------------------- from __future__ import absolute_import, division, print_function + __metaclass__ = type ################################################################################ # Documentation ################################################################################ -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ["preview"], - 'supported_by': 'community'} +ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ["preview"], 'supported_by': 'community'} DOCUMENTATION = ''' --- @@ -115,11 +114,7 @@ def main(): - module = GcpModule( - argument_spec=dict( - filters=dict(type='list', elements='str') - ) - ) + module = GcpModule(argument_spec=dict(filters=dict(type='list', elements='str'))) if not module.params['scopes']: module.params['scopes'] = ['https://www.googleapis.com/auth/compute'] @@ -129,9 +124,7 @@ def main(): items = items.get('items') else: items = [] - return_value = { - 'items': items - } + return_value = {'items': items} module.exit_json(**return_value) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_vpn_gateway.py b/lib/ansible/modules/cloud/google/gcp_compute_target_vpn_gateway.py index a9a9c9218e3bd0..b59bdbbc3435d5 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_vpn_gateway.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_vpn_gateway.py @@ -18,15 +18,14 @@ # ---------------------------------------------------------------------------- from __future__ import absolute_import, division, print_function + __metaclass__ = type ################################################################################ # Documentation ################################################################################ -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ["preview"], - 'supported_by': 'community'} +ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ["preview"], 'supported_by': 'community'} DOCUMENTATION = ''' --- @@ -181,7 +180,7 @@ def main(): description=dict(type='str'), name=dict(required=True, type='str'), network=dict(required=True), - region=dict(required=True, type='str') + region=dict(required=True, type='str'), ) ) @@ -235,7 +234,7 @@ def resource_to_request(module): u'kind': 'compute#targetVpnGateway', u'description': module.params.get('description'), u'name': module.params.get('name'), - u'network': replace_resource_dict(module.params.get(u'network', {}), 'selfLink') + u'network': replace_resource_dict(module.params.get(u'network', {}), 'selfLink'), } return_vals = {} for k, v in request.items(): @@ -307,7 +306,7 @@ def response_to_hash(module, response): u'id': response.get(u'id'), u'network': replace_resource_dict(module.params.get(u'network', {}), 'selfLink'), u'tunnels': response.get(u'tunnels'), - u'forwardingRules': response.get(u'forwardingRules') + u'forwardingRules': response.get(u'forwardingRules'), } diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_vpn_gateway_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_target_vpn_gateway_facts.py index b31ede95fb9021..7d51d39761cd17 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_vpn_gateway_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_vpn_gateway_facts.py @@ -18,15 +18,14 @@ # ---------------------------------------------------------------------------- from __future__ import absolute_import, division, print_function + __metaclass__ = type ################################################################################ # Documentation ################################################################################ -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ["preview"], - 'supported_by': 'community'} +ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ["preview"], 'supported_by': 'community'} DOCUMENTATION = ''' --- @@ -130,12 +129,7 @@ def main(): - module = GcpModule( - argument_spec=dict( - filters=dict(type='list', elements='str'), - region=dict(required=True, type='str') - ) - ) + module = GcpModule(argument_spec=dict(filters=dict(type='list', elements='str'), region=dict(required=True, type='str'))) if not module.params['scopes']: module.params['scopes'] = ['https://www.googleapis.com/auth/compute'] @@ -145,9 +139,7 @@ def main(): items = items.get('items') else: items = [] - return_value = { - 'items': items - } + return_value = {'items': items} module.exit_json(**return_value) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_url_map.py b/lib/ansible/modules/cloud/google/gcp_compute_url_map.py index ddc027bcf997c7..711398c3965c00 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_url_map.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_url_map.py @@ -18,15 +18,14 @@ # ---------------------------------------------------------------------------- from __future__ import absolute_import, division, print_function + __metaclass__ = type ################################################################################ # Documentation ################################################################################ -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ["preview"], - 'supported_by': 'community'} +ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ["preview"], 'supported_by': 'community'} DOCUMENTATION = ''' --- @@ -371,27 +370,33 @@ def main(): state=dict(default='present', choices=['present', 'absent'], type='str'), default_service=dict(required=True), description=dict(type='str'), - host_rules=dict(type='list', elements='dict', options=dict( - description=dict(type='str'), - hosts=dict(required=True, type='list', elements='str'), - path_matcher=dict(required=True, type='str') - )), + host_rules=dict( + type='list', + elements='dict', + options=dict( + description=dict(type='str'), hosts=dict(required=True, type='list', elements='str'), path_matcher=dict(required=True, type='str') + ), + ), name=dict(required=True, type='str'), - path_matchers=dict(type='list', elements='dict', options=dict( - default_service=dict(required=True), - description=dict(type='str'), - name=dict(required=True, type='str'), - path_rules=dict(type='list', elements='dict', options=dict( - paths=dict(required=True, type='list', elements='str'), - service=dict(required=True) - )) - )), - tests=dict(type='list', elements='dict', options=dict( - description=dict(type='str'), - host=dict(required=True, type='str'), - path=dict(required=True, type='str'), - service=dict(required=True) - )) + path_matchers=dict( + type='list', + elements='dict', + options=dict( + default_service=dict(required=True), + description=dict(type='str'), + name=dict(required=True, type='str'), + path_rules=dict( + type='list', elements='dict', options=dict(paths=dict(required=True, type='list', elements='str'), service=dict(required=True)) + ), + ), + ), + tests=dict( + type='list', + elements='dict', + options=dict( + description=dict(type='str'), host=dict(required=True, type='str'), path=dict(required=True, type='str'), service=dict(required=True) + ), + ), ) ) @@ -449,7 +454,7 @@ def resource_to_request(module): u'hostRules': UrlMapHostrulesArray(module.params.get('host_rules', []), module).to_request(), u'name': module.params.get('name'), u'pathMatchers': UrlMapPathmatchersArray(module.params.get('path_matchers', []), module).to_request(), - u'tests': UrlMapTestsArray(module.params.get('tests', []), module).to_request() + u'tests': UrlMapTestsArray(module.params.get('tests', []), module).to_request(), } return_vals = {} for k, v in request.items(): @@ -523,7 +528,7 @@ def response_to_hash(module, response): u'fingerprint': response.get(u'fingerprint'), u'name': module.params.get('name'), u'pathMatchers': UrlMapPathmatchersArray(response.get(u'pathMatchers', []), module).from_response(), - u'tests': UrlMapTestsArray(response.get(u'tests', []), module).from_response() + u'tests': UrlMapTestsArray(response.get(u'tests', []), module).from_response(), } @@ -583,18 +588,10 @@ def from_response(self): return items def _request_for_item(self, item): - return remove_nones_from_dict({ - u'description': item.get('description'), - u'hosts': item.get('hosts'), - u'pathMatcher': item.get('path_matcher') - }) + return remove_nones_from_dict({u'description': item.get('description'), u'hosts': item.get('hosts'), u'pathMatcher': item.get('path_matcher')}) def _response_from_item(self, item): - return remove_nones_from_dict({ - u'description': item.get(u'description'), - u'hosts': item.get(u'hosts'), - u'pathMatcher': item.get(u'pathMatcher') - }) + return remove_nones_from_dict({u'description': item.get(u'description'), u'hosts': item.get(u'hosts'), u'pathMatcher': item.get(u'pathMatcher')}) class UrlMapPathmatchersArray(object): @@ -618,20 +615,24 @@ def from_response(self): return items def _request_for_item(self, item): - return remove_nones_from_dict({ - u'defaultService': replace_resource_dict(item.get(u'default_service', {}), 'selfLink'), - u'description': item.get('description'), - u'name': item.get('name'), - u'pathRules': UrlMapPathrulesArray(item.get('path_rules', []), self.module).to_request() - }) + return remove_nones_from_dict( + { + u'defaultService': replace_resource_dict(item.get(u'default_service', {}), 'selfLink'), + u'description': item.get('description'), + u'name': item.get('name'), + u'pathRules': UrlMapPathrulesArray(item.get('path_rules', []), self.module).to_request(), + } + ) def _response_from_item(self, item): - return remove_nones_from_dict({ - u'defaultService': item.get(u'defaultService'), - u'description': item.get(u'description'), - u'name': item.get(u'name'), - u'pathRules': UrlMapPathrulesArray(item.get(u'pathRules', []), self.module).from_response() - }) + return remove_nones_from_dict( + { + u'defaultService': item.get(u'defaultService'), + u'description': item.get(u'description'), + u'name': item.get(u'name'), + u'pathRules': UrlMapPathrulesArray(item.get(u'pathRules', []), self.module).from_response(), + } + ) class UrlMapPathrulesArray(object): @@ -655,16 +656,10 @@ def from_response(self): return items def _request_for_item(self, item): - return remove_nones_from_dict({ - u'paths': item.get('paths'), - u'service': replace_resource_dict(item.get(u'service', {}), 'selfLink') - }) + return remove_nones_from_dict({u'paths': item.get('paths'), u'service': replace_resource_dict(item.get(u'service', {}), 'selfLink')}) def _response_from_item(self, item): - return remove_nones_from_dict({ - u'paths': item.get(u'paths'), - u'service': item.get(u'service') - }) + return remove_nones_from_dict({u'paths': item.get(u'paths'), u'service': item.get(u'service')}) class UrlMapTestsArray(object): @@ -688,20 +683,19 @@ def from_response(self): return items def _request_for_item(self, item): - return remove_nones_from_dict({ - u'description': item.get('description'), - u'host': item.get('host'), - u'path': item.get('path'), - u'service': replace_resource_dict(item.get(u'service', {}), 'selfLink') - }) + return remove_nones_from_dict( + { + u'description': item.get('description'), + u'host': item.get('host'), + u'path': item.get('path'), + u'service': replace_resource_dict(item.get(u'service', {}), 'selfLink'), + } + ) def _response_from_item(self, item): - return remove_nones_from_dict({ - u'description': item.get(u'description'), - u'host': item.get(u'host'), - u'path': item.get(u'path'), - u'service': item.get(u'service') - }) + return remove_nones_from_dict( + {u'description': item.get(u'description'), u'host': item.get(u'host'), u'path': item.get(u'path'), u'service': item.get(u'service')} + ) if __name__ == '__main__': diff --git a/lib/ansible/modules/cloud/google/gcp_compute_url_map_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_url_map_facts.py index a3125c71d5e4d8..5957f67e9f9b12 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_url_map_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_url_map_facts.py @@ -18,15 +18,14 @@ # ---------------------------------------------------------------------------- from __future__ import absolute_import, division, print_function + __metaclass__ = type ################################################################################ # Documentation ################################################################################ -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ["preview"], - 'supported_by': 'community'} +ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ["preview"], 'supported_by': 'community'} DOCUMENTATION = ''' --- @@ -211,11 +210,7 @@ def main(): - module = GcpModule( - argument_spec=dict( - filters=dict(type='list', elements='str') - ) - ) + module = GcpModule(argument_spec=dict(filters=dict(type='list', elements='str'))) if not module.params['scopes']: module.params['scopes'] = ['https://www.googleapis.com/auth/compute'] @@ -225,9 +220,7 @@ def main(): items = items.get('items') else: items = [] - return_value = { - 'items': items - } + return_value = {'items': items} module.exit_json(**return_value) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_vpn_tunnel.py b/lib/ansible/modules/cloud/google/gcp_compute_vpn_tunnel.py index b694fae62b68dc..33690e68610708 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_vpn_tunnel.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_vpn_tunnel.py @@ -18,15 +18,14 @@ # ---------------------------------------------------------------------------- from __future__ import absolute_import, division, print_function + __metaclass__ = type ################################################################################ # Documentation ################################################################################ -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ["preview"], - 'supported_by': 'community'} +ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ["preview"], 'supported_by': 'community'} DOCUMENTATION = ''' --- @@ -289,7 +288,7 @@ def main(): local_traffic_selector=dict(type='list', elements='str'), remote_traffic_selector=dict(type='list', elements='str'), labels=dict(type='dict'), - region=dict(required=True, type='str') + region=dict(required=True, type='str'), ) ) @@ -331,8 +330,7 @@ def create(module, link, kind): def update(module, link, kind, fetch): - update_fields(module, resource_to_request(module), - response_to_hash(module, fetch)) + update_fields(module, resource_to_request(module), response_to_hash(module, fetch)) return fetch_resource(module, self_link(module), kind) @@ -344,14 +342,8 @@ def update_fields(module, request, response): def labels_update(module, request, response): auth = GcpSession(module, 'compute') auth.post( - ''.join([ - "https://www.googleapis.com/compute/v1/", - "projects/{project}/regions/{region}/vpnTunnels/{name}/setLabels" - ]).format(**module.params), - { - u'labels': module.params.get('labels'), - u'labelFingerprint': response.get('labelFingerprint') - } + ''.join(["https://www.googleapis.com/compute/v1/", "projects/{project}/regions/{region}/vpnTunnels/{name}/setLabels"]).format(**module.params), + {u'labels': module.params.get('labels'), u'labelFingerprint': response.get('labelFingerprint')}, ) @@ -372,7 +364,7 @@ def resource_to_request(module): u'ikeVersion': module.params.get('ike_version'), u'localTrafficSelector': module.params.get('local_traffic_selector'), u'remoteTrafficSelector': module.params.get('remote_traffic_selector'), - u'labels': module.params.get('labels') + u'labels': module.params.get('labels'), } return_vals = {} for k, v in request.items(): @@ -450,7 +442,7 @@ def response_to_hash(module, response): u'localTrafficSelector': response.get(u'localTrafficSelector'), u'remoteTrafficSelector': response.get(u'remoteTrafficSelector'), u'labels': response.get(u'labels'), - u'labelFingerprint': response.get(u'labelFingerprint') + u'labelFingerprint': response.get(u'labelFingerprint'), } diff --git a/lib/ansible/modules/cloud/google/gcp_compute_vpn_tunnel_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_vpn_tunnel_facts.py index d51235ecdfc1ee..8c805236bd320a 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_vpn_tunnel_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_vpn_tunnel_facts.py @@ -18,15 +18,14 @@ # ---------------------------------------------------------------------------- from __future__ import absolute_import, division, print_function + __metaclass__ = type ################################################################################ # Documentation ################################################################################ -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ["preview"], - 'supported_by': 'community'} +ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ["preview"], 'supported_by': 'community'} DOCUMENTATION = ''' --- @@ -168,12 +167,7 @@ def main(): - module = GcpModule( - argument_spec=dict( - filters=dict(type='list', elements='str'), - region=dict(required=True, type='str') - ) - ) + module = GcpModule(argument_spec=dict(filters=dict(type='list', elements='str'), region=dict(required=True, type='str'))) if not module.params['scopes']: module.params['scopes'] = ['https://www.googleapis.com/auth/compute'] @@ -183,9 +177,7 @@ def main(): items = items.get('items') else: items = [] - return_value = { - 'items': items - } + return_value = {'items': items} module.exit_json(**return_value) diff --git a/lib/ansible/modules/cloud/google/gcp_container_cluster.py b/lib/ansible/modules/cloud/google/gcp_container_cluster.py index c88addf0efe84b..7bb744c0a93fea 100644 --- a/lib/ansible/modules/cloud/google/gcp_container_cluster.py +++ b/lib/ansible/modules/cloud/google/gcp_container_cluster.py @@ -18,15 +18,14 @@ # ---------------------------------------------------------------------------- from __future__ import absolute_import, division, print_function + __metaclass__ = type ################################################################################ # Documentation ################################################################################ -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ["preview"], - 'supported_by': 'community'} +ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ["preview"], 'supported_by': 'community'} DOCUMENTATION = ''' --- @@ -597,40 +596,45 @@ def main(): name=dict(type='str'), description=dict(type='str'), initial_node_count=dict(required=True, type='int'), - node_config=dict(type='dict', options=dict( - machine_type=dict(type='str'), - disk_size_gb=dict(type='int'), - oauth_scopes=dict(type='list', elements='str'), - service_account=dict(type='str'), - metadata=dict(type='dict'), - image_type=dict(type='str'), - labels=dict(type='dict'), - local_ssd_count=dict(type='int'), - tags=dict(type='list', elements='str'), - preemptible=dict(type='bool') - )), - master_auth=dict(type='dict', options=dict( - username=dict(type='str'), - password=dict(type='str'), - cluster_ca_certificate=dict(type='str'), - client_certificate=dict(type='str'), - client_key=dict(type='str') - )), + node_config=dict( + type='dict', + options=dict( + machine_type=dict(type='str'), + disk_size_gb=dict(type='int'), + oauth_scopes=dict(type='list', elements='str'), + service_account=dict(type='str'), + metadata=dict(type='dict'), + image_type=dict(type='str'), + labels=dict(type='dict'), + local_ssd_count=dict(type='int'), + tags=dict(type='list', elements='str'), + preemptible=dict(type='bool'), + ), + ), + master_auth=dict( + type='dict', + options=dict( + username=dict(type='str'), + password=dict(type='str'), + cluster_ca_certificate=dict(type='str'), + client_certificate=dict(type='str'), + client_key=dict(type='str'), + ), + ), logging_service=dict(type='str', choices=['logging.googleapis.com', 'none']), monitoring_service=dict(type='str', choices=['monitoring.googleapis.com', 'none']), network=dict(type='str'), cluster_ipv4_cidr=dict(type='str'), - addons_config=dict(type='dict', options=dict( - http_load_balancing=dict(type='dict', options=dict( - disabled=dict(type='bool') - )), - horizontal_pod_autoscaling=dict(type='dict', options=dict( - disabled=dict(type='bool') - )) - )), + addons_config=dict( + type='dict', + options=dict( + http_load_balancing=dict(type='dict', options=dict(disabled=dict(type='bool'))), + horizontal_pod_autoscaling=dict(type='dict', options=dict(disabled=dict(type='bool'))), + ), + ), subnetwork=dict(type='str'), location=dict(type='list', elements='str'), - zone=dict(required=True, type='str') + zone=dict(required=True, type='str'), ) ) @@ -692,7 +696,7 @@ def resource_to_request(module): u'clusterIpv4Cidr': module.params.get('cluster_ipv4_cidr'), u'addonsConfig': ClusterAddonsconfig(module.params.get('addons_config', {}), module).to_request(), u'subnetwork': module.params.get('subnetwork'), - u'location': module.params.get('location') + u'location': module.params.get('location'), } request = encode_request(request, module) return_vals = {} @@ -779,7 +783,7 @@ def response_to_hash(module, response): u'nodeIpv4CidrSize': response.get(u'nodeIpv4CidrSize'), u'servicesIpv4Cidr': response.get(u'servicesIpv4Cidr'), u'currentNodeCount': response.get(u'currentNodeCount'), - u'expireTime': response.get(u'expireTime') + u'expireTime': response.get(u'expireTime'), } @@ -829,9 +833,7 @@ def raise_if_errors(response, err_path, module): # # Format the request to match the expected input by the API def encode_request(resource_request, module): - return { - 'cluster': resource_request - } + return {'cluster': resource_request} class ClusterNodeconfig(object): @@ -843,32 +845,36 @@ def __init__(self, request, module): self.request = {} def to_request(self): - return remove_nones_from_dict({ - u'machineType': self.request.get('machine_type'), - u'diskSizeGb': self.request.get('disk_size_gb'), - u'oauthScopes': self.request.get('oauth_scopes'), - u'serviceAccount': self.request.get('service_account'), - u'metadata': self.request.get('metadata'), - u'imageType': self.request.get('image_type'), - u'labels': self.request.get('labels'), - u'localSsdCount': self.request.get('local_ssd_count'), - u'tags': self.request.get('tags'), - u'preemptible': self.request.get('preemptible') - }) + return remove_nones_from_dict( + { + u'machineType': self.request.get('machine_type'), + u'diskSizeGb': self.request.get('disk_size_gb'), + u'oauthScopes': self.request.get('oauth_scopes'), + u'serviceAccount': self.request.get('service_account'), + u'metadata': self.request.get('metadata'), + u'imageType': self.request.get('image_type'), + u'labels': self.request.get('labels'), + u'localSsdCount': self.request.get('local_ssd_count'), + u'tags': self.request.get('tags'), + u'preemptible': self.request.get('preemptible'), + } + ) def from_response(self): - return remove_nones_from_dict({ - u'machineType': self.request.get(u'machineType'), - u'diskSizeGb': self.request.get(u'diskSizeGb'), - u'oauthScopes': self.request.get(u'oauthScopes'), - u'serviceAccount': self.request.get(u'serviceAccount'), - u'metadata': self.request.get(u'metadata'), - u'imageType': self.request.get(u'imageType'), - u'labels': self.request.get(u'labels'), - u'localSsdCount': self.request.get(u'localSsdCount'), - u'tags': self.request.get(u'tags'), - u'preemptible': self.request.get(u'preemptible') - }) + return remove_nones_from_dict( + { + u'machineType': self.request.get(u'machineType'), + u'diskSizeGb': self.request.get(u'diskSizeGb'), + u'oauthScopes': self.request.get(u'oauthScopes'), + u'serviceAccount': self.request.get(u'serviceAccount'), + u'metadata': self.request.get(u'metadata'), + u'imageType': self.request.get(u'imageType'), + u'labels': self.request.get(u'labels'), + u'localSsdCount': self.request.get(u'localSsdCount'), + u'tags': self.request.get(u'tags'), + u'preemptible': self.request.get(u'preemptible'), + } + ) class ClusterMasterauth(object): @@ -880,22 +886,26 @@ def __init__(self, request, module): self.request = {} def to_request(self): - return remove_nones_from_dict({ - u'username': self.request.get('username'), - u'password': self.request.get('password'), - u'clusterCaCertificate': self.request.get('cluster_ca_certificate'), - u'clientCertificate': self.request.get('client_certificate'), - u'clientKey': self.request.get('client_key') - }) + return remove_nones_from_dict( + { + u'username': self.request.get('username'), + u'password': self.request.get('password'), + u'clusterCaCertificate': self.request.get('cluster_ca_certificate'), + u'clientCertificate': self.request.get('client_certificate'), + u'clientKey': self.request.get('client_key'), + } + ) def from_response(self): - return remove_nones_from_dict({ - u'username': self.request.get(u'username'), - u'password': self.request.get(u'password'), - u'clusterCaCertificate': self.request.get(u'clusterCaCertificate'), - u'clientCertificate': self.request.get(u'clientCertificate'), - u'clientKey': self.request.get(u'clientKey') - }) + return remove_nones_from_dict( + { + u'username': self.request.get(u'username'), + u'password': self.request.get(u'password'), + u'clusterCaCertificate': self.request.get(u'clusterCaCertificate'), + u'clientCertificate': self.request.get(u'clientCertificate'), + u'clientKey': self.request.get(u'clientKey'), + } + ) class ClusterAddonsconfig(object): @@ -907,16 +917,20 @@ def __init__(self, request, module): self.request = {} def to_request(self): - return remove_nones_from_dict({ - u'httpLoadBalancing': ClusterHttploadbalancing(self.request.get('http_load_balancing', {}), self.module).to_request(), - u'horizontalPodAutoscaling': ClusterHorizontalpodautoscaling(self.request.get('horizontal_pod_autoscaling', {}), self.module).to_request() - }) + return remove_nones_from_dict( + { + u'httpLoadBalancing': ClusterHttploadbalancing(self.request.get('http_load_balancing', {}), self.module).to_request(), + u'horizontalPodAutoscaling': ClusterHorizontalpodautoscaling(self.request.get('horizontal_pod_autoscaling', {}), self.module).to_request(), + } + ) def from_response(self): - return remove_nones_from_dict({ - u'httpLoadBalancing': ClusterHttploadbalancing(self.request.get(u'httpLoadBalancing', {}), self.module).from_response(), - u'horizontalPodAutoscaling': ClusterHorizontalpodautoscaling(self.request.get(u'horizontalPodAutoscaling', {}), self.module).from_response() - }) + return remove_nones_from_dict( + { + u'httpLoadBalancing': ClusterHttploadbalancing(self.request.get(u'httpLoadBalancing', {}), self.module).from_response(), + u'horizontalPodAutoscaling': ClusterHorizontalpodautoscaling(self.request.get(u'horizontalPodAutoscaling', {}), self.module).from_response(), + } + ) class ClusterHttploadbalancing(object): @@ -928,14 +942,10 @@ def __init__(self, request, module): self.request = {} def to_request(self): - return remove_nones_from_dict({ - u'disabled': self.request.get('disabled') - }) + return remove_nones_from_dict({u'disabled': self.request.get('disabled')}) def from_response(self): - return remove_nones_from_dict({ - u'disabled': self.request.get(u'disabled') - }) + return remove_nones_from_dict({u'disabled': self.request.get(u'disabled')}) class ClusterHorizontalpodautoscaling(object): @@ -947,14 +957,10 @@ def __init__(self, request, module): self.request = {} def to_request(self): - return remove_nones_from_dict({ - u'disabled': self.request.get('disabled') - }) + return remove_nones_from_dict({u'disabled': self.request.get('disabled')}) def from_response(self): - return remove_nones_from_dict({ - u'disabled': self.request.get(u'disabled') - }) + return remove_nones_from_dict({u'disabled': self.request.get(u'disabled')}) if __name__ == '__main__': diff --git a/lib/ansible/modules/cloud/google/gcp_container_cluster_facts.py b/lib/ansible/modules/cloud/google/gcp_container_cluster_facts.py index 8dcca826651b4d..1f6e020ff483e5 100644 --- a/lib/ansible/modules/cloud/google/gcp_container_cluster_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_container_cluster_facts.py @@ -18,15 +18,14 @@ # ---------------------------------------------------------------------------- from __future__ import absolute_import, division, print_function + __metaclass__ = type ################################################################################ # Documentation ################################################################################ -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ["preview"], - 'supported_by': 'community'} +ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ["preview"], 'supported_by': 'community'} DOCUMENTATION = ''' --- @@ -367,11 +366,7 @@ def main(): - module = GcpModule( - argument_spec=dict( - zone=dict(required=True, type='str') - ) - ) + module = GcpModule(argument_spec=dict(zone=dict(required=True, type='str'))) if not module.params['scopes']: module.params['scopes'] = ['https://www.googleapis.com/auth/cloud-platform'] @@ -381,9 +376,7 @@ def main(): items = items.get('clusters') else: items = [] - return_value = { - 'items': items - } + return_value = {'items': items} module.exit_json(**return_value) diff --git a/lib/ansible/modules/cloud/google/gcp_container_node_pool.py b/lib/ansible/modules/cloud/google/gcp_container_node_pool.py index a2c9fa3445d620..65c7e42f46508a 100644 --- a/lib/ansible/modules/cloud/google/gcp_container_node_pool.py +++ b/lib/ansible/modules/cloud/google/gcp_container_node_pool.py @@ -18,15 +18,14 @@ # ---------------------------------------------------------------------------- from __future__ import absolute_import, division, print_function + __metaclass__ = type ################################################################################ # Documentation ################################################################################ -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ["preview"], - 'supported_by': 'community'} +ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ["preview"], 'supported_by': 'community'} DOCUMENTATION = ''' --- @@ -443,34 +442,33 @@ def main(): argument_spec=dict( state=dict(default='present', choices=['present', 'absent'], type='str'), name=dict(type='str'), - config=dict(type='dict', options=dict( - machine_type=dict(type='str'), - disk_size_gb=dict(type='int'), - oauth_scopes=dict(type='list', elements='str'), - service_account=dict(type='str'), - metadata=dict(type='dict'), - image_type=dict(type='str'), - labels=dict(type='dict'), - local_ssd_count=dict(type='int'), - tags=dict(type='list', elements='str'), - preemptible=dict(type='bool') - )), + config=dict( + type='dict', + options=dict( + machine_type=dict(type='str'), + disk_size_gb=dict(type='int'), + oauth_scopes=dict(type='list', elements='str'), + service_account=dict(type='str'), + metadata=dict(type='dict'), + image_type=dict(type='str'), + labels=dict(type='dict'), + local_ssd_count=dict(type='int'), + tags=dict(type='list', elements='str'), + preemptible=dict(type='bool'), + ), + ), initial_node_count=dict(required=True, type='int'), - autoscaling=dict(type='dict', options=dict( - enabled=dict(type='bool'), - min_node_count=dict(type='int'), - max_node_count=dict(type='int') - )), - management=dict(type='dict', options=dict( - auto_upgrade=dict(type='bool'), - auto_repair=dict(type='bool'), - upgrade_options=dict(type='dict', options=dict( - auto_upgrade_start_time=dict(type='str'), - description=dict(type='str') - )) - )), + autoscaling=dict(type='dict', options=dict(enabled=dict(type='bool'), min_node_count=dict(type='int'), max_node_count=dict(type='int'))), + management=dict( + type='dict', + options=dict( + auto_upgrade=dict(type='bool'), + auto_repair=dict(type='bool'), + upgrade_options=dict(type='dict', options=dict(auto_upgrade_start_time=dict(type='str'), description=dict(type='str'))), + ), + ), cluster=dict(required=True), - zone=dict(required=True, type='str') + zone=dict(required=True, type='str'), ) ) @@ -525,7 +523,7 @@ def resource_to_request(module): u'config': NodePoolConfig(module.params.get('config', {}), module).to_request(), u'initialNodeCount': module.params.get('initial_node_count'), u'autoscaling': NodePoolAutoscaling(module.params.get('autoscaling', {}), module).to_request(), - u'management': NodePoolManagement(module.params.get('management', {}), module).to_request() + u'management': NodePoolManagement(module.params.get('management', {}), module).to_request(), } request = encode_request(request, module) return_vals = {} @@ -546,17 +544,13 @@ def self_link(module): 'project': module.params['project'], 'zone': module.params['zone'], 'cluster': replace_resource_dict(module.params['cluster'], 'name'), - 'name': module.params['name'] + 'name': module.params['name'], } return "https://container.googleapis.com/v1/projects/{project}/zones/{zone}/clusters/{cluster}/nodePools/{name}".format(**res) def collection(module): - res = { - 'project': module.params['project'], - 'zone': module.params['zone'], - 'cluster': replace_resource_dict(module.params['cluster'], 'name') - } + res = {'project': module.params['project'], 'zone': module.params['zone'], 'cluster': replace_resource_dict(module.params['cluster'], 'name')} return "https://container.googleapis.com/v1/projects/{project}/zones/{zone}/clusters/{cluster}/nodePools".format(**res) @@ -608,7 +602,7 @@ def response_to_hash(module, response): u'initialNodeCount': module.params.get('initial_node_count'), u'version': response.get(u'version'), u'autoscaling': NodePoolAutoscaling(response.get(u'autoscaling', {}), module).from_response(), - u'management': NodePoolManagement(response.get(u'management', {}), module).from_response() + u'management': NodePoolManagement(response.get(u'management', {}), module).from_response(), } @@ -658,9 +652,7 @@ def raise_if_errors(response, err_path, module): # # Format the request to match the expected input by the API def encode_request(resource_request, module): - return { - 'nodePool': resource_request - } + return {'nodePool': resource_request} class NodePoolConfig(object): @@ -672,32 +664,36 @@ def __init__(self, request, module): self.request = {} def to_request(self): - return remove_nones_from_dict({ - u'machineType': self.request.get('machine_type'), - u'diskSizeGb': self.request.get('disk_size_gb'), - u'oauthScopes': self.request.get('oauth_scopes'), - u'serviceAccount': self.request.get('service_account'), - u'metadata': self.request.get('metadata'), - u'imageType': self.request.get('image_type'), - u'labels': self.request.get('labels'), - u'localSsdCount': self.request.get('local_ssd_count'), - u'tags': self.request.get('tags'), - u'preemptible': self.request.get('preemptible') - }) + return remove_nones_from_dict( + { + u'machineType': self.request.get('machine_type'), + u'diskSizeGb': self.request.get('disk_size_gb'), + u'oauthScopes': self.request.get('oauth_scopes'), + u'serviceAccount': self.request.get('service_account'), + u'metadata': self.request.get('metadata'), + u'imageType': self.request.get('image_type'), + u'labels': self.request.get('labels'), + u'localSsdCount': self.request.get('local_ssd_count'), + u'tags': self.request.get('tags'), + u'preemptible': self.request.get('preemptible'), + } + ) def from_response(self): - return remove_nones_from_dict({ - u'machineType': self.request.get(u'machineType'), - u'diskSizeGb': self.request.get(u'diskSizeGb'), - u'oauthScopes': self.request.get(u'oauthScopes'), - u'serviceAccount': self.request.get(u'serviceAccount'), - u'metadata': self.request.get(u'metadata'), - u'imageType': self.request.get(u'imageType'), - u'labels': self.request.get(u'labels'), - u'localSsdCount': self.request.get(u'localSsdCount'), - u'tags': self.request.get(u'tags'), - u'preemptible': self.request.get(u'preemptible') - }) + return remove_nones_from_dict( + { + u'machineType': self.request.get(u'machineType'), + u'diskSizeGb': self.request.get(u'diskSizeGb'), + u'oauthScopes': self.request.get(u'oauthScopes'), + u'serviceAccount': self.request.get(u'serviceAccount'), + u'metadata': self.request.get(u'metadata'), + u'imageType': self.request.get(u'imageType'), + u'labels': self.request.get(u'labels'), + u'localSsdCount': self.request.get(u'localSsdCount'), + u'tags': self.request.get(u'tags'), + u'preemptible': self.request.get(u'preemptible'), + } + ) class NodePoolAutoscaling(object): @@ -709,18 +705,14 @@ def __init__(self, request, module): self.request = {} def to_request(self): - return remove_nones_from_dict({ - u'enabled': self.request.get('enabled'), - u'minNodeCount': self.request.get('min_node_count'), - u'maxNodeCount': self.request.get('max_node_count') - }) + return remove_nones_from_dict( + {u'enabled': self.request.get('enabled'), u'minNodeCount': self.request.get('min_node_count'), u'maxNodeCount': self.request.get('max_node_count')} + ) def from_response(self): - return remove_nones_from_dict({ - u'enabled': self.request.get(u'enabled'), - u'minNodeCount': self.request.get(u'minNodeCount'), - u'maxNodeCount': self.request.get(u'maxNodeCount') - }) + return remove_nones_from_dict( + {u'enabled': self.request.get(u'enabled'), u'minNodeCount': self.request.get(u'minNodeCount'), u'maxNodeCount': self.request.get(u'maxNodeCount')} + ) class NodePoolManagement(object): @@ -732,18 +724,22 @@ def __init__(self, request, module): self.request = {} def to_request(self): - return remove_nones_from_dict({ - u'autoUpgrade': self.request.get('auto_upgrade'), - u'autoRepair': self.request.get('auto_repair'), - u'upgradeOptions': NodePoolUpgradeoptions(self.request.get('upgrade_options', {}), self.module).to_request() - }) + return remove_nones_from_dict( + { + u'autoUpgrade': self.request.get('auto_upgrade'), + u'autoRepair': self.request.get('auto_repair'), + u'upgradeOptions': NodePoolUpgradeoptions(self.request.get('upgrade_options', {}), self.module).to_request(), + } + ) def from_response(self): - return remove_nones_from_dict({ - u'autoUpgrade': self.request.get(u'autoUpgrade'), - u'autoRepair': self.request.get(u'autoRepair'), - u'upgradeOptions': NodePoolUpgradeoptions(self.request.get(u'upgradeOptions', {}), self.module).from_response() - }) + return remove_nones_from_dict( + { + u'autoUpgrade': self.request.get(u'autoUpgrade'), + u'autoRepair': self.request.get(u'autoRepair'), + u'upgradeOptions': NodePoolUpgradeoptions(self.request.get(u'upgradeOptions', {}), self.module).from_response(), + } + ) class NodePoolUpgradeoptions(object): @@ -755,16 +751,10 @@ def __init__(self, request, module): self.request = {} def to_request(self): - return remove_nones_from_dict({ - u'autoUpgradeStartTime': self.request.get('auto_upgrade_start_time'), - u'description': self.request.get('description') - }) + return remove_nones_from_dict({u'autoUpgradeStartTime': self.request.get('auto_upgrade_start_time'), u'description': self.request.get('description')}) def from_response(self): - return remove_nones_from_dict({ - u'autoUpgradeStartTime': self.request.get(u'autoUpgradeStartTime'), - u'description': self.request.get(u'description') - }) + return remove_nones_from_dict({u'autoUpgradeStartTime': self.request.get(u'autoUpgradeStartTime'), u'description': self.request.get(u'description')}) if __name__ == '__main__': diff --git a/lib/ansible/modules/cloud/google/gcp_container_node_pool_facts.py b/lib/ansible/modules/cloud/google/gcp_container_node_pool_facts.py index 8f3eece3a675e7..1ab26232cc03f1 100644 --- a/lib/ansible/modules/cloud/google/gcp_container_node_pool_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_container_node_pool_facts.py @@ -18,15 +18,14 @@ # ---------------------------------------------------------------------------- from __future__ import absolute_import, division, print_function + __metaclass__ = type ################################################################################ # Documentation ################################################################################ -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ["preview"], - 'supported_by': 'community'} +ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ["preview"], 'supported_by': 'community'} DOCUMENTATION = ''' --- @@ -268,12 +267,7 @@ def main(): - module = GcpModule( - argument_spec=dict( - zone=dict(required=True, type='str'), - cluster=dict(required=True) - ) - ) + module = GcpModule(argument_spec=dict(zone=dict(required=True, type='str'), cluster=dict(required=True))) if not module.params['scopes']: module.params['scopes'] = ['https://www.googleapis.com/auth/cloud-platform'] @@ -283,18 +277,12 @@ def main(): items = items.get('nodePools') else: items = [] - return_value = { - 'items': items - } + return_value = {'items': items} module.exit_json(**return_value) def collection(module): - res = { - 'project': module.params['project'], - 'zone': module.params['zone'], - 'cluster': replace_resource_dict(module.params['cluster'], 'name') - } + res = {'project': module.params['project'], 'zone': module.params['zone'], 'cluster': replace_resource_dict(module.params['cluster'], 'name')} return "https://container.googleapis.com/v1/projects/{project}/zones/{zone}/clusters/{cluster}/nodePools".format(**res) diff --git a/lib/ansible/modules/cloud/google/gcp_dns_managed_zone.py b/lib/ansible/modules/cloud/google/gcp_dns_managed_zone.py index 841a07c19cd409..db604695e88d57 100644 --- a/lib/ansible/modules/cloud/google/gcp_dns_managed_zone.py +++ b/lib/ansible/modules/cloud/google/gcp_dns_managed_zone.py @@ -18,15 +18,14 @@ # ---------------------------------------------------------------------------- from __future__ import absolute_import, division, print_function + __metaclass__ = type ################################################################################ # Documentation ################################################################################ -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ["preview"], - 'supported_by': 'community'} +ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ["preview"], 'supported_by': 'community'} DOCUMENTATION = ''' --- @@ -163,7 +162,7 @@ def main(): dns_name=dict(required=True, type='str'), name=dict(required=True, type='str'), name_server_set=dict(type='list', elements='str'), - labels=dict(type='dict') + labels=dict(type='dict'), ) ) @@ -204,8 +203,7 @@ def create(module, link, kind): def update(module, link, kind, fetch): - update_fields(module, resource_to_request(module), - response_to_hash(module, fetch)) + update_fields(module, resource_to_request(module), response_to_hash(module, fetch)) return fetch_resource(module, self_link(module), kind) @@ -217,14 +215,8 @@ def update_fields(module, request, response): def description_update(module, request, response): auth = GcpSession(module, 'dns') auth.patch( - ''.join([ - "https://www.googleapis.com/dns/v1/", - "projects/{project}/managedZones/{name}" - ]).format(**module.params), - { - u'description': module.params.get('description'), - u'labels': module.params.get('labels') - } + ''.join(["https://www.googleapis.com/dns/v1/", "projects/{project}/managedZones/{name}"]).format(**module.params), + {u'description': module.params.get('description'), u'labels': module.params.get('labels')}, ) @@ -240,7 +232,7 @@ def resource_to_request(module): u'dnsName': module.params.get('dns_name'), u'name': module.params.get('name'), u'nameServerSet': module.params.get('name_server_set'), - u'labels': module.params.get('labels') + u'labels': module.params.get('labels'), } return_vals = {} for k, v in request.items(): @@ -313,7 +305,7 @@ def response_to_hash(module, response): u'nameServers': response.get(u'nameServers'), u'nameServerSet': response.get(u'nameServerSet'), u'creationTime': response.get(u'creationTime'), - u'labels': response.get(u'labels') + u'labels': response.get(u'labels'), } diff --git a/lib/ansible/modules/cloud/google/gcp_dns_managed_zone_facts.py b/lib/ansible/modules/cloud/google/gcp_dns_managed_zone_facts.py index 164f0245e0bcd8..8a7b6750893c18 100644 --- a/lib/ansible/modules/cloud/google/gcp_dns_managed_zone_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_dns_managed_zone_facts.py @@ -18,15 +18,14 @@ # ---------------------------------------------------------------------------- from __future__ import absolute_import, division, print_function + __metaclass__ = type ################################################################################ # Documentation ################################################################################ -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ["preview"], - 'supported_by': 'community'} +ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ["preview"], 'supported_by': 'community'} DOCUMENTATION = ''' --- @@ -122,11 +121,7 @@ def main(): - module = GcpModule( - argument_spec=dict( - dns_name=dict(type='list', elements='str') - ) - ) + module = GcpModule(argument_spec=dict(dns_name=dict(type='list', elements='str'))) if not module.params['scopes']: module.params['scopes'] = ['https://www.googleapis.com/auth/ndev.clouddns.readwrite'] @@ -136,9 +131,7 @@ def main(): items = items.get('managedZones') else: items = [] - return_value = { - 'items': items - } + return_value = {'items': items} module.exit_json(**return_value) diff --git a/lib/ansible/modules/cloud/google/gcp_dns_resource_record_set.py b/lib/ansible/modules/cloud/google/gcp_dns_resource_record_set.py index e57770486c9d57..4cb4b3f2795e9b 100644 --- a/lib/ansible/modules/cloud/google/gcp_dns_resource_record_set.py +++ b/lib/ansible/modules/cloud/google/gcp_dns_resource_record_set.py @@ -18,15 +18,14 @@ # ---------------------------------------------------------------------------- from __future__ import absolute_import, division, print_function + __metaclass__ = type ################################################################################ # Documentation ################################################################################ -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ["preview"], - 'supported_by': 'community'} +ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ["preview"], 'supported_by': 'community'} DOCUMENTATION = ''' --- @@ -174,7 +173,7 @@ def main(): type=dict(required=True, type='str', choices=['A', 'AAAA', 'CAA', 'CNAME', 'MX', 'NAPTR', 'NS', 'PTR', 'SOA', 'SPF', 'SRV', 'TXT']), ttl=dict(type='int'), target=dict(type='list', elements='str'), - managed_zone=dict(required=True) + managed_zone=dict(required=True), ) ) @@ -184,9 +183,7 @@ def main(): state = module.params['state'] kind = 'dns#resourceRecordSet' - fetch = fetch_wrapped_resource(module, 'dns#resourceRecordSet', - 'dns#resourceRecordSetsListResponse', - 'rrsets') + fetch = fetch_wrapped_resource(module, 'dns#resourceRecordSet', 'dns#resourceRecordSetsListResponse', 'rrsets') changed = False if fetch: @@ -216,9 +213,7 @@ def create(module, link, kind): change_id = int(change['id']) if change['status'] == 'pending': wait_for_change_to_complete(change_id, module) - return fetch_wrapped_resource(module, 'dns#resourceRecordSet', - 'dns#resourceRecordSetsListResponse', - 'rrsets') + return fetch_wrapped_resource(module, 'dns#resourceRecordSet', 'dns#resourceRecordSetsListResponse', 'rrsets') def update(module, link, kind, fetch): @@ -226,9 +221,7 @@ def update(module, link, kind, fetch): change_id = int(change['id']) if change['status'] == 'pending': wait_for_change_to_complete(change_id, module) - return fetch_wrapped_resource(module, 'dns#resourceRecordSet', - 'dns#resourceRecordSetsListResponse', - 'rrsets') + return fetch_wrapped_resource(module, 'dns#resourceRecordSet', 'dns#resourceRecordSetsListResponse', 'rrsets') def delete(module, link, kind, fetch): @@ -236,9 +229,7 @@ def delete(module, link, kind, fetch): change_id = int(change['id']) if change['status'] == 'pending': wait_for_change_to_complete(change_id, module) - return fetch_wrapped_resource(module, 'dns#resourceRecordSet', - 'dns#resourceRecordSetsListResponse', - 'rrsets') + return fetch_wrapped_resource(module, 'dns#resourceRecordSet', 'dns#resourceRecordSetsListResponse', 'rrsets') def resource_to_request(module): @@ -247,7 +238,7 @@ def resource_to_request(module): u'name': module.params.get('name'), u'type': module.params.get('type'), u'ttl': module.params.get('ttl'), - u'rrdatas': module.params.get('target') + u'rrdatas': module.params.get('target'), } return_vals = {} for k, v in request.items(): @@ -283,16 +274,13 @@ def self_link(module): 'project': module.params['project'], 'managed_zone': replace_resource_dict(module.params['managed_zone'], 'name'), 'name': module.params['name'], - 'type': module.params['type'] + 'type': module.params['type'], } return "https://www.googleapis.com/dns/v1/projects/{project}/managedZones/{managed_zone}/rrsets?name={name}&type={type}".format(**res) def collection(module): - res = { - 'project': module.params['project'], - 'managed_zone': replace_resource_dict(module.params['managed_zone'], 'name') - } + res = {'project': module.params['project'], 'managed_zone': replace_resource_dict(module.params['managed_zone'], 'name')} return "https://www.googleapis.com/dns/v1/projects/{project}/managedZones/{managed_zone}/changes".format(**res) @@ -338,12 +326,7 @@ def is_different(module, response): # Remove unnecessary properties from the response. # This is for doing comparisons with Ansible's current parameters. def response_to_hash(module, response): - return { - u'name': response.get(u'name'), - u'type': response.get(u'type'), - u'ttl': response.get(u'ttl'), - u'rrdatas': response.get(u'target') - } + return {u'name': response.get(u'name'), u'type': response.get(u'type'), u'ttl': response.get(u'ttl'), u'rrdatas': response.get(u'target')} def updated_record(module): @@ -352,7 +335,7 @@ def updated_record(module): 'name': module.params['name'], 'type': module.params['type'], 'ttl': module.params['ttl'] if module.params['ttl'] else 900, - 'rrdatas': module.params['target'] + 'rrdatas': module.params['target'], } @@ -377,20 +360,21 @@ def raise_for_status(self, *args, **kwargs): def prefetch_soa_resource(module): name = module.params['name'].split('.')[1:] - resource = SOAForwardable({ - 'type': 'SOA', - 'managed_zone': module.params['managed_zone'], - 'name': '.'.join(name), - 'project': module.params['project'], - 'scopes': module.params['scopes'], - 'service_account_file': module.params['service_account_file'], - 'auth_kind': module.params['auth_kind'], - 'service_account_email': module.params['service_account_email'] - }, module) - - result = fetch_wrapped_resource(resource, 'dns#resourceRecordSet', - 'dns#resourceRecordSetsListResponse', - 'rrsets') + resource = SOAForwardable( + { + 'type': 'SOA', + 'managed_zone': module.params['managed_zone'], + 'name': '.'.join(name), + 'project': module.params['project'], + 'scopes': module.params['scopes'], + 'service_account_file': module.params['service_account_file'], + 'auth_kind': module.params['auth_kind'], + 'service_account_email': module.params['service_account_email'], + }, + module, + ) + + result = fetch_wrapped_resource(resource, 'dns#resourceRecordSet', 'dns#resourceRecordSetsListResponse', 'rrsets') if not result: raise ValueError("Google DNS Managed Zone %s not found" % module.params['managed_zone']['name']) return result @@ -398,11 +382,7 @@ def prefetch_soa_resource(module): def create_change(original, updated, module): auth = GcpSession(module, 'dns') - return return_if_change_object(module, - auth.post(collection(module), - resource_to_change_request( - original, updated, module) - )) + return return_if_change_object(module, auth.post(collection(module), resource_to_change_request(original, updated, module))) # Fetch current SOA. We need the last SOA so we can increment its serial @@ -458,12 +438,7 @@ def get_change_status(change_id, module): def new_change_request(): - return { - 'kind': 'dns#change', - 'additions': [], - 'deletions': [], - 'start_time': datetime.datetime.now().isoformat() - } + return {'kind': 'dns#change', 'additions': [], 'deletions': [], 'start_time': datetime.datetime.now().isoformat()} def return_if_change_object(module, response): diff --git a/lib/ansible/modules/cloud/google/gcp_dns_resource_record_set_facts.py b/lib/ansible/modules/cloud/google/gcp_dns_resource_record_set_facts.py index 7727f87b5a78e6..683487e82ed698 100644 --- a/lib/ansible/modules/cloud/google/gcp_dns_resource_record_set_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_dns_resource_record_set_facts.py @@ -18,15 +18,14 @@ # ---------------------------------------------------------------------------- from __future__ import absolute_import, division, print_function + __metaclass__ = type ################################################################################ # Documentation ################################################################################ -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ["preview"], - 'supported_by': 'community'} +ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ["preview"], 'supported_by': 'community'} DOCUMENTATION = ''' --- @@ -108,11 +107,7 @@ def main(): - module = GcpModule( - argument_spec=dict( - managed_zone=dict(required=True) - ) - ) + module = GcpModule(argument_spec=dict(managed_zone=dict(required=True))) if not module.params['scopes']: module.params['scopes'] = ['https://www.googleapis.com/auth/ndev.clouddns.readwrite'] @@ -122,17 +117,12 @@ def main(): items = items.get('rrsets') else: items = [] - return_value = { - 'items': items - } + return_value = {'items': items} module.exit_json(**return_value) def collection(module): - res = { - 'project': module.params['project'], - 'managed_zone': replace_resource_dict(module.params['managed_zone'], 'name') - } + res = {'project': module.params['project'], 'managed_zone': replace_resource_dict(module.params['managed_zone'], 'name')} return "https://www.googleapis.com/dns/v1/projects/{project}/managedZones/{managed_zone}/rrsets".format(**res) diff --git a/lib/ansible/modules/cloud/google/gcp_iam_service_account.py b/lib/ansible/modules/cloud/google/gcp_iam_service_account.py index 07e337e63277b9..8cce57fb4cfc5b 100644 --- a/lib/ansible/modules/cloud/google/gcp_iam_service_account.py +++ b/lib/ansible/modules/cloud/google/gcp_iam_service_account.py @@ -18,15 +18,14 @@ # ---------------------------------------------------------------------------- from __future__ import absolute_import, division, print_function + __metaclass__ = type ################################################################################ # Documentation ################################################################################ -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ["preview"], - 'supported_by': 'community'} +ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ["preview"], 'supported_by': 'community'} DOCUMENTATION = ''' --- @@ -121,11 +120,7 @@ def main(): """Main function""" module = GcpModule( - argument_spec=dict( - state=dict(default='present', choices=['present', 'absent'], type='str'), - name=dict(type='str'), - display_name=dict(type='str') - ) + argument_spec=dict(state=dict(default='present', choices=['present', 'absent'], type='str'), name=dict(type='str'), display_name=dict(type='str')) ) if not module.params['scopes']: @@ -174,10 +169,7 @@ def delete(module, link): def resource_to_request(module): - request = { - u'name': module.params.get('name'), - u'displayName': module.params.get('display_name') - } + request = {u'name': module.params.get('name'), u'displayName': module.params.get('display_name')} request = encode_request(request, module) return_vals = {} for k, v in request.items(): @@ -251,7 +243,7 @@ def response_to_hash(module, response): u'uniqueId': response.get(u'uniqueId'), u'email': response.get(u'email'), u'displayName': response.get(u'displayName'), - u'oauth2ClientId': response.get(u'oauth2ClientId') + u'oauth2ClientId': response.get(u'oauth2ClientId'), } @@ -259,10 +251,7 @@ def encode_request(resource_request, module): """Structures the request as accountId + rest of request""" account_id = resource_request['name'].split('@')[0] del resource_request['name'] - return { - 'accountId': account_id, - 'serviceAccount': resource_request - } + return {'accountId': account_id, 'serviceAccount': resource_request} def decode_response(response, module): diff --git a/lib/ansible/modules/cloud/google/gcp_iam_service_account_facts.py b/lib/ansible/modules/cloud/google/gcp_iam_service_account_facts.py index 646e906a5ad76a..062fc5799452ab 100644 --- a/lib/ansible/modules/cloud/google/gcp_iam_service_account_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_iam_service_account_facts.py @@ -18,15 +18,14 @@ # ---------------------------------------------------------------------------- from __future__ import absolute_import, division, print_function + __metaclass__ = type ################################################################################ # Documentation ################################################################################ -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ["preview"], - 'supported_by': 'community'} +ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ["preview"], 'supported_by': 'community'} DOCUMENTATION = ''' --- @@ -102,10 +101,7 @@ def main(): - module = GcpModule( - argument_spec=dict( - ) - ) + module = GcpModule(argument_spec=dict()) if not module.params['scopes']: module.params['scopes'] = ['https://www.googleapis.com/auth/iam'] @@ -115,9 +111,7 @@ def main(): items = items.get('items') else: items = [] - return_value = { - 'items': items - } + return_value = {'items': items} module.exit_json(**return_value) diff --git a/lib/ansible/modules/cloud/google/gcp_iam_service_account_key.py b/lib/ansible/modules/cloud/google/gcp_iam_service_account_key.py index c84261539fe86e..a1057798b5ff48 100644 --- a/lib/ansible/modules/cloud/google/gcp_iam_service_account_key.py +++ b/lib/ansible/modules/cloud/google/gcp_iam_service_account_key.py @@ -18,15 +18,14 @@ # ---------------------------------------------------------------------------- from __future__ import absolute_import, division, print_function + __metaclass__ = type ################################################################################ # Documentation ################################################################################ -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ["preview"], - 'supported_by': 'community'} +ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ["preview"], 'supported_by': 'community'} DOCUMENTATION = ''' --- @@ -178,7 +177,7 @@ def main(): private_key_type=dict(type='str', choices=['TYPE_UNSPECIFIED', 'TYPE_PKCS12_FILE', 'TYPE_GOOGLE_CREDENTIALS_FILE']), key_algorithm=dict(type='str', choices=['KEY_ALG_UNSPECIFIED', 'KEY_ALG_RSA_1024', 'KEY_ALG_RSA_2048']), service_account=dict(), - path=dict(type='path') + path=dict(type='path'), ) ) @@ -220,10 +219,7 @@ def delete(module): def resource_to_request(module): - request = { - u'privateKeyType': module.params.get('private_key_type'), - u'keyAlgorithm': module.params.get('key_algorithm') - } + request = {u'privateKeyType': module.params.get('private_key_type'), u'keyAlgorithm': module.params.get('key_algorithm')} return_vals = {} for k, v in request.items(): if v: @@ -252,10 +248,7 @@ def self_link_from_file(module): def self_link(module): - results = { - 'project': module.params['project'], - 'service_account': replace_resource_dict(module.params['service_account'], 'name') - } + results = {'project': module.params['project'], 'service_account': replace_resource_dict(module.params['service_account'], 'name')} return "https://iam.googleapis.com/v1/projects/{project}/serviceAccounts/{service_account}/keys".format(**results) diff --git a/lib/ansible/modules/cloud/google/gcp_pubsub_subscription.py b/lib/ansible/modules/cloud/google/gcp_pubsub_subscription.py index 157bc3a7224dd3..1a42048f66bf80 100644 --- a/lib/ansible/modules/cloud/google/gcp_pubsub_subscription.py +++ b/lib/ansible/modules/cloud/google/gcp_pubsub_subscription.py @@ -18,15 +18,14 @@ # ---------------------------------------------------------------------------- from __future__ import absolute_import, division, print_function + __metaclass__ = type ################################################################################ # Documentation ################################################################################ -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ["preview"], - 'supported_by': 'community'} +ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ["preview"], 'supported_by': 'community'} DOCUMENTATION = ''' --- @@ -179,10 +178,8 @@ def main(): state=dict(default='present', choices=['present', 'absent'], type='str'), name=dict(type='str'), topic=dict(), - push_config=dict(type='dict', options=dict( - push_endpoint=dict(type='str') - )), - ack_deadline_seconds=dict(type='int') + push_config=dict(type='dict', options=dict(push_endpoint=dict(type='str'))), + ack_deadline_seconds=dict(type='int'), ) ) @@ -235,7 +232,7 @@ def resource_to_request(module): u'name': module.params.get('name'), u'topic': replace_resource_dict(module.params.get(u'topic', {}), 'name'), u'pushConfig': SubscriptionPushconfig(module.params.get('push_config', {}), module).to_request(), - u'ackDeadlineSeconds': module.params.get('ack_deadline_seconds') + u'ackDeadlineSeconds': module.params.get('ack_deadline_seconds'), } request = encode_request(request, module) return_vals = {} @@ -308,7 +305,7 @@ def response_to_hash(module, response): u'name': response.get(u'name'), u'topic': response.get(u'topic'), u'pushConfig': SubscriptionPushconfig(response.get(u'pushConfig', {}), module).from_response(), - u'ackDeadlineSeconds': response.get(u'ackDeadlineSeconds') + u'ackDeadlineSeconds': response.get(u'ackDeadlineSeconds'), } @@ -323,10 +320,8 @@ def decode_request(response, module): def encode_request(request, module): - request['topic'] = '/'.join(['projects', module.params['project'], - 'topics', module.params['topic']['name']]) - request['name'] = '/'.join(['projects', module.params['project'], - 'subscriptions', module.params['name']]) + request['topic'] = '/'.join(['projects', module.params['project'], 'topics', module.params['topic']['name']]) + request['name'] = '/'.join(['projects', module.params['project'], 'subscriptions', module.params['name']]) return request @@ -340,14 +335,10 @@ def __init__(self, request, module): self.request = {} def to_request(self): - return remove_nones_from_dict({ - u'pushEndpoint': self.request.get('push_endpoint') - }) + return remove_nones_from_dict({u'pushEndpoint': self.request.get('push_endpoint')}) def from_response(self): - return remove_nones_from_dict({ - u'pushEndpoint': self.request.get(u'pushEndpoint') - }) + return remove_nones_from_dict({u'pushEndpoint': self.request.get(u'pushEndpoint')}) if __name__ == '__main__': diff --git a/lib/ansible/modules/cloud/google/gcp_pubsub_subscription_facts.py b/lib/ansible/modules/cloud/google/gcp_pubsub_subscription_facts.py index 50272b74c37c91..45070052487e8a 100644 --- a/lib/ansible/modules/cloud/google/gcp_pubsub_subscription_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_pubsub_subscription_facts.py @@ -18,15 +18,14 @@ # ---------------------------------------------------------------------------- from __future__ import absolute_import, division, print_function + __metaclass__ = type ################################################################################ # Documentation ################################################################################ -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ["preview"], - 'supported_by': 'community'} +ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ["preview"], 'supported_by': 'community'} DOCUMENTATION = ''' --- @@ -115,10 +114,7 @@ def main(): - module = GcpModule( - argument_spec=dict( - ) - ) + module = GcpModule(argument_spec=dict()) if not module.params['scopes']: module.params['scopes'] = ['https://www.googleapis.com/auth/pubsub'] @@ -128,9 +124,7 @@ def main(): items = items.get('subscriptions') else: items = [] - return_value = { - 'items': items - } + return_value = {'items': items} module.exit_json(**return_value) diff --git a/lib/ansible/modules/cloud/google/gcp_pubsub_topic.py b/lib/ansible/modules/cloud/google/gcp_pubsub_topic.py index c70e22edb50db7..f73cd13655ce80 100644 --- a/lib/ansible/modules/cloud/google/gcp_pubsub_topic.py +++ b/lib/ansible/modules/cloud/google/gcp_pubsub_topic.py @@ -18,15 +18,14 @@ # ---------------------------------------------------------------------------- from __future__ import absolute_import, division, print_function + __metaclass__ = type ################################################################################ # Documentation ################################################################################ -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ["preview"], - 'supported_by': 'community'} +ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ["preview"], 'supported_by': 'community'} DOCUMENTATION = ''' --- @@ -88,12 +87,7 @@ def main(): """Main function""" - module = GcpModule( - argument_spec=dict( - state=dict(default='present', choices=['present', 'absent'], type='str'), - name=dict(type='str') - ) - ) + module = GcpModule(argument_spec=dict(state=dict(default='present', choices=['present', 'absent'], type='str'), name=dict(type='str'))) if not module.params['scopes']: module.params['scopes'] = ['https://www.googleapis.com/auth/pubsub'] @@ -141,9 +135,7 @@ def delete(module, link): def resource_to_request(module): - request = { - u'name': module.params.get('name') - } + request = {u'name': module.params.get('name')} request = encode_request(request, module) return_vals = {} for k, v in request.items(): @@ -211,9 +203,7 @@ def is_different(module, response): # Remove unnecessary properties from the response. # This is for doing comparisons with Ansible's current parameters. def response_to_hash(module, response): - return { - u'name': response.get(u'name') - } + return {u'name': response.get(u'name')} def decode_request(response, module): @@ -223,8 +213,7 @@ def decode_request(response, module): def encode_request(request, module): - request['name'] = '/'.join(['projects', module.params['project'], - 'topics', module.params['name']]) + request['name'] = '/'.join(['projects', module.params['project'], 'topics', module.params['name']]) return request diff --git a/lib/ansible/modules/cloud/google/gcp_pubsub_topic_facts.py b/lib/ansible/modules/cloud/google/gcp_pubsub_topic_facts.py index b9f42cdf2cf943..9d40382281bd50 100644 --- a/lib/ansible/modules/cloud/google/gcp_pubsub_topic_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_pubsub_topic_facts.py @@ -18,15 +18,14 @@ # ---------------------------------------------------------------------------- from __future__ import absolute_import, division, print_function + __metaclass__ = type ################################################################################ # Documentation ################################################################################ -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ["preview"], - 'supported_by': 'community'} +ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ["preview"], 'supported_by': 'community'} DOCUMENTATION = ''' --- @@ -77,10 +76,7 @@ def main(): - module = GcpModule( - argument_spec=dict( - ) - ) + module = GcpModule(argument_spec=dict()) if not module.params['scopes']: module.params['scopes'] = ['https://www.googleapis.com/auth/pubsub'] @@ -90,9 +86,7 @@ def main(): items = items.get('topics') else: items = [] - return_value = { - 'items': items - } + return_value = {'items': items} module.exit_json(**return_value) diff --git a/lib/ansible/modules/cloud/google/gcp_resourcemanager_project.py b/lib/ansible/modules/cloud/google/gcp_resourcemanager_project.py index 5ce0ef76846e10..95c237ef3c8c55 100644 --- a/lib/ansible/modules/cloud/google/gcp_resourcemanager_project.py +++ b/lib/ansible/modules/cloud/google/gcp_resourcemanager_project.py @@ -18,15 +18,14 @@ # ---------------------------------------------------------------------------- from __future__ import absolute_import, division, print_function + __metaclass__ = type ################################################################################ # Documentation ################################################################################ -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ["preview"], - 'supported_by': 'community'} +ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ["preview"], 'supported_by': 'community'} DOCUMENTATION = ''' --- @@ -182,11 +181,8 @@ def main(): state=dict(default='present', choices=['present', 'absent'], type='str'), name=dict(type='str'), labels=dict(type='dict'), - parent=dict(type='dict', options=dict( - type=dict(type='str'), - id=dict(type='str') - )), - id=dict(required=True, type='str') + parent=dict(type='dict', options=dict(type=dict(type='str'), id=dict(type='str'))), + id=dict(required=True, type='str'), ) ) @@ -240,7 +236,7 @@ def resource_to_request(module): u'projectId': module.params.get('id'), u'name': module.params.get('name'), u'labels': module.params.get('labels'), - u'parent': ProjectParent(module.params.get('parent', {}), module).to_request() + u'parent': ProjectParent(module.params.get('parent', {}), module).to_request(), } return_vals = {} for k, v in request.items(): @@ -314,7 +310,7 @@ def response_to_hash(module, response): u'name': response.get(u'name'), u'createTime': response.get(u'createTime'), u'labels': response.get(u'labels'), - u'parent': ProjectParent(response.get(u'parent', {}), module).from_response() + u'parent': ProjectParent(response.get(u'parent', {}), module).from_response(), } @@ -362,16 +358,10 @@ def __init__(self, request, module): self.request = {} def to_request(self): - return remove_nones_from_dict({ - u'type': self.request.get('type'), - u'id': self.request.get('id') - }) + return remove_nones_from_dict({u'type': self.request.get('type'), u'id': self.request.get('id')}) def from_response(self): - return remove_nones_from_dict({ - u'type': self.request.get(u'type'), - u'id': self.request.get(u'id') - }) + return remove_nones_from_dict({u'type': self.request.get(u'type'), u'id': self.request.get(u'id')}) if __name__ == '__main__': diff --git a/lib/ansible/modules/cloud/google/gcp_resourcemanager_project_facts.py b/lib/ansible/modules/cloud/google/gcp_resourcemanager_project_facts.py index a27c1b331b3ae1..b5e787e640647a 100644 --- a/lib/ansible/modules/cloud/google/gcp_resourcemanager_project_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_resourcemanager_project_facts.py @@ -18,15 +18,14 @@ # ---------------------------------------------------------------------------- from __future__ import absolute_import, division, print_function + __metaclass__ = type ################################################################################ # Documentation ################################################################################ -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ["preview"], - 'supported_by': 'community'} +ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ["preview"], 'supported_by': 'community'} DOCUMENTATION = ''' --- @@ -129,10 +128,7 @@ def main(): - module = GcpModule( - argument_spec=dict( - ) - ) + module = GcpModule(argument_spec=dict()) if not module.params['scopes']: module.params['scopes'] = ['https://www.googleapis.com/auth/cloud-platform'] @@ -142,9 +138,7 @@ def main(): items = items.get('projects') else: items = [] - return_value = { - 'items': items - } + return_value = {'items': items} module.exit_json(**return_value) diff --git a/lib/ansible/modules/cloud/google/gcp_spanner_database.py b/lib/ansible/modules/cloud/google/gcp_spanner_database.py index 1435fc4d87819b..020f7e16883674 100644 --- a/lib/ansible/modules/cloud/google/gcp_spanner_database.py +++ b/lib/ansible/modules/cloud/google/gcp_spanner_database.py @@ -18,15 +18,14 @@ # ---------------------------------------------------------------------------- from __future__ import absolute_import, division, print_function + __metaclass__ = type ################################################################################ # Documentation ################################################################################ -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ["preview"], - 'supported_by': 'community'} +ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ["preview"], 'supported_by': 'community'} DOCUMENTATION = ''' --- @@ -140,7 +139,7 @@ def main(): state=dict(default='present', choices=['present', 'absent'], type='str'), name=dict(type='str'), extra_statements=dict(type='list', elements='str'), - instance=dict(required=True) + instance=dict(required=True), ) ) @@ -190,10 +189,7 @@ def delete(module, link): def resource_to_request(module): - request = { - u'name': module.params.get('name'), - u'extraStatements': module.params.get('extra_statements') - } + request = {u'name': module.params.get('name'), u'extraStatements': module.params.get('extra_statements')} request = encode_request(request, module) return_vals = {} for k, v in request.items(): @@ -209,19 +205,12 @@ def fetch_resource(module, link, allow_not_found=True): def self_link(module): - res = { - 'project': module.params['project'], - 'instance': replace_resource_dict(module.params['instance'], 'name'), - 'name': module.params['name'] - } + res = {'project': module.params['project'], 'instance': replace_resource_dict(module.params['instance'], 'name'), 'name': module.params['name']} return "https://spanner.googleapis.com/v1/projects/{project}/instances/{instance}/databases/{name}".format(**res) def collection(module): - res = { - 'project': module.params['project'], - 'instance': replace_resource_dict(module.params['instance'], 'name') - } + res = {'project': module.params['project'], 'instance': replace_resource_dict(module.params['instance'], 'name')} return "https://spanner.googleapis.com/v1/projects/{project}/instances/{instance}/databases".format(**res) @@ -270,10 +259,7 @@ def is_different(module, response): # Remove unnecessary properties from the response. # This is for doing comparisons with Ansible's current parameters. def response_to_hash(module, response): - return { - u'name': response.get(u'name'), - u'extraStatements': module.params.get('extra_statements') - } + return {u'name': response.get(u'name'), u'extraStatements': module.params.get('extra_statements')} def decode_response(response, module): diff --git a/lib/ansible/modules/cloud/google/gcp_spanner_database_facts.py b/lib/ansible/modules/cloud/google/gcp_spanner_database_facts.py index d781a9e9925585..6f901df48650a3 100644 --- a/lib/ansible/modules/cloud/google/gcp_spanner_database_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_spanner_database_facts.py @@ -18,15 +18,14 @@ # ---------------------------------------------------------------------------- from __future__ import absolute_import, division, print_function + __metaclass__ = type ################################################################################ # Documentation ################################################################################ -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ["preview"], - 'supported_by': 'community'} +ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ["preview"], 'supported_by': 'community'} DOCUMENTATION = ''' --- @@ -101,11 +100,7 @@ def main(): - module = GcpModule( - argument_spec=dict( - instance=dict(required=True) - ) - ) + module = GcpModule(argument_spec=dict(instance=dict(required=True))) if not module.params['scopes']: module.params['scopes'] = ['https://www.googleapis.com/auth/spanner.admin'] @@ -115,17 +110,12 @@ def main(): items = items.get('databases') else: items = [] - return_value = { - 'items': items - } + return_value = {'items': items} module.exit_json(**return_value) def collection(module): - res = { - 'project': module.params['project'], - 'instance': replace_resource_dict(module.params['instance'], 'name') - } + res = {'project': module.params['project'], 'instance': replace_resource_dict(module.params['instance'], 'name')} return "https://spanner.googleapis.com/v1/projects/{project}/instances/{instance}/databases".format(**res) diff --git a/lib/ansible/modules/cloud/google/gcp_spanner_instance.py b/lib/ansible/modules/cloud/google/gcp_spanner_instance.py index 4aa2fbb0149953..412d28fb5370f5 100644 --- a/lib/ansible/modules/cloud/google/gcp_spanner_instance.py +++ b/lib/ansible/modules/cloud/google/gcp_spanner_instance.py @@ -18,15 +18,14 @@ # ---------------------------------------------------------------------------- from __future__ import absolute_import, division, print_function + __metaclass__ = type ################################################################################ # Documentation ################################################################################ -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ["preview"], - 'supported_by': 'community'} +ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ["preview"], 'supported_by': 'community'} DOCUMENTATION = ''' --- @@ -176,7 +175,7 @@ def main(): config=dict(type='str'), display_name=dict(required=True, type='str'), node_count=dict(type='int'), - labels=dict(type='dict') + labels=dict(type='dict'), ) ) @@ -231,7 +230,7 @@ def resource_to_request(module): u'config': module.params.get('config'), u'displayName': module.params.get('display_name'), u'nodeCount': module.params.get('node_count'), - u'labels': module.params.get('labels') + u'labels': module.params.get('labels'), } return_vals = {} for k, v in request.items(): @@ -304,32 +303,22 @@ def response_to_hash(module, response): u'config': response.get(u'config'), u'displayName': response.get(u'displayName'), u'nodeCount': response.get(u'nodeCount'), - u'labels': response.get(u'labels') + u'labels': response.get(u'labels'), } def resource_to_create(module): instance = resource_to_request(module) - instance['name'] = "projects/{0}/instances/{1}".format(module.params['project'], - module.params['name']) - instance['config'] = "projects/{0}/instanceConfigs/{1}".format(module.params['project'], - instance['config']) - return { - 'instanceId': module.params['name'], - 'instance': instance - } + instance['name'] = "projects/{0}/instances/{1}".format(module.params['project'], module.params['name']) + instance['config'] = "projects/{0}/instanceConfigs/{1}".format(module.params['project'], instance['config']) + return {'instanceId': module.params['name'], 'instance': instance} def resource_to_update(module): instance = resource_to_request(module) - instance['name'] = "projects/{0}/instances/{1}".format(module.params['project'], - module.params['name']) - instance['config'] = "projects/{0}/instanceConfigs/{1}".format(module.params['project'], - instance['config']) - return { - 'instance': instance, - 'fieldMask': "'name' ,'config' ,'displayName' ,'nodeCount' ,'labels'" - } + instance['name'] = "projects/{0}/instances/{1}".format(module.params['project'], module.params['name']) + instance['config'] = "projects/{0}/instanceConfigs/{1}".format(module.params['project'], instance['config']) + return {'instance': instance, 'fieldMask': "'name' ,'config' ,'displayName' ,'nodeCount' ,'labels'"} def decode_response(response, module): diff --git a/lib/ansible/modules/cloud/google/gcp_spanner_instance_facts.py b/lib/ansible/modules/cloud/google/gcp_spanner_instance_facts.py index 639dc5159bff03..07af4a459d7510 100644 --- a/lib/ansible/modules/cloud/google/gcp_spanner_instance_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_spanner_instance_facts.py @@ -18,15 +18,14 @@ # ---------------------------------------------------------------------------- from __future__ import absolute_import, division, print_function + __metaclass__ = type ################################################################################ # Documentation ################################################################################ -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ["preview"], - 'supported_by': 'community'} +ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ["preview"], 'supported_by': 'community'} DOCUMENTATION = ''' --- @@ -118,10 +117,7 @@ def main(): - module = GcpModule( - argument_spec=dict( - ) - ) + module = GcpModule(argument_spec=dict()) if not module.params['scopes']: module.params['scopes'] = ['https://www.googleapis.com/auth/spanner.admin'] @@ -131,9 +127,7 @@ def main(): items = items.get('instances') else: items = [] - return_value = { - 'items': items - } + return_value = {'items': items} module.exit_json(**return_value) diff --git a/lib/ansible/modules/cloud/google/gcp_sql_database.py b/lib/ansible/modules/cloud/google/gcp_sql_database.py index d19b6c7865f831..05000cbbf9ab05 100644 --- a/lib/ansible/modules/cloud/google/gcp_sql_database.py +++ b/lib/ansible/modules/cloud/google/gcp_sql_database.py @@ -18,15 +18,14 @@ # ---------------------------------------------------------------------------- from __future__ import absolute_import, division, print_function + __metaclass__ = type ################################################################################ # Documentation ################################################################################ -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ["preview"], - 'supported_by': 'community'} +ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ["preview"], 'supported_by': 'community'} DOCUMENTATION = ''' --- @@ -146,7 +145,7 @@ def main(): charset=dict(type='str'), collation=dict(type='str'), name=dict(type='str'), - instance=dict(required=True) + instance=dict(required=True), ) ) @@ -201,7 +200,7 @@ def resource_to_request(module): u'kind': 'sql#database', u'charset': module.params.get('charset'), u'collation': module.params.get('collation'), - u'name': module.params.get('name') + u'name': module.params.get('name'), } return_vals = {} for k, v in request.items(): @@ -217,19 +216,12 @@ def fetch_resource(module, link, kind, allow_not_found=True): def self_link(module): - res = { - 'project': module.params['project'], - 'instance': replace_resource_dict(module.params['instance'], 'name'), - 'name': module.params['name'] - } + res = {'project': module.params['project'], 'instance': replace_resource_dict(module.params['instance'], 'name'), 'name': module.params['name']} return "https://www.googleapis.com/sql/v1beta4/projects/{project}/instances/{instance}/databases/{name}".format(**res) def collection(module): - res = { - 'project': module.params['project'], - 'instance': replace_resource_dict(module.params['instance'], 'name') - } + res = {'project': module.params['project'], 'instance': replace_resource_dict(module.params['instance'], 'name')} return "https://www.googleapis.com/sql/v1beta4/projects/{project}/instances/{instance}/databases".format(**res) @@ -278,11 +270,7 @@ def is_different(module, response): # Remove unnecessary properties from the response. # This is for doing comparisons with Ansible's current parameters. def response_to_hash(module, response): - return { - u'charset': response.get(u'charset'), - u'collation': response.get(u'collation'), - u'name': response.get(u'name') - } + return {u'charset': response.get(u'charset'), u'collation': response.get(u'collation'), u'name': response.get(u'name')} def async_op_url(module, extra_data=None): diff --git a/lib/ansible/modules/cloud/google/gcp_sql_database_facts.py b/lib/ansible/modules/cloud/google/gcp_sql_database_facts.py index cc4e6bb9377c91..b1b4305880b7fe 100644 --- a/lib/ansible/modules/cloud/google/gcp_sql_database_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_sql_database_facts.py @@ -18,15 +18,14 @@ # ---------------------------------------------------------------------------- from __future__ import absolute_import, division, print_function + __metaclass__ = type ################################################################################ # Documentation ################################################################################ -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ["preview"], - 'supported_by': 'community'} +ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ["preview"], 'supported_by': 'community'} DOCUMENTATION = ''' --- @@ -102,11 +101,7 @@ def main(): - module = GcpModule( - argument_spec=dict( - instance=dict(required=True) - ) - ) + module = GcpModule(argument_spec=dict(instance=dict(required=True))) if not module.params['scopes']: module.params['scopes'] = ['https://www.googleapis.com/auth/sqlservice.admin'] @@ -116,17 +111,12 @@ def main(): items = items.get('items') else: items = [] - return_value = { - 'items': items - } + return_value = {'items': items} module.exit_json(**return_value) def collection(module): - res = { - 'project': module.params['project'], - 'instance': replace_resource_dict(module.params['instance'], 'name') - } + res = {'project': module.params['project'], 'instance': replace_resource_dict(module.params['instance'], 'name')} return "https://www.googleapis.com/sql/v1beta4/projects/{project}/instances/{instance}/databases".format(**res) diff --git a/lib/ansible/modules/cloud/google/gcp_sql_instance.py b/lib/ansible/modules/cloud/google/gcp_sql_instance.py index df4a46ef75e993..239da1e43f762a 100644 --- a/lib/ansible/modules/cloud/google/gcp_sql_instance.py +++ b/lib/ansible/modules/cloud/google/gcp_sql_instance.py @@ -18,15 +18,14 @@ # ---------------------------------------------------------------------------- from __future__ import absolute_import, division, print_function + __metaclass__ = type ################################################################################ # Documentation ################################################################################ -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ["preview"], - 'supported_by': 'community'} +ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ["preview"], 'supported_by': 'community'} DOCUMENTATION = ''' --- @@ -571,46 +570,53 @@ def main(): backend_type=dict(type='str', choices=['FIRST_GEN', 'SECOND_GEN', 'EXTERNAL']), connection_name=dict(type='str'), database_version=dict(type='str', choices=['MYSQL_5_5', 'MYSQL_5_6', 'MYSQL_5_7', 'POSTGRES_9_6']), - failover_replica=dict(type='dict', options=dict( - available=dict(type='bool'), - name=dict(type='str') - )), + failover_replica=dict(type='dict', options=dict(available=dict(type='bool'), name=dict(type='str'))), instance_type=dict(type='str', choices=['CLOUD_SQL_INSTANCE', 'ON_PREMISES_INSTANCE', 'READ_REPLICA_INSTANCE']), ipv6_address=dict(type='str'), master_instance_name=dict(type='str'), max_disk_size=dict(type='int'), name=dict(required=True, type='str'), region=dict(type='str'), - replica_configuration=dict(type='dict', options=dict( - failover_target=dict(type='bool'), - mysql_replica_configuration=dict(type='dict', options=dict( - ca_certificate=dict(type='str'), - client_certificate=dict(type='str'), - client_key=dict(type='str'), - connect_retry_interval=dict(type='int'), - dump_file_path=dict(type='str'), - master_heartbeat_period=dict(type='int'), - password=dict(type='str'), - ssl_cipher=dict(type='str'), - username=dict(type='str'), - verify_server_certificate=dict(type='bool') - )), - replica_names=dict(type='list', elements='str'), - service_account_email_address=dict(type='str') - )), - settings=dict(type='dict', options=dict( - ip_configuration=dict(type='dict', options=dict( - ipv4_enabled=dict(type='bool'), - authorized_networks=dict(type='list', elements='dict', options=dict( - expiration_time=dict(type='str'), - name=dict(type='str'), - value=dict(type='str') - )), - require_ssl=dict(type='bool') - )), - tier=dict(type='str'), - settings_version=dict(type='int') - )) + replica_configuration=dict( + type='dict', + options=dict( + failover_target=dict(type='bool'), + mysql_replica_configuration=dict( + type='dict', + options=dict( + ca_certificate=dict(type='str'), + client_certificate=dict(type='str'), + client_key=dict(type='str'), + connect_retry_interval=dict(type='int'), + dump_file_path=dict(type='str'), + master_heartbeat_period=dict(type='int'), + password=dict(type='str'), + ssl_cipher=dict(type='str'), + username=dict(type='str'), + verify_server_certificate=dict(type='bool'), + ), + ), + replica_names=dict(type='list', elements='str'), + service_account_email_address=dict(type='str'), + ), + ), + settings=dict( + type='dict', + options=dict( + ip_configuration=dict( + type='dict', + options=dict( + ipv4_enabled=dict(type='bool'), + authorized_networks=dict( + type='list', elements='dict', options=dict(expiration_time=dict(type='str'), name=dict(type='str'), value=dict(type='str')) + ), + require_ssl=dict(type='bool'), + ), + ), + tier=dict(type='str'), + settings_version=dict(type='int'), + ), + ), ) ) @@ -674,7 +680,7 @@ def resource_to_request(module): u'name': module.params.get('name'), u'region': module.params.get('region'), u'replicaConfiguration': InstanceReplicaconfiguration(module.params.get('replica_configuration', {}), module).to_request(), - u'settings': InstanceSettings(module.params.get('settings', {}), module).to_request() + u'settings': InstanceSettings(module.params.get('settings', {}), module).to_request(), } return_vals = {} for k, v in request.items(): @@ -755,7 +761,7 @@ def response_to_hash(module, response): u'name': response.get(u'name'), u'region': response.get(u'region'), u'replicaConfiguration': InstanceReplicaconfiguration(response.get(u'replicaConfiguration', {}), module).from_response(), - u'settings': InstanceSettings(response.get(u'settings', {}), module).from_response() + u'settings': InstanceSettings(response.get(u'settings', {}), module).from_response(), } @@ -803,16 +809,10 @@ def __init__(self, request, module): self.request = {} def to_request(self): - return remove_nones_from_dict({ - u'available': self.request.get('available'), - u'name': self.request.get('name') - }) + return remove_nones_from_dict({u'available': self.request.get('available'), u'name': self.request.get('name')}) def from_response(self): - return remove_nones_from_dict({ - u'available': self.request.get(u'available'), - u'name': self.request.get(u'name') - }) + return remove_nones_from_dict({u'available': self.request.get(u'available'), u'name': self.request.get(u'name')}) class InstanceIpaddressesArray(object): @@ -836,18 +836,10 @@ def from_response(self): return items def _request_for_item(self, item): - return remove_nones_from_dict({ - u'ipAddress': item.get('ip_address'), - u'timeToRetire': item.get('time_to_retire'), - u'type': item.get('type') - }) + return remove_nones_from_dict({u'ipAddress': item.get('ip_address'), u'timeToRetire': item.get('time_to_retire'), u'type': item.get('type')}) def _response_from_item(self, item): - return remove_nones_from_dict({ - u'ipAddress': item.get(u'ipAddress'), - u'timeToRetire': item.get(u'timeToRetire'), - u'type': item.get(u'type') - }) + return remove_nones_from_dict({u'ipAddress': item.get(u'ipAddress'), u'timeToRetire': item.get(u'timeToRetire'), u'type': item.get(u'type')}) class InstanceReplicaconfiguration(object): @@ -859,20 +851,26 @@ def __init__(self, request, module): self.request = {} def to_request(self): - return remove_nones_from_dict({ - u'failoverTarget': self.request.get('failover_target'), - u'mysqlReplicaConfiguration': InstanceMysqlreplicaconfiguration(self.request.get('mysql_replica_configuration', {}), self.module).to_request(), - u'replicaNames': self.request.get('replica_names'), - u'serviceAccountEmailAddress': self.request.get('service_account_email_address') - }) + return remove_nones_from_dict( + { + u'failoverTarget': self.request.get('failover_target'), + u'mysqlReplicaConfiguration': InstanceMysqlreplicaconfiguration(self.request.get('mysql_replica_configuration', {}), self.module).to_request(), + u'replicaNames': self.request.get('replica_names'), + u'serviceAccountEmailAddress': self.request.get('service_account_email_address'), + } + ) def from_response(self): - return remove_nones_from_dict({ - u'failoverTarget': self.request.get(u'failoverTarget'), - u'mysqlReplicaConfiguration': InstanceMysqlreplicaconfiguration(self.request.get(u'mysqlReplicaConfiguration', {}), self.module).from_response(), - u'replicaNames': self.request.get(u'replicaNames'), - u'serviceAccountEmailAddress': self.request.get(u'serviceAccountEmailAddress') - }) + return remove_nones_from_dict( + { + u'failoverTarget': self.request.get(u'failoverTarget'), + u'mysqlReplicaConfiguration': InstanceMysqlreplicaconfiguration( + self.request.get(u'mysqlReplicaConfiguration', {}), self.module + ).from_response(), + u'replicaNames': self.request.get(u'replicaNames'), + u'serviceAccountEmailAddress': self.request.get(u'serviceAccountEmailAddress'), + } + ) class InstanceMysqlreplicaconfiguration(object): @@ -884,32 +882,36 @@ def __init__(self, request, module): self.request = {} def to_request(self): - return remove_nones_from_dict({ - u'caCertificate': self.request.get('ca_certificate'), - u'clientCertificate': self.request.get('client_certificate'), - u'clientKey': self.request.get('client_key'), - u'connectRetryInterval': self.request.get('connect_retry_interval'), - u'dumpFilePath': self.request.get('dump_file_path'), - u'masterHeartbeatPeriod': self.request.get('master_heartbeat_period'), - u'password': self.request.get('password'), - u'sslCipher': self.request.get('ssl_cipher'), - u'username': self.request.get('username'), - u'verifyServerCertificate': self.request.get('verify_server_certificate') - }) + return remove_nones_from_dict( + { + u'caCertificate': self.request.get('ca_certificate'), + u'clientCertificate': self.request.get('client_certificate'), + u'clientKey': self.request.get('client_key'), + u'connectRetryInterval': self.request.get('connect_retry_interval'), + u'dumpFilePath': self.request.get('dump_file_path'), + u'masterHeartbeatPeriod': self.request.get('master_heartbeat_period'), + u'password': self.request.get('password'), + u'sslCipher': self.request.get('ssl_cipher'), + u'username': self.request.get('username'), + u'verifyServerCertificate': self.request.get('verify_server_certificate'), + } + ) def from_response(self): - return remove_nones_from_dict({ - u'caCertificate': self.request.get(u'caCertificate'), - u'clientCertificate': self.request.get(u'clientCertificate'), - u'clientKey': self.request.get(u'clientKey'), - u'connectRetryInterval': self.request.get(u'connectRetryInterval'), - u'dumpFilePath': self.request.get(u'dumpFilePath'), - u'masterHeartbeatPeriod': self.request.get(u'masterHeartbeatPeriod'), - u'password': self.request.get(u'password'), - u'sslCipher': self.request.get(u'sslCipher'), - u'username': self.request.get(u'username'), - u'verifyServerCertificate': self.request.get(u'verifyServerCertificate') - }) + return remove_nones_from_dict( + { + u'caCertificate': self.request.get(u'caCertificate'), + u'clientCertificate': self.request.get(u'clientCertificate'), + u'clientKey': self.request.get(u'clientKey'), + u'connectRetryInterval': self.request.get(u'connectRetryInterval'), + u'dumpFilePath': self.request.get(u'dumpFilePath'), + u'masterHeartbeatPeriod': self.request.get(u'masterHeartbeatPeriod'), + u'password': self.request.get(u'password'), + u'sslCipher': self.request.get(u'sslCipher'), + u'username': self.request.get(u'username'), + u'verifyServerCertificate': self.request.get(u'verifyServerCertificate'), + } + ) class InstanceSettings(object): @@ -921,18 +923,22 @@ def __init__(self, request, module): self.request = {} def to_request(self): - return remove_nones_from_dict({ - u'ipConfiguration': InstanceIpconfiguration(self.request.get('ip_configuration', {}), self.module).to_request(), - u'tier': self.request.get('tier'), - u'settingsVersion': self.request.get('settings_version') - }) + return remove_nones_from_dict( + { + u'ipConfiguration': InstanceIpconfiguration(self.request.get('ip_configuration', {}), self.module).to_request(), + u'tier': self.request.get('tier'), + u'settingsVersion': self.request.get('settings_version'), + } + ) def from_response(self): - return remove_nones_from_dict({ - u'ipConfiguration': InstanceIpconfiguration(self.request.get(u'ipConfiguration', {}), self.module).from_response(), - u'tier': self.request.get(u'tier'), - u'settingsVersion': self.request.get(u'settingsVersion') - }) + return remove_nones_from_dict( + { + u'ipConfiguration': InstanceIpconfiguration(self.request.get(u'ipConfiguration', {}), self.module).from_response(), + u'tier': self.request.get(u'tier'), + u'settingsVersion': self.request.get(u'settingsVersion'), + } + ) class InstanceIpconfiguration(object): @@ -944,18 +950,22 @@ def __init__(self, request, module): self.request = {} def to_request(self): - return remove_nones_from_dict({ - u'ipv4Enabled': self.request.get('ipv4_enabled'), - u'authorizedNetworks': InstanceAuthorizednetworksArray(self.request.get('authorized_networks', []), self.module).to_request(), - u'requireSsl': self.request.get('require_ssl') - }) + return remove_nones_from_dict( + { + u'ipv4Enabled': self.request.get('ipv4_enabled'), + u'authorizedNetworks': InstanceAuthorizednetworksArray(self.request.get('authorized_networks', []), self.module).to_request(), + u'requireSsl': self.request.get('require_ssl'), + } + ) def from_response(self): - return remove_nones_from_dict({ - u'ipv4Enabled': self.request.get(u'ipv4Enabled'), - u'authorizedNetworks': InstanceAuthorizednetworksArray(self.request.get(u'authorizedNetworks', []), self.module).from_response(), - u'requireSsl': self.request.get(u'requireSsl') - }) + return remove_nones_from_dict( + { + u'ipv4Enabled': self.request.get(u'ipv4Enabled'), + u'authorizedNetworks': InstanceAuthorizednetworksArray(self.request.get(u'authorizedNetworks', []), self.module).from_response(), + u'requireSsl': self.request.get(u'requireSsl'), + } + ) class InstanceAuthorizednetworksArray(object): @@ -979,18 +989,10 @@ def from_response(self): return items def _request_for_item(self, item): - return remove_nones_from_dict({ - u'expirationTime': item.get('expiration_time'), - u'name': item.get('name'), - u'value': item.get('value') - }) + return remove_nones_from_dict({u'expirationTime': item.get('expiration_time'), u'name': item.get('name'), u'value': item.get('value')}) def _response_from_item(self, item): - return remove_nones_from_dict({ - u'expirationTime': item.get(u'expirationTime'), - u'name': item.get(u'name'), - u'value': item.get(u'value') - }) + return remove_nones_from_dict({u'expirationTime': item.get(u'expirationTime'), u'name': item.get(u'name'), u'value': item.get(u'value')}) if __name__ == '__main__': diff --git a/lib/ansible/modules/cloud/google/gcp_sql_instance_facts.py b/lib/ansible/modules/cloud/google/gcp_sql_instance_facts.py index 55842f9f72c660..f5bf3c6fe15a1a 100644 --- a/lib/ansible/modules/cloud/google/gcp_sql_instance_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_sql_instance_facts.py @@ -18,15 +18,14 @@ # ---------------------------------------------------------------------------- from __future__ import absolute_import, division, print_function + __metaclass__ = type ################################################################################ # Documentation ################################################################################ -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ["preview"], - 'supported_by': 'community'} +ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ["preview"], 'supported_by': 'community'} DOCUMENTATION = ''' --- @@ -335,10 +334,7 @@ def main(): - module = GcpModule( - argument_spec=dict( - ) - ) + module = GcpModule(argument_spec=dict()) if not module.params['scopes']: module.params['scopes'] = ['https://www.googleapis.com/auth/sqlservice.admin'] @@ -348,9 +344,7 @@ def main(): items = items.get('items') else: items = [] - return_value = { - 'items': items - } + return_value = {'items': items} module.exit_json(**return_value) diff --git a/lib/ansible/modules/cloud/google/gcp_sql_user.py b/lib/ansible/modules/cloud/google/gcp_sql_user.py index 54f7a4ff4b3d7a..ebcb60e05d4adb 100644 --- a/lib/ansible/modules/cloud/google/gcp_sql_user.py +++ b/lib/ansible/modules/cloud/google/gcp_sql_user.py @@ -18,15 +18,14 @@ # ---------------------------------------------------------------------------- from __future__ import absolute_import, division, print_function + __metaclass__ = type ################################################################################ # Documentation ################################################################################ -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ["preview"], - 'supported_by': 'community'} +ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ["preview"], 'supported_by': 'community'} DOCUMENTATION = ''' --- @@ -149,7 +148,7 @@ def main(): host=dict(required=True, type='str'), name=dict(required=True, type='str'), instance=dict(required=True), - password=dict(type='str') + password=dict(type='str'), ) ) @@ -159,9 +158,7 @@ def main(): state = module.params['state'] kind = 'sql#user' - fetch = fetch_wrapped_resource(module, 'sql#user', - 'sql#usersList', - 'items') + fetch = fetch_wrapped_resource(module, 'sql#user', 'sql#usersList', 'items') changed = False if fetch: @@ -202,12 +199,7 @@ def delete(module, link, kind): def resource_to_request(module): - request = { - u'kind': 'sql#user', - u'password': module.params.get('password'), - u'host': module.params.get('host'), - u'name': module.params.get('name') - } + request = {u'kind': 'sql#user', u'password': module.params.get('password'), u'host': module.params.get('host'), u'name': module.params.get('name')} return_vals = {} for k, v in request.items(): if v or v is False: @@ -217,10 +209,7 @@ def resource_to_request(module): def unwrap_resource_filter(module): - return { - 'host': module.params['host'], - 'name': module.params['name'] - } + return {'host': module.params['host'], 'name': module.params['name']} def unwrap_resource(result, module): @@ -264,16 +253,13 @@ def self_link(module): 'project': module.params['project'], 'instance': replace_resource_dict(module.params['instance'], 'name'), 'name': module.params['name'], - 'host': module.params['host'] + 'host': module.params['host'], } return "https://www.googleapis.com/sql/v1beta4/projects/{project}/instances/{instance}/users?name={name}&host={host}".format(**res) def collection(module): - res = { - 'project': module.params['project'], - 'instance': replace_resource_dict(module.params['instance'], 'name') - } + res = {'project': module.params['project'], 'instance': replace_resource_dict(module.params['instance'], 'name')} return "https://www.googleapis.com/sql/v1beta4/projects/{project}/instances/{instance}/users".format(**res) @@ -322,10 +308,7 @@ def is_different(module, response): # Remove unnecessary properties from the response. # This is for doing comparisons with Ansible's current parameters. def response_to_hash(module, response): - return { - u'host': response.get(u'host'), - u'name': response.get(u'name') - } + return {u'host': response.get(u'host'), u'name': response.get(u'name')} def async_op_url(module, extra_data=None): diff --git a/lib/ansible/modules/cloud/google/gcp_sql_user_facts.py b/lib/ansible/modules/cloud/google/gcp_sql_user_facts.py index 462efcb22c396c..22692b6898bb84 100644 --- a/lib/ansible/modules/cloud/google/gcp_sql_user_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_sql_user_facts.py @@ -18,15 +18,14 @@ # ---------------------------------------------------------------------------- from __future__ import absolute_import, division, print_function + __metaclass__ = type ################################################################################ # Documentation ################################################################################ -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ["preview"], - 'supported_by': 'community'} +ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ["preview"], 'supported_by': 'community'} DOCUMENTATION = ''' --- @@ -103,11 +102,7 @@ def main(): - module = GcpModule( - argument_spec=dict( - instance=dict(required=True) - ) - ) + module = GcpModule(argument_spec=dict(instance=dict(required=True))) if not module.params['scopes']: module.params['scopes'] = ['https://www.googleapis.com/auth/sqlservice.admin'] @@ -117,17 +112,12 @@ def main(): items = items.get('items') else: items = [] - return_value = { - 'items': items - } + return_value = {'items': items} module.exit_json(**return_value) def collection(module): - res = { - 'project': module.params['project'], - 'instance': replace_resource_dict(module.params['instance'], 'name') - } + res = {'project': module.params['project'], 'instance': replace_resource_dict(module.params['instance'], 'name')} return "https://www.googleapis.com/sql/v1beta4/projects/{project}/instances/{instance}/users".format(**res) diff --git a/lib/ansible/modules/cloud/google/gcp_storage_bucket.py b/lib/ansible/modules/cloud/google/gcp_storage_bucket.py index 6c432a9bd75059..da40969fae873b 100644 --- a/lib/ansible/modules/cloud/google/gcp_storage_bucket.py +++ b/lib/ansible/modules/cloud/google/gcp_storage_bucket.py @@ -18,15 +18,14 @@ # ---------------------------------------------------------------------------- from __future__ import absolute_import, division, print_function + __metaclass__ = type ################################################################################ # Documentation ################################################################################ -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ["preview"], - 'supported_by': 'community'} +ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ["preview"], 'supported_by': 'community'} DOCUMENTATION = ''' --- @@ -790,81 +789,86 @@ def main(): module = GcpModule( argument_spec=dict( state=dict(default='present', choices=['present', 'absent'], type='str'), - acl=dict(type='list', elements='dict', options=dict( - bucket=dict(required=True), - domain=dict(type='str'), - email=dict(type='str'), - entity=dict(required=True, type='str'), - entity_id=dict(type='str'), - id=dict(type='str'), - project_team=dict(type='dict', options=dict( - project_number=dict(type='str'), - team=dict(type='str', choices=['editors', 'owners', 'viewers']) - )), - role=dict(type='str', choices=['OWNER', 'READER', 'WRITER']) - )), - cors=dict(type='list', elements='dict', options=dict( - max_age_seconds=dict(type='int'), - method=dict(type='list', elements='str'), - origin=dict(type='list', elements='str'), - response_header=dict(type='list', elements='str') - )), - default_object_acl=dict(type='list', elements='dict', options=dict( - bucket=dict(required=True), - domain=dict(type='str'), - email=dict(type='str'), - entity=dict(required=True, type='str'), - entity_id=dict(type='str'), - generation=dict(type='int'), - id=dict(type='str'), - object=dict(type='str'), - project_team=dict(type='dict', options=dict( - project_number=dict(type='str'), - team=dict(type='str', choices=['editors', 'owners', 'viewers']) - )), - role=dict(required=True, type='str', choices=['OWNER', 'READER']) - )), - lifecycle=dict(type='dict', options=dict( - rule=dict(type='list', elements='dict', options=dict( - action=dict(type='dict', options=dict( - storage_class=dict(type='str'), - type=dict(type='str', choices=['Delete', 'SetStorageClass']) - )), - condition=dict(type='dict', options=dict( - age_days=dict(type='int'), - created_before=dict(type='str'), - is_live=dict(type='bool'), - matches_storage_class=dict(type='list', elements='str'), - num_newer_versions=dict(type='int') - )) - )) - )), + acl=dict( + type='list', + elements='dict', + options=dict( + bucket=dict(required=True), + domain=dict(type='str'), + email=dict(type='str'), + entity=dict(required=True, type='str'), + entity_id=dict(type='str'), + id=dict(type='str'), + project_team=dict( + type='dict', options=dict(project_number=dict(type='str'), team=dict(type='str', choices=['editors', 'owners', 'viewers'])) + ), + role=dict(type='str', choices=['OWNER', 'READER', 'WRITER']), + ), + ), + cors=dict( + type='list', + elements='dict', + options=dict( + max_age_seconds=dict(type='int'), + method=dict(type='list', elements='str'), + origin=dict(type='list', elements='str'), + response_header=dict(type='list', elements='str'), + ), + ), + default_object_acl=dict( + type='list', + elements='dict', + options=dict( + bucket=dict(required=True), + domain=dict(type='str'), + email=dict(type='str'), + entity=dict(required=True, type='str'), + entity_id=dict(type='str'), + generation=dict(type='int'), + id=dict(type='str'), + object=dict(type='str'), + project_team=dict( + type='dict', options=dict(project_number=dict(type='str'), team=dict(type='str', choices=['editors', 'owners', 'viewers'])) + ), + role=dict(required=True, type='str', choices=['OWNER', 'READER']), + ), + ), + lifecycle=dict( + type='dict', + options=dict( + rule=dict( + type='list', + elements='dict', + options=dict( + action=dict( + type='dict', options=dict(storage_class=dict(type='str'), type=dict(type='str', choices=['Delete', 'SetStorageClass'])) + ), + condition=dict( + type='dict', + options=dict( + age_days=dict(type='int'), + created_before=dict(type='str'), + is_live=dict(type='bool'), + matches_storage_class=dict(type='list', elements='str'), + num_newer_versions=dict(type='int'), + ), + ), + ), + ) + ), + ), location=dict(type='str'), - logging=dict(type='dict', options=dict( - log_bucket=dict(type='str'), - log_object_prefix=dict(type='str') - )), + logging=dict(type='dict', options=dict(log_bucket=dict(type='str'), log_object_prefix=dict(type='str'))), metageneration=dict(type='int'), name=dict(type='str'), - owner=dict(type='dict', options=dict( - entity=dict(type='str'), - entity_id=dict(type='str') - )), + owner=dict(type='dict', options=dict(entity=dict(type='str'), entity_id=dict(type='str'))), storage_class=dict(type='str', choices=['MULTI_REGIONAL', 'REGIONAL', 'STANDARD', 'NEARLINE', 'COLDLINE', 'DURABLE_REDUCED_AVAILABILITY']), - versioning=dict(type='dict', options=dict( - enabled=dict(type='bool') - )), - website=dict(type='dict', options=dict( - main_page_suffix=dict(type='str'), - not_found_page=dict(type='str') - )), + versioning=dict(type='dict', options=dict(enabled=dict(type='bool'))), + website=dict(type='dict', options=dict(main_page_suffix=dict(type='str'), not_found_page=dict(type='str'))), project=dict(type='str'), - predefined_default_object_acl=dict(type='str', choices=['authenticatedRead', - 'bucketOwnerFullControl', - 'bucketOwnerRead', - 'private', - 'projectPrivate', - 'publicRead']) + predefined_default_object_acl=dict( + type='str', choices=['authenticatedRead', 'bucketOwnerFullControl', 'bucketOwnerRead', 'private', 'projectPrivate', 'publicRead'] + ), ) ) @@ -930,7 +934,7 @@ def resource_to_request(module): u'owner': BucketOwner(module.params.get('owner', {}), module).to_request(), u'storageClass': module.params.get('storage_class'), u'versioning': BucketVersioning(module.params.get('versioning', {}), module).to_request(), - u'website': BucketWebsite(module.params.get('website', {}), module).to_request() + u'website': BucketWebsite(module.params.get('website', {}), module).to_request(), } return_vals = {} for k, v in request.items(): @@ -1011,7 +1015,7 @@ def response_to_hash(module, response): u'timeCreated': response.get(u'timeCreated'), u'updated': response.get(u'updated'), u'versioning': BucketVersioning(response.get(u'versioning', {}), module).from_response(), - u'website': BucketWebsite(response.get(u'website', {}), module).from_response() + u'website': BucketWebsite(response.get(u'website', {}), module).from_response(), } @@ -1036,28 +1040,32 @@ def from_response(self): return items def _request_for_item(self, item): - return remove_nones_from_dict({ - u'bucket': replace_resource_dict(item.get(u'bucket', {}), 'name'), - u'domain': item.get('domain'), - u'email': item.get('email'), - u'entity': item.get('entity'), - u'entityId': item.get('entity_id'), - u'id': item.get('id'), - u'projectTeam': BucketProjectteam(item.get('project_team', {}), self.module).to_request(), - u'role': item.get('role') - }) + return remove_nones_from_dict( + { + u'bucket': replace_resource_dict(item.get(u'bucket', {}), 'name'), + u'domain': item.get('domain'), + u'email': item.get('email'), + u'entity': item.get('entity'), + u'entityId': item.get('entity_id'), + u'id': item.get('id'), + u'projectTeam': BucketProjectteam(item.get('project_team', {}), self.module).to_request(), + u'role': item.get('role'), + } + ) def _response_from_item(self, item): - return remove_nones_from_dict({ - u'bucket': item.get(u'bucket'), - u'domain': item.get(u'domain'), - u'email': item.get(u'email'), - u'entity': item.get(u'entity'), - u'entityId': item.get(u'entityId'), - u'id': item.get(u'id'), - u'projectTeam': BucketProjectteam(item.get(u'projectTeam', {}), self.module).from_response(), - u'role': item.get(u'role') - }) + return remove_nones_from_dict( + { + u'bucket': item.get(u'bucket'), + u'domain': item.get(u'domain'), + u'email': item.get(u'email'), + u'entity': item.get(u'entity'), + u'entityId': item.get(u'entityId'), + u'id': item.get(u'id'), + u'projectTeam': BucketProjectteam(item.get(u'projectTeam', {}), self.module).from_response(), + u'role': item.get(u'role'), + } + ) class BucketProjectteam(object): @@ -1069,16 +1077,10 @@ def __init__(self, request, module): self.request = {} def to_request(self): - return remove_nones_from_dict({ - u'projectNumber': self.request.get('project_number'), - u'team': self.request.get('team') - }) + return remove_nones_from_dict({u'projectNumber': self.request.get('project_number'), u'team': self.request.get('team')}) def from_response(self): - return remove_nones_from_dict({ - u'projectNumber': self.request.get(u'projectNumber'), - u'team': self.request.get(u'team') - }) + return remove_nones_from_dict({u'projectNumber': self.request.get(u'projectNumber'), u'team': self.request.get(u'team')}) class BucketCorsArray(object): @@ -1102,20 +1104,24 @@ def from_response(self): return items def _request_for_item(self, item): - return remove_nones_from_dict({ - u'maxAgeSeconds': item.get('max_age_seconds'), - u'method': item.get('method'), - u'origin': item.get('origin'), - u'responseHeader': item.get('response_header') - }) + return remove_nones_from_dict( + { + u'maxAgeSeconds': item.get('max_age_seconds'), + u'method': item.get('method'), + u'origin': item.get('origin'), + u'responseHeader': item.get('response_header'), + } + ) def _response_from_item(self, item): - return remove_nones_from_dict({ - u'maxAgeSeconds': item.get(u'maxAgeSeconds'), - u'method': item.get(u'method'), - u'origin': item.get(u'origin'), - u'responseHeader': item.get(u'responseHeader') - }) + return remove_nones_from_dict( + { + u'maxAgeSeconds': item.get(u'maxAgeSeconds'), + u'method': item.get(u'method'), + u'origin': item.get(u'origin'), + u'responseHeader': item.get(u'responseHeader'), + } + ) class BucketDefaultobjectaclArray(object): @@ -1139,32 +1145,36 @@ def from_response(self): return items def _request_for_item(self, item): - return remove_nones_from_dict({ - u'bucket': replace_resource_dict(item.get(u'bucket', {}), 'name'), - u'domain': item.get('domain'), - u'email': item.get('email'), - u'entity': item.get('entity'), - u'entityId': item.get('entity_id'), - u'generation': item.get('generation'), - u'id': item.get('id'), - u'object': item.get('object'), - u'projectTeam': BucketProjectteam(item.get('project_team', {}), self.module).to_request(), - u'role': item.get('role') - }) + return remove_nones_from_dict( + { + u'bucket': replace_resource_dict(item.get(u'bucket', {}), 'name'), + u'domain': item.get('domain'), + u'email': item.get('email'), + u'entity': item.get('entity'), + u'entityId': item.get('entity_id'), + u'generation': item.get('generation'), + u'id': item.get('id'), + u'object': item.get('object'), + u'projectTeam': BucketProjectteam(item.get('project_team', {}), self.module).to_request(), + u'role': item.get('role'), + } + ) def _response_from_item(self, item): - return remove_nones_from_dict({ - u'bucket': item.get(u'bucket'), - u'domain': item.get(u'domain'), - u'email': item.get(u'email'), - u'entity': item.get(u'entity'), - u'entityId': item.get(u'entityId'), - u'generation': item.get(u'generation'), - u'id': item.get(u'id'), - u'object': item.get(u'object'), - u'projectTeam': BucketProjectteam(item.get(u'projectTeam', {}), self.module).from_response(), - u'role': item.get(u'role') - }) + return remove_nones_from_dict( + { + u'bucket': item.get(u'bucket'), + u'domain': item.get(u'domain'), + u'email': item.get(u'email'), + u'entity': item.get(u'entity'), + u'entityId': item.get(u'entityId'), + u'generation': item.get(u'generation'), + u'id': item.get(u'id'), + u'object': item.get(u'object'), + u'projectTeam': BucketProjectteam(item.get(u'projectTeam', {}), self.module).from_response(), + u'role': item.get(u'role'), + } + ) class BucketProjectteam(object): @@ -1176,16 +1186,10 @@ def __init__(self, request, module): self.request = {} def to_request(self): - return remove_nones_from_dict({ - u'projectNumber': self.request.get('project_number'), - u'team': self.request.get('team') - }) + return remove_nones_from_dict({u'projectNumber': self.request.get('project_number'), u'team': self.request.get('team')}) def from_response(self): - return remove_nones_from_dict({ - u'projectNumber': self.request.get(u'projectNumber'), - u'team': self.request.get(u'team') - }) + return remove_nones_from_dict({u'projectNumber': self.request.get(u'projectNumber'), u'team': self.request.get(u'team')}) class BucketLifecycle(object): @@ -1197,14 +1201,10 @@ def __init__(self, request, module): self.request = {} def to_request(self): - return remove_nones_from_dict({ - u'rule': BucketRuleArray(self.request.get('rule', []), self.module).to_request() - }) + return remove_nones_from_dict({u'rule': BucketRuleArray(self.request.get('rule', []), self.module).to_request()}) def from_response(self): - return remove_nones_from_dict({ - u'rule': BucketRuleArray(self.request.get(u'rule', []), self.module).from_response() - }) + return remove_nones_from_dict({u'rule': BucketRuleArray(self.request.get(u'rule', []), self.module).from_response()}) class BucketRuleArray(object): @@ -1228,16 +1228,20 @@ def from_response(self): return items def _request_for_item(self, item): - return remove_nones_from_dict({ - u'action': BucketAction(item.get('action', {}), self.module).to_request(), - u'condition': BucketCondition(item.get('condition', {}), self.module).to_request() - }) + return remove_nones_from_dict( + { + u'action': BucketAction(item.get('action', {}), self.module).to_request(), + u'condition': BucketCondition(item.get('condition', {}), self.module).to_request(), + } + ) def _response_from_item(self, item): - return remove_nones_from_dict({ - u'action': BucketAction(item.get(u'action', {}), self.module).from_response(), - u'condition': BucketCondition(item.get(u'condition', {}), self.module).from_response() - }) + return remove_nones_from_dict( + { + u'action': BucketAction(item.get(u'action', {}), self.module).from_response(), + u'condition': BucketCondition(item.get(u'condition', {}), self.module).from_response(), + } + ) class BucketAction(object): @@ -1249,16 +1253,10 @@ def __init__(self, request, module): self.request = {} def to_request(self): - return remove_nones_from_dict({ - u'storageClass': self.request.get('storage_class'), - u'type': self.request.get('type') - }) + return remove_nones_from_dict({u'storageClass': self.request.get('storage_class'), u'type': self.request.get('type')}) def from_response(self): - return remove_nones_from_dict({ - u'storageClass': self.request.get(u'storageClass'), - u'type': self.request.get(u'type') - }) + return remove_nones_from_dict({u'storageClass': self.request.get(u'storageClass'), u'type': self.request.get(u'type')}) class BucketCondition(object): @@ -1270,22 +1268,26 @@ def __init__(self, request, module): self.request = {} def to_request(self): - return remove_nones_from_dict({ - u'age': self.request.get('age_days'), - u'createdBefore': self.request.get('created_before'), - u'isLive': self.request.get('is_live'), - u'matchesStorageClass': self.request.get('matches_storage_class'), - u'numNewerVersions': self.request.get('num_newer_versions') - }) + return remove_nones_from_dict( + { + u'age': self.request.get('age_days'), + u'createdBefore': self.request.get('created_before'), + u'isLive': self.request.get('is_live'), + u'matchesStorageClass': self.request.get('matches_storage_class'), + u'numNewerVersions': self.request.get('num_newer_versions'), + } + ) def from_response(self): - return remove_nones_from_dict({ - u'age': self.request.get(u'ageDays'), - u'createdBefore': self.request.get(u'createdBefore'), - u'isLive': self.request.get(u'isLive'), - u'matchesStorageClass': self.request.get(u'matchesStorageClass'), - u'numNewerVersions': self.request.get(u'numNewerVersions') - }) + return remove_nones_from_dict( + { + u'age': self.request.get(u'ageDays'), + u'createdBefore': self.request.get(u'createdBefore'), + u'isLive': self.request.get(u'isLive'), + u'matchesStorageClass': self.request.get(u'matchesStorageClass'), + u'numNewerVersions': self.request.get(u'numNewerVersions'), + } + ) class BucketLogging(object): @@ -1297,16 +1299,10 @@ def __init__(self, request, module): self.request = {} def to_request(self): - return remove_nones_from_dict({ - u'logBucket': self.request.get('log_bucket'), - u'logObjectPrefix': self.request.get('log_object_prefix') - }) + return remove_nones_from_dict({u'logBucket': self.request.get('log_bucket'), u'logObjectPrefix': self.request.get('log_object_prefix')}) def from_response(self): - return remove_nones_from_dict({ - u'logBucket': self.request.get(u'logBucket'), - u'logObjectPrefix': self.request.get(u'logObjectPrefix') - }) + return remove_nones_from_dict({u'logBucket': self.request.get(u'logBucket'), u'logObjectPrefix': self.request.get(u'logObjectPrefix')}) class BucketOwner(object): @@ -1318,16 +1314,10 @@ def __init__(self, request, module): self.request = {} def to_request(self): - return remove_nones_from_dict({ - u'entity': self.request.get('entity'), - u'entityId': self.request.get('entity_id') - }) + return remove_nones_from_dict({u'entity': self.request.get('entity'), u'entityId': self.request.get('entity_id')}) def from_response(self): - return remove_nones_from_dict({ - u'entity': self.request.get(u'entity'), - u'entityId': self.request.get(u'entityId') - }) + return remove_nones_from_dict({u'entity': self.request.get(u'entity'), u'entityId': self.request.get(u'entityId')}) class BucketVersioning(object): @@ -1339,14 +1329,10 @@ def __init__(self, request, module): self.request = {} def to_request(self): - return remove_nones_from_dict({ - u'enabled': self.request.get('enabled') - }) + return remove_nones_from_dict({u'enabled': self.request.get('enabled')}) def from_response(self): - return remove_nones_from_dict({ - u'enabled': self.request.get(u'enabled') - }) + return remove_nones_from_dict({u'enabled': self.request.get(u'enabled')}) class BucketWebsite(object): @@ -1358,16 +1344,10 @@ def __init__(self, request, module): self.request = {} def to_request(self): - return remove_nones_from_dict({ - u'mainPageSuffix': self.request.get('main_page_suffix'), - u'notFoundPage': self.request.get('not_found_page') - }) + return remove_nones_from_dict({u'mainPageSuffix': self.request.get('main_page_suffix'), u'notFoundPage': self.request.get('not_found_page')}) def from_response(self): - return remove_nones_from_dict({ - u'mainPageSuffix': self.request.get(u'mainPageSuffix'), - u'notFoundPage': self.request.get(u'notFoundPage') - }) + return remove_nones_from_dict({u'mainPageSuffix': self.request.get(u'mainPageSuffix'), u'notFoundPage': self.request.get(u'notFoundPage')}) if __name__ == '__main__': diff --git a/lib/ansible/modules/cloud/google/gcp_storage_bucket_access_control.py b/lib/ansible/modules/cloud/google/gcp_storage_bucket_access_control.py index 6a7defa7a10600..e79e1850fa3de0 100644 --- a/lib/ansible/modules/cloud/google/gcp_storage_bucket_access_control.py +++ b/lib/ansible/modules/cloud/google/gcp_storage_bucket_access_control.py @@ -18,15 +18,14 @@ # ---------------------------------------------------------------------------- from __future__ import absolute_import, division, print_function + __metaclass__ = type ################################################################################ # Documentation ################################################################################ -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ["preview"], - 'supported_by': 'community'} +ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ["preview"], 'supported_by': 'community'} DOCUMENTATION = ''' --- @@ -207,11 +206,8 @@ def main(): bucket=dict(required=True), entity=dict(required=True, type='str'), entity_id=dict(type='str'), - project_team=dict(type='dict', options=dict( - project_number=dict(type='str'), - team=dict(type='str', choices=['editors', 'owners', 'viewers']) - )), - role=dict(type='str', choices=['OWNER', 'READER', 'WRITER']) + project_team=dict(type='dict', options=dict(project_number=dict(type='str'), team=dict(type='str', choices=['editors', 'owners', 'viewers']))), + role=dict(type='str', choices=['OWNER', 'READER', 'WRITER']), ) ) @@ -268,7 +264,7 @@ def resource_to_request(module): u'entity': module.params.get('entity'), u'entityId': module.params.get('entity_id'), u'projectTeam': BucketAccessControlProjectteam(module.params.get('project_team', {}), module).to_request(), - u'role': module.params.get('role') + u'role': module.params.get('role'), } return_vals = {} for k, v in request.items(): @@ -341,7 +337,7 @@ def response_to_hash(module, response): u'entityId': response.get(u'entityId'), u'id': response.get(u'id'), u'projectTeam': BucketAccessControlProjectteam(response.get(u'projectTeam', {}), module).from_response(), - u'role': response.get(u'role') + u'role': response.get(u'role'), } @@ -354,16 +350,10 @@ def __init__(self, request, module): self.request = {} def to_request(self): - return remove_nones_from_dict({ - u'projectNumber': self.request.get('project_number'), - u'team': self.request.get('team') - }) + return remove_nones_from_dict({u'projectNumber': self.request.get('project_number'), u'team': self.request.get('team')}) def from_response(self): - return remove_nones_from_dict({ - u'projectNumber': self.request.get(u'projectNumber'), - u'team': self.request.get(u'team') - }) + return remove_nones_from_dict({u'projectNumber': self.request.get(u'projectNumber'), u'team': self.request.get(u'team')}) if __name__ == '__main__': diff --git a/lib/ansible/modules/cloud/google/gcp_storage_object.py b/lib/ansible/modules/cloud/google/gcp_storage_object.py index ee110a81bc1725..f589a36b8d05b9 100644 --- a/lib/ansible/modules/cloud/google/gcp_storage_object.py +++ b/lib/ansible/modules/cloud/google/gcp_storage_object.py @@ -18,15 +18,14 @@ # ---------------------------------------------------------------------------- from __future__ import absolute_import, division, print_function + __metaclass__ = type ################################################################################ # Documentation ################################################################################ -ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ["preview"], - 'supported_by': 'community'} +ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ["preview"], 'supported_by': 'community'} DOCUMENTATION = ''' --- @@ -145,7 +144,7 @@ def main(): overwrite=dict(type='bool'), src=dict(type='path'), dest=dict(type='path'), - bucket=dict(type='str') + bucket=dict(type='str'), ) ) @@ -277,7 +276,7 @@ def object_headers(module): return { "name": module.params['dest'], "Content-Type": mimetypes.guess_type(module.params['src'])[0], - "Content-Length": str(os.path.getsize(module.params['src'])) + "Content-Length": str(os.path.getsize(module.params['src'])), } From 7a4d90de3c5bf188cceee409893b2afadda7c3fb Mon Sep 17 00:00:00 2001 From: The Magician Date: Tue, 15 Jan 2019 15:18:05 -0800 Subject: [PATCH 087/144] Using Native Ruby Types on AnsibleModule (#164) Signed-off-by: Modular Magician --- lib/ansible/modules/cloud/google/gcp_compute_firewall.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_firewall.py b/lib/ansible/modules/cloud/google/gcp_compute_firewall.py index 18212ce0e57edb..7cca733580ef7d 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_firewall.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_firewall.py @@ -433,7 +433,7 @@ def main(): direction=dict(type='str', choices=['INGRESS', 'EGRESS']), disabled=dict(type='bool'), name=dict(required=True, type='str'), - network=dict(default={'selfLink': 'global/networks/default'}), + network=dict(default=dict(selfLink='global/networks/default')), priority=dict(default=1000, type='int'), source_ranges=dict(type='list', elements='str'), source_service_accounts=dict(type='list', elements='str'), From f745716a5223080714d84c8a4164a0f4c980fc25 Mon Sep 17 00:00:00 2001 From: The Magician Date: Tue, 15 Jan 2019 16:57:06 -0800 Subject: [PATCH 088/144] spelling correction (#167) Signed-off-by: Modular Magician --- lib/ansible/module_utils/gcp_utils.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/ansible/module_utils/gcp_utils.py b/lib/ansible/module_utils/gcp_utils.py index 9649468b4abb84..46bb2b88637ce2 100644 --- a/lib/ansible/module_utils/gcp_utils.py +++ b/lib/ansible/module_utils/gcp_utils.py @@ -72,7 +72,7 @@ def replace_resource_dict(item, value): return new_item -# Handles all authentation and HTTP sessions for GCP API calls. +# Handles all authentication and HTTP sessions for GCP API calls. class GcpSession(object): def __init__(self, module, product): self.module = module @@ -140,12 +140,12 @@ def _validate(self): if self.module.params.get('service_account_email') is not None and self.module.params['auth_kind'] != 'machineaccount': self.module.fail_json( - msg="Service Acccount Email only works with Machine Account-based authentication" + msg="Service Account Email only works with Machine Account-based authentication" ) if self.module.params.get('service_account_file') is not None and self.module.params['auth_kind'] != 'serviceaccount': self.module.fail_json( - msg="Service Acccount File only works with Service Account-based authentication" + msg="Service Account File only works with Service Account-based authentication" ) def _credentials(self): @@ -160,7 +160,7 @@ def _credentials(self): return google.auth.compute_engine.Credentials( self.module.params['service_account_email']) else: - self.module.fail_json(msg="Credential type '%s' not implmented" % cred_type) + self.module.fail_json(msg="Credential type '%s' not implemented" % cred_type) def _headers(self): return { From 80f7d619ec1264ec56900d436d0a96530c690d42 Mon Sep 17 00:00:00 2001 From: Chris Stephens Date: Wed, 16 Jan 2019 03:25:06 +0000 Subject: [PATCH 089/144] Make Disk KMS features GA Signed-off-by: Modular Magician --- .../modules/cloud/google/gcp_compute_disk.py | 57 ++++++++++++++++--- .../cloud/google/gcp_compute_disk_facts.py | 15 +++++ 2 files changed, 63 insertions(+), 9 deletions(-) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_disk.py b/lib/ansible/modules/cloud/google/gcp_compute_disk.py index 7998ab4a7300e8..84eae4eded0b1d 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_disk.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_disk.py @@ -129,6 +129,10 @@ - The RFC 4648 base64 encoded SHA-256 hash of the customer-supplied encryption key that protects this resource. required: false + kms_key_name: + description: + - The name of the encryption key that is stored in Google Cloud KMS. + required: false disk_encryption_key: description: - Encrypts the disk using a customer-supplied encryption key. @@ -151,6 +155,10 @@ - The RFC 4648 base64 encoded SHA-256 hash of the customer-supplied encryption key that protects this resource. required: false + kms_key_name: + description: + - The name of the encryption key that is stored in Google Cloud KMS. + required: false source_snapshot: description: - The source snapshot used to create this disk. You can provide this as a partial @@ -171,6 +179,10 @@ - Specifies a 256-bit customer-supplied encryption key, encoded in RFC 4648 base64 to either encrypt or decrypt this resource. required: false + kms_key_name: + description: + - The name of the encryption key that is stored in Google Cloud KMS. + required: false sha256: description: - The RFC 4648 base64 encoded SHA-256 hash of the customer-supplied encryption @@ -310,6 +322,11 @@ key that protects this resource. returned: success type: str + kmsKeyName: + description: + - The name of the encryption key that is stored in Google Cloud KMS. + returned: success + type: str sourceImageId: description: - The ID value of the image used to create this disk. This value identifies the @@ -344,6 +361,11 @@ key that protects this resource. returned: success type: str + kmsKeyName: + description: + - The name of the encryption key that is stored in Google Cloud KMS. + returned: success + type: str sourceSnapshot: description: - The source snapshot used to create this disk. You can provide this as a partial @@ -363,6 +385,11 @@ base64 to either encrypt or decrypt this resource. returned: success type: str + kmsKeyName: + description: + - The name of the encryption key that is stored in Google Cloud KMS. + returned: success + type: str sha256: description: - The RFC 4648 base64 encoded SHA-256 hash of the customer-supplied encryption @@ -408,10 +435,10 @@ def main(): type=dict(type='str'), source_image=dict(type='str'), zone=dict(required=True, type='str'), - source_image_encryption_key=dict(type='dict', options=dict(raw_key=dict(type='str'), sha256=dict(type='str'))), - disk_encryption_key=dict(type='dict', options=dict(raw_key=dict(type='str'), sha256=dict(type='str'))), + source_image_encryption_key=dict(type='dict', options=dict(raw_key=dict(type='str'), sha256=dict(type='str'), kms_key_name=dict(type='str'))), + disk_encryption_key=dict(type='dict', options=dict(raw_key=dict(type='str'), sha256=dict(type='str'), kms_key_name=dict(type='str'))), source_snapshot=dict(), - source_snapshot_encryption_key=dict(type='dict', options=dict(raw_key=dict(type='str'), sha256=dict(type='str'))), + source_snapshot_encryption_key=dict(type='dict', options=dict(raw_key=dict(type='str'), kms_key_name=dict(type='str'), sha256=dict(type='str'))), ) ) @@ -631,10 +658,14 @@ def __init__(self, request, module): self.request = {} def to_request(self): - return remove_nones_from_dict({u'rawKey': self.request.get('raw_key'), u'sha256': self.request.get('sha256')}) + return remove_nones_from_dict( + {u'rawKey': self.request.get('raw_key'), u'sha256': self.request.get('sha256'), u'kmsKeyName': self.request.get('kms_key_name')} + ) def from_response(self): - return remove_nones_from_dict({u'rawKey': self.request.get(u'rawKey'), u'sha256': self.request.get(u'sha256')}) + return remove_nones_from_dict( + {u'rawKey': self.request.get(u'rawKey'), u'sha256': self.request.get(u'sha256'), u'kmsKeyName': self.request.get(u'kmsKeyName')} + ) class DiskDiskencryptionkey(object): @@ -646,10 +677,14 @@ def __init__(self, request, module): self.request = {} def to_request(self): - return remove_nones_from_dict({u'rawKey': self.request.get('raw_key'), u'sha256': self.request.get('sha256')}) + return remove_nones_from_dict( + {u'rawKey': self.request.get('raw_key'), u'sha256': self.request.get('sha256'), u'kmsKeyName': self.request.get('kms_key_name')} + ) def from_response(self): - return remove_nones_from_dict({u'rawKey': self.request.get(u'rawKey'), u'sha256': self.request.get(u'sha256')}) + return remove_nones_from_dict( + {u'rawKey': self.request.get(u'rawKey'), u'sha256': self.request.get(u'sha256'), u'kmsKeyName': self.request.get(u'kmsKeyName')} + ) class DiskSourcesnapshotencryptionkey(object): @@ -661,10 +696,14 @@ def __init__(self, request, module): self.request = {} def to_request(self): - return remove_nones_from_dict({u'rawKey': self.request.get('raw_key'), u'sha256': self.request.get('sha256')}) + return remove_nones_from_dict( + {u'rawKey': self.request.get('raw_key'), u'kmsKeyName': self.request.get('kms_key_name'), u'sha256': self.request.get('sha256')} + ) def from_response(self): - return remove_nones_from_dict({u'rawKey': self.request.get(u'rawKey'), u'sha256': self.request.get(u'sha256')}) + return remove_nones_from_dict( + {u'rawKey': self.request.get(u'rawKey'), u'kmsKeyName': self.request.get(u'kmsKeyName'), u'sha256': self.request.get(u'sha256')} + ) if __name__ == '__main__': diff --git a/lib/ansible/modules/cloud/google/gcp_compute_disk_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_disk_facts.py index 5a62b425f94f5d..56f618967dc432 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_disk_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_disk_facts.py @@ -183,6 +183,11 @@ key that protects this resource. returned: success type: str + kmsKeyName: + description: + - The name of the encryption key that is stored in Google Cloud KMS. + returned: success + type: str sourceImageId: description: - The ID value of the image used to create this disk. This value identifies @@ -218,6 +223,11 @@ key that protects this resource. returned: success type: str + kmsKeyName: + description: + - The name of the encryption key that is stored in Google Cloud KMS. + returned: success + type: str sourceSnapshot: description: - The source snapshot used to create this disk. You can provide this as a partial @@ -237,6 +247,11 @@ base64 to either encrypt or decrypt this resource. returned: success type: str + kmsKeyName: + description: + - The name of the encryption key that is stored in Google Cloud KMS. + returned: success + type: str sha256: description: - The RFC 4648 base64 encoded SHA-256 hash of the customer-supplied encryption From 2688e3be4ab9adbf06b95e91a86c43ab3c6381bc Mon Sep 17 00:00:00 2001 From: The Magician Date: Wed, 16 Jan 2019 13:41:27 -0800 Subject: [PATCH 090/144] Initial addition of generated spanner database to terraform. (#159) Signed-off-by: Modular Magician --- .../cloud/google/gcp_spanner_database.py | 24 +++++++++++-------- .../google/gcp_spanner_database_facts.py | 3 +-- 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/lib/ansible/modules/cloud/google/gcp_spanner_database.py b/lib/ansible/modules/cloud/google/gcp_spanner_database.py index 020f7e16883674..59e059d970d477 100644 --- a/lib/ansible/modules/cloud/google/gcp_spanner_database.py +++ b/lib/ansible/modules/cloud/google/gcp_spanner_database.py @@ -50,9 +50,8 @@ name: description: - A unique identifier for the database, which cannot be changed after the instance - is created. Values are of the form projects//instances/[a-z][-a-z0-9]*[a-z0-9]. - The final segment of the name must be between 6 and 30 characters in length. - required: false + is created. Values are of the form [a-z][-a-z0-9]*[a-z0-9]. + required: true extra_statements: description: - 'An optional list of DDL statements to run inside the newly created database. @@ -69,6 +68,9 @@ task and then set this instance field to "{{ name-of-resource }}"' required: true extends_documentation_fragment: gcp +notes: +- 'API Reference: U(https://cloud.google.com/spanner/docs/reference/rest/v1/projects.instances.databases)' +- 'Official Documentation: U(https://cloud.google.com/spanner/)' ''' EXAMPLES = ''' @@ -100,8 +102,7 @@ name: description: - A unique identifier for the database, which cannot be changed after the instance - is created. Values are of the form projects//instances/[a-z][-a-z0-9]*[a-z0-9]. - The final segment of the name must be between 6 and 30 characters in length. + is created. Values are of the form [a-z][-a-z0-9]*[a-z0-9]. returned: success type: str extraStatements: @@ -137,7 +138,7 @@ def main(): module = GcpModule( argument_spec=dict( state=dict(default='present', choices=['present', 'absent'], type='str'), - name=dict(type='str'), + name=dict(required=True, type='str'), extra_statements=dict(type='list', elements='str'), instance=dict(required=True), ) @@ -179,8 +180,7 @@ def create(module, link): def update(module, link): - auth = GcpSession(module, 'spanner') - return return_if_object(module, auth.put(link, resource_to_request(module))) + module.fail_json(msg="Database cannot be edited") def delete(module, link): @@ -189,7 +189,11 @@ def delete(module, link): def resource_to_request(module): - request = {u'name': module.params.get('name'), u'extraStatements': module.params.get('extra_statements')} + request = { + u'instance': replace_resource_dict(module.params.get(u'instance', {}), 'name'), + u'name': module.params.get('name'), + u'extraStatements': module.params.get('extra_statements'), + } request = encode_request(request, module) return_vals = {} for k, v in request.items(): @@ -259,7 +263,7 @@ def is_different(module, response): # Remove unnecessary properties from the response. # This is for doing comparisons with Ansible's current parameters. def response_to_hash(module, response): - return {u'name': response.get(u'name'), u'extraStatements': module.params.get('extra_statements')} + return {u'name': module.params.get('name'), u'extraStatements': module.params.get('extra_statements')} def decode_response(response, module): diff --git a/lib/ansible/modules/cloud/google/gcp_spanner_database_facts.py b/lib/ansible/modules/cloud/google/gcp_spanner_database_facts.py index 6f901df48650a3..07deedf1805c34 100644 --- a/lib/ansible/modules/cloud/google/gcp_spanner_database_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_spanner_database_facts.py @@ -69,8 +69,7 @@ name: description: - A unique identifier for the database, which cannot be changed after the instance - is created. Values are of the form projects//instances/[a-z][-a-z0-9]*[a-z0-9]. - The final segment of the name must be between 6 and 30 characters in length. + is created. Values are of the form [a-z][-a-z0-9]*[a-z0-9]. returned: success type: str extraStatements: From 0bfdf127dcb3592e0f7ce11223a997dfab055f1b Mon Sep 17 00:00:00 2001 From: The Magician Date: Wed, 16 Jan 2019 15:34:34 -0800 Subject: [PATCH 091/144] Ansible async errors + printing formatter issues (#170) /cc @rambleraptor --- lib/ansible/modules/cloud/google/gcp_bigquery_dataset.py | 4 ++-- lib/ansible/modules/cloud/google/gcp_bigquery_table.py | 4 ++-- lib/ansible/modules/cloud/google/gcp_compute_address.py | 6 +++--- .../modules/cloud/google/gcp_compute_backend_bucket.py | 6 +++--- .../modules/cloud/google/gcp_compute_backend_service.py | 6 +++--- lib/ansible/modules/cloud/google/gcp_compute_disk.py | 6 +++--- lib/ansible/modules/cloud/google/gcp_compute_firewall.py | 6 +++--- .../modules/cloud/google/gcp_compute_forwarding_rule.py | 6 +++--- .../modules/cloud/google/gcp_compute_global_address.py | 6 +++--- .../cloud/google/gcp_compute_global_forwarding_rule.py | 6 +++--- .../modules/cloud/google/gcp_compute_health_check.py | 6 +++--- .../modules/cloud/google/gcp_compute_http_health_check.py | 6 +++--- .../modules/cloud/google/gcp_compute_https_health_check.py | 6 +++--- lib/ansible/modules/cloud/google/gcp_compute_image.py | 6 +++--- lib/ansible/modules/cloud/google/gcp_compute_instance.py | 6 +++--- .../modules/cloud/google/gcp_compute_instance_group.py | 6 +++--- .../cloud/google/gcp_compute_instance_group_manager.py | 6 +++--- .../modules/cloud/google/gcp_compute_instance_template.py | 6 +++--- .../cloud/google/gcp_compute_interconnect_attachment.py | 6 +++--- lib/ansible/modules/cloud/google/gcp_compute_network.py | 6 +++--- lib/ansible/modules/cloud/google/gcp_compute_region_disk.py | 6 +++--- lib/ansible/modules/cloud/google/gcp_compute_route.py | 6 +++--- lib/ansible/modules/cloud/google/gcp_compute_router.py | 6 +++--- .../modules/cloud/google/gcp_compute_ssl_certificate.py | 6 +++--- lib/ansible/modules/cloud/google/gcp_compute_ssl_policy.py | 6 +++--- lib/ansible/modules/cloud/google/gcp_compute_subnetwork.py | 6 +++--- .../modules/cloud/google/gcp_compute_target_http_proxy.py | 6 +++--- .../modules/cloud/google/gcp_compute_target_https_proxy.py | 6 +++--- lib/ansible/modules/cloud/google/gcp_compute_target_pool.py | 6 +++--- .../modules/cloud/google/gcp_compute_target_ssl_proxy.py | 6 +++--- .../modules/cloud/google/gcp_compute_target_tcp_proxy.py | 6 +++--- .../modules/cloud/google/gcp_compute_target_vpn_gateway.py | 6 +++--- lib/ansible/modules/cloud/google/gcp_compute_url_map.py | 6 +++--- lib/ansible/modules/cloud/google/gcp_compute_vpn_tunnel.py | 6 +++--- lib/ansible/modules/cloud/google/gcp_container_cluster.py | 6 +++--- lib/ansible/modules/cloud/google/gcp_container_node_pool.py | 6 +++--- lib/ansible/modules/cloud/google/gcp_dns_managed_zone.py | 4 ++-- .../modules/cloud/google/gcp_dns_resource_record_set.py | 4 ++-- lib/ansible/modules/cloud/google/gcp_iam_service_account.py | 4 ++-- lib/ansible/modules/cloud/google/gcp_pubsub_subscription.py | 4 ++-- lib/ansible/modules/cloud/google/gcp_pubsub_topic.py | 4 ++-- .../modules/cloud/google/gcp_resourcemanager_project.py | 3 ++- lib/ansible/modules/cloud/google/gcp_spanner_database.py | 4 ++-- lib/ansible/modules/cloud/google/gcp_spanner_instance.py | 4 ++-- lib/ansible/modules/cloud/google/gcp_sql_database.py | 2 +- lib/ansible/modules/cloud/google/gcp_sql_instance.py | 2 +- lib/ansible/modules/cloud/google/gcp_sql_user.py | 2 +- lib/ansible/modules/cloud/google/gcp_storage_bucket.py | 4 ++-- .../cloud/google/gcp_storage_bucket_access_control.py | 4 ++-- 49 files changed, 129 insertions(+), 128 deletions(-) diff --git a/lib/ansible/modules/cloud/google/gcp_bigquery_dataset.py b/lib/ansible/modules/cloud/google/gcp_bigquery_dataset.py index ed1d7172f82b3b..bdba1e07ca5133 100644 --- a/lib/ansible/modules/cloud/google/gcp_bigquery_dataset.py +++ b/lib/ansible/modules/cloud/google/gcp_bigquery_dataset.py @@ -422,8 +422,8 @@ def return_if_object(module, response, kind, allow_not_found=False): try: module.raise_for_status(response) result = response.json() - except getattr(json.decoder, 'JSONDecodeError', ValueError) as inst: - module.fail_json(msg="Invalid JSON response with error: %s" % inst) + except getattr(json.decoder, 'JSONDecodeError', ValueError): + module.fail_json(msg="Invalid JSON response with error: %s" % response.text) if navigate_hash(result, ['error', 'errors']): module.fail_json(msg=navigate_hash(result, ['error', 'errors'])) diff --git a/lib/ansible/modules/cloud/google/gcp_bigquery_table.py b/lib/ansible/modules/cloud/google/gcp_bigquery_table.py index bb36a6981c8879..5e8c5b492f7195 100644 --- a/lib/ansible/modules/cloud/google/gcp_bigquery_table.py +++ b/lib/ansible/modules/cloud/google/gcp_bigquery_table.py @@ -1101,8 +1101,8 @@ def return_if_object(module, response, kind, allow_not_found=False): try: module.raise_for_status(response) result = response.json() - except getattr(json.decoder, 'JSONDecodeError', ValueError) as inst: - module.fail_json(msg="Invalid JSON response with error: %s" % inst) + except getattr(json.decoder, 'JSONDecodeError', ValueError): + module.fail_json(msg="Invalid JSON response with error: %s" % response.text) if navigate_hash(result, ['error', 'errors']): module.fail_json(msg=navigate_hash(result, ['error', 'errors'])) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_address.py b/lib/ansible/modules/cloud/google/gcp_compute_address.py index 61c256c635c246..9a6a20c9986009 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_address.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_address.py @@ -312,8 +312,8 @@ def return_if_object(module, response, kind, allow_not_found=False): try: module.raise_for_status(response) result = response.json() - except getattr(json.decoder, 'JSONDecodeError', ValueError) as inst: - module.fail_json(msg="Invalid JSON response with error: %s" % inst) + except getattr(json.decoder, 'JSONDecodeError', ValueError): + module.fail_json(msg="Invalid JSON response with error: %s" % response.text) if navigate_hash(result, ['error', 'errors']): module.fail_json(msg=navigate_hash(result, ['error', 'errors'])) @@ -377,7 +377,7 @@ def wait_for_completion(status, op_result, module): op_id = navigate_hash(op_result, ['name']) op_uri = async_op_url(module, {'op_id': op_id}) while status != 'DONE': - raise_if_errors(op_result, ['error', 'errors'], 'message') + raise_if_errors(op_result, ['error', 'errors'], module) time.sleep(1.0) op_result = fetch_resource(module, op_uri, 'compute#operation') status = navigate_hash(op_result, ['status']) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_backend_bucket.py b/lib/ansible/modules/cloud/google/gcp_compute_backend_bucket.py index 7c84fd2675d2c2..4e3bd87f7515b1 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_backend_bucket.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_backend_bucket.py @@ -254,8 +254,8 @@ def return_if_object(module, response, kind, allow_not_found=False): try: module.raise_for_status(response) result = response.json() - except getattr(json.decoder, 'JSONDecodeError', ValueError) as inst: - module.fail_json(msg="Invalid JSON response with error: %s" % inst) + except getattr(json.decoder, 'JSONDecodeError', ValueError): + module.fail_json(msg="Invalid JSON response with error: %s" % response.text) if navigate_hash(result, ['error', 'errors']): module.fail_json(msg=navigate_hash(result, ['error', 'errors'])) @@ -316,7 +316,7 @@ def wait_for_completion(status, op_result, module): op_id = navigate_hash(op_result, ['name']) op_uri = async_op_url(module, {'op_id': op_id}) while status != 'DONE': - raise_if_errors(op_result, ['error', 'errors'], 'message') + raise_if_errors(op_result, ['error', 'errors'], module) time.sleep(1.0) op_result = fetch_resource(module, op_uri, 'compute#operation') status = navigate_hash(op_result, ['status']) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_backend_service.py b/lib/ansible/modules/cloud/google/gcp_compute_backend_service.py index 7c625485c3bdfe..f81e7783e50946 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_backend_service.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_backend_service.py @@ -772,8 +772,8 @@ def return_if_object(module, response, kind, allow_not_found=False): try: module.raise_for_status(response) result = response.json() - except getattr(json.decoder, 'JSONDecodeError', ValueError) as inst: - module.fail_json(msg="Invalid JSON response with error: %s" % inst) + except getattr(json.decoder, 'JSONDecodeError', ValueError): + module.fail_json(msg="Invalid JSON response with error: %s" % response.text) if navigate_hash(result, ['error', 'errors']): module.fail_json(msg=navigate_hash(result, ['error', 'errors'])) @@ -854,7 +854,7 @@ def wait_for_completion(status, op_result, module): op_id = navigate_hash(op_result, ['name']) op_uri = async_op_url(module, {'op_id': op_id}) while status != 'DONE': - raise_if_errors(op_result, ['error', 'errors'], 'message') + raise_if_errors(op_result, ['error', 'errors'], module) time.sleep(1.0) op_result = fetch_resource(module, op_uri, 'compute#operation') status = navigate_hash(op_result, ['status']) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_disk.py b/lib/ansible/modules/cloud/google/gcp_compute_disk.py index 84eae4eded0b1d..4603a951f5fac0 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_disk.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_disk.py @@ -558,8 +558,8 @@ def return_if_object(module, response, kind, allow_not_found=False): try: module.raise_for_status(response) result = response.json() - except getattr(json.decoder, 'JSONDecodeError', ValueError) as inst: - module.fail_json(msg="Invalid JSON response with error: %s" % inst) + except getattr(json.decoder, 'JSONDecodeError', ValueError): + module.fail_json(msg="Invalid JSON response with error: %s" % response.text) if navigate_hash(result, ['error', 'errors']): module.fail_json(msg=navigate_hash(result, ['error', 'errors'])) @@ -636,7 +636,7 @@ def wait_for_completion(status, op_result, module): op_id = navigate_hash(op_result, ['name']) op_uri = async_op_url(module, {'op_id': op_id}) while status != 'DONE': - raise_if_errors(op_result, ['error', 'errors'], 'message') + raise_if_errors(op_result, ['error', 'errors'], module) time.sleep(1.0) op_result = fetch_resource(module, op_uri, 'compute#operation') status = navigate_hash(op_result, ['status']) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_firewall.py b/lib/ansible/modules/cloud/google/gcp_compute_firewall.py index 7cca733580ef7d..9b177b62e464e7 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_firewall.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_firewall.py @@ -550,8 +550,8 @@ def return_if_object(module, response, kind, allow_not_found=False): try: module.raise_for_status(response) result = response.json() - except getattr(json.decoder, 'JSONDecodeError', ValueError) as inst: - module.fail_json(msg="Invalid JSON response with error: %s" % inst) + except getattr(json.decoder, 'JSONDecodeError', ValueError): + module.fail_json(msg="Invalid JSON response with error: %s" % response.text) if navigate_hash(result, ['error', 'errors']): module.fail_json(msg=navigate_hash(result, ['error', 'errors'])) @@ -622,7 +622,7 @@ def wait_for_completion(status, op_result, module): op_id = navigate_hash(op_result, ['name']) op_uri = async_op_url(module, {'op_id': op_id}) while status != 'DONE': - raise_if_errors(op_result, ['error', 'errors'], 'message') + raise_if_errors(op_result, ['error', 'errors'], module) time.sleep(1.0) op_result = fetch_resource(module, op_uri, 'compute#operation') status = navigate_hash(op_result, ['status']) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_forwarding_rule.py b/lib/ansible/modules/cloud/google/gcp_compute_forwarding_rule.py index fe4c122b048381..eedcfee2bff48a 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_forwarding_rule.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_forwarding_rule.py @@ -534,8 +534,8 @@ def return_if_object(module, response, kind, allow_not_found=False): try: module.raise_for_status(response) result = response.json() - except getattr(json.decoder, 'JSONDecodeError', ValueError) as inst: - module.fail_json(msg="Invalid JSON response with error: %s" % inst) + except getattr(json.decoder, 'JSONDecodeError', ValueError): + module.fail_json(msg="Invalid JSON response with error: %s" % response.text) if navigate_hash(result, ['error', 'errors']): module.fail_json(msg=navigate_hash(result, ['error', 'errors'])) @@ -605,7 +605,7 @@ def wait_for_completion(status, op_result, module): op_id = navigate_hash(op_result, ['name']) op_uri = async_op_url(module, {'op_id': op_id}) while status != 'DONE': - raise_if_errors(op_result, ['error', 'errors'], 'message') + raise_if_errors(op_result, ['error', 'errors'], module) time.sleep(1.0) op_result = fetch_resource(module, op_uri, 'compute#operation') status = navigate_hash(op_result, ['status']) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_global_address.py b/lib/ansible/modules/cloud/google/gcp_compute_global_address.py index 09b276cf3baa08..e1e8f5ffab0952 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_global_address.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_global_address.py @@ -269,8 +269,8 @@ def return_if_object(module, response, kind, allow_not_found=False): try: module.raise_for_status(response) result = response.json() - except getattr(json.decoder, 'JSONDecodeError', ValueError) as inst: - module.fail_json(msg="Invalid JSON response with error: %s" % inst) + except getattr(json.decoder, 'JSONDecodeError', ValueError): + module.fail_json(msg="Invalid JSON response with error: %s" % response.text) if navigate_hash(result, ['error', 'errors']): module.fail_json(msg=navigate_hash(result, ['error', 'errors'])) @@ -342,7 +342,7 @@ def wait_for_completion(status, op_result, module): op_id = navigate_hash(op_result, ['name']) op_uri = async_op_url(module, {'op_id': op_id}) while status != 'DONE': - raise_if_errors(op_result, ['error', 'errors'], 'message') + raise_if_errors(op_result, ['error', 'errors'], module) time.sleep(1.0) op_result = fetch_resource(module, op_uri, 'compute#operation') status = navigate_hash(op_result, ['status']) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_global_forwarding_rule.py b/lib/ansible/modules/cloud/google/gcp_compute_global_forwarding_rule.py index dab4f47c07f57b..36c2a7c72fce0b 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_global_forwarding_rule.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_global_forwarding_rule.py @@ -529,8 +529,8 @@ def return_if_object(module, response, kind, allow_not_found=False): try: module.raise_for_status(response) result = response.json() - except getattr(json.decoder, 'JSONDecodeError', ValueError) as inst: - module.fail_json(msg="Invalid JSON response with error: %s" % inst) + except getattr(json.decoder, 'JSONDecodeError', ValueError): + module.fail_json(msg="Invalid JSON response with error: %s" % response.text) if navigate_hash(result, ['error', 'errors']): module.fail_json(msg=navigate_hash(result, ['error', 'errors'])) @@ -600,7 +600,7 @@ def wait_for_completion(status, op_result, module): op_id = navigate_hash(op_result, ['name']) op_uri = async_op_url(module, {'op_id': op_id}) while status != 'DONE': - raise_if_errors(op_result, ['error', 'errors'], 'message') + raise_if_errors(op_result, ['error', 'errors'], module) time.sleep(1.0) op_result = fetch_resource(module, op_uri, 'compute#operation') status = navigate_hash(op_result, ['status']) 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 924f9f8771e35f..b0334a5383e690 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_health_check.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_health_check.py @@ -676,8 +676,8 @@ def return_if_object(module, response, kind, allow_not_found=False): try: module.raise_for_status(response) result = response.json() - except getattr(json.decoder, 'JSONDecodeError', ValueError) as inst: - module.fail_json(msg="Invalid JSON response with error: %s" % inst) + except getattr(json.decoder, 'JSONDecodeError', ValueError): + module.fail_json(msg="Invalid JSON response with error: %s" % response.text) if navigate_hash(result, ['error', 'errors']): module.fail_json(msg=navigate_hash(result, ['error', 'errors'])) @@ -745,7 +745,7 @@ def wait_for_completion(status, op_result, module): op_id = navigate_hash(op_result, ['name']) op_uri = async_op_url(module, {'op_id': op_id}) while status != 'DONE': - raise_if_errors(op_result, ['error', 'errors'], 'message') + raise_if_errors(op_result, ['error', 'errors'], module) time.sleep(1.0) op_result = fetch_resource(module, op_uri, 'compute#operation') status = navigate_hash(op_result, ['status']) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_http_health_check.py b/lib/ansible/modules/cloud/google/gcp_compute_http_health_check.py index 387e692be9f898..dd2ae039e695da 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_http_health_check.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_http_health_check.py @@ -318,8 +318,8 @@ def return_if_object(module, response, kind, allow_not_found=False): try: module.raise_for_status(response) result = response.json() - except getattr(json.decoder, 'JSONDecodeError', ValueError) as inst: - module.fail_json(msg="Invalid JSON response with error: %s" % inst) + except getattr(json.decoder, 'JSONDecodeError', ValueError): + module.fail_json(msg="Invalid JSON response with error: %s" % response.text) if navigate_hash(result, ['error', 'errors']): module.fail_json(msg=navigate_hash(result, ['error', 'errors'])) @@ -385,7 +385,7 @@ def wait_for_completion(status, op_result, module): op_id = navigate_hash(op_result, ['name']) op_uri = async_op_url(module, {'op_id': op_id}) while status != 'DONE': - raise_if_errors(op_result, ['error', 'errors'], 'message') + raise_if_errors(op_result, ['error', 'errors'], module) time.sleep(1.0) op_result = fetch_resource(module, op_uri, 'compute#operation') status = navigate_hash(op_result, ['status']) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_https_health_check.py b/lib/ansible/modules/cloud/google/gcp_compute_https_health_check.py index 6635209bc9927f..72e9832b284b7d 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_https_health_check.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_https_health_check.py @@ -315,8 +315,8 @@ def return_if_object(module, response, kind, allow_not_found=False): try: module.raise_for_status(response) result = response.json() - except getattr(json.decoder, 'JSONDecodeError', ValueError) as inst: - module.fail_json(msg="Invalid JSON response with error: %s" % inst) + except getattr(json.decoder, 'JSONDecodeError', ValueError): + module.fail_json(msg="Invalid JSON response with error: %s" % response.text) if navigate_hash(result, ['error', 'errors']): module.fail_json(msg=navigate_hash(result, ['error', 'errors'])) @@ -382,7 +382,7 @@ def wait_for_completion(status, op_result, module): op_id = navigate_hash(op_result, ['name']) op_uri = async_op_url(module, {'op_id': op_id}) while status != 'DONE': - raise_if_errors(op_result, ['error', 'errors'], 'message') + raise_if_errors(op_result, ['error', 'errors'], module) time.sleep(1.0) op_result = fetch_resource(module, op_uri, 'compute#operation') status = navigate_hash(op_result, ['status']) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_image.py b/lib/ansible/modules/cloud/google/gcp_compute_image.py index 1b51f58014ee49..80831673422868 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_image.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_image.py @@ -576,8 +576,8 @@ def return_if_object(module, response, kind, allow_not_found=False): try: module.raise_for_status(response) result = response.json() - except getattr(json.decoder, 'JSONDecodeError', ValueError) as inst: - module.fail_json(msg="Invalid JSON response with error: %s" % inst) + except getattr(json.decoder, 'JSONDecodeError', ValueError): + module.fail_json(msg="Invalid JSON response with error: %s" % response.text) if navigate_hash(result, ['error', 'errors']): module.fail_json(msg=navigate_hash(result, ['error', 'errors'])) @@ -650,7 +650,7 @@ def wait_for_completion(status, op_result, module): op_id = navigate_hash(op_result, ['name']) op_uri = async_op_url(module, {'op_id': op_id}) while status != 'DONE': - raise_if_errors(op_result, ['error', 'errors'], 'message') + raise_if_errors(op_result, ['error', 'errors'], module) time.sleep(1.0) op_result = fetch_resource(module, op_uri, 'compute#operation') status = navigate_hash(op_result, ['status']) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_instance.py b/lib/ansible/modules/cloud/google/gcp_compute_instance.py index 4ea36bdb66b2e7..23a0d80f296918 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_instance.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_instance.py @@ -1062,8 +1062,8 @@ def return_if_object(module, response, kind, allow_not_found=False): try: module.raise_for_status(response) result = response.json() - except getattr(json.decoder, 'JSONDecodeError', ValueError) as inst: - module.fail_json(msg="Invalid JSON response with error: %s" % inst) + except getattr(json.decoder, 'JSONDecodeError', ValueError): + module.fail_json(msg="Invalid JSON response with error: %s" % response.text) result = decode_response(result, module) @@ -1156,7 +1156,7 @@ def wait_for_completion(status, op_result, module): op_id = navigate_hash(op_result, ['name']) op_uri = async_op_url(module, {'op_id': op_id}) while status != 'DONE': - raise_if_errors(op_result, ['error', 'errors'], 'message') + raise_if_errors(op_result, ['error', 'errors'], module) time.sleep(1.0) op_result = fetch_resource(module, op_uri, 'compute#operation') status = navigate_hash(op_result, ['status']) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_instance_group.py b/lib/ansible/modules/cloud/google/gcp_compute_instance_group.py index a7ae235641087b..e92f66ed8abcaf 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_instance_group.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_instance_group.py @@ -339,8 +339,8 @@ def return_if_object(module, response, kind, allow_not_found=False): try: module.raise_for_status(response) result = response.json() - except getattr(json.decoder, 'JSONDecodeError', ValueError) as inst: - module.fail_json(msg="Invalid JSON response with error: %s" % inst) + except getattr(json.decoder, 'JSONDecodeError', ValueError): + module.fail_json(msg="Invalid JSON response with error: %s" % response.text) if navigate_hash(result, ['error', 'errors']): module.fail_json(msg=navigate_hash(result, ['error', 'errors'])) @@ -412,7 +412,7 @@ def wait_for_completion(status, op_result, module): op_id = navigate_hash(op_result, ['name']) op_uri = async_op_url(module, {'op_id': op_id}) while status != 'DONE': - raise_if_errors(op_result, ['error', 'errors'], 'message') + raise_if_errors(op_result, ['error', 'errors'], module) time.sleep(1.0) op_result = fetch_resource(module, op_uri, 'compute#operation') status = navigate_hash(op_result, ['status']) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_instance_group_manager.py b/lib/ansible/modules/cloud/google/gcp_compute_instance_group_manager.py index 4a78ed487e2df0..4fbc5be5bdaf1a 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_instance_group_manager.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_instance_group_manager.py @@ -438,8 +438,8 @@ def return_if_object(module, response, kind, allow_not_found=False): try: module.raise_for_status(response) result = response.json() - except getattr(json.decoder, 'JSONDecodeError', ValueError) as inst: - module.fail_json(msg="Invalid JSON response with error: %s" % inst) + except getattr(json.decoder, 'JSONDecodeError', ValueError): + module.fail_json(msg="Invalid JSON response with error: %s" % response.text) if navigate_hash(result, ['error', 'errors']): module.fail_json(msg=navigate_hash(result, ['error', 'errors'])) @@ -515,7 +515,7 @@ def wait_for_completion(status, op_result, module): op_id = navigate_hash(op_result, ['name']) op_uri = async_op_url(module, {'op_id': op_id}) while status != 'DONE': - raise_if_errors(op_result, ['error', 'errors'], 'message') + raise_if_errors(op_result, ['error', 'errors'], module) time.sleep(1.0) op_result = fetch_resource(module, op_uri, 'compute#operation') status = navigate_hash(op_result, ['status']) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_instance_template.py b/lib/ansible/modules/cloud/google/gcp_compute_instance_template.py index e194c471d9028c..691493eca008db 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_instance_template.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_instance_template.py @@ -1018,8 +1018,8 @@ def return_if_object(module, response, kind, allow_not_found=False): try: module.raise_for_status(response) result = response.json() - except getattr(json.decoder, 'JSONDecodeError', ValueError) as inst: - module.fail_json(msg="Invalid JSON response with error: %s" % inst) + except getattr(json.decoder, 'JSONDecodeError', ValueError): + module.fail_json(msg="Invalid JSON response with error: %s" % response.text) result = decode_response(result, module) @@ -1091,7 +1091,7 @@ def wait_for_completion(status, op_result, module): op_id = navigate_hash(op_result, ['name']) op_uri = async_op_url(module, {'op_id': op_id}) while status != 'DONE': - raise_if_errors(op_result, ['error', 'errors'], 'message') + raise_if_errors(op_result, ['error', 'errors'], module) time.sleep(1.0) op_result = fetch_resource(module, op_uri, 'compute#operation') status = navigate_hash(op_result, ['status']) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_interconnect_attachment.py b/lib/ansible/modules/cloud/google/gcp_compute_interconnect_attachment.py index bb352b16391c93..4e32450e5d5e50 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_interconnect_attachment.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_interconnect_attachment.py @@ -290,8 +290,8 @@ def return_if_object(module, response, kind, allow_not_found=False): try: module.raise_for_status(response) result = response.json() - except getattr(json.decoder, 'JSONDecodeError', ValueError) as inst: - module.fail_json(msg="Invalid JSON response with error: %s" % inst) + except getattr(json.decoder, 'JSONDecodeError', ValueError): + module.fail_json(msg="Invalid JSON response with error: %s" % response.text) if navigate_hash(result, ['error', 'errors']): module.fail_json(msg=navigate_hash(result, ['error', 'errors'])) @@ -365,7 +365,7 @@ def wait_for_completion(status, op_result, module): op_id = navigate_hash(op_result, ['name']) op_uri = async_op_url(module, {'op_id': op_id}) while status != 'DONE': - raise_if_errors(op_result, ['error', 'errors'], 'message') + raise_if_errors(op_result, ['error', 'errors'], module) time.sleep(1.0) op_result = fetch_resource(module, op_uri, 'compute#operation') status = navigate_hash(op_result, ['status']) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_network.py b/lib/ansible/modules/cloud/google/gcp_compute_network.py index b9078dcdf008bd..b5d120188099c3 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_network.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_network.py @@ -308,8 +308,8 @@ def return_if_object(module, response, kind, allow_not_found=False): try: module.raise_for_status(response) result = response.json() - except getattr(json.decoder, 'JSONDecodeError', ValueError) as inst: - module.fail_json(msg="Invalid JSON response with error: %s" % inst) + except getattr(json.decoder, 'JSONDecodeError', ValueError): + module.fail_json(msg="Invalid JSON response with error: %s" % response.text) if navigate_hash(result, ['error', 'errors']): module.fail_json(msg=navigate_hash(result, ['error', 'errors'])) @@ -373,7 +373,7 @@ def wait_for_completion(status, op_result, module): op_id = navigate_hash(op_result, ['name']) op_uri = async_op_url(module, {'op_id': op_id}) while status != 'DONE': - raise_if_errors(op_result, ['error', 'errors'], 'message') + raise_if_errors(op_result, ['error', 'errors'], module) time.sleep(1.0) op_result = fetch_resource(module, op_uri, 'compute#operation') status = navigate_hash(op_result, ['status']) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_region_disk.py b/lib/ansible/modules/cloud/google/gcp_compute_region_disk.py index da28b945abe7ac..880fe8be91add4 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_region_disk.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_region_disk.py @@ -466,8 +466,8 @@ def return_if_object(module, response, kind, allow_not_found=False): try: module.raise_for_status(response) result = response.json() - except getattr(json.decoder, 'JSONDecodeError', ValueError) as inst: - module.fail_json(msg="Invalid JSON response with error: %s" % inst) + except getattr(json.decoder, 'JSONDecodeError', ValueError): + module.fail_json(msg="Invalid JSON response with error: %s" % response.text) if navigate_hash(result, ['error', 'errors']): module.fail_json(msg=navigate_hash(result, ['error', 'errors'])) @@ -553,7 +553,7 @@ def wait_for_completion(status, op_result, module): op_id = navigate_hash(op_result, ['name']) op_uri = async_op_url(module, {'op_id': op_id}) while status != 'DONE': - raise_if_errors(op_result, ['error', 'errors'], 'message') + raise_if_errors(op_result, ['error', 'errors'], module) time.sleep(1.0) op_result = fetch_resource(module, op_uri, 'compute#operation') status = navigate_hash(op_result, ['status']) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_route.py b/lib/ansible/modules/cloud/google/gcp_compute_route.py index 5eb0721fd77850..42f28538e47c58 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_route.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_route.py @@ -364,8 +364,8 @@ def return_if_object(module, response, kind, allow_not_found=False): try: module.raise_for_status(response) result = response.json() - except getattr(json.decoder, 'JSONDecodeError', ValueError) as inst: - module.fail_json(msg="Invalid JSON response with error: %s" % inst) + except getattr(json.decoder, 'JSONDecodeError', ValueError): + module.fail_json(msg="Invalid JSON response with error: %s" % response.text) if navigate_hash(result, ['error', 'errors']): module.fail_json(msg=navigate_hash(result, ['error', 'errors'])) @@ -431,7 +431,7 @@ def wait_for_completion(status, op_result, module): op_id = navigate_hash(op_result, ['name']) op_uri = async_op_url(module, {'op_id': op_id}) while status != 'DONE': - raise_if_errors(op_result, ['error', 'errors'], 'message') + raise_if_errors(op_result, ['error', 'errors'], module) time.sleep(1.0) op_result = fetch_resource(module, op_uri, 'compute#operation') status = navigate_hash(op_result, ['status']) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_router.py b/lib/ansible/modules/cloud/google/gcp_compute_router.py index 8d08b8b7d46dc6..86ff9be81a9edf 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_router.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_router.py @@ -360,8 +360,8 @@ def return_if_object(module, response, kind, allow_not_found=False): try: module.raise_for_status(response) result = response.json() - except getattr(json.decoder, 'JSONDecodeError', ValueError) as inst: - module.fail_json(msg="Invalid JSON response with error: %s" % inst) + except getattr(json.decoder, 'JSONDecodeError', ValueError): + module.fail_json(msg="Invalid JSON response with error: %s" % response.text) if navigate_hash(result, ['error', 'errors']): module.fail_json(msg=navigate_hash(result, ['error', 'errors'])) @@ -422,7 +422,7 @@ def wait_for_completion(status, op_result, module): op_id = navigate_hash(op_result, ['name']) op_uri = async_op_url(module, {'op_id': op_id}) while status != 'DONE': - raise_if_errors(op_result, ['error', 'errors'], 'message') + raise_if_errors(op_result, ['error', 'errors'], module) time.sleep(1.0) op_result = fetch_resource(module, op_uri, 'compute#operation') status = navigate_hash(op_result, ['status']) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_ssl_certificate.py b/lib/ansible/modules/cloud/google/gcp_compute_ssl_certificate.py index f5f600fc42ab5f..f9fd45e04f7b54 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_ssl_certificate.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_ssl_certificate.py @@ -265,8 +265,8 @@ def return_if_object(module, response, kind, allow_not_found=False): try: module.raise_for_status(response) result = response.json() - except getattr(json.decoder, 'JSONDecodeError', ValueError) as inst: - module.fail_json(msg="Invalid JSON response with error: %s" % inst) + except getattr(json.decoder, 'JSONDecodeError', ValueError): + module.fail_json(msg="Invalid JSON response with error: %s" % response.text) if navigate_hash(result, ['error', 'errors']): module.fail_json(msg=navigate_hash(result, ['error', 'errors'])) @@ -327,7 +327,7 @@ def wait_for_completion(status, op_result, module): op_id = navigate_hash(op_result, ['name']) op_uri = async_op_url(module, {'op_id': op_id}) while status != 'DONE': - raise_if_errors(op_result, ['error', 'errors'], 'message') + raise_if_errors(op_result, ['error', 'errors'], module) time.sleep(1.0) op_result = fetch_resource(module, op_uri, 'compute#operation') status = navigate_hash(op_result, ['status']) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_ssl_policy.py b/lib/ansible/modules/cloud/google/gcp_compute_ssl_policy.py index ff3bb66e8eaafe..59efb92c5b1d75 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_ssl_policy.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_ssl_policy.py @@ -303,8 +303,8 @@ def return_if_object(module, response, kind, allow_not_found=False): try: module.raise_for_status(response) result = response.json() - except getattr(json.decoder, 'JSONDecodeError', ValueError) as inst: - module.fail_json(msg="Invalid JSON response with error: %s" % inst) + except getattr(json.decoder, 'JSONDecodeError', ValueError): + module.fail_json(msg="Invalid JSON response with error: %s" % response.text) if navigate_hash(result, ['error', 'errors']): module.fail_json(msg=navigate_hash(result, ['error', 'errors'])) @@ -369,7 +369,7 @@ def wait_for_completion(status, op_result, module): op_id = navigate_hash(op_result, ['name']) op_uri = async_op_url(module, {'op_id': op_id}) while status != 'DONE': - raise_if_errors(op_result, ['error', 'errors'], 'message') + raise_if_errors(op_result, ['error', 'errors'], module) time.sleep(1.0) op_result = fetch_resource(module, op_uri, 'compute#operation') status = navigate_hash(op_result, ['status']) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_subnetwork.py b/lib/ansible/modules/cloud/google/gcp_compute_subnetwork.py index 65eb844db5a01b..be3f9088849244 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_subnetwork.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_subnetwork.py @@ -416,8 +416,8 @@ def return_if_object(module, response, kind, allow_not_found=False): try: module.raise_for_status(response) result = response.json() - except getattr(json.decoder, 'JSONDecodeError', ValueError) as inst: - module.fail_json(msg="Invalid JSON response with error: %s" % inst) + except getattr(json.decoder, 'JSONDecodeError', ValueError): + module.fail_json(msg="Invalid JSON response with error: %s" % response.text) if navigate_hash(result, ['error', 'errors']): module.fail_json(msg=navigate_hash(result, ['error', 'errors'])) @@ -484,7 +484,7 @@ def wait_for_completion(status, op_result, module): op_id = navigate_hash(op_result, ['name']) op_uri = async_op_url(module, {'op_id': op_id}) while status != 'DONE': - raise_if_errors(op_result, ['error', 'errors'], 'message') + raise_if_errors(op_result, ['error', 'errors'], module) time.sleep(1.0) op_result = fetch_resource(module, op_uri, 'compute#operation') status = navigate_hash(op_result, ['status']) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_http_proxy.py b/lib/ansible/modules/cloud/google/gcp_compute_target_http_proxy.py index 676feee4496195..09aa92e3168094 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_http_proxy.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_http_proxy.py @@ -291,8 +291,8 @@ def return_if_object(module, response, kind, allow_not_found=False): try: module.raise_for_status(response) result = response.json() - except getattr(json.decoder, 'JSONDecodeError', ValueError) as inst: - module.fail_json(msg="Invalid JSON response with error: %s" % inst) + except getattr(json.decoder, 'JSONDecodeError', ValueError): + module.fail_json(msg="Invalid JSON response with error: %s" % response.text) if navigate_hash(result, ['error', 'errors']): module.fail_json(msg=navigate_hash(result, ['error', 'errors'])) @@ -352,7 +352,7 @@ def wait_for_completion(status, op_result, module): op_id = navigate_hash(op_result, ['name']) op_uri = async_op_url(module, {'op_id': op_id}) while status != 'DONE': - raise_if_errors(op_result, ['error', 'errors'], 'message') + raise_if_errors(op_result, ['error', 'errors'], module) time.sleep(1.0) op_result = fetch_resource(module, op_uri, 'compute#operation') status = navigate_hash(op_result, ['status']) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_https_proxy.py b/lib/ansible/modules/cloud/google/gcp_compute_target_https_proxy.py index da990efc17b6fb..725d790bc756f3 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_https_proxy.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_https_proxy.py @@ -415,8 +415,8 @@ def return_if_object(module, response, kind, allow_not_found=False): try: module.raise_for_status(response) result = response.json() - except getattr(json.decoder, 'JSONDecodeError', ValueError) as inst: - module.fail_json(msg="Invalid JSON response with error: %s" % inst) + except getattr(json.decoder, 'JSONDecodeError', ValueError): + module.fail_json(msg="Invalid JSON response with error: %s" % response.text) if navigate_hash(result, ['error', 'errors']): module.fail_json(msg=navigate_hash(result, ['error', 'errors'])) @@ -479,7 +479,7 @@ def wait_for_completion(status, op_result, module): op_id = navigate_hash(op_result, ['name']) op_uri = async_op_url(module, {'op_id': op_id}) while status != 'DONE': - raise_if_errors(op_result, ['error', 'errors'], 'message') + raise_if_errors(op_result, ['error', 'errors'], module) time.sleep(1.0) op_result = fetch_resource(module, op_uri, 'compute#operation') status = navigate_hash(op_result, ['status']) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_pool.py b/lib/ansible/modules/cloud/google/gcp_compute_target_pool.py index a7a30a84061621..5cecd07362ca8c 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_pool.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_pool.py @@ -351,8 +351,8 @@ def return_if_object(module, response, kind, allow_not_found=False): try: module.raise_for_status(response) result = response.json() - except getattr(json.decoder, 'JSONDecodeError', ValueError) as inst: - module.fail_json(msg="Invalid JSON response with error: %s" % inst) + except getattr(json.decoder, 'JSONDecodeError', ValueError): + module.fail_json(msg="Invalid JSON response with error: %s" % response.text) result = decode_request(result, module) @@ -419,7 +419,7 @@ def wait_for_completion(status, op_result, module): op_id = navigate_hash(op_result, ['name']) op_uri = async_op_url(module, {'op_id': op_id}) while status != 'DONE': - raise_if_errors(op_result, ['error', 'errors'], 'message') + raise_if_errors(op_result, ['error', 'errors'], module) time.sleep(1.0) op_result = fetch_resource(module, op_uri, 'compute#operation') status = navigate_hash(op_result, ['status']) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_ssl_proxy.py b/lib/ansible/modules/cloud/google/gcp_compute_target_ssl_proxy.py index ba9a1fc1f9440b..51476c6fa80af4 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_ssl_proxy.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_ssl_proxy.py @@ -401,8 +401,8 @@ def return_if_object(module, response, kind, allow_not_found=False): try: module.raise_for_status(response) result = response.json() - except getattr(json.decoder, 'JSONDecodeError', ValueError) as inst: - module.fail_json(msg="Invalid JSON response with error: %s" % inst) + except getattr(json.decoder, 'JSONDecodeError', ValueError): + module.fail_json(msg="Invalid JSON response with error: %s" % response.text) if navigate_hash(result, ['error', 'errors']): module.fail_json(msg=navigate_hash(result, ['error', 'errors'])) @@ -465,7 +465,7 @@ def wait_for_completion(status, op_result, module): op_id = navigate_hash(op_result, ['name']) op_uri = async_op_url(module, {'op_id': op_id}) while status != 'DONE': - raise_if_errors(op_result, ['error', 'errors'], 'message') + raise_if_errors(op_result, ['error', 'errors'], module) time.sleep(1.0) op_result = fetch_resource(module, op_uri, 'compute#operation') status = navigate_hash(op_result, ['status']) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_tcp_proxy.py b/lib/ansible/modules/cloud/google/gcp_compute_target_tcp_proxy.py index 3616220ecd581c..0f522f270848f7 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_tcp_proxy.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_tcp_proxy.py @@ -312,8 +312,8 @@ def return_if_object(module, response, kind, allow_not_found=False): try: module.raise_for_status(response) result = response.json() - except getattr(json.decoder, 'JSONDecodeError', ValueError) as inst: - module.fail_json(msg="Invalid JSON response with error: %s" % inst) + except getattr(json.decoder, 'JSONDecodeError', ValueError): + module.fail_json(msg="Invalid JSON response with error: %s" % response.text) if navigate_hash(result, ['error', 'errors']): module.fail_json(msg=navigate_hash(result, ['error', 'errors'])) @@ -374,7 +374,7 @@ def wait_for_completion(status, op_result, module): op_id = navigate_hash(op_result, ['name']) op_uri = async_op_url(module, {'op_id': op_id}) while status != 'DONE': - raise_if_errors(op_result, ['error', 'errors'], 'message') + raise_if_errors(op_result, ['error', 'errors'], module) time.sleep(1.0) op_result = fetch_resource(module, op_uri, 'compute#operation') status = navigate_hash(op_result, ['status']) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_vpn_gateway.py b/lib/ansible/modules/cloud/google/gcp_compute_target_vpn_gateway.py index b59bdbbc3435d5..b2c263abf585b6 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_vpn_gateway.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_vpn_gateway.py @@ -269,8 +269,8 @@ def return_if_object(module, response, kind, allow_not_found=False): try: module.raise_for_status(response) result = response.json() - except getattr(json.decoder, 'JSONDecodeError', ValueError) as inst: - module.fail_json(msg="Invalid JSON response with error: %s" % inst) + except getattr(json.decoder, 'JSONDecodeError', ValueError): + module.fail_json(msg="Invalid JSON response with error: %s" % response.text) if navigate_hash(result, ['error', 'errors']): module.fail_json(msg=navigate_hash(result, ['error', 'errors'])) @@ -332,7 +332,7 @@ def wait_for_completion(status, op_result, module): op_id = navigate_hash(op_result, ['name']) op_uri = async_op_url(module, {'op_id': op_id}) while status != 'DONE': - raise_if_errors(op_result, ['error', 'errors'], 'message') + raise_if_errors(op_result, ['error', 'errors'], module) time.sleep(1.0) op_result = fetch_resource(module, op_uri, 'compute#operation') status = navigate_hash(op_result, ['status']) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_url_map.py b/lib/ansible/modules/cloud/google/gcp_compute_url_map.py index 711398c3965c00..76f3b61a879255 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_url_map.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_url_map.py @@ -489,8 +489,8 @@ def return_if_object(module, response, kind, allow_not_found=False): try: module.raise_for_status(response) result = response.json() - except getattr(json.decoder, 'JSONDecodeError', ValueError) as inst: - module.fail_json(msg="Invalid JSON response with error: %s" % inst) + except getattr(json.decoder, 'JSONDecodeError', ValueError): + module.fail_json(msg="Invalid JSON response with error: %s" % response.text) if navigate_hash(result, ['error', 'errors']): module.fail_json(msg=navigate_hash(result, ['error', 'errors'])) @@ -554,7 +554,7 @@ def wait_for_completion(status, op_result, module): op_id = navigate_hash(op_result, ['name']) op_uri = async_op_url(module, {'op_id': op_id}) while status != 'DONE': - raise_if_errors(op_result, ['error', 'errors'], 'message') + raise_if_errors(op_result, ['error', 'errors'], module) time.sleep(1.0) op_result = fetch_resource(module, op_uri, 'compute#operation') status = navigate_hash(op_result, ['status']) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_vpn_tunnel.py b/lib/ansible/modules/cloud/google/gcp_compute_vpn_tunnel.py index 33690e68610708..ed644fef386623 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_vpn_tunnel.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_vpn_tunnel.py @@ -399,8 +399,8 @@ def return_if_object(module, response, kind, allow_not_found=False): try: module.raise_for_status(response) result = response.json() - except getattr(json.decoder, 'JSONDecodeError', ValueError) as inst: - module.fail_json(msg="Invalid JSON response with error: %s" % inst) + except getattr(json.decoder, 'JSONDecodeError', ValueError): + module.fail_json(msg="Invalid JSON response with error: %s" % response.text) if navigate_hash(result, ['error', 'errors']): module.fail_json(msg=navigate_hash(result, ['error', 'errors'])) @@ -468,7 +468,7 @@ def wait_for_completion(status, op_result, module): op_id = navigate_hash(op_result, ['name']) op_uri = async_op_url(module, {'op_id': op_id}) while status != 'DONE': - raise_if_errors(op_result, ['error', 'errors'], 'message') + raise_if_errors(op_result, ['error', 'errors'], module) time.sleep(1.0) op_result = fetch_resource(module, op_uri, 'compute#operation') status = navigate_hash(op_result, ['status']) diff --git a/lib/ansible/modules/cloud/google/gcp_container_cluster.py b/lib/ansible/modules/cloud/google/gcp_container_cluster.py index 7bb744c0a93fea..660aed70ab8000 100644 --- a/lib/ansible/modules/cloud/google/gcp_container_cluster.py +++ b/lib/ansible/modules/cloud/google/gcp_container_cluster.py @@ -732,8 +732,8 @@ def return_if_object(module, response, allow_not_found=False): try: module.raise_for_status(response) result = response.json() - except getattr(json.decoder, 'JSONDecodeError', ValueError) as inst: - module.fail_json(msg="Invalid JSON response with error: %s" % inst) + except getattr(json.decoder, 'JSONDecodeError', ValueError): + module.fail_json(msg="Invalid JSON response with error: %s" % response.text) if navigate_hash(result, ['error', 'errors']): module.fail_json(msg=navigate_hash(result, ['error', 'errors'])) @@ -809,7 +809,7 @@ def wait_for_completion(status, op_result, module): op_id = navigate_hash(op_result, ['name']) op_uri = async_op_url(module, {'op_id': op_id}) while status != 'DONE': - raise_if_errors(op_result, ['error', 'errors'], 'message') + raise_if_errors(op_result, ['error', 'errors'], module) time.sleep(1.0) op_result = fetch_resource(module, op_uri) status = navigate_hash(op_result, ['status']) diff --git a/lib/ansible/modules/cloud/google/gcp_container_node_pool.py b/lib/ansible/modules/cloud/google/gcp_container_node_pool.py index 65c7e42f46508a..cb4ca8785d0998 100644 --- a/lib/ansible/modules/cloud/google/gcp_container_node_pool.py +++ b/lib/ansible/modules/cloud/google/gcp_container_node_pool.py @@ -566,8 +566,8 @@ def return_if_object(module, response, allow_not_found=False): try: module.raise_for_status(response) result = response.json() - except getattr(json.decoder, 'JSONDecodeError', ValueError) as inst: - module.fail_json(msg="Invalid JSON response with error: %s" % inst) + except getattr(json.decoder, 'JSONDecodeError', ValueError): + module.fail_json(msg="Invalid JSON response with error: %s" % response.text) if navigate_hash(result, ['error', 'errors']): module.fail_json(msg=navigate_hash(result, ['error', 'errors'])) @@ -628,7 +628,7 @@ def wait_for_completion(status, op_result, module): op_id = navigate_hash(op_result, ['name']) op_uri = async_op_url(module, {'op_id': op_id}) while status != 'DONE': - raise_if_errors(op_result, ['error', 'errors'], 'message') + raise_if_errors(op_result, ['error', 'errors'], module) time.sleep(1.0) op_result = fetch_resource(module, op_uri) status = navigate_hash(op_result, ['status']) diff --git a/lib/ansible/modules/cloud/google/gcp_dns_managed_zone.py b/lib/ansible/modules/cloud/google/gcp_dns_managed_zone.py index db604695e88d57..1030f95bab2d41 100644 --- a/lib/ansible/modules/cloud/google/gcp_dns_managed_zone.py +++ b/lib/ansible/modules/cloud/google/gcp_dns_managed_zone.py @@ -267,8 +267,8 @@ def return_if_object(module, response, kind, allow_not_found=False): try: module.raise_for_status(response) result = response.json() - except getattr(json.decoder, 'JSONDecodeError', ValueError) as inst: - module.fail_json(msg="Invalid JSON response with error: %s" % inst) + except getattr(json.decoder, 'JSONDecodeError', ValueError): + module.fail_json(msg="Invalid JSON response with error: %s" % response.text) if navigate_hash(result, ['error', 'errors']): module.fail_json(msg=navigate_hash(result, ['error', 'errors'])) diff --git a/lib/ansible/modules/cloud/google/gcp_dns_resource_record_set.py b/lib/ansible/modules/cloud/google/gcp_dns_resource_record_set.py index 4cb4b3f2795e9b..50b5f2118875c8 100644 --- a/lib/ansible/modules/cloud/google/gcp_dns_resource_record_set.py +++ b/lib/ansible/modules/cloud/google/gcp_dns_resource_record_set.py @@ -296,8 +296,8 @@ def return_if_object(module, response, kind, allow_not_found=False): try: module.raise_for_status(response) result = response.json() - except getattr(json.decoder, 'JSONDecodeError', ValueError) as inst: - module.fail_json(msg="Invalid JSON response with error: %s" % inst) + except getattr(json.decoder, 'JSONDecodeError', ValueError): + module.fail_json(msg="Invalid JSON response with error: %s" % response.text) if navigate_hash(result, ['error', 'errors']): module.fail_json(msg=navigate_hash(result, ['error', 'errors'])) diff --git a/lib/ansible/modules/cloud/google/gcp_iam_service_account.py b/lib/ansible/modules/cloud/google/gcp_iam_service_account.py index 8cce57fb4cfc5b..e7b6ddcaf574bc 100644 --- a/lib/ansible/modules/cloud/google/gcp_iam_service_account.py +++ b/lib/ansible/modules/cloud/google/gcp_iam_service_account.py @@ -204,8 +204,8 @@ def return_if_object(module, response, allow_not_found=False): try: module.raise_for_status(response) result = response.json() - except getattr(json.decoder, 'JSONDecodeError', ValueError) as inst: - module.fail_json(msg="Invalid JSON response with error: %s" % inst) + except getattr(json.decoder, 'JSONDecodeError', ValueError): + module.fail_json(msg="Invalid JSON response with error: %s" % response.text) result = decode_response(result, module) diff --git a/lib/ansible/modules/cloud/google/gcp_pubsub_subscription.py b/lib/ansible/modules/cloud/google/gcp_pubsub_subscription.py index 1a42048f66bf80..8f67760985bad7 100644 --- a/lib/ansible/modules/cloud/google/gcp_pubsub_subscription.py +++ b/lib/ansible/modules/cloud/google/gcp_pubsub_subscription.py @@ -268,8 +268,8 @@ def return_if_object(module, response, allow_not_found=False): try: module.raise_for_status(response) result = response.json() - except getattr(json.decoder, 'JSONDecodeError', ValueError) as inst: - module.fail_json(msg="Invalid JSON response with error: %s" % inst) + except getattr(json.decoder, 'JSONDecodeError', ValueError): + module.fail_json(msg="Invalid JSON response with error: %s" % response.text) result = decode_request(result, module) diff --git a/lib/ansible/modules/cloud/google/gcp_pubsub_topic.py b/lib/ansible/modules/cloud/google/gcp_pubsub_topic.py index f73cd13655ce80..55380c7eae3a4b 100644 --- a/lib/ansible/modules/cloud/google/gcp_pubsub_topic.py +++ b/lib/ansible/modules/cloud/google/gcp_pubsub_topic.py @@ -170,8 +170,8 @@ def return_if_object(module, response, allow_not_found=False): try: module.raise_for_status(response) result = response.json() - except getattr(json.decoder, 'JSONDecodeError', ValueError) as inst: - module.fail_json(msg="Invalid JSON response with error: %s" % inst) + except getattr(json.decoder, 'JSONDecodeError', ValueError): + module.fail_json(msg="Invalid JSON response with error: %s" % response.text) result = decode_request(result, module) diff --git a/lib/ansible/modules/cloud/google/gcp_resourcemanager_project.py b/lib/ansible/modules/cloud/google/gcp_resourcemanager_project.py index 95c237ef3c8c55..45254ceb9c671d 100644 --- a/lib/ansible/modules/cloud/google/gcp_resourcemanager_project.py +++ b/lib/ansible/modules/cloud/google/gcp_resourcemanager_project.py @@ -329,6 +329,7 @@ def wait_for_operation(module, response): return {} status = navigate_hash(op_result, ['done']) wait_done = wait_for_completion(status, op_result, module) + raise_if_errors(op_result, ['error'], module) return navigate_hash(wait_done, ['response']) @@ -336,7 +337,7 @@ def wait_for_completion(status, op_result, module): op_id = navigate_hash(op_result, ['name']) op_uri = async_op_url(module, {'op_id': op_id}) if not status: - raise_if_errors(op_result, ['error'], 'message') + raise_if_errors(op_result, ['error'], module) time.sleep(1.0) op_result = fetch_resource(module, op_uri) status = navigate_hash(op_result, ['done']) diff --git a/lib/ansible/modules/cloud/google/gcp_spanner_database.py b/lib/ansible/modules/cloud/google/gcp_spanner_database.py index 59e059d970d477..c472ddf10fce94 100644 --- a/lib/ansible/modules/cloud/google/gcp_spanner_database.py +++ b/lib/ansible/modules/cloud/google/gcp_spanner_database.py @@ -230,8 +230,8 @@ def return_if_object(module, response, allow_not_found=False): try: module.raise_for_status(response) result = response.json() - except getattr(json.decoder, 'JSONDecodeError', ValueError) as inst: - module.fail_json(msg="Invalid JSON response with error: %s" % inst) + except getattr(json.decoder, 'JSONDecodeError', ValueError): + module.fail_json(msg="Invalid JSON response with error: %s" % response.text) result = decode_response(result, module) diff --git a/lib/ansible/modules/cloud/google/gcp_spanner_instance.py b/lib/ansible/modules/cloud/google/gcp_spanner_instance.py index 412d28fb5370f5..f13778a92482a2 100644 --- a/lib/ansible/modules/cloud/google/gcp_spanner_instance.py +++ b/lib/ansible/modules/cloud/google/gcp_spanner_instance.py @@ -265,8 +265,8 @@ def return_if_object(module, response, allow_not_found=False): try: module.raise_for_status(response) result = response.json() - except getattr(json.decoder, 'JSONDecodeError', ValueError) as inst: - module.fail_json(msg="Invalid JSON response with error: %s" % inst) + except getattr(json.decoder, 'JSONDecodeError', ValueError): + module.fail_json(msg="Invalid JSON response with error: %s" % response.text) result = decode_response(result, module) diff --git a/lib/ansible/modules/cloud/google/gcp_sql_database.py b/lib/ansible/modules/cloud/google/gcp_sql_database.py index 05000cbbf9ab05..9849480d022ca3 100644 --- a/lib/ansible/modules/cloud/google/gcp_sql_database.py +++ b/lib/ansible/modules/cloud/google/gcp_sql_database.py @@ -295,7 +295,7 @@ def wait_for_completion(status, op_result, module): op_id = navigate_hash(op_result, ['name']) op_uri = async_op_url(module, {'op_id': op_id}) while status != 'DONE': - raise_if_errors(op_result, ['error', 'errors'], 'message') + raise_if_errors(op_result, ['error', 'errors'], module) time.sleep(1.0) op_result = fetch_resource(module, op_uri, 'sql#operation') status = navigate_hash(op_result, ['status']) diff --git a/lib/ansible/modules/cloud/google/gcp_sql_instance.py b/lib/ansible/modules/cloud/google/gcp_sql_instance.py index 239da1e43f762a..67fd0dff78a242 100644 --- a/lib/ansible/modules/cloud/google/gcp_sql_instance.py +++ b/lib/ansible/modules/cloud/google/gcp_sql_instance.py @@ -787,7 +787,7 @@ def wait_for_completion(status, op_result, module): op_id = navigate_hash(op_result, ['name']) op_uri = async_op_url(module, {'op_id': op_id}) while status != 'DONE': - raise_if_errors(op_result, ['error', 'errors'], 'message') + raise_if_errors(op_result, ['error', 'errors'], module) time.sleep(1.0) op_result = fetch_resource(module, op_uri, 'sql#operation') status = navigate_hash(op_result, ['status']) diff --git a/lib/ansible/modules/cloud/google/gcp_sql_user.py b/lib/ansible/modules/cloud/google/gcp_sql_user.py index ebcb60e05d4adb..e782613888c2e8 100644 --- a/lib/ansible/modules/cloud/google/gcp_sql_user.py +++ b/lib/ansible/modules/cloud/google/gcp_sql_user.py @@ -333,7 +333,7 @@ def wait_for_completion(status, op_result, module): op_id = navigate_hash(op_result, ['name']) op_uri = async_op_url(module, {'op_id': op_id}) while status != 'DONE': - raise_if_errors(op_result, ['error', 'errors'], 'message') + raise_if_errors(op_result, ['error', 'errors'], module) time.sleep(1.0) op_result = fetch_resource(module, op_uri, 'sql#operation') status = navigate_hash(op_result, ['status']) diff --git a/lib/ansible/modules/cloud/google/gcp_storage_bucket.py b/lib/ansible/modules/cloud/google/gcp_storage_bucket.py index da40969fae873b..717a309b92a7a1 100644 --- a/lib/ansible/modules/cloud/google/gcp_storage_bucket.py +++ b/lib/ansible/modules/cloud/google/gcp_storage_bucket.py @@ -969,8 +969,8 @@ def return_if_object(module, response, kind, allow_not_found=False): try: module.raise_for_status(response) result = response.json() - except getattr(json.decoder, 'JSONDecodeError', ValueError) as inst: - module.fail_json(msg="Invalid JSON response with error: %s" % inst) + except getattr(json.decoder, 'JSONDecodeError', ValueError): + module.fail_json(msg="Invalid JSON response with error: %s" % response.text) if navigate_hash(result, ['error', 'errors']): module.fail_json(msg=navigate_hash(result, ['error', 'errors'])) diff --git a/lib/ansible/modules/cloud/google/gcp_storage_bucket_access_control.py b/lib/ansible/modules/cloud/google/gcp_storage_bucket_access_control.py index e79e1850fa3de0..fd87e8fc4e32db 100644 --- a/lib/ansible/modules/cloud/google/gcp_storage_bucket_access_control.py +++ b/lib/ansible/modules/cloud/google/gcp_storage_bucket_access_control.py @@ -299,8 +299,8 @@ def return_if_object(module, response, kind, allow_not_found=False): try: module.raise_for_status(response) result = response.json() - except getattr(json.decoder, 'JSONDecodeError', ValueError) as inst: - module.fail_json(msg="Invalid JSON response with error: %s" % inst) + except getattr(json.decoder, 'JSONDecodeError', ValueError): + module.fail_json(msg="Invalid JSON response with error: %s" % response.text) if navigate_hash(result, ['error', 'errors']): module.fail_json(msg=navigate_hash(result, ['error', 'errors'])) From b635141341cd3ffba85fdb770c11f95e5ca9a595 Mon Sep 17 00:00:00 2001 From: The Magician Date: Thu, 17 Jan 2019 13:56:04 -0800 Subject: [PATCH 092/144] Ansible Cloud Source Repositories (#165) Signed-off-by: Modular Magician --- .../cloud/google/gcp_sourcerepo_repository.py | 222 ++++++++++++++++++ .../google/gcp_sourcerepo_repository_facts.py | 137 +++++++++++ .../targets/gcp_sourcerepo_repository/aliases | 2 + .../defaults/main.yml | 3 + .../gcp_sourcerepo_repository/meta/main.yml | 0 .../gcp_sourcerepo_repository/tasks/main.yml | 98 ++++++++ 6 files changed, 462 insertions(+) create mode 100644 lib/ansible/modules/cloud/google/gcp_sourcerepo_repository.py create mode 100644 lib/ansible/modules/cloud/google/gcp_sourcerepo_repository_facts.py create mode 100644 test/integration/targets/gcp_sourcerepo_repository/aliases create mode 100644 test/integration/targets/gcp_sourcerepo_repository/defaults/main.yml create mode 100644 test/integration/targets/gcp_sourcerepo_repository/meta/main.yml create mode 100644 test/integration/targets/gcp_sourcerepo_repository/tasks/main.yml diff --git a/lib/ansible/modules/cloud/google/gcp_sourcerepo_repository.py b/lib/ansible/modules/cloud/google/gcp_sourcerepo_repository.py new file mode 100644 index 00000000000000..23d197747479de --- /dev/null +++ b/lib/ansible/modules/cloud/google/gcp_sourcerepo_repository.py @@ -0,0 +1,222 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# +# Copyright (C) 2017 Google +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) +# ---------------------------------------------------------------------------- +# +# *** AUTO GENERATED CODE *** AUTO GENERATED CODE *** +# +# ---------------------------------------------------------------------------- +# +# This file is automatically generated by Magic Modules and manual +# changes will be clobbered when the file is regenerated. +# +# Please read more about how to change this file at +# https://www.github.com/GoogleCloudPlatform/magic-modules +# +# ---------------------------------------------------------------------------- + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +################################################################################ +# Documentation +################################################################################ + +ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ["preview"], 'supported_by': 'community'} + +DOCUMENTATION = ''' +--- +module: gcp_sourcerepo_repository +description: +- A repository (or repo) is a Git repository storing versioned source content. +short_description: Creates a GCP Repository +version_added: 2.8 +author: Google Inc. (@googlecloudplatform) +requirements: +- python >= 2.6 +- requests >= 2.18.4 +- google-auth >= 1.3.0 +options: + state: + description: + - Whether the given object should exist in GCP + choices: + - present + - absent + default: present + name: + description: + - Resource name of the repository, of the form projects/{{project}}/repos/{{repo}}. + - The repo name may contain slashes. eg, projects/myproject/repos/name/with/slash + . + required: true +extends_documentation_fragment: gcp +notes: +- 'API Reference: U(https://cloud.google.com/source-repositories/docs/reference/rest/v1/projects.repos)' +- 'Official Documentation: U(https://cloud.google.com/source-repositories/)' +''' + +EXAMPLES = ''' +- name: create a repository + gcp_sourcerepo_repository: + name: projects/test_project/repos/test_object + project: "test_project" + auth_kind: "serviceaccount" + service_account_file: "/tmp/auth.pem" + state: present +''' + +RETURN = ''' +name: + description: + - Resource name of the repository, of the form projects/{{project}}/repos/{{repo}}. + - The repo name may contain slashes. eg, projects/myproject/repos/name/with/slash + . + returned: success + type: str +url: + description: + - URL to clone the repository from Google Cloud Source Repositories. + returned: success + type: str +size: + description: + - The disk usage of the repo, in bytes. + returned: success + type: int +''' + +################################################################################ +# Imports +################################################################################ + +from ansible.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest, replace_resource_dict +import json + +################################################################################ +# Main +################################################################################ + + +def main(): + """Main function""" + + module = GcpModule(argument_spec=dict(state=dict(default='present', choices=['present', 'absent'], type='str'), name=dict(required=True, type='str'))) + + if not module.params['scopes']: + module.params['scopes'] = ['https://www.googleapis.com/auth/cloud-platform'] + + state = module.params['state'] + + fetch = fetch_resource(module, self_link(module)) + changed = False + + if fetch: + if state == 'present': + if is_different(module, fetch): + update(module, self_link(module)) + fetch = fetch_resource(module, self_link(module)) + changed = True + else: + delete(module, self_link(module)) + fetch = {} + changed = True + else: + if state == 'present': + fetch = create(module, collection(module)) + changed = True + else: + fetch = {} + + fetch.update({'changed': changed}) + + module.exit_json(**fetch) + + +def create(module, link): + auth = GcpSession(module, 'sourcerepo') + return return_if_object(module, auth.post(link, resource_to_request(module))) + + +def update(module, link): + module.fail_json(msg="Repository cannot be edited") + + +def delete(module, link): + auth = GcpSession(module, 'sourcerepo') + return return_if_object(module, auth.delete(link)) + + +def resource_to_request(module): + request = {u'name': module.params.get('name')} + return_vals = {} + for k, v in request.items(): + if v or v is False: + return_vals[k] = v + + return return_vals + + +def fetch_resource(module, link, allow_not_found=True): + auth = GcpSession(module, 'sourcerepo') + return return_if_object(module, auth.get(link), allow_not_found) + + +def self_link(module): + return "https://sourcerepo.googleapis.com/v1/{name}".format(**module.params) + + +def collection(module): + return "https://sourcerepo.googleapis.com/v1/projects/{project}/repos".format(**module.params) + + +def return_if_object(module, response, allow_not_found=False): + # If not found, return nothing. + if allow_not_found and response.status_code == 404: + return None + + # If no content, return nothing. + if response.status_code == 204: + return None + + try: + module.raise_for_status(response) + result = response.json() + except getattr(json.decoder, 'JSONDecodeError', ValueError) as inst: + module.fail_json(msg="Invalid JSON response with error: %s" % inst) + + if navigate_hash(result, ['error', 'errors']): + module.fail_json(msg=navigate_hash(result, ['error', 'errors'])) + + return result + + +def is_different(module, response): + request = resource_to_request(module) + response = response_to_hash(module, response) + + # Remove all output-only from response. + response_vals = {} + for k, v in response.items(): + if k in request: + response_vals[k] = v + + request_vals = {} + for k, v in request.items(): + if k in response: + request_vals[k] = v + + return GcpRequest(request_vals) != GcpRequest(response_vals) + + +# Remove unnecessary properties from the response. +# This is for doing comparisons with Ansible's current parameters. +def response_to_hash(module, response): + return {u'name': module.params.get('name'), u'url': response.get(u'url'), u'size': response.get(u'size')} + + +if __name__ == '__main__': + main() diff --git a/lib/ansible/modules/cloud/google/gcp_sourcerepo_repository_facts.py b/lib/ansible/modules/cloud/google/gcp_sourcerepo_repository_facts.py new file mode 100644 index 00000000000000..cdf028f27e2943 --- /dev/null +++ b/lib/ansible/modules/cloud/google/gcp_sourcerepo_repository_facts.py @@ -0,0 +1,137 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# +# Copyright (C) 2017 Google +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) +# ---------------------------------------------------------------------------- +# +# *** AUTO GENERATED CODE *** AUTO GENERATED CODE *** +# +# ---------------------------------------------------------------------------- +# +# This file is automatically generated by Magic Modules and manual +# changes will be clobbered when the file is regenerated. +# +# Please read more about how to change this file at +# https://www.github.com/GoogleCloudPlatform/magic-modules +# +# ---------------------------------------------------------------------------- + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +################################################################################ +# Documentation +################################################################################ + +ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ["preview"], 'supported_by': 'community'} + +DOCUMENTATION = ''' +--- +module: gcp_sourcerepo_repository_facts +description: +- Gather facts for GCP Repository +short_description: Gather facts for GCP Repository +version_added: 2.8 +author: Google Inc. (@googlecloudplatform) +requirements: +- python >= 2.6 +- requests >= 2.18.4 +- google-auth >= 1.3.0 +options: {} +extends_documentation_fragment: gcp +''' + +EXAMPLES = ''' +- name: a repository facts + gcp_sourcerepo_repository_facts: + project: test_project + auth_kind: serviceaccount + service_account_file: "/tmp/auth.pem" +''' + +RETURN = ''' +items: + description: List of items + returned: always + type: complex + contains: + name: + description: + - Resource name of the repository, of the form projects/{{project}}/repos/{{repo}}. + - The repo name may contain slashes. eg, projects/myproject/repos/name/with/slash + . + returned: success + type: str + url: + description: + - URL to clone the repository from Google Cloud Source Repositories. + returned: success + type: str + size: + description: + - The disk usage of the repo, in bytes. + returned: success + type: int +''' + +################################################################################ +# Imports +################################################################################ +from ansible.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest +import json + +################################################################################ +# Main +################################################################################ + + +def main(): + module = GcpModule(argument_spec=dict()) + + if not module.params['scopes']: + module.params['scopes'] = ['https://www.googleapis.com/auth/cloud-platform'] + + items = fetch_list(module, collection(module)) + if items.get('repos'): + items = items.get('repos') + else: + items = [] + return_value = {'items': items} + module.exit_json(**return_value) + + +def collection(module): + return "https://sourcerepo.googleapis.com/v1/projects/{project}/repos".format(**module.params) + + +def fetch_list(module, link): + auth = GcpSession(module, 'sourcerepo') + response = auth.get(link) + return return_if_object(module, response) + + +def return_if_object(module, response): + # If not found, return nothing. + if response.status_code == 404: + return None + + # If no content, return nothing. + if response.status_code == 204: + return None + + try: + module.raise_for_status(response) + result = response.json() + except getattr(json.decoder, 'JSONDecodeError', ValueError) as inst: + module.fail_json(msg="Invalid JSON response with error: %s" % inst) + + if navigate_hash(result, ['error', 'errors']): + module.fail_json(msg=navigate_hash(result, ['error', 'errors'])) + + return result + + +if __name__ == "__main__": + main() diff --git a/test/integration/targets/gcp_sourcerepo_repository/aliases b/test/integration/targets/gcp_sourcerepo_repository/aliases new file mode 100644 index 00000000000000..9812f019ca4bae --- /dev/null +++ b/test/integration/targets/gcp_sourcerepo_repository/aliases @@ -0,0 +1,2 @@ +cloud/gcp +unsupported diff --git a/test/integration/targets/gcp_sourcerepo_repository/defaults/main.yml b/test/integration/targets/gcp_sourcerepo_repository/defaults/main.yml new file mode 100644 index 00000000000000..aa87a2a8e0e0e0 --- /dev/null +++ b/test/integration/targets/gcp_sourcerepo_repository/defaults/main.yml @@ -0,0 +1,3 @@ +--- +# defaults file +resource_name: '{{resource_prefix}}' diff --git a/test/integration/targets/gcp_sourcerepo_repository/meta/main.yml b/test/integration/targets/gcp_sourcerepo_repository/meta/main.yml new file mode 100644 index 00000000000000..e69de29bb2d1d6 diff --git a/test/integration/targets/gcp_sourcerepo_repository/tasks/main.yml b/test/integration/targets/gcp_sourcerepo_repository/tasks/main.yml new file mode 100644 index 00000000000000..bd3048a3c305b2 --- /dev/null +++ b/test/integration/targets/gcp_sourcerepo_repository/tasks/main.yml @@ -0,0 +1,98 @@ +--- +# ---------------------------------------------------------------------------- +# +# *** AUTO GENERATED CODE *** AUTO GENERATED CODE *** +# +# ---------------------------------------------------------------------------- +# +# This file is automatically generated by Magic Modules and manual +# changes will be clobbered when the file is regenerated. +# +# Please read more about how to change this file at +# https://www.github.com/GoogleCloudPlatform/magic-modules +# +# ---------------------------------------------------------------------------- +# Pre-test setup +- name: delete a repository + gcp_sourcerepo_repository: + name: projects/{{ gcp_project }}/repos/{{ resource_name }} + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent +#---------------------------------------------------------- +- name: create a repository + gcp_sourcerepo_repository: + name: projects/{{ gcp_project }}/repos/{{ resource_name }} + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present + register: result +- name: assert changed is true + assert: + that: + - result.changed == true +- name: verify that repository was created + gcp_sourcerepo_repository_facts: + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + scopes: + - https://www.googleapis.com/auth/cloud-platform + register: results +- name: verify that command succeeded + assert: + that: + - results['items'] | length >= 1 +# ---------------------------------------------------------------------------- +- name: create a repository that already exists + gcp_sourcerepo_repository: + name: projects/{{ gcp_project }}/repos/{{ resource_name }} + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present + register: result +- name: assert changed is false + assert: + that: + - result.changed == false +#---------------------------------------------------------- +- name: delete a repository + gcp_sourcerepo_repository: + name: projects/{{ gcp_project }}/repos/{{ resource_name }} + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: result +- name: assert changed is true + assert: + that: + - result.changed == true +- name: verify that repository was deleted + gcp_sourcerepo_repository_facts: + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + scopes: + - https://www.googleapis.com/auth/cloud-platform + register: results +- name: verify that command succeeded + assert: + that: + - results['items'] | length == 0 +# ---------------------------------------------------------------------------- +- name: delete a repository that does not exist + gcp_sourcerepo_repository: + name: projects/{{ gcp_project }}/repos/{{ resource_name }} + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: result +- name: assert changed is false + assert: + that: + - result.changed == false From 439dcc2e4e8589c7e5eeb86a824ee5d445ec75e7 Mon Sep 17 00:00:00 2001 From: The Magician Date: Thu, 17 Jan 2019 16:13:39 -0800 Subject: [PATCH 093/144] Fixing method name (#172) /cc @rambleraptor --- lib/ansible/modules/cloud/google/gcp_sourcerepo_repository.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/ansible/modules/cloud/google/gcp_sourcerepo_repository.py b/lib/ansible/modules/cloud/google/gcp_sourcerepo_repository.py index 23d197747479de..43cb36efc1b5d1 100644 --- a/lib/ansible/modules/cloud/google/gcp_sourcerepo_repository.py +++ b/lib/ansible/modules/cloud/google/gcp_sourcerepo_repository.py @@ -185,8 +185,8 @@ def return_if_object(module, response, allow_not_found=False): try: module.raise_for_status(response) result = response.json() - except getattr(json.decoder, 'JSONDecodeError', ValueError) as inst: - module.fail_json(msg="Invalid JSON response with error: %s" % inst) + except getattr(json.decoder, 'JSONDecodeError', ValueError): + module.fail_json(msg="Invalid JSON response with error: %s" % response.text) if navigate_hash(result, ['error', 'errors']): module.fail_json(msg=navigate_hash(result, ['error', 'errors'])) From 8eb9167f5481cdd1c3ef96138075746319bc03bd Mon Sep 17 00:00:00 2001 From: The Magician Date: Tue, 22 Jan 2019 12:35:33 -0800 Subject: [PATCH 094/144] Description / doc changes related to spanner instances in Terraform. (#171) Signed-off-by: Modular Magician --- .../cloud/google/gcp_spanner_instance.py | 110 ++++++++++-------- .../google/gcp_spanner_instance_facts.py | 27 ++--- 2 files changed, 70 insertions(+), 67 deletions(-) diff --git a/lib/ansible/modules/cloud/google/gcp_spanner_instance.py b/lib/ansible/modules/cloud/google/gcp_spanner_instance.py index f13778a92482a2..c6d607ec9fcdae 100644 --- a/lib/ansible/modules/cloud/google/gcp_spanner_instance.py +++ b/lib/ansible/modules/cloud/google/gcp_spanner_instance.py @@ -50,13 +50,17 @@ name: description: - A unique identifier for the instance, which cannot be changed after the instance - is created. Values are of the form projects//instances/[a-z][-a-z0-9]*[a-z0-9]. - The final segment of the name must be between 6 and 30 characters in length. - required: false + is created. The name must be between 6 and 30 characters in length. + required: true config: description: - - A reference to the instance configuration. - required: false + - The name of the instance's configuration (similar but not quite the same as + a region) which defines defines the geographic placement and replication of + your databases in this instance. It determines where your data is stored. Values + are typically of the form `regional-europe-west1` , `us-central` etc. + - In order to obtain a valid list please consult the [Configuration section of + the docs](U(https://cloud.google.com/spanner/docs/instances).) + required: true display_name: description: - The descriptive name for this instance as it appears in UIs. Must be unique @@ -66,28 +70,16 @@ description: - The number of nodes allocated to this instance. required: false + default: '1' labels: description: - - Cloud Labels are a flexible and lightweight mechanism for organizing cloud resources - into groups that reflect a customer's organizational needs and deployment strategies. - Cloud Labels can be used to filter collections of resources. They can be used - to control how resource metrics are aggregated. And they can be used as arguments - to policy management rules (e.g. route, firewall, load balancing, etc.). - - 'Label keys must be between 1 and 63 characters long and must conform to the - following regular expression: `[a-z]([-a-z0-9]*[a-z0-9])?`.' - - Label values must be between 0 and 63 characters long and must conform to the - regular expression `([a-z]([-a-z0-9]*[a-z0-9])?)?`. - - No more than 64 labels can be associated with a given resource. - - See U(https://goo.gl/xmQnxf) for more information on and examples of labels. - - 'If you plan to use labels in your own code, please note that additional characters - may be allowed in the future. And so you are advised to use an internal label - representation, such as JSON, which doesn''t rely upon specific characters being - disallowed. For example, representing labels as the string: name + "_" + value - would prove problematic if we were to allow "_" in a future release.' - 'An object containing a list of "key": value pairs.' - 'Example: { "name": "wrench", "mass": "1.3kg", "count": "3" }.' required: false extends_documentation_fragment: gcp +notes: +- 'API Reference: U(https://cloud.google.com/spanner/docs/reference/rest/v1/projects.instances)' +- 'Official Documentation: U(https://cloud.google.com/spanner/)' ''' EXAMPLES = ''' @@ -109,13 +101,17 @@ name: description: - A unique identifier for the instance, which cannot be changed after the instance - is created. Values are of the form projects//instances/[a-z][-a-z0-9]*[a-z0-9]. - The final segment of the name must be between 6 and 30 characters in length. + is created. The name must be between 6 and 30 characters in length. returned: success type: str config: description: - - A reference to the instance configuration. + - The name of the instance's configuration (similar but not quite the same as a + region) which defines defines the geographic placement and replication of your + databases in this instance. It determines where your data is stored. Values are + typically of the form `regional-europe-west1` , `us-central` etc. + - In order to obtain a valid list please consult the [Configuration section of the + docs](U(https://cloud.google.com/spanner/docs/instances).) returned: success type: str displayName: @@ -131,22 +127,6 @@ type: int labels: description: - - Cloud Labels are a flexible and lightweight mechanism for organizing cloud resources - into groups that reflect a customer's organizational needs and deployment strategies. - Cloud Labels can be used to filter collections of resources. They can be used - to control how resource metrics are aggregated. And they can be used as arguments - to policy management rules (e.g. route, firewall, load balancing, etc.). - - 'Label keys must be between 1 and 63 characters long and must conform to the following - regular expression: `[a-z]([-a-z0-9]*[a-z0-9])?`.' - - Label values must be between 0 and 63 characters long and must conform to the - regular expression `([a-z]([-a-z0-9]*[a-z0-9])?)?`. - - No more than 64 labels can be associated with a given resource. - - See U(https://goo.gl/xmQnxf) for more information on and examples of labels. - - 'If you plan to use labels in your own code, please note that additional characters - may be allowed in the future. And so you are advised to use an internal label - representation, such as JSON, which doesn''t rely upon specific characters being - disallowed. For example, representing labels as the string: name + "_" + value - would prove problematic if we were to allow "_" in a future release.' - 'An object containing a list of "key": value pairs.' - 'Example: { "name": "wrench", "mass": "1.3kg", "count": "3" }.' returned: success @@ -159,6 +139,7 @@ from ansible.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest, replace_resource_dict import json +import time ################################################################################ # Main @@ -171,10 +152,10 @@ def main(): module = GcpModule( argument_spec=dict( state=dict(default='present', choices=['present', 'absent'], type='str'), - name=dict(type='str'), - config=dict(type='str'), + name=dict(required=True, type='str'), + config=dict(required=True, type='str'), display_name=dict(required=True, type='str'), - node_count=dict(type='int'), + node_count=dict(default=1, type='int'), labels=dict(type='dict'), ) ) @@ -211,17 +192,17 @@ def main(): def create(module, link): auth = GcpSession(module, 'spanner') - return return_if_object(module, auth.post(link, resource_to_create(module))) + return wait_for_operation(module, auth.post(link, resource_to_create(module))) def update(module, link): auth = GcpSession(module, 'spanner') - return return_if_object(module, auth.patch(link, resource_to_update(module))) + return wait_for_operation(module, auth.patch(link, resource_to_update(module))) def delete(module, link): auth = GcpSession(module, 'spanner') - return return_if_object(module, auth.delete(link)) + return wait_for_operation(module, auth.delete(link)) def resource_to_request(module): @@ -299,7 +280,7 @@ def is_different(module, response): # This is for doing comparisons with Ansible's current parameters. def response_to_hash(module, response): return { - u'name': response.get(u'name'), + u'name': module.params.get('name'), u'config': response.get(u'config'), u'displayName': response.get(u'displayName'), u'nodeCount': response.get(u'nodeCount'), @@ -307,6 +288,41 @@ def response_to_hash(module, response): } +def async_op_url(module, extra_data=None): + if extra_data is None: + extra_data = {} + url = "https://spanner.googleapis.com/v1/projects/{project}/global/operations/{op_id}" + combined = extra_data.copy() + combined.update(module.params) + return url.format(**combined) + + +def wait_for_operation(module, response): + op_result = return_if_object(module, response) + if op_result is None: + return {} + status = navigate_hash(op_result, ['status']) + wait_done = wait_for_completion(status, op_result, module) + return fetch_resource(module, navigate_hash(wait_done, ['targetLink'])) + + +def wait_for_completion(status, op_result, module): + op_id = navigate_hash(op_result, ['name']) + op_uri = async_op_url(module, {'op_id': op_id}) + while status != 'DONE': + raise_if_errors(op_result, ['error', 'errors'], module) + time.sleep(1.0) + op_result = fetch_resource(module, op_uri) + status = navigate_hash(op_result, ['status']) + return op_result + + +def raise_if_errors(response, err_path, module): + errors = navigate_hash(response, err_path) + if errors is not None: + module.fail_json(msg=errors) + + def resource_to_create(module): instance = resource_to_request(module) instance['name'] = "projects/{0}/instances/{1}".format(module.params['project'], module.params['name']) diff --git a/lib/ansible/modules/cloud/google/gcp_spanner_instance_facts.py b/lib/ansible/modules/cloud/google/gcp_spanner_instance_facts.py index 07af4a459d7510..918bfae2b1caba 100644 --- a/lib/ansible/modules/cloud/google/gcp_spanner_instance_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_spanner_instance_facts.py @@ -60,13 +60,17 @@ name: description: - A unique identifier for the instance, which cannot be changed after the instance - is created. Values are of the form projects//instances/[a-z][-a-z0-9]*[a-z0-9]. - The final segment of the name must be between 6 and 30 characters in length. + is created. The name must be between 6 and 30 characters in length. returned: success type: str config: description: - - A reference to the instance configuration. + - The name of the instance's configuration (similar but not quite the same as + a region) which defines defines the geographic placement and replication of + your databases in this instance. It determines where your data is stored. + Values are typically of the form `regional-europe-west1` , `us-central` etc. + - In order to obtain a valid list please consult the [Configuration section + of the docs](U(https://cloud.google.com/spanner/docs/instances).) returned: success type: str displayName: @@ -82,23 +86,6 @@ type: int labels: description: - - Cloud Labels are a flexible and lightweight mechanism for organizing cloud - resources into groups that reflect a customer's organizational needs and deployment - strategies. Cloud Labels can be used to filter collections of resources. They - can be used to control how resource metrics are aggregated. And they can be - used as arguments to policy management rules (e.g. route, firewall, load balancing, - etc.). - - 'Label keys must be between 1 and 63 characters long and must conform to the - following regular expression: `[a-z]([-a-z0-9]*[a-z0-9])?`.' - - Label values must be between 0 and 63 characters long and must conform to - the regular expression `([a-z]([-a-z0-9]*[a-z0-9])?)?`. - - No more than 64 labels can be associated with a given resource. - - See U(https://goo.gl/xmQnxf) for more information on and examples of labels. - - 'If you plan to use labels in your own code, please note that additional characters - may be allowed in the future. And so you are advised to use an internal label - representation, such as JSON, which doesn''t rely upon specific characters - being disallowed. For example, representing labels as the string: name + "_" - + value would prove problematic if we were to allow "_" in a future release.' - 'An object containing a list of "key": value pairs.' - 'Example: { "name": "wrench", "mass": "1.3kg", "count": "3" }.' returned: success From 015e4aaa59cf6a321c14e6e0a7aa130196d033be Mon Sep 17 00:00:00 2001 From: The Magician Date: Tue, 22 Jan 2019 13:11:12 -0800 Subject: [PATCH 095/144] Add vlan tag and subnet candidates to Interconnect Attachments. (#166) Signed-off-by: Modular Magician --- .../gcp_compute_interconnect_attachment.py | 36 +++++++++++++++++++ ...p_compute_interconnect_attachment_facts.py | 16 +++++++++ 2 files changed, 52 insertions(+) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_interconnect_attachment.py b/lib/ansible/modules/cloud/google/gcp_compute_interconnect_attachment.py index 4e32450e5d5e50..ac70e94158ebdc 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_interconnect_attachment.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_interconnect_attachment.py @@ -77,6 +77,20 @@ characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash. required: true + candidate_subnets: + description: + - Up to 16 candidate prefixes that can be used to restrict the allocation of cloudRouterIpAddress + and customerRouterIpAddress for this attachment. + - All prefixes must be within link-local address space (169.254.0.0/16) and must + be /29 or shorter (/28, /27, etc). Google will attempt to select an unused /29 + from the supplied candidate prefix(es). The request will fail if all possible + /29s are in use on Google's edge. If not supplied, Google will randomly select + an unused /29 from all of link-local space. + required: false + vlan_tag8021q: + description: + - The IEEE 802.1Q VLAN tag for this attachment, in the range 2-4094. + required: false region: description: - Region where the regional interconnect attachment resides. @@ -169,6 +183,22 @@ which cannot be a dash. returned: success type: str +candidateSubnets: + description: + - Up to 16 candidate prefixes that can be used to restrict the allocation of cloudRouterIpAddress + and customerRouterIpAddress for this attachment. + - All prefixes must be within link-local address space (169.254.0.0/16) and must + be /29 or shorter (/28, /27, etc). Google will attempt to select an unused /29 + from the supplied candidate prefix(es). The request will fail if all possible + /29s are in use on Google's edge. If not supplied, Google will randomly select + an unused /29 from all of link-local space. + returned: success + type: list +vlanTag8021q: + description: + - The IEEE 802.1Q VLAN tag for this attachment, in the range 2-4094. + returned: success + type: int region: description: - Region where the regional interconnect attachment resides. @@ -200,6 +230,8 @@ def main(): description=dict(type='str'), router=dict(required=True), name=dict(required=True, type='str'), + candidate_subnets=dict(type='list', elements='str'), + vlan_tag8021q=dict(type='int'), region=dict(required=True, type='str'), ) ) @@ -256,6 +288,8 @@ def resource_to_request(module): u'description': module.params.get('description'), u'router': replace_resource_dict(module.params.get(u'router', {}), 'selfLink'), u'name': module.params.get('name'), + u'candidateSubnets': module.params.get('candidate_subnets'), + u'vlanTag8021q': module.params.get('vlan_tag8021q'), } return_vals = {} for k, v in request.items(): @@ -331,6 +365,8 @@ def response_to_hash(module, response): u'creationTimestamp': response.get(u'creationTimestamp'), u'id': response.get(u'id'), u'name': response.get(u'name'), + u'candidateSubnets': response.get(u'candidateSubnets'), + u'vlanTag8021q': response.get(u'vlanTag8021q'), } diff --git a/lib/ansible/modules/cloud/google/gcp_compute_interconnect_attachment_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_interconnect_attachment_facts.py index 69a3bc215e56c9..482c7b0621ac6a 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_interconnect_attachment_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_interconnect_attachment_facts.py @@ -140,6 +140,22 @@ which cannot be a dash. returned: success type: str + candidateSubnets: + description: + - Up to 16 candidate prefixes that can be used to restrict the allocation of + cloudRouterIpAddress and customerRouterIpAddress for this attachment. + - All prefixes must be within link-local address space (169.254.0.0/16) and + must be /29 or shorter (/28, /27, etc). Google will attempt to select an unused + /29 from the supplied candidate prefix(es). The request will fail if all possible + /29s are in use on Google's edge. If not supplied, Google will randomly select + an unused /29 from all of link-local space. + returned: success + type: list + vlanTag8021q: + description: + - The IEEE 802.1Q VLAN tag for this attachment, in the range 2-4094. + returned: success + type: int region: description: - Region where the regional interconnect attachment resides. From e78303e59160b6314f784d7d19c1986c7a6a2acd Mon Sep 17 00:00:00 2001 From: The Magician Date: Wed, 23 Jan 2019 12:27:53 -0800 Subject: [PATCH 096/144] Adding exception type on Ansible Service Account Keys (#174) /cc @rambleraptor --- lib/ansible/modules/cloud/google/gcp_iam_service_account_key.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ansible/modules/cloud/google/gcp_iam_service_account_key.py b/lib/ansible/modules/cloud/google/gcp_iam_service_account_key.py index a1057798b5ff48..daaa3d6a5f3df6 100644 --- a/lib/ansible/modules/cloud/google/gcp_iam_service_account_key.py +++ b/lib/ansible/modules/cloud/google/gcp_iam_service_account_key.py @@ -238,7 +238,7 @@ def key_name_from_file(filename, module): try: json_data = json.loads(f.read()) return "projects/{project_id}/serviceAccounts/{client_email}/keys/{private_key_id}".format(**json_data) - except: + except ValueError as inst: module.fail_json(msg="File is not a valid GCP JSON service account key") From c26f617b6be7525143edb242b6ca7e21c2209a4b Mon Sep 17 00:00:00 2001 From: The Magician Date: Mon, 28 Jan 2019 12:08:00 -0800 Subject: [PATCH 097/144] Ansible Redis (#173) /cc @rambleraptor --- .../gcp_dns_resource_record_set_facts.py | 2 +- .../cloud/google/gcp_redis_instance.py | 465 ++++++++++++++++++ .../cloud/google/gcp_redis_instance_facts.py | 226 +++++++++ .../google/gcp_resourcemanager_project.py | 2 +- .../targets/gcp_redis_instance/aliases | 2 + .../gcp_redis_instance/defaults/main.yml | 3 + .../targets/gcp_redis_instance/meta/main.yml | 0 .../targets/gcp_redis_instance/tasks/main.yml | 170 +++++++ 8 files changed, 868 insertions(+), 2 deletions(-) create mode 100644 lib/ansible/modules/cloud/google/gcp_redis_instance.py create mode 100644 lib/ansible/modules/cloud/google/gcp_redis_instance_facts.py create mode 100644 test/integration/targets/gcp_redis_instance/aliases create mode 100644 test/integration/targets/gcp_redis_instance/defaults/main.yml create mode 100644 test/integration/targets/gcp_redis_instance/meta/main.yml create mode 100644 test/integration/targets/gcp_redis_instance/tasks/main.yml diff --git a/lib/ansible/modules/cloud/google/gcp_dns_resource_record_set_facts.py b/lib/ansible/modules/cloud/google/gcp_dns_resource_record_set_facts.py index 683487e82ed698..f40930857a7982 100644 --- a/lib/ansible/modules/cloud/google/gcp_dns_resource_record_set_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_dns_resource_record_set_facts.py @@ -123,7 +123,7 @@ def main(): def collection(module): res = {'project': module.params['project'], 'managed_zone': replace_resource_dict(module.params['managed_zone'], 'name')} - return "https://www.googleapis.com/dns/v1/projects/{project}/managedZones/{managed_zone}/rrsets".format(**res) + return "https://www.googleapis.com/dns/v1/projects/{project}/managedZones/{managed_zone}/changes".format(**res) def fetch_list(module, link): diff --git a/lib/ansible/modules/cloud/google/gcp_redis_instance.py b/lib/ansible/modules/cloud/google/gcp_redis_instance.py new file mode 100644 index 00000000000000..c096b0ba1a85fa --- /dev/null +++ b/lib/ansible/modules/cloud/google/gcp_redis_instance.py @@ -0,0 +1,465 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# +# Copyright (C) 2017 Google +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) +# ---------------------------------------------------------------------------- +# +# *** AUTO GENERATED CODE *** AUTO GENERATED CODE *** +# +# ---------------------------------------------------------------------------- +# +# This file is automatically generated by Magic Modules and manual +# changes will be clobbered when the file is regenerated. +# +# Please read more about how to change this file at +# https://www.github.com/GoogleCloudPlatform/magic-modules +# +# ---------------------------------------------------------------------------- + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +################################################################################ +# Documentation +################################################################################ + +ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ["preview"], 'supported_by': 'community'} + +DOCUMENTATION = ''' +--- +module: gcp_redis_instance +description: +- A Google Cloud Redis instance. +short_description: Creates a GCP Instance +version_added: 2.8 +author: Google Inc. (@googlecloudplatform) +requirements: +- python >= 2.6 +- requests >= 2.18.4 +- google-auth >= 1.3.0 +options: + state: + description: + - Whether the given object should exist in GCP + choices: + - present + - absent + default: present + alternative_location_id: + description: + - Only applicable to STANDARD_HA tier which protects the instance against zonal + failures by provisioning it across two zones. + - If provided, it must be a different zone from the one provided in [locationId]. + required: false + authorized_network: + description: + - The full name of the Google Compute Engine network to which the instance is + connected. If left unspecified, the default network will be used. + required: false + display_name: + description: + - An arbitrary and optional user-provided name for the instance. + required: false + labels: + description: + - Resource labels to represent user provided metadata. + required: false + redis_configs: + description: + - Redis configuration parameters, according to U(http://redis.io/topics/config.) + - 'Please check Memorystore documentation for the list of supported parameters: + U(https://cloud.google.com/memorystore/docs/redis/reference/rest/v1/projects.locations.instances#Instance.FIELDS.redis_configs) + .' + required: false + location_id: + description: + - The zone where the instance will be provisioned. If not provided, the service + will choose a zone for the instance. For STANDARD_HA tier, instances will be + created across two zones for protection against zonal failures. If [alternativeLocationId] + is also provided, it must be different from [locationId]. + required: false + name: + description: + - The ID of the instance or a fully qualified identifier for the instance. . + required: true + memory_size_gb: + description: + - Redis memory size in GiB. + required: true + redis_version: + description: + - The version of Redis software. If not provided, latest supported version will + be used. Updating the version will perform an upgrade/downgrade to the new version. + Currently, the supported values are REDIS_3_2 for Redis 3.2. + required: false + reserved_ip_range: + description: + - The CIDR range of internal addresses that are reserved for this instance. If + not provided, the service will choose an unused /29 block, for example, 10.0.0.0/29 + or 192.168.0.0/29. Ranges must be unique and non-overlapping with existing subnets + in an authorized network. + required: false + tier: + description: + - 'The service tier of the instance. Must be one of these values: - BASIC: standalone + instance - STANDARD_HA: highly available primary/replica instances .' + required: false + default: BASIC + choices: + - BASIC + - STANDARD_HA + region: + description: + - The name of the Redis region of the instance. + required: true +extends_documentation_fragment: gcp +notes: +- 'API Reference: U(https://cloud.google.com/memorystore/docs/redis/reference/rest/)' +- 'Official Documentation: U(https://cloud.google.com/memorystore/docs/redis/)' +''' + +EXAMPLES = ''' +- name: create a network + gcp_compute_network: + name: "network-instance" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present + register: network + +- name: create a instance + gcp_redis_instance: + name: instance37 + tier: STANDARD_HA + memory_size_gb: 1 + region: us-central1 + location_id: us-central1-a + redis_version: REDIS_3_2 + display_name: Ansible Test Instance + reserved_ip_range: 192.168.0.0/29 + labels: + my_key: my_val + other_key: other_val + project: "test_project" + auth_kind: "serviceaccount" + service_account_file: "/tmp/auth.pem" + state: present +''' + +RETURN = ''' +alternativeLocationId: + description: + - Only applicable to STANDARD_HA tier which protects the instance against zonal + failures by provisioning it across two zones. + - If provided, it must be a different zone from the one provided in [locationId]. + returned: success + type: str +authorizedNetwork: + description: + - The full name of the Google Compute Engine network to which the instance is connected. + If left unspecified, the default network will be used. + returned: success + type: str +createTime: + description: + - The time the instance was created in RFC3339 UTC "Zulu" format, accurate to nanoseconds. + returned: success + type: str +currentLocationId: + description: + - The current zone where the Redis endpoint is placed. + - For Basic Tier instances, this will always be the same as the [locationId] provided + by the user at creation time. For Standard Tier instances, this can be either + [locationId] or [alternativeLocationId] and can change after a failover event. + returned: success + type: str +displayName: + description: + - An arbitrary and optional user-provided name for the instance. + returned: success + type: str +host: + description: + - Hostname or IP address of the exposed Redis endpoint used by clients to connect + to the service. + returned: success + type: str +labels: + description: + - Resource labels to represent user provided metadata. + returned: success + type: dict +redisConfigs: + description: + - Redis configuration parameters, according to U(http://redis.io/topics/config.) + - 'Please check Memorystore documentation for the list of supported parameters: + U(https://cloud.google.com/memorystore/docs/redis/reference/rest/v1/projects.locations.instances#Instance.FIELDS.redis_configs) + .' + returned: success + type: dict +locationId: + description: + - The zone where the instance will be provisioned. If not provided, the service + will choose a zone for the instance. For STANDARD_HA tier, instances will be created + across two zones for protection against zonal failures. If [alternativeLocationId] + is also provided, it must be different from [locationId]. + returned: success + type: str +name: + description: + - The ID of the instance or a fully qualified identifier for the instance. . + returned: success + type: str +memorySizeGb: + description: + - Redis memory size in GiB. + returned: success + type: int +port: + description: + - The port number of the exposed Redis endpoint. + returned: success + type: int +redisVersion: + description: + - The version of Redis software. If not provided, latest supported version will + be used. Updating the version will perform an upgrade/downgrade to the new version. + Currently, the supported values are REDIS_3_2 for Redis 3.2. + returned: success + type: str +reservedIpRange: + description: + - The CIDR range of internal addresses that are reserved for this instance. If not + provided, the service will choose an unused /29 block, for example, 10.0.0.0/29 + or 192.168.0.0/29. Ranges must be unique and non-overlapping with existing subnets + in an authorized network. + returned: success + type: str +tier: + description: + - 'The service tier of the instance. Must be one of these values: - BASIC: standalone + instance - STANDARD_HA: highly available primary/replica instances .' + returned: success + type: str +region: + description: + - The name of the Redis region of the instance. + returned: success + type: str +''' + +################################################################################ +# Imports +################################################################################ + +from ansible.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest, replace_resource_dict +import json +import time + +################################################################################ +# Main +################################################################################ + + +def main(): + """Main function""" + + module = GcpModule( + argument_spec=dict( + state=dict(default='present', choices=['present', 'absent'], type='str'), + alternative_location_id=dict(type='str'), + authorized_network=dict(type='str'), + display_name=dict(type='str'), + labels=dict(type='dict'), + redis_configs=dict(type='dict'), + location_id=dict(type='str'), + name=dict(required=True, type='str'), + memory_size_gb=dict(required=True, type='int'), + redis_version=dict(type='str'), + reserved_ip_range=dict(type='str'), + tier=dict(default='BASIC', type='str', choices=['BASIC', 'STANDARD_HA']), + region=dict(required=True, type='str'), + ) + ) + + if not module.params['scopes']: + module.params['scopes'] = ['https://www.googleapis.com/auth/cloud-platform'] + + state = module.params['state'] + + fetch = fetch_resource(module, self_link(module)) + changed = False + + if fetch: + if state == 'present': + if is_different(module, fetch): + update(module, self_link(module)) + fetch = fetch_resource(module, self_link(module)) + changed = True + else: + delete(module, self_link(module)) + fetch = {} + changed = True + else: + if state == 'present': + fetch = create(module, collection(module)) + changed = True + else: + fetch = {} + + fetch.update({'changed': changed}) + + module.exit_json(**fetch) + + +def create(module, link): + auth = GcpSession(module, 'redis') + return wait_for_operation(module, auth.post(link, resource_to_request(module))) + + +def update(module, link): + module.fail_json(msg="Instance cannot be edited") + + +def delete(module, link): + auth = GcpSession(module, 'redis') + return wait_for_operation(module, auth.delete(link)) + + +def resource_to_request(module): + request = { + u'alternativeLocationId': module.params.get('alternative_location_id'), + u'authorizedNetwork': module.params.get('authorized_network'), + u'displayName': module.params.get('display_name'), + u'labels': module.params.get('labels'), + u'redisConfigs': module.params.get('redis_configs'), + u'locationId': module.params.get('location_id'), + u'name': module.params.get('name'), + u'memorySizeGb': module.params.get('memory_size_gb'), + u'redisVersion': module.params.get('redis_version'), + u'reservedIpRange': module.params.get('reserved_ip_range'), + u'tier': module.params.get('tier'), + } + return_vals = {} + for k, v in request.items(): + if v or v is False: + return_vals[k] = v + + return return_vals + + +def fetch_resource(module, link, allow_not_found=True): + auth = GcpSession(module, 'redis') + return return_if_object(module, auth.get(link), allow_not_found) + + +def self_link(module): + return "https://redis.googleapis.com/v1/projects/{project}/locations/{region}/instances/{name}".format(**module.params) + + +def collection(module): + return "https://redis.googleapis.com/v1/projects/{project}/locations/{region}/instances?instanceId={name}".format(**module.params) + + +def return_if_object(module, response, allow_not_found=False): + # If not found, return nothing. + if allow_not_found and response.status_code == 404: + return None + + # If no content, return nothing. + if response.status_code == 204: + return None + + try: + module.raise_for_status(response) + result = response.json() + except getattr(json.decoder, 'JSONDecodeError', ValueError): + module.fail_json(msg="Invalid JSON response with error: %s" % response.text) + + if navigate_hash(result, ['error', 'errors']): + module.fail_json(msg=navigate_hash(result, ['error', 'errors'])) + + return result + + +def is_different(module, response): + request = resource_to_request(module) + response = response_to_hash(module, response) + + # Remove all output-only from response. + response_vals = {} + for k, v in response.items(): + if k in request: + response_vals[k] = v + + request_vals = {} + for k, v in request.items(): + if k in response: + request_vals[k] = v + + return GcpRequest(request_vals) != GcpRequest(response_vals) + + +# Remove unnecessary properties from the response. +# This is for doing comparisons with Ansible's current parameters. +def response_to_hash(module, response): + return { + u'alternativeLocationId': module.params.get('alternative_location_id'), + u'authorizedNetwork': module.params.get('authorized_network'), + u'createTime': response.get(u'createTime'), + u'currentLocationId': module.params.get('current_location_id'), + u'displayName': response.get(u'displayName'), + u'host': response.get(u'host'), + u'labels': response.get(u'labels'), + u'redisConfigs': response.get(u'redisConfigs'), + u'locationId': module.params.get('location_id'), + u'name': module.params.get('name'), + u'memorySizeGb': response.get(u'memorySizeGb'), + u'port': response.get(u'port'), + u'redisVersion': module.params.get('redis_version'), + u'reservedIpRange': module.params.get('reserved_ip_range'), + u'tier': module.params.get('tier'), + } + + +def async_op_url(module, extra_data=None): + if extra_data is None: + extra_data = {} + url = "https://redis.googleapis.com/v1/{op_id}" + combined = extra_data.copy() + combined.update(module.params) + return url.format(**combined) + + +def wait_for_operation(module, response): + op_result = return_if_object(module, response) + if op_result is None: + return {} + status = navigate_hash(op_result, ['done']) + wait_done = wait_for_completion(status, op_result, module) + raise_if_errors(op_result, ['error'], module) + return navigate_hash(wait_done, ['response']) + + +def wait_for_completion(status, op_result, module): + op_id = navigate_hash(op_result, ['name']) + op_uri = async_op_url(module, {'op_id': op_id}) + while not status: + raise_if_errors(op_result, ['error'], module) + time.sleep(1.0) + op_result = fetch_resource(module, op_uri) + status = navigate_hash(op_result, ['done']) + return op_result + + +def raise_if_errors(response, err_path, module): + errors = navigate_hash(response, err_path) + if errors is not None: + module.fail_json(msg=errors) + + +if __name__ == '__main__': + main() diff --git a/lib/ansible/modules/cloud/google/gcp_redis_instance_facts.py b/lib/ansible/modules/cloud/google/gcp_redis_instance_facts.py new file mode 100644 index 00000000000000..6a00cf4a3f601c --- /dev/null +++ b/lib/ansible/modules/cloud/google/gcp_redis_instance_facts.py @@ -0,0 +1,226 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# +# Copyright (C) 2017 Google +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) +# ---------------------------------------------------------------------------- +# +# *** AUTO GENERATED CODE *** AUTO GENERATED CODE *** +# +# ---------------------------------------------------------------------------- +# +# This file is automatically generated by Magic Modules and manual +# changes will be clobbered when the file is regenerated. +# +# Please read more about how to change this file at +# https://www.github.com/GoogleCloudPlatform/magic-modules +# +# ---------------------------------------------------------------------------- + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +################################################################################ +# Documentation +################################################################################ + +ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ["preview"], 'supported_by': 'community'} + +DOCUMENTATION = ''' +--- +module: gcp_redis_instance_facts +description: +- Gather facts for GCP Instance +short_description: Gather facts for GCP Instance +version_added: 2.8 +author: Google Inc. (@googlecloudplatform) +requirements: +- python >= 2.6 +- requests >= 2.18.4 +- google-auth >= 1.3.0 +options: + region: + description: + - The name of the Redis region of the instance. + required: true +extends_documentation_fragment: gcp +''' + +EXAMPLES = ''' +- name: a instance facts + gcp_redis_instance_facts: + region: us-central1 + project: test_project + auth_kind: serviceaccount + service_account_file: "/tmp/auth.pem" +''' + +RETURN = ''' +items: + description: List of items + returned: always + type: complex + contains: + alternativeLocationId: + description: + - Only applicable to STANDARD_HA tier which protects the instance against zonal + failures by provisioning it across two zones. + - If provided, it must be a different zone from the one provided in [locationId]. + returned: success + type: str + authorizedNetwork: + description: + - The full name of the Google Compute Engine network to which the instance is + connected. If left unspecified, the default network will be used. + returned: success + type: str + createTime: + description: + - The time the instance was created in RFC3339 UTC "Zulu" format, accurate to + nanoseconds. + returned: success + type: str + currentLocationId: + description: + - The current zone where the Redis endpoint is placed. + - For Basic Tier instances, this will always be the same as the [locationId] + provided by the user at creation time. For Standard Tier instances, this can + be either [locationId] or [alternativeLocationId] and can change after a failover + event. + returned: success + type: str + displayName: + description: + - An arbitrary and optional user-provided name for the instance. + returned: success + type: str + host: + description: + - Hostname or IP address of the exposed Redis endpoint used by clients to connect + to the service. + returned: success + type: str + labels: + description: + - Resource labels to represent user provided metadata. + returned: success + type: dict + redisConfigs: + description: + - Redis configuration parameters, according to U(http://redis.io/topics/config.) + - 'Please check Memorystore documentation for the list of supported parameters: + U(https://cloud.google.com/memorystore/docs/redis/reference/rest/v1/projects.locations.instances#Instance.FIELDS.redis_configs) + .' + returned: success + type: dict + locationId: + description: + - The zone where the instance will be provisioned. If not provided, the service + will choose a zone for the instance. For STANDARD_HA tier, instances will + be created across two zones for protection against zonal failures. If [alternativeLocationId] + is also provided, it must be different from [locationId]. + returned: success + type: str + name: + description: + - The ID of the instance or a fully qualified identifier for the instance. . + returned: success + type: str + memorySizeGb: + description: + - Redis memory size in GiB. + returned: success + type: int + port: + description: + - The port number of the exposed Redis endpoint. + returned: success + type: int + redisVersion: + description: + - The version of Redis software. If not provided, latest supported version will + be used. Updating the version will perform an upgrade/downgrade to the new + version. Currently, the supported values are REDIS_3_2 for Redis 3.2. + returned: success + type: str + reservedIpRange: + description: + - The CIDR range of internal addresses that are reserved for this instance. + If not provided, the service will choose an unused /29 block, for example, + 10.0.0.0/29 or 192.168.0.0/29. Ranges must be unique and non-overlapping with + existing subnets in an authorized network. + returned: success + type: str + tier: + description: + - 'The service tier of the instance. Must be one of these values: - BASIC: standalone + instance - STANDARD_HA: highly available primary/replica instances .' + returned: success + type: str + region: + description: + - The name of the Redis region of the instance. + returned: success + type: str +''' + +################################################################################ +# Imports +################################################################################ +from ansible.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest +import json + +################################################################################ +# Main +################################################################################ + + +def main(): + module = GcpModule(argument_spec=dict(region=dict(required=True, type='str'))) + + if not module.params['scopes']: + module.params['scopes'] = ['https://www.googleapis.com/auth/cloud-platform'] + + items = fetch_list(module, collection(module)) + if items.get('instances'): + items = items.get('instances') + else: + items = [] + return_value = {'items': items} + module.exit_json(**return_value) + + +def collection(module): + return "https://redis.googleapis.com/v1/projects/{project}/locations/{region}/instances".format(**module.params) + + +def fetch_list(module, link): + auth = GcpSession(module, 'redis') + response = auth.get(link) + return return_if_object(module, response) + + +def return_if_object(module, response): + # If not found, return nothing. + if response.status_code == 404: + return None + + # If no content, return nothing. + if response.status_code == 204: + return None + + try: + module.raise_for_status(response) + result = response.json() + except getattr(json.decoder, 'JSONDecodeError', ValueError) as inst: + module.fail_json(msg="Invalid JSON response with error: %s" % inst) + + if navigate_hash(result, ['error', 'errors']): + module.fail_json(msg=navigate_hash(result, ['error', 'errors'])) + + return result + + +if __name__ == "__main__": + main() diff --git a/lib/ansible/modules/cloud/google/gcp_resourcemanager_project.py b/lib/ansible/modules/cloud/google/gcp_resourcemanager_project.py index 45254ceb9c671d..90d10c9848a74d 100644 --- a/lib/ansible/modules/cloud/google/gcp_resourcemanager_project.py +++ b/lib/ansible/modules/cloud/google/gcp_resourcemanager_project.py @@ -336,7 +336,7 @@ def wait_for_operation(module, response): def wait_for_completion(status, op_result, module): op_id = navigate_hash(op_result, ['name']) op_uri = async_op_url(module, {'op_id': op_id}) - if not status: + while not status: raise_if_errors(op_result, ['error'], module) time.sleep(1.0) op_result = fetch_resource(module, op_uri) diff --git a/test/integration/targets/gcp_redis_instance/aliases b/test/integration/targets/gcp_redis_instance/aliases new file mode 100644 index 00000000000000..9812f019ca4bae --- /dev/null +++ b/test/integration/targets/gcp_redis_instance/aliases @@ -0,0 +1,2 @@ +cloud/gcp +unsupported diff --git a/test/integration/targets/gcp_redis_instance/defaults/main.yml b/test/integration/targets/gcp_redis_instance/defaults/main.yml new file mode 100644 index 00000000000000..aa87a2a8e0e0e0 --- /dev/null +++ b/test/integration/targets/gcp_redis_instance/defaults/main.yml @@ -0,0 +1,3 @@ +--- +# defaults file +resource_name: '{{resource_prefix}}' diff --git a/test/integration/targets/gcp_redis_instance/meta/main.yml b/test/integration/targets/gcp_redis_instance/meta/main.yml new file mode 100644 index 00000000000000..e69de29bb2d1d6 diff --git a/test/integration/targets/gcp_redis_instance/tasks/main.yml b/test/integration/targets/gcp_redis_instance/tasks/main.yml new file mode 100644 index 00000000000000..b260311b942871 --- /dev/null +++ b/test/integration/targets/gcp_redis_instance/tasks/main.yml @@ -0,0 +1,170 @@ +--- +# ---------------------------------------------------------------------------- +# +# *** AUTO GENERATED CODE *** AUTO GENERATED CODE *** +# +# ---------------------------------------------------------------------------- +# +# This file is automatically generated by Magic Modules and manual +# changes will be clobbered when the file is regenerated. +# +# Please read more about how to change this file at +# https://www.github.com/GoogleCloudPlatform/magic-modules +# +# ---------------------------------------------------------------------------- +# Pre-test setup +- name: create a network + gcp_compute_network: + name: "network-instance" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present + register: network +- name: delete a instance + gcp_redis_instance: + name: instance37 + tier: STANDARD_HA + memory_size_gb: 1 + region: us-central1 + location_id: us-central1-a + redis_version: REDIS_3_2 + display_name: Ansible Test Instance + reserved_ip_range: 192.168.0.0/29 + labels: + my_key: my_val + other_key: other_val + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent +#---------------------------------------------------------- +- name: create a instance + gcp_redis_instance: + name: instance37 + tier: STANDARD_HA + memory_size_gb: 1 + region: us-central1 + location_id: us-central1-a + redis_version: REDIS_3_2 + display_name: Ansible Test Instance + reserved_ip_range: 192.168.0.0/29 + labels: + my_key: my_val + other_key: other_val + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present + register: result +- name: assert changed is true + assert: + that: + - result.changed == true +- name: verify that instance was created + gcp_redis_instance_facts: + region: us-central1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + scopes: + - https://www.googleapis.com/auth/cloud-platform + register: results +- name: verify that command succeeded + assert: + that: + - results['items'] | length >= 1 +# ---------------------------------------------------------------------------- +- name: create a instance that already exists + gcp_redis_instance: + name: instance37 + tier: STANDARD_HA + memory_size_gb: 1 + region: us-central1 + location_id: us-central1-a + redis_version: REDIS_3_2 + display_name: Ansible Test Instance + reserved_ip_range: 192.168.0.0/29 + labels: + my_key: my_val + other_key: other_val + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present + register: result +- name: assert changed is false + assert: + that: + - result.changed == false +#---------------------------------------------------------- +- name: delete a instance + gcp_redis_instance: + name: instance37 + tier: STANDARD_HA + memory_size_gb: 1 + region: us-central1 + location_id: us-central1-a + redis_version: REDIS_3_2 + display_name: Ansible Test Instance + reserved_ip_range: 192.168.0.0/29 + labels: + my_key: my_val + other_key: other_val + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: result +- name: assert changed is true + assert: + that: + - result.changed == true +- name: verify that instance was deleted + gcp_redis_instance_facts: + region: us-central1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + scopes: + - https://www.googleapis.com/auth/cloud-platform + register: results +- name: verify that command succeeded + assert: + that: + - results['items'] | length == 0 +# ---------------------------------------------------------------------------- +- name: delete a instance that does not exist + gcp_redis_instance: + name: instance37 + tier: STANDARD_HA + memory_size_gb: 1 + region: us-central1 + location_id: us-central1-a + redis_version: REDIS_3_2 + display_name: Ansible Test Instance + reserved_ip_range: 192.168.0.0/29 + labels: + my_key: my_val + other_key: other_val + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: result +- name: assert changed is false + assert: + that: + - result.changed == false +#--------------------------------------------------------- +# Post-test teardown +# If errors happen, don't crash the playbook! +- name: delete a network + gcp_compute_network: + name: "network-instance" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: network + ignore_errors: true From e62380f5046a6aa8835e3c79f3e51c164e014c27 Mon Sep 17 00:00:00 2001 From: The Magician Date: Tue, 29 Jan 2019 12:26:26 -0800 Subject: [PATCH 098/144] Upstream PR that fixed gcp_utils bug (#177) /cc @rambleraptor --- lib/ansible/module_utils/gcp_utils.py | 2 +- lib/ansible/modules/cloud/google/gcp_dns_resource_record_set.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/ansible/module_utils/gcp_utils.py b/lib/ansible/module_utils/gcp_utils.py index 46bb2b88637ce2..65cd877781d2fc 100644 --- a/lib/ansible/module_utils/gcp_utils.py +++ b/lib/ansible/module_utils/gcp_utils.py @@ -69,7 +69,7 @@ def replace_resource_dict(item, value): new_item = ast.literal_eval(item) return replace_resource_dict(new_item, value) except ValueError: - return new_item + return item # Handles all authentication and HTTP sessions for GCP API calls. diff --git a/lib/ansible/modules/cloud/google/gcp_dns_resource_record_set.py b/lib/ansible/modules/cloud/google/gcp_dns_resource_record_set.py index 50b5f2118875c8..d87bd82de3b6ce 100644 --- a/lib/ansible/modules/cloud/google/gcp_dns_resource_record_set.py +++ b/lib/ansible/modules/cloud/google/gcp_dns_resource_record_set.py @@ -376,7 +376,7 @@ def prefetch_soa_resource(module): result = fetch_wrapped_resource(resource, 'dns#resourceRecordSet', 'dns#resourceRecordSetsListResponse', 'rrsets') if not result: - raise ValueError("Google DNS Managed Zone %s not found" % module.params['managed_zone']['name']) + raise ValueError("Google DNS Managed Zone %s not found" % replace_resource_dict(module.params['managed_zone'], 'name')) return result From 7081caaa8518c72d974399794db83fb67f2620e5 Mon Sep 17 00:00:00 2001 From: The Magician Date: Tue, 29 Jan 2019 15:50:53 -0800 Subject: [PATCH 099/144] Fix URL in documentation (#178) Signed-off-by: Modular Magician --- lib/ansible/modules/cloud/google/gcp_compute_address_facts.py | 2 +- .../modules/cloud/google/gcp_compute_backend_bucket_facts.py | 2 +- .../modules/cloud/google/gcp_compute_backend_service_facts.py | 2 +- lib/ansible/modules/cloud/google/gcp_compute_disk_facts.py | 2 +- lib/ansible/modules/cloud/google/gcp_compute_firewall_facts.py | 2 +- .../modules/cloud/google/gcp_compute_forwarding_rule_facts.py | 2 +- .../modules/cloud/google/gcp_compute_global_address_facts.py | 2 +- .../cloud/google/gcp_compute_global_forwarding_rule_facts.py | 2 +- .../modules/cloud/google/gcp_compute_health_check_facts.py | 2 +- .../modules/cloud/google/gcp_compute_http_health_check_facts.py | 2 +- .../cloud/google/gcp_compute_https_health_check_facts.py | 2 +- lib/ansible/modules/cloud/google/gcp_compute_image_facts.py | 2 +- lib/ansible/modules/cloud/google/gcp_compute_instance_facts.py | 2 +- .../modules/cloud/google/gcp_compute_instance_group_facts.py | 2 +- .../cloud/google/gcp_compute_instance_group_manager_facts.py | 2 +- .../modules/cloud/google/gcp_compute_instance_template_facts.py | 2 +- .../cloud/google/gcp_compute_interconnect_attachment_facts.py | 2 +- lib/ansible/modules/cloud/google/gcp_compute_network_facts.py | 2 +- .../modules/cloud/google/gcp_compute_region_disk_facts.py | 2 +- lib/ansible/modules/cloud/google/gcp_compute_route_facts.py | 2 +- lib/ansible/modules/cloud/google/gcp_compute_router_facts.py | 2 +- .../modules/cloud/google/gcp_compute_ssl_certificate_facts.py | 2 +- .../modules/cloud/google/gcp_compute_ssl_policy_facts.py | 2 +- .../modules/cloud/google/gcp_compute_subnetwork_facts.py | 2 +- .../modules/cloud/google/gcp_compute_target_http_proxy_facts.py | 2 +- .../cloud/google/gcp_compute_target_https_proxy_facts.py | 2 +- .../modules/cloud/google/gcp_compute_target_pool_facts.py | 2 +- .../modules/cloud/google/gcp_compute_target_ssl_proxy_facts.py | 2 +- .../modules/cloud/google/gcp_compute_target_tcp_proxy_facts.py | 2 +- .../cloud/google/gcp_compute_target_vpn_gateway_facts.py | 2 +- lib/ansible/modules/cloud/google/gcp_compute_url_map_facts.py | 2 +- .../modules/cloud/google/gcp_compute_vpn_tunnel_facts.py | 2 +- 32 files changed, 32 insertions(+), 32 deletions(-) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_address_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_address_facts.py index e423a0306f97e6..6eefbae74d523b 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_address_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_address_facts.py @@ -42,7 +42,7 @@ options: filters: description: - - A list of filter value pairs. Available filters are listed here U(U(https://cloud.google.com/sdk/gcloud/reference/topic/filters).) + - A list of filter value pairs. Available filters are listed here U(https://cloud.google.com/sdk/gcloud/reference/topic/filters.) - Each additional filter in the list will act be added as an AND condition (filter1 and filter2) . region: diff --git a/lib/ansible/modules/cloud/google/gcp_compute_backend_bucket_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_backend_bucket_facts.py index f53b46d5158571..5588340851ba35 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_backend_bucket_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_backend_bucket_facts.py @@ -42,7 +42,7 @@ options: filters: description: - - A list of filter value pairs. Available filters are listed here U(U(https://cloud.google.com/sdk/gcloud/reference/topic/filters).) + - A list of filter value pairs. Available filters are listed here U(https://cloud.google.com/sdk/gcloud/reference/topic/filters.) - Each additional filter in the list will act be added as an AND condition (filter1 and filter2) . extends_documentation_fragment: gcp diff --git a/lib/ansible/modules/cloud/google/gcp_compute_backend_service_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_backend_service_facts.py index 6916604b931905..3abdd1f5228d80 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_backend_service_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_backend_service_facts.py @@ -42,7 +42,7 @@ options: filters: description: - - A list of filter value pairs. Available filters are listed here U(U(https://cloud.google.com/sdk/gcloud/reference/topic/filters).) + - A list of filter value pairs. Available filters are listed here U(https://cloud.google.com/sdk/gcloud/reference/topic/filters.) - Each additional filter in the list will act be added as an AND condition (filter1 and filter2) . extends_documentation_fragment: gcp diff --git a/lib/ansible/modules/cloud/google/gcp_compute_disk_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_disk_facts.py index 56f618967dc432..286ff33d3db3ee 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_disk_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_disk_facts.py @@ -42,7 +42,7 @@ options: filters: description: - - A list of filter value pairs. Available filters are listed here U(U(https://cloud.google.com/sdk/gcloud/reference/topic/filters).) + - A list of filter value pairs. Available filters are listed here U(https://cloud.google.com/sdk/gcloud/reference/topic/filters.) - Each additional filter in the list will act be added as an AND condition (filter1 and filter2) . zone: diff --git a/lib/ansible/modules/cloud/google/gcp_compute_firewall_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_firewall_facts.py index d20437654940be..782236e4da1c97 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_firewall_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_firewall_facts.py @@ -42,7 +42,7 @@ options: filters: description: - - A list of filter value pairs. Available filters are listed here U(U(https://cloud.google.com/sdk/gcloud/reference/topic/filters).) + - A list of filter value pairs. Available filters are listed here U(https://cloud.google.com/sdk/gcloud/reference/topic/filters.) - Each additional filter in the list will act be added as an AND condition (filter1 and filter2) . extends_documentation_fragment: gcp diff --git a/lib/ansible/modules/cloud/google/gcp_compute_forwarding_rule_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_forwarding_rule_facts.py index 7a4f749e28318a..c4dc80b55d42d5 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_forwarding_rule_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_forwarding_rule_facts.py @@ -42,7 +42,7 @@ options: filters: description: - - A list of filter value pairs. Available filters are listed here U(U(https://cloud.google.com/sdk/gcloud/reference/topic/filters).) + - A list of filter value pairs. Available filters are listed here U(https://cloud.google.com/sdk/gcloud/reference/topic/filters.) - Each additional filter in the list will act be added as an AND condition (filter1 and filter2) . region: diff --git a/lib/ansible/modules/cloud/google/gcp_compute_global_address_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_global_address_facts.py index c326c9fb81bcb1..4d5b8955289ae5 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_global_address_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_global_address_facts.py @@ -42,7 +42,7 @@ options: filters: description: - - A list of filter value pairs. Available filters are listed here U(U(https://cloud.google.com/sdk/gcloud/reference/topic/filters).) + - A list of filter value pairs. Available filters are listed here U(https://cloud.google.com/sdk/gcloud/reference/topic/filters.) - Each additional filter in the list will act be added as an AND condition (filter1 and filter2) . extends_documentation_fragment: gcp diff --git a/lib/ansible/modules/cloud/google/gcp_compute_global_forwarding_rule_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_global_forwarding_rule_facts.py index f5076f79210cd2..84f514404bde6a 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_global_forwarding_rule_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_global_forwarding_rule_facts.py @@ -42,7 +42,7 @@ options: filters: description: - - A list of filter value pairs. Available filters are listed here U(U(https://cloud.google.com/sdk/gcloud/reference/topic/filters).) + - A list of filter value pairs. Available filters are listed here U(https://cloud.google.com/sdk/gcloud/reference/topic/filters.) - Each additional filter in the list will act be added as an AND condition (filter1 and filter2) . extends_documentation_fragment: gcp 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 1635466a8225c8..8db32afba7d373 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 @@ -42,7 +42,7 @@ options: filters: description: - - A list of filter value pairs. Available filters are listed here U(U(https://cloud.google.com/sdk/gcloud/reference/topic/filters).) + - A list of filter value pairs. Available filters are listed here U(https://cloud.google.com/sdk/gcloud/reference/topic/filters.) - Each additional filter in the list will act be added as an AND condition (filter1 and filter2) . extends_documentation_fragment: gcp diff --git a/lib/ansible/modules/cloud/google/gcp_compute_http_health_check_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_http_health_check_facts.py index 1bbea3f6333b65..5594d91360003b 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_http_health_check_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_http_health_check_facts.py @@ -42,7 +42,7 @@ options: filters: description: - - A list of filter value pairs. Available filters are listed here U(U(https://cloud.google.com/sdk/gcloud/reference/topic/filters).) + - A list of filter value pairs. Available filters are listed here U(https://cloud.google.com/sdk/gcloud/reference/topic/filters.) - Each additional filter in the list will act be added as an AND condition (filter1 and filter2) . extends_documentation_fragment: gcp diff --git a/lib/ansible/modules/cloud/google/gcp_compute_https_health_check_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_https_health_check_facts.py index 47605bfe9c8950..4bd372b6899aa0 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_https_health_check_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_https_health_check_facts.py @@ -42,7 +42,7 @@ options: filters: description: - - A list of filter value pairs. Available filters are listed here U(U(https://cloud.google.com/sdk/gcloud/reference/topic/filters).) + - A list of filter value pairs. Available filters are listed here U(https://cloud.google.com/sdk/gcloud/reference/topic/filters.) - Each additional filter in the list will act be added as an AND condition (filter1 and filter2) . extends_documentation_fragment: gcp diff --git a/lib/ansible/modules/cloud/google/gcp_compute_image_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_image_facts.py index a9b67bf847786c..d745044c94940c 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_image_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_image_facts.py @@ -42,7 +42,7 @@ options: filters: description: - - A list of filter value pairs. Available filters are listed here U(U(https://cloud.google.com/sdk/gcloud/reference/topic/filters).) + - A list of filter value pairs. Available filters are listed here U(https://cloud.google.com/sdk/gcloud/reference/topic/filters.) - Each additional filter in the list will act be added as an AND condition (filter1 and filter2) . extends_documentation_fragment: gcp diff --git a/lib/ansible/modules/cloud/google/gcp_compute_instance_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_instance_facts.py index 7840d6b4414303..44187d879a65fc 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_instance_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_instance_facts.py @@ -42,7 +42,7 @@ options: filters: description: - - A list of filter value pairs. Available filters are listed here U(U(https://cloud.google.com/sdk/gcloud/reference/topic/filters).) + - A list of filter value pairs. Available filters are listed here U(https://cloud.google.com/sdk/gcloud/reference/topic/filters.) - Each additional filter in the list will act be added as an AND condition (filter1 and filter2) . zone: diff --git a/lib/ansible/modules/cloud/google/gcp_compute_instance_group_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_instance_group_facts.py index 0486890a0ed506..e01d25043854af 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_instance_group_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_instance_group_facts.py @@ -42,7 +42,7 @@ options: filters: description: - - A list of filter value pairs. Available filters are listed here U(U(https://cloud.google.com/sdk/gcloud/reference/topic/filters).) + - A list of filter value pairs. Available filters are listed here U(https://cloud.google.com/sdk/gcloud/reference/topic/filters.) - Each additional filter in the list will act be added as an AND condition (filter1 and filter2) . zone: diff --git a/lib/ansible/modules/cloud/google/gcp_compute_instance_group_manager_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_instance_group_manager_facts.py index 03f2caee85085d..17250efc2456d9 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_instance_group_manager_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_instance_group_manager_facts.py @@ -42,7 +42,7 @@ options: filters: description: - - A list of filter value pairs. Available filters are listed here U(U(https://cloud.google.com/sdk/gcloud/reference/topic/filters).) + - A list of filter value pairs. Available filters are listed here U(https://cloud.google.com/sdk/gcloud/reference/topic/filters.) - Each additional filter in the list will act be added as an AND condition (filter1 and filter2) . zone: diff --git a/lib/ansible/modules/cloud/google/gcp_compute_instance_template_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_instance_template_facts.py index 190c4b3ee5493c..38e264c9b47fe3 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_instance_template_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_instance_template_facts.py @@ -42,7 +42,7 @@ options: filters: description: - - A list of filter value pairs. Available filters are listed here U(U(https://cloud.google.com/sdk/gcloud/reference/topic/filters).) + - A list of filter value pairs. Available filters are listed here U(https://cloud.google.com/sdk/gcloud/reference/topic/filters.) - Each additional filter in the list will act be added as an AND condition (filter1 and filter2) . extends_documentation_fragment: gcp diff --git a/lib/ansible/modules/cloud/google/gcp_compute_interconnect_attachment_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_interconnect_attachment_facts.py index 482c7b0621ac6a..1605afc995ac79 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_interconnect_attachment_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_interconnect_attachment_facts.py @@ -42,7 +42,7 @@ options: filters: description: - - A list of filter value pairs. Available filters are listed here U(U(https://cloud.google.com/sdk/gcloud/reference/topic/filters).) + - A list of filter value pairs. Available filters are listed here U(https://cloud.google.com/sdk/gcloud/reference/topic/filters.) - Each additional filter in the list will act be added as an AND condition (filter1 and filter2) . region: diff --git a/lib/ansible/modules/cloud/google/gcp_compute_network_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_network_facts.py index 6a61d555713652..6f2594ae96a948 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_network_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_network_facts.py @@ -42,7 +42,7 @@ options: filters: description: - - A list of filter value pairs. Available filters are listed here U(U(https://cloud.google.com/sdk/gcloud/reference/topic/filters).) + - A list of filter value pairs. Available filters are listed here U(https://cloud.google.com/sdk/gcloud/reference/topic/filters.) - Each additional filter in the list will act be added as an AND condition (filter1 and filter2) . extends_documentation_fragment: gcp diff --git a/lib/ansible/modules/cloud/google/gcp_compute_region_disk_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_region_disk_facts.py index 9d7d15b2e3302b..8fd6202707228e 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_region_disk_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_region_disk_facts.py @@ -42,7 +42,7 @@ options: filters: description: - - A list of filter value pairs. Available filters are listed here U(U(https://cloud.google.com/sdk/gcloud/reference/topic/filters).) + - A list of filter value pairs. Available filters are listed here U(https://cloud.google.com/sdk/gcloud/reference/topic/filters.) - Each additional filter in the list will act be added as an AND condition (filter1 and filter2) . region: diff --git a/lib/ansible/modules/cloud/google/gcp_compute_route_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_route_facts.py index 65fc91b225163b..965189b252f9d6 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_route_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_route_facts.py @@ -42,7 +42,7 @@ options: filters: description: - - A list of filter value pairs. Available filters are listed here U(U(https://cloud.google.com/sdk/gcloud/reference/topic/filters).) + - A list of filter value pairs. Available filters are listed here U(https://cloud.google.com/sdk/gcloud/reference/topic/filters.) - Each additional filter in the list will act be added as an AND condition (filter1 and filter2) . extends_documentation_fragment: gcp diff --git a/lib/ansible/modules/cloud/google/gcp_compute_router_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_router_facts.py index 2d142c7346a3f9..1ef82f2e044d8e 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_router_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_router_facts.py @@ -42,7 +42,7 @@ options: filters: description: - - A list of filter value pairs. Available filters are listed here U(U(https://cloud.google.com/sdk/gcloud/reference/topic/filters).) + - A list of filter value pairs. Available filters are listed here U(https://cloud.google.com/sdk/gcloud/reference/topic/filters.) - Each additional filter in the list will act be added as an AND condition (filter1 and filter2) . region: diff --git a/lib/ansible/modules/cloud/google/gcp_compute_ssl_certificate_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_ssl_certificate_facts.py index 12463218cf78a3..51e16a94b4dd79 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_ssl_certificate_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_ssl_certificate_facts.py @@ -42,7 +42,7 @@ options: filters: description: - - A list of filter value pairs. Available filters are listed here U(U(https://cloud.google.com/sdk/gcloud/reference/topic/filters).) + - A list of filter value pairs. Available filters are listed here U(https://cloud.google.com/sdk/gcloud/reference/topic/filters.) - Each additional filter in the list will act be added as an AND condition (filter1 and filter2) . extends_documentation_fragment: gcp diff --git a/lib/ansible/modules/cloud/google/gcp_compute_ssl_policy_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_ssl_policy_facts.py index 62c1c3fcc7ad65..c620ec05b8bb49 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_ssl_policy_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_ssl_policy_facts.py @@ -42,7 +42,7 @@ options: filters: description: - - A list of filter value pairs. Available filters are listed here U(U(https://cloud.google.com/sdk/gcloud/reference/topic/filters).) + - A list of filter value pairs. Available filters are listed here U(https://cloud.google.com/sdk/gcloud/reference/topic/filters.) - Each additional filter in the list will act be added as an AND condition (filter1 and filter2) . extends_documentation_fragment: gcp diff --git a/lib/ansible/modules/cloud/google/gcp_compute_subnetwork_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_subnetwork_facts.py index 746448d60ca87e..0c6a4e52d59f96 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_subnetwork_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_subnetwork_facts.py @@ -42,7 +42,7 @@ options: filters: description: - - A list of filter value pairs. Available filters are listed here U(U(https://cloud.google.com/sdk/gcloud/reference/topic/filters).) + - A list of filter value pairs. Available filters are listed here U(https://cloud.google.com/sdk/gcloud/reference/topic/filters.) - Each additional filter in the list will act be added as an AND condition (filter1 and filter2) . region: diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_http_proxy_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_target_http_proxy_facts.py index ea39b5241e4bec..b7f56b9c6f159b 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_http_proxy_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_http_proxy_facts.py @@ -42,7 +42,7 @@ options: filters: description: - - A list of filter value pairs. Available filters are listed here U(U(https://cloud.google.com/sdk/gcloud/reference/topic/filters).) + - A list of filter value pairs. Available filters are listed here U(https://cloud.google.com/sdk/gcloud/reference/topic/filters.) - Each additional filter in the list will act be added as an AND condition (filter1 and filter2) . extends_documentation_fragment: gcp diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_https_proxy_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_target_https_proxy_facts.py index d579b36412b8df..e68a89728d3a22 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_https_proxy_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_https_proxy_facts.py @@ -42,7 +42,7 @@ options: filters: description: - - A list of filter value pairs. Available filters are listed here U(U(https://cloud.google.com/sdk/gcloud/reference/topic/filters).) + - A list of filter value pairs. Available filters are listed here U(https://cloud.google.com/sdk/gcloud/reference/topic/filters.) - Each additional filter in the list will act be added as an AND condition (filter1 and filter2) . extends_documentation_fragment: gcp diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_pool_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_target_pool_facts.py index 146495f7e8fb3b..05332d6a112cef 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_pool_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_pool_facts.py @@ -42,7 +42,7 @@ options: filters: description: - - A list of filter value pairs. Available filters are listed here U(U(https://cloud.google.com/sdk/gcloud/reference/topic/filters).) + - A list of filter value pairs. Available filters are listed here U(https://cloud.google.com/sdk/gcloud/reference/topic/filters.) - Each additional filter in the list will act be added as an AND condition (filter1 and filter2) . region: diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_ssl_proxy_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_target_ssl_proxy_facts.py index 4b6bc30312ce99..237ed188bfee45 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_ssl_proxy_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_ssl_proxy_facts.py @@ -42,7 +42,7 @@ options: filters: description: - - A list of filter value pairs. Available filters are listed here U(U(https://cloud.google.com/sdk/gcloud/reference/topic/filters).) + - A list of filter value pairs. Available filters are listed here U(https://cloud.google.com/sdk/gcloud/reference/topic/filters.) - Each additional filter in the list will act be added as an AND condition (filter1 and filter2) . extends_documentation_fragment: gcp diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_tcp_proxy_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_target_tcp_proxy_facts.py index 2ffcedc028f4b2..82c16cc1ab6457 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_tcp_proxy_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_tcp_proxy_facts.py @@ -42,7 +42,7 @@ options: filters: description: - - A list of filter value pairs. Available filters are listed here U(U(https://cloud.google.com/sdk/gcloud/reference/topic/filters).) + - A list of filter value pairs. Available filters are listed here U(https://cloud.google.com/sdk/gcloud/reference/topic/filters.) - Each additional filter in the list will act be added as an AND condition (filter1 and filter2) . extends_documentation_fragment: gcp diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_vpn_gateway_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_target_vpn_gateway_facts.py index 7d51d39761cd17..cdb5992650154c 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_vpn_gateway_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_vpn_gateway_facts.py @@ -42,7 +42,7 @@ options: filters: description: - - A list of filter value pairs. Available filters are listed here U(U(https://cloud.google.com/sdk/gcloud/reference/topic/filters).) + - A list of filter value pairs. Available filters are listed here U(https://cloud.google.com/sdk/gcloud/reference/topic/filters.) - Each additional filter in the list will act be added as an AND condition (filter1 and filter2) . region: diff --git a/lib/ansible/modules/cloud/google/gcp_compute_url_map_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_url_map_facts.py index 5957f67e9f9b12..11116766b7c4de 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_url_map_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_url_map_facts.py @@ -42,7 +42,7 @@ options: filters: description: - - A list of filter value pairs. Available filters are listed here U(U(https://cloud.google.com/sdk/gcloud/reference/topic/filters).) + - A list of filter value pairs. Available filters are listed here U(https://cloud.google.com/sdk/gcloud/reference/topic/filters.) - Each additional filter in the list will act be added as an AND condition (filter1 and filter2) . extends_documentation_fragment: gcp diff --git a/lib/ansible/modules/cloud/google/gcp_compute_vpn_tunnel_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_vpn_tunnel_facts.py index 8c805236bd320a..5ef29369bdf969 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_vpn_tunnel_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_vpn_tunnel_facts.py @@ -42,7 +42,7 @@ options: filters: description: - - A list of filter value pairs. Available filters are listed here U(U(https://cloud.google.com/sdk/gcloud/reference/topic/filters).) + - A list of filter value pairs. Available filters are listed here U(https://cloud.google.com/sdk/gcloud/reference/topic/filters.) - Each additional filter in the list will act be added as an AND condition (filter1 and filter2) . region: From 54175ccd0be58a624f8ce7dd9c29332879252472 Mon Sep 17 00:00:00 2001 From: The Magician Date: Tue, 29 Jan 2019 17:25:59 -0800 Subject: [PATCH 100/144] Native Update Mask support (#176) /cc @rambleraptor --- .../cloud/google/gcp_redis_instance.py | 23 ++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/lib/ansible/modules/cloud/google/gcp_redis_instance.py b/lib/ansible/modules/cloud/google/gcp_redis_instance.py index c096b0ba1a85fa..2006b3b33325ad 100644 --- a/lib/ansible/modules/cloud/google/gcp_redis_instance.py +++ b/lib/ansible/modules/cloud/google/gcp_redis_instance.py @@ -296,7 +296,7 @@ def main(): if fetch: if state == 'present': if is_different(module, fetch): - update(module, self_link(module)) + update(module, self_link(module), fetch) fetch = fetch_resource(module, self_link(module)) changed = True else: @@ -320,8 +320,25 @@ def create(module, link): return wait_for_operation(module, auth.post(link, resource_to_request(module))) -def update(module, link): - module.fail_json(msg="Instance cannot be edited") +def update(module, link, fetch): + auth = GcpSession(module, 'redis') + params = {'updateMask': updateMask(resource_to_request(module), response_to_hash(module, fetch))} + request = resource_to_request(module) + del request['name'] + return wait_for_operation(module, auth.patch(link, request, params=params)) + + +def updateMask(request, response): + update_mask = [] + if request.get('displayName') != response.get('displayName'): + update_mask.append('displayName') + if request.get('labels') != response.get('labels'): + update_mask.append('labels') + if request.get('redisConfigs') != response.get('redisConfigs'): + update_mask.append('redisConfigs') + if request.get('memorySizeGb') != response.get('memorySizeGb'): + update_mask.append('memorySizeGb') + return ','.join(update_mask) def delete(module, link): From bc6e339f6b287d3184e6b9db5b0d26cb099c2836 Mon Sep 17 00:00:00 2001 From: Sam Levenick Date: Wed, 30 Jan 2019 17:36:52 +0000 Subject: [PATCH 101/144] Inspec regional cluster Signed-off-by: Modular Magician --- .../cloud/google/gcp_container_cluster.py | 32 ++++++------------- .../google/gcp_container_cluster_facts.py | 24 ++++++-------- .../gcp_container_cluster/tasks/main.yml | 14 ++++---- 3 files changed, 26 insertions(+), 44 deletions(-) diff --git a/lib/ansible/modules/cloud/google/gcp_container_cluster.py b/lib/ansible/modules/cloud/google/gcp_container_cluster.py index 660aed70ab8000..3e51c543e9abcb 100644 --- a/lib/ansible/modules/cloud/google/gcp_container_cluster.py +++ b/lib/ansible/modules/cloud/google/gcp_container_cluster.py @@ -49,7 +49,7 @@ default: present name: description: - - The name of this cluster. The name must be unique within this project and zone, + - The name of this cluster. The name must be unique within this project and location, and can be up to 40 characters. Must be Lowercase letters, numbers, and hyphens only. Must start with a letter. Must end with a number or a letter. required: false @@ -254,12 +254,7 @@ required: false location: description: - - The list of Google Compute Engine locations in which the cluster's nodes should - be located. - required: false - zone: - description: - - The zone where the cluster is deployed. + - The location where the cluster is deployed. required: true extends_documentation_fragment: gcp ''' @@ -275,7 +270,7 @@ node_config: machine_type: n1-standard-4 disk_size_gb: 500 - zone: us-central1-a + location: us-central1-a project: "test_project" auth_kind: "serviceaccount" service_account_file: "/tmp/auth.pem" @@ -285,7 +280,7 @@ RETURN = ''' name: description: - - The name of this cluster. The name must be unique within this project and zone, + - The name of this cluster. The name must be unique within this project and location, and can be up to 40 characters. Must be Lowercase letters, numbers, and hyphens only. Must start with a letter. Must end with a number or a letter. returned: success @@ -508,12 +503,6 @@ - The name of the Google Compute Engine subnetwork to which the cluster is connected. returned: success type: str -location: - description: - - The list of Google Compute Engine locations in which the cluster's nodes should - be located. - returned: success - type: list endpoint: description: - The IP address of this cluster's master endpoint. @@ -567,9 +556,9 @@ - The time the cluster will be automatically deleted in RFC3339 text format. returned: success type: str -zone: +location: description: - - The zone where the cluster is deployed. + - The location where the cluster is deployed. returned: success type: str ''' @@ -633,8 +622,7 @@ def main(): ), ), subnetwork=dict(type='str'), - location=dict(type='list', elements='str'), - zone=dict(required=True, type='str'), + location=dict(required=True, type='str'), ) ) @@ -696,7 +684,6 @@ def resource_to_request(module): u'clusterIpv4Cidr': module.params.get('cluster_ipv4_cidr'), u'addonsConfig': ClusterAddonsconfig(module.params.get('addons_config', {}), module).to_request(), u'subnetwork': module.params.get('subnetwork'), - u'location': module.params.get('location'), } request = encode_request(request, module) return_vals = {} @@ -713,11 +700,11 @@ def fetch_resource(module, link, allow_not_found=True): def self_link(module): - return "https://container.googleapis.com/v1/projects/{project}/zones/{zone}/clusters/{name}".format(**module.params) + return "https://container.googleapis.com/v1/projects/{project}/locations/{location}/clusters/{name}".format(**module.params) def collection(module): - return "https://container.googleapis.com/v1/projects/{project}/zones/{zone}/clusters".format(**module.params) + return "https://container.googleapis.com/v1/projects/{project}/locations/{location}/clusters".format(**module.params) def return_if_object(module, response, allow_not_found=False): @@ -774,7 +761,6 @@ def response_to_hash(module, response): u'clusterIpv4Cidr': response.get(u'clusterIpv4Cidr'), u'addonsConfig': ClusterAddonsconfig(response.get(u'addonsConfig', {}), module).from_response(), u'subnetwork': response.get(u'subnetwork'), - u'location': response.get(u'location'), u'endpoint': response.get(u'endpoint'), u'initialClusterVersion': response.get(u'initialClusterVersion'), u'currentMasterVersion': response.get(u'currentMasterVersion'), diff --git a/lib/ansible/modules/cloud/google/gcp_container_cluster_facts.py b/lib/ansible/modules/cloud/google/gcp_container_cluster_facts.py index 1f6e020ff483e5..5f5f1d754fdf0c 100644 --- a/lib/ansible/modules/cloud/google/gcp_container_cluster_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_container_cluster_facts.py @@ -40,17 +40,19 @@ - requests >= 2.18.4 - google-auth >= 1.3.0 options: - zone: + location: description: - - The zone where the cluster is deployed. + - The location where the cluster is deployed. required: true + aliases: + - zone extends_documentation_fragment: gcp ''' EXAMPLES = ''' - name: a cluster facts gcp_container_cluster_facts: - zone: us-central1-a + location: us-central1-a project: test_project auth_kind: serviceaccount service_account_file: "/tmp/auth.pem" @@ -65,7 +67,7 @@ name: description: - The name of this cluster. The name must be unique within this project and - zone, and can be up to 40 characters. Must be Lowercase letters, numbers, + location, and can be up to 40 characters. Must be Lowercase letters, numbers, and hyphens only. Must start with a letter. Must end with a number or a letter. returned: success type: str @@ -288,12 +290,6 @@ - The name of the Google Compute Engine subnetwork to which the cluster is connected. returned: success type: str - location: - description: - - The list of Google Compute Engine locations in which the cluster's nodes should - be located. - returned: success - type: list endpoint: description: - The IP address of this cluster's master endpoint. @@ -347,9 +343,9 @@ - The time the cluster will be automatically deleted in RFC3339 text format. returned: success type: str - zone: + location: description: - - The zone where the cluster is deployed. + - The location where the cluster is deployed. returned: success type: str ''' @@ -366,7 +362,7 @@ def main(): - module = GcpModule(argument_spec=dict(zone=dict(required=True, type='str'))) + module = GcpModule(argument_spec=dict(location=dict(required=True, type='str', aliases=['zone']))) if not module.params['scopes']: module.params['scopes'] = ['https://www.googleapis.com/auth/cloud-platform'] @@ -381,7 +377,7 @@ def main(): def collection(module): - return "https://container.googleapis.com/v1/projects/{project}/zones/{zone}/clusters".format(**module.params) + return "https://container.googleapis.com/v1/projects/{project}/locations/{location}/clusters".format(**module.params) def fetch_list(module, link): diff --git a/test/integration/targets/gcp_container_cluster/tasks/main.yml b/test/integration/targets/gcp_container_cluster/tasks/main.yml index 21ab8225612f29..1785c269452057 100644 --- a/test/integration/targets/gcp_container_cluster/tasks/main.yml +++ b/test/integration/targets/gcp_container_cluster/tasks/main.yml @@ -23,7 +23,7 @@ node_config: machine_type: n1-standard-4 disk_size_gb: 500 - zone: us-central1-a + location: us-central1-a project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" @@ -39,7 +39,7 @@ node_config: machine_type: n1-standard-4 disk_size_gb: 500 - zone: us-central1-a + location: us-central1-a project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" @@ -51,7 +51,7 @@ - result.changed == true - name: verify that cluster was created gcp_container_cluster_facts: - zone: us-central1-a + location: us-central1-a project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" @@ -73,7 +73,7 @@ node_config: machine_type: n1-standard-4 disk_size_gb: 500 - zone: us-central1-a + location: us-central1-a project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" @@ -94,7 +94,7 @@ node_config: machine_type: n1-standard-4 disk_size_gb: 500 - zone: us-central1-a + location: us-central1-a project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" @@ -106,7 +106,7 @@ - result.changed == true - name: verify that cluster was deleted gcp_container_cluster_facts: - zone: us-central1-a + location: us-central1-a project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" @@ -128,7 +128,7 @@ node_config: machine_type: n1-standard-4 disk_size_gb: 500 - zone: us-central1-a + location: us-central1-a project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" From b4170c2a40ef31f9e3eea976fbb834363dd1f88e Mon Sep 17 00:00:00 2001 From: The Magician Date: Wed, 30 Jan 2019 14:11:08 -0800 Subject: [PATCH 102/144] response_to_hash should use api_name (#181) /cc @rambleraptor --- lib/ansible/modules/cloud/google/gcp_compute_firewall.py | 4 ++-- lib/ansible/modules/cloud/google/gcp_compute_network.py | 2 +- .../modules/cloud/google/gcp_dns_resource_record_set.py | 2 +- .../modules/cloud/google/gcp_resourcemanager_project.py | 2 +- lib/ansible/modules/cloud/google/gcp_storage_bucket.py | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_firewall.py b/lib/ansible/modules/cloud/google/gcp_compute_firewall.py index 9b177b62e464e7..6a2511546187ba 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_firewall.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_firewall.py @@ -669,7 +669,7 @@ def _request_for_item(self, item): return remove_nones_from_dict({u'IPProtocol': item.get('ip_protocol'), u'ports': item.get('ports')}) def _response_from_item(self, item): - return remove_nones_from_dict({u'IPProtocol': item.get(u'ip_protocol'), u'ports': item.get(u'ports')}) + return remove_nones_from_dict({u'IPProtocol': item.get(u'IPProtocol'), u'ports': item.get(u'ports')}) class FirewallDeniedArray(object): @@ -696,7 +696,7 @@ def _request_for_item(self, item): return remove_nones_from_dict({u'IPProtocol': item.get('ip_protocol'), u'ports': item.get('ports')}) def _response_from_item(self, item): - return remove_nones_from_dict({u'IPProtocol': item.get(u'ip_protocol'), u'ports': item.get(u'ports')}) + return remove_nones_from_dict({u'IPProtocol': item.get(u'IPProtocol'), u'ports': item.get(u'ports')}) if __name__ == '__main__': diff --git a/lib/ansible/modules/cloud/google/gcp_compute_network.py b/lib/ansible/modules/cloud/google/gcp_compute_network.py index b5d120188099c3..b3b092119fd943 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_network.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_network.py @@ -340,7 +340,7 @@ def is_different(module, response): def response_to_hash(module, response): return { u'description': module.params.get('description'), - u'gatewayIPv4': response.get(u'gateway_ipv4'), + u'gatewayIPv4': response.get(u'gatewayIPv4'), u'id': response.get(u'id'), u'IPv4Range': module.params.get('ipv4_range'), u'name': module.params.get('name'), diff --git a/lib/ansible/modules/cloud/google/gcp_dns_resource_record_set.py b/lib/ansible/modules/cloud/google/gcp_dns_resource_record_set.py index d87bd82de3b6ce..a6fccb7032ada6 100644 --- a/lib/ansible/modules/cloud/google/gcp_dns_resource_record_set.py +++ b/lib/ansible/modules/cloud/google/gcp_dns_resource_record_set.py @@ -326,7 +326,7 @@ def is_different(module, response): # Remove unnecessary properties from the response. # This is for doing comparisons with Ansible's current parameters. def response_to_hash(module, response): - return {u'name': response.get(u'name'), u'type': response.get(u'type'), u'ttl': response.get(u'ttl'), u'rrdatas': response.get(u'target')} + return {u'name': response.get(u'name'), u'type': response.get(u'type'), u'ttl': response.get(u'ttl'), u'rrdatas': response.get(u'rrdatas')} def updated_record(module): diff --git a/lib/ansible/modules/cloud/google/gcp_resourcemanager_project.py b/lib/ansible/modules/cloud/google/gcp_resourcemanager_project.py index 90d10c9848a74d..480d130da354a2 100644 --- a/lib/ansible/modules/cloud/google/gcp_resourcemanager_project.py +++ b/lib/ansible/modules/cloud/google/gcp_resourcemanager_project.py @@ -305,7 +305,7 @@ def is_different(module, response): # This is for doing comparisons with Ansible's current parameters. def response_to_hash(module, response): return { - u'projectNumber': response.get(u'number'), + u'projectNumber': response.get(u'projectNumber'), u'lifecycleState': response.get(u'lifecycleState'), u'name': response.get(u'name'), u'createTime': response.get(u'createTime'), diff --git a/lib/ansible/modules/cloud/google/gcp_storage_bucket.py b/lib/ansible/modules/cloud/google/gcp_storage_bucket.py index 717a309b92a7a1..691b216100df9a 100644 --- a/lib/ansible/modules/cloud/google/gcp_storage_bucket.py +++ b/lib/ansible/modules/cloud/google/gcp_storage_bucket.py @@ -1281,7 +1281,7 @@ def to_request(self): def from_response(self): return remove_nones_from_dict( { - u'age': self.request.get(u'ageDays'), + u'age': self.request.get(u'age'), u'createdBefore': self.request.get(u'createdBefore'), u'isLive': self.request.get(u'isLive'), u'matchesStorageClass': self.request.get(u'matchesStorageClass'), From 27e1dad57f42f52b46bbe526232d17298f8fde35 Mon Sep 17 00:00:00 2001 From: The Magician Date: Wed, 30 Jan 2019 14:44:55 -0800 Subject: [PATCH 103/144] Fixing Ansible Integration tests (#175) /cc @rambleraptor --- .../modules/cloud/google/gcp_compute_address.py | 2 +- .../cloud/google/gcp_compute_backend_bucket.py | 2 +- .../cloud/google/gcp_compute_backend_service.py | 2 +- .../modules/cloud/google/gcp_compute_disk.py | 2 +- .../cloud/google/gcp_compute_firewall.py | 2 +- .../cloud/google/gcp_compute_forwarding_rule.py | 2 +- .../cloud/google/gcp_compute_global_address.py | 2 +- .../gcp_compute_global_forwarding_rule.py | 2 +- .../cloud/google/gcp_compute_health_check.py | 2 +- .../google/gcp_compute_http_health_check.py | 2 +- .../google/gcp_compute_https_health_check.py | 2 +- .../modules/cloud/google/gcp_compute_image.py | 2 +- .../cloud/google/gcp_compute_instance.py | 2 +- .../cloud/google/gcp_compute_instance_group.py | 2 +- .../gcp_compute_instance_group_manager.py | 2 +- .../google/gcp_compute_instance_template.py | 2 +- .../gcp_compute_interconnect_attachment.py | 2 +- .../modules/cloud/google/gcp_compute_network.py | 2 +- .../cloud/google/gcp_compute_region_disk.py | 2 +- .../modules/cloud/google/gcp_compute_route.py | 2 +- .../modules/cloud/google/gcp_compute_router.py | 2 +- .../cloud/google/gcp_compute_ssl_certificate.py | 2 +- .../cloud/google/gcp_compute_ssl_policy.py | 2 +- .../cloud/google/gcp_compute_subnetwork.py | 2 +- .../google/gcp_compute_target_http_proxy.py | 2 +- .../google/gcp_compute_target_https_proxy.py | 2 +- .../cloud/google/gcp_compute_target_pool.py | 2 +- .../google/gcp_compute_target_ssl_proxy.py | 2 +- .../google/gcp_compute_target_tcp_proxy.py | 2 +- .../google/gcp_compute_target_vpn_gateway.py | 2 +- .../modules/cloud/google/gcp_compute_url_map.py | 2 +- .../cloud/google/gcp_compute_vpn_tunnel.py | 2 +- .../cloud/google/gcp_container_cluster.py | 2 +- .../cloud/google/gcp_container_node_pool.py | 2 +- .../cloud/google/gcp_pubsub_subscription.py | 2 +- .../modules/cloud/google/gcp_redis_instance.py | 2 +- .../cloud/google/gcp_resourcemanager_project.py | 2 +- .../cloud/google/gcp_spanner_instance.py | 17 +++++++++-------- .../modules/cloud/google/gcp_sql_database.py | 2 +- .../modules/cloud/google/gcp_sql_instance.py | 2 +- .../modules/cloud/google/gcp_sql_user.py | 2 +- .../google/gcp_storage_bucket_access_control.py | 2 +- .../targets/gcp_spanner_instance/tasks/main.yml | 10 +++++----- .../tasks/main.yml | 10 +++++----- 44 files changed, 60 insertions(+), 59 deletions(-) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_address.py b/lib/ansible/modules/cloud/google/gcp_compute_address.py index 9a6a20c9986009..6e2a6f1c783591 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_address.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_address.py @@ -379,7 +379,7 @@ def wait_for_completion(status, op_result, module): while status != 'DONE': raise_if_errors(op_result, ['error', 'errors'], module) time.sleep(1.0) - op_result = fetch_resource(module, op_uri, 'compute#operation') + op_result = fetch_resource(module, op_uri, 'compute#operation', False) status = navigate_hash(op_result, ['status']) return op_result diff --git a/lib/ansible/modules/cloud/google/gcp_compute_backend_bucket.py b/lib/ansible/modules/cloud/google/gcp_compute_backend_bucket.py index 4e3bd87f7515b1..d13c8d1a22efb1 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_backend_bucket.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_backend_bucket.py @@ -318,7 +318,7 @@ def wait_for_completion(status, op_result, module): while status != 'DONE': raise_if_errors(op_result, ['error', 'errors'], module) time.sleep(1.0) - op_result = fetch_resource(module, op_uri, 'compute#operation') + op_result = fetch_resource(module, op_uri, 'compute#operation', False) status = navigate_hash(op_result, ['status']) return op_result diff --git a/lib/ansible/modules/cloud/google/gcp_compute_backend_service.py b/lib/ansible/modules/cloud/google/gcp_compute_backend_service.py index f81e7783e50946..508652ac3acd83 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_backend_service.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_backend_service.py @@ -856,7 +856,7 @@ def wait_for_completion(status, op_result, module): while status != 'DONE': raise_if_errors(op_result, ['error', 'errors'], module) time.sleep(1.0) - op_result = fetch_resource(module, op_uri, 'compute#operation') + op_result = fetch_resource(module, op_uri, 'compute#operation', False) status = navigate_hash(op_result, ['status']) return op_result diff --git a/lib/ansible/modules/cloud/google/gcp_compute_disk.py b/lib/ansible/modules/cloud/google/gcp_compute_disk.py index 4603a951f5fac0..e4da74189fbb18 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_disk.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_disk.py @@ -638,7 +638,7 @@ def wait_for_completion(status, op_result, module): while status != 'DONE': raise_if_errors(op_result, ['error', 'errors'], module) time.sleep(1.0) - op_result = fetch_resource(module, op_uri, 'compute#operation') + op_result = fetch_resource(module, op_uri, 'compute#operation', False) status = navigate_hash(op_result, ['status']) return op_result diff --git a/lib/ansible/modules/cloud/google/gcp_compute_firewall.py b/lib/ansible/modules/cloud/google/gcp_compute_firewall.py index 6a2511546187ba..ccecb4be77316a 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_firewall.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_firewall.py @@ -624,7 +624,7 @@ def wait_for_completion(status, op_result, module): while status != 'DONE': raise_if_errors(op_result, ['error', 'errors'], module) time.sleep(1.0) - op_result = fetch_resource(module, op_uri, 'compute#operation') + op_result = fetch_resource(module, op_uri, 'compute#operation', False) status = navigate_hash(op_result, ['status']) return op_result diff --git a/lib/ansible/modules/cloud/google/gcp_compute_forwarding_rule.py b/lib/ansible/modules/cloud/google/gcp_compute_forwarding_rule.py index eedcfee2bff48a..d18d954b072c9a 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_forwarding_rule.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_forwarding_rule.py @@ -607,7 +607,7 @@ def wait_for_completion(status, op_result, module): while status != 'DONE': raise_if_errors(op_result, ['error', 'errors'], module) time.sleep(1.0) - op_result = fetch_resource(module, op_uri, 'compute#operation') + op_result = fetch_resource(module, op_uri, 'compute#operation', False) status = navigate_hash(op_result, ['status']) return op_result diff --git a/lib/ansible/modules/cloud/google/gcp_compute_global_address.py b/lib/ansible/modules/cloud/google/gcp_compute_global_address.py index e1e8f5ffab0952..f597b111f03b3f 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_global_address.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_global_address.py @@ -344,7 +344,7 @@ def wait_for_completion(status, op_result, module): while status != 'DONE': raise_if_errors(op_result, ['error', 'errors'], module) time.sleep(1.0) - op_result = fetch_resource(module, op_uri, 'compute#operation') + op_result = fetch_resource(module, op_uri, 'compute#operation', False) status = navigate_hash(op_result, ['status']) return op_result diff --git a/lib/ansible/modules/cloud/google/gcp_compute_global_forwarding_rule.py b/lib/ansible/modules/cloud/google/gcp_compute_global_forwarding_rule.py index 36c2a7c72fce0b..9506472abe77a6 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_global_forwarding_rule.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_global_forwarding_rule.py @@ -602,7 +602,7 @@ def wait_for_completion(status, op_result, module): while status != 'DONE': raise_if_errors(op_result, ['error', 'errors'], module) time.sleep(1.0) - op_result = fetch_resource(module, op_uri, 'compute#operation') + op_result = fetch_resource(module, op_uri, 'compute#operation', False) status = navigate_hash(op_result, ['status']) return op_result 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 b0334a5383e690..080caa2c839485 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_health_check.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_health_check.py @@ -747,7 +747,7 @@ def wait_for_completion(status, op_result, module): while status != 'DONE': raise_if_errors(op_result, ['error', 'errors'], module) time.sleep(1.0) - op_result = fetch_resource(module, op_uri, 'compute#operation') + op_result = fetch_resource(module, op_uri, 'compute#operation', False) status = navigate_hash(op_result, ['status']) return op_result diff --git a/lib/ansible/modules/cloud/google/gcp_compute_http_health_check.py b/lib/ansible/modules/cloud/google/gcp_compute_http_health_check.py index dd2ae039e695da..6c20f3edeefbe4 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_http_health_check.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_http_health_check.py @@ -387,7 +387,7 @@ def wait_for_completion(status, op_result, module): while status != 'DONE': raise_if_errors(op_result, ['error', 'errors'], module) time.sleep(1.0) - op_result = fetch_resource(module, op_uri, 'compute#operation') + op_result = fetch_resource(module, op_uri, 'compute#operation', False) status = navigate_hash(op_result, ['status']) return op_result diff --git a/lib/ansible/modules/cloud/google/gcp_compute_https_health_check.py b/lib/ansible/modules/cloud/google/gcp_compute_https_health_check.py index 72e9832b284b7d..9d75310d6a928e 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_https_health_check.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_https_health_check.py @@ -384,7 +384,7 @@ def wait_for_completion(status, op_result, module): while status != 'DONE': raise_if_errors(op_result, ['error', 'errors'], module) time.sleep(1.0) - op_result = fetch_resource(module, op_uri, 'compute#operation') + op_result = fetch_resource(module, op_uri, 'compute#operation', False) status = navigate_hash(op_result, ['status']) return op_result diff --git a/lib/ansible/modules/cloud/google/gcp_compute_image.py b/lib/ansible/modules/cloud/google/gcp_compute_image.py index 80831673422868..5695b6663b688c 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_image.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_image.py @@ -652,7 +652,7 @@ def wait_for_completion(status, op_result, module): while status != 'DONE': raise_if_errors(op_result, ['error', 'errors'], module) time.sleep(1.0) - op_result = fetch_resource(module, op_uri, 'compute#operation') + op_result = fetch_resource(module, op_uri, 'compute#operation', False) status = navigate_hash(op_result, ['status']) return op_result diff --git a/lib/ansible/modules/cloud/google/gcp_compute_instance.py b/lib/ansible/modules/cloud/google/gcp_compute_instance.py index 23a0d80f296918..2908a151262543 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_instance.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_instance.py @@ -1158,7 +1158,7 @@ def wait_for_completion(status, op_result, module): while status != 'DONE': raise_if_errors(op_result, ['error', 'errors'], module) time.sleep(1.0) - op_result = fetch_resource(module, op_uri, 'compute#operation') + op_result = fetch_resource(module, op_uri, 'compute#operation', False) status = navigate_hash(op_result, ['status']) return op_result diff --git a/lib/ansible/modules/cloud/google/gcp_compute_instance_group.py b/lib/ansible/modules/cloud/google/gcp_compute_instance_group.py index e92f66ed8abcaf..fbbe6370dd3e39 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_instance_group.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_instance_group.py @@ -414,7 +414,7 @@ def wait_for_completion(status, op_result, module): while status != 'DONE': raise_if_errors(op_result, ['error', 'errors'], module) time.sleep(1.0) - op_result = fetch_resource(module, op_uri, 'compute#operation') + op_result = fetch_resource(module, op_uri, 'compute#operation', False) status = navigate_hash(op_result, ['status']) return op_result diff --git a/lib/ansible/modules/cloud/google/gcp_compute_instance_group_manager.py b/lib/ansible/modules/cloud/google/gcp_compute_instance_group_manager.py index 4fbc5be5bdaf1a..7c8facab90d2d6 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_instance_group_manager.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_instance_group_manager.py @@ -517,7 +517,7 @@ def wait_for_completion(status, op_result, module): while status != 'DONE': raise_if_errors(op_result, ['error', 'errors'], module) time.sleep(1.0) - op_result = fetch_resource(module, op_uri, 'compute#operation') + op_result = fetch_resource(module, op_uri, 'compute#operation', False) status = navigate_hash(op_result, ['status']) return op_result diff --git a/lib/ansible/modules/cloud/google/gcp_compute_instance_template.py b/lib/ansible/modules/cloud/google/gcp_compute_instance_template.py index 691493eca008db..44ec013363c56e 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_instance_template.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_instance_template.py @@ -1093,7 +1093,7 @@ def wait_for_completion(status, op_result, module): while status != 'DONE': raise_if_errors(op_result, ['error', 'errors'], module) time.sleep(1.0) - op_result = fetch_resource(module, op_uri, 'compute#operation') + op_result = fetch_resource(module, op_uri, 'compute#operation', False) status = navigate_hash(op_result, ['status']) return op_result diff --git a/lib/ansible/modules/cloud/google/gcp_compute_interconnect_attachment.py b/lib/ansible/modules/cloud/google/gcp_compute_interconnect_attachment.py index ac70e94158ebdc..c9a483bd22a756 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_interconnect_attachment.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_interconnect_attachment.py @@ -403,7 +403,7 @@ def wait_for_completion(status, op_result, module): while status != 'DONE': raise_if_errors(op_result, ['error', 'errors'], module) time.sleep(1.0) - op_result = fetch_resource(module, op_uri, 'compute#operation') + op_result = fetch_resource(module, op_uri, 'compute#operation', False) status = navigate_hash(op_result, ['status']) return op_result diff --git a/lib/ansible/modules/cloud/google/gcp_compute_network.py b/lib/ansible/modules/cloud/google/gcp_compute_network.py index b3b092119fd943..072c71b99055d4 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_network.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_network.py @@ -375,7 +375,7 @@ def wait_for_completion(status, op_result, module): while status != 'DONE': raise_if_errors(op_result, ['error', 'errors'], module) time.sleep(1.0) - op_result = fetch_resource(module, op_uri, 'compute#operation') + op_result = fetch_resource(module, op_uri, 'compute#operation', False) status = navigate_hash(op_result, ['status']) return op_result diff --git a/lib/ansible/modules/cloud/google/gcp_compute_region_disk.py b/lib/ansible/modules/cloud/google/gcp_compute_region_disk.py index 880fe8be91add4..9ea373238e97ca 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_region_disk.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_region_disk.py @@ -555,7 +555,7 @@ def wait_for_completion(status, op_result, module): while status != 'DONE': raise_if_errors(op_result, ['error', 'errors'], module) time.sleep(1.0) - op_result = fetch_resource(module, op_uri, 'compute#operation') + op_result = fetch_resource(module, op_uri, 'compute#operation', False) status = navigate_hash(op_result, ['status']) return op_result diff --git a/lib/ansible/modules/cloud/google/gcp_compute_route.py b/lib/ansible/modules/cloud/google/gcp_compute_route.py index 42f28538e47c58..0053d8cb26731c 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_route.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_route.py @@ -433,7 +433,7 @@ def wait_for_completion(status, op_result, module): while status != 'DONE': raise_if_errors(op_result, ['error', 'errors'], module) time.sleep(1.0) - op_result = fetch_resource(module, op_uri, 'compute#operation') + op_result = fetch_resource(module, op_uri, 'compute#operation', False) status = navigate_hash(op_result, ['status']) return op_result diff --git a/lib/ansible/modules/cloud/google/gcp_compute_router.py b/lib/ansible/modules/cloud/google/gcp_compute_router.py index 86ff9be81a9edf..9977375cb0c377 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_router.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_router.py @@ -424,7 +424,7 @@ def wait_for_completion(status, op_result, module): while status != 'DONE': raise_if_errors(op_result, ['error', 'errors'], module) time.sleep(1.0) - op_result = fetch_resource(module, op_uri, 'compute#operation') + op_result = fetch_resource(module, op_uri, 'compute#operation', False) status = navigate_hash(op_result, ['status']) return op_result diff --git a/lib/ansible/modules/cloud/google/gcp_compute_ssl_certificate.py b/lib/ansible/modules/cloud/google/gcp_compute_ssl_certificate.py index f9fd45e04f7b54..c2b2e04949ec59 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_ssl_certificate.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_ssl_certificate.py @@ -329,7 +329,7 @@ def wait_for_completion(status, op_result, module): while status != 'DONE': raise_if_errors(op_result, ['error', 'errors'], module) time.sleep(1.0) - op_result = fetch_resource(module, op_uri, 'compute#operation') + op_result = fetch_resource(module, op_uri, 'compute#operation', False) status = navigate_hash(op_result, ['status']) return op_result diff --git a/lib/ansible/modules/cloud/google/gcp_compute_ssl_policy.py b/lib/ansible/modules/cloud/google/gcp_compute_ssl_policy.py index 59efb92c5b1d75..02def517b039d1 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_ssl_policy.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_ssl_policy.py @@ -371,7 +371,7 @@ def wait_for_completion(status, op_result, module): while status != 'DONE': raise_if_errors(op_result, ['error', 'errors'], module) time.sleep(1.0) - op_result = fetch_resource(module, op_uri, 'compute#operation') + op_result = fetch_resource(module, op_uri, 'compute#operation', False) status = navigate_hash(op_result, ['status']) return op_result diff --git a/lib/ansible/modules/cloud/google/gcp_compute_subnetwork.py b/lib/ansible/modules/cloud/google/gcp_compute_subnetwork.py index be3f9088849244..f33349d0b975d0 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_subnetwork.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_subnetwork.py @@ -486,7 +486,7 @@ def wait_for_completion(status, op_result, module): while status != 'DONE': raise_if_errors(op_result, ['error', 'errors'], module) time.sleep(1.0) - op_result = fetch_resource(module, op_uri, 'compute#operation') + op_result = fetch_resource(module, op_uri, 'compute#operation', False) status = navigate_hash(op_result, ['status']) return op_result diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_http_proxy.py b/lib/ansible/modules/cloud/google/gcp_compute_target_http_proxy.py index 09aa92e3168094..ec150e13d41c73 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_http_proxy.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_http_proxy.py @@ -354,7 +354,7 @@ def wait_for_completion(status, op_result, module): while status != 'DONE': raise_if_errors(op_result, ['error', 'errors'], module) time.sleep(1.0) - op_result = fetch_resource(module, op_uri, 'compute#operation') + op_result = fetch_resource(module, op_uri, 'compute#operation', False) status = navigate_hash(op_result, ['status']) return op_result diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_https_proxy.py b/lib/ansible/modules/cloud/google/gcp_compute_target_https_proxy.py index 725d790bc756f3..229d81a4d7a804 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_https_proxy.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_https_proxy.py @@ -481,7 +481,7 @@ def wait_for_completion(status, op_result, module): while status != 'DONE': raise_if_errors(op_result, ['error', 'errors'], module) time.sleep(1.0) - op_result = fetch_resource(module, op_uri, 'compute#operation') + op_result = fetch_resource(module, op_uri, 'compute#operation', False) status = navigate_hash(op_result, ['status']) return op_result diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_pool.py b/lib/ansible/modules/cloud/google/gcp_compute_target_pool.py index 5cecd07362ca8c..89afc7701a1056 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_pool.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_pool.py @@ -421,7 +421,7 @@ def wait_for_completion(status, op_result, module): while status != 'DONE': raise_if_errors(op_result, ['error', 'errors'], module) time.sleep(1.0) - op_result = fetch_resource(module, op_uri, 'compute#operation') + op_result = fetch_resource(module, op_uri, 'compute#operation', False) status = navigate_hash(op_result, ['status']) return op_result diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_ssl_proxy.py b/lib/ansible/modules/cloud/google/gcp_compute_target_ssl_proxy.py index 51476c6fa80af4..0e00b0b15b17ae 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_ssl_proxy.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_ssl_proxy.py @@ -467,7 +467,7 @@ def wait_for_completion(status, op_result, module): while status != 'DONE': raise_if_errors(op_result, ['error', 'errors'], module) time.sleep(1.0) - op_result = fetch_resource(module, op_uri, 'compute#operation') + op_result = fetch_resource(module, op_uri, 'compute#operation', False) status = navigate_hash(op_result, ['status']) return op_result diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_tcp_proxy.py b/lib/ansible/modules/cloud/google/gcp_compute_target_tcp_proxy.py index 0f522f270848f7..1a4679f713ea25 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_tcp_proxy.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_tcp_proxy.py @@ -376,7 +376,7 @@ def wait_for_completion(status, op_result, module): while status != 'DONE': raise_if_errors(op_result, ['error', 'errors'], module) time.sleep(1.0) - op_result = fetch_resource(module, op_uri, 'compute#operation') + op_result = fetch_resource(module, op_uri, 'compute#operation', False) status = navigate_hash(op_result, ['status']) return op_result diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_vpn_gateway.py b/lib/ansible/modules/cloud/google/gcp_compute_target_vpn_gateway.py index b2c263abf585b6..2ab6321c15b5d2 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_vpn_gateway.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_vpn_gateway.py @@ -334,7 +334,7 @@ def wait_for_completion(status, op_result, module): while status != 'DONE': raise_if_errors(op_result, ['error', 'errors'], module) time.sleep(1.0) - op_result = fetch_resource(module, op_uri, 'compute#operation') + op_result = fetch_resource(module, op_uri, 'compute#operation', False) status = navigate_hash(op_result, ['status']) return op_result diff --git a/lib/ansible/modules/cloud/google/gcp_compute_url_map.py b/lib/ansible/modules/cloud/google/gcp_compute_url_map.py index 76f3b61a879255..4410306ffaca33 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_url_map.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_url_map.py @@ -556,7 +556,7 @@ def wait_for_completion(status, op_result, module): while status != 'DONE': raise_if_errors(op_result, ['error', 'errors'], module) time.sleep(1.0) - op_result = fetch_resource(module, op_uri, 'compute#operation') + op_result = fetch_resource(module, op_uri, 'compute#operation', False) status = navigate_hash(op_result, ['status']) return op_result diff --git a/lib/ansible/modules/cloud/google/gcp_compute_vpn_tunnel.py b/lib/ansible/modules/cloud/google/gcp_compute_vpn_tunnel.py index ed644fef386623..b01e884e967429 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_vpn_tunnel.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_vpn_tunnel.py @@ -470,7 +470,7 @@ def wait_for_completion(status, op_result, module): while status != 'DONE': raise_if_errors(op_result, ['error', 'errors'], module) time.sleep(1.0) - op_result = fetch_resource(module, op_uri, 'compute#operation') + op_result = fetch_resource(module, op_uri, 'compute#operation', False) status = navigate_hash(op_result, ['status']) return op_result diff --git a/lib/ansible/modules/cloud/google/gcp_container_cluster.py b/lib/ansible/modules/cloud/google/gcp_container_cluster.py index 3e51c543e9abcb..e0f8726ccc51a6 100644 --- a/lib/ansible/modules/cloud/google/gcp_container_cluster.py +++ b/lib/ansible/modules/cloud/google/gcp_container_cluster.py @@ -797,7 +797,7 @@ def wait_for_completion(status, op_result, module): while status != 'DONE': raise_if_errors(op_result, ['error', 'errors'], module) time.sleep(1.0) - op_result = fetch_resource(module, op_uri) + op_result = fetch_resource(module, op_uri, False) status = navigate_hash(op_result, ['status']) return op_result diff --git a/lib/ansible/modules/cloud/google/gcp_container_node_pool.py b/lib/ansible/modules/cloud/google/gcp_container_node_pool.py index cb4ca8785d0998..1619ebbca7f9e8 100644 --- a/lib/ansible/modules/cloud/google/gcp_container_node_pool.py +++ b/lib/ansible/modules/cloud/google/gcp_container_node_pool.py @@ -630,7 +630,7 @@ def wait_for_completion(status, op_result, module): while status != 'DONE': raise_if_errors(op_result, ['error', 'errors'], module) time.sleep(1.0) - op_result = fetch_resource(module, op_uri) + op_result = fetch_resource(module, op_uri, False) status = navigate_hash(op_result, ['status']) return op_result diff --git a/lib/ansible/modules/cloud/google/gcp_pubsub_subscription.py b/lib/ansible/modules/cloud/google/gcp_pubsub_subscription.py index 8f67760985bad7..879c252d985d18 100644 --- a/lib/ansible/modules/cloud/google/gcp_pubsub_subscription.py +++ b/lib/ansible/modules/cloud/google/gcp_pubsub_subscription.py @@ -320,7 +320,7 @@ def decode_request(response, module): def encode_request(request, module): - request['topic'] = '/'.join(['projects', module.params['project'], 'topics', module.params['topic']['name']]) + request['topic'] = '/'.join(['projects', module.params['project'], 'topics', request['topic']]) request['name'] = '/'.join(['projects', module.params['project'], 'subscriptions', module.params['name']]) return request diff --git a/lib/ansible/modules/cloud/google/gcp_redis_instance.py b/lib/ansible/modules/cloud/google/gcp_redis_instance.py index 2006b3b33325ad..bec3b2a38cd1be 100644 --- a/lib/ansible/modules/cloud/google/gcp_redis_instance.py +++ b/lib/ansible/modules/cloud/google/gcp_redis_instance.py @@ -467,7 +467,7 @@ def wait_for_completion(status, op_result, module): while not status: raise_if_errors(op_result, ['error'], module) time.sleep(1.0) - op_result = fetch_resource(module, op_uri) + op_result = fetch_resource(module, op_uri, False) status = navigate_hash(op_result, ['done']) return op_result diff --git a/lib/ansible/modules/cloud/google/gcp_resourcemanager_project.py b/lib/ansible/modules/cloud/google/gcp_resourcemanager_project.py index 480d130da354a2..71bcc3517d5c17 100644 --- a/lib/ansible/modules/cloud/google/gcp_resourcemanager_project.py +++ b/lib/ansible/modules/cloud/google/gcp_resourcemanager_project.py @@ -339,7 +339,7 @@ def wait_for_completion(status, op_result, module): while not status: raise_if_errors(op_result, ['error'], module) time.sleep(1.0) - op_result = fetch_resource(module, op_uri) + op_result = fetch_resource(module, op_uri, False) status = navigate_hash(op_result, ['done']) return op_result diff --git a/lib/ansible/modules/cloud/google/gcp_spanner_instance.py b/lib/ansible/modules/cloud/google/gcp_spanner_instance.py index c6d607ec9fcdae..8a118cc2655a56 100644 --- a/lib/ansible/modules/cloud/google/gcp_spanner_instance.py +++ b/lib/ansible/modules/cloud/google/gcp_spanner_instance.py @@ -85,7 +85,7 @@ EXAMPLES = ''' - name: create a instance gcp_spanner_instance: - name: "test_object" + name: testinstance display_name: My Spanner Instance node_count: 2 labels: @@ -291,7 +291,7 @@ def response_to_hash(module, response): def async_op_url(module, extra_data=None): if extra_data is None: extra_data = {} - url = "https://spanner.googleapis.com/v1/projects/{project}/global/operations/{op_id}" + url = "https://spanner.googleapis.com/v1/{op_id}" combined = extra_data.copy() combined.update(module.params) return url.format(**combined) @@ -301,19 +301,20 @@ def wait_for_operation(module, response): op_result = return_if_object(module, response) if op_result is None: return {} - status = navigate_hash(op_result, ['status']) + status = navigate_hash(op_result, ['done']) wait_done = wait_for_completion(status, op_result, module) - return fetch_resource(module, navigate_hash(wait_done, ['targetLink'])) + raise_if_errors(op_result, ['error'], module) + return navigate_hash(wait_done, ['response']) def wait_for_completion(status, op_result, module): op_id = navigate_hash(op_result, ['name']) op_uri = async_op_url(module, {'op_id': op_id}) - while status != 'DONE': - raise_if_errors(op_result, ['error', 'errors'], module) + while not status: + raise_if_errors(op_result, ['error'], module) time.sleep(1.0) - op_result = fetch_resource(module, op_uri) - status = navigate_hash(op_result, ['status']) + op_result = fetch_resource(module, op_uri, False) + status = navigate_hash(op_result, ['done']) return op_result diff --git a/lib/ansible/modules/cloud/google/gcp_sql_database.py b/lib/ansible/modules/cloud/google/gcp_sql_database.py index 9849480d022ca3..89ad8fad734c26 100644 --- a/lib/ansible/modules/cloud/google/gcp_sql_database.py +++ b/lib/ansible/modules/cloud/google/gcp_sql_database.py @@ -297,7 +297,7 @@ def wait_for_completion(status, op_result, module): while status != 'DONE': raise_if_errors(op_result, ['error', 'errors'], module) time.sleep(1.0) - op_result = fetch_resource(module, op_uri, 'sql#operation') + op_result = fetch_resource(module, op_uri, 'sql#operation', False) status = navigate_hash(op_result, ['status']) return op_result diff --git a/lib/ansible/modules/cloud/google/gcp_sql_instance.py b/lib/ansible/modules/cloud/google/gcp_sql_instance.py index 67fd0dff78a242..470cc21ed91db8 100644 --- a/lib/ansible/modules/cloud/google/gcp_sql_instance.py +++ b/lib/ansible/modules/cloud/google/gcp_sql_instance.py @@ -789,7 +789,7 @@ def wait_for_completion(status, op_result, module): while status != 'DONE': raise_if_errors(op_result, ['error', 'errors'], module) time.sleep(1.0) - op_result = fetch_resource(module, op_uri, 'sql#operation') + op_result = fetch_resource(module, op_uri, 'sql#operation', False) status = navigate_hash(op_result, ['status']) return op_result diff --git a/lib/ansible/modules/cloud/google/gcp_sql_user.py b/lib/ansible/modules/cloud/google/gcp_sql_user.py index e782613888c2e8..e1d6d940495a80 100644 --- a/lib/ansible/modules/cloud/google/gcp_sql_user.py +++ b/lib/ansible/modules/cloud/google/gcp_sql_user.py @@ -335,7 +335,7 @@ def wait_for_completion(status, op_result, module): while status != 'DONE': raise_if_errors(op_result, ['error', 'errors'], module) time.sleep(1.0) - op_result = fetch_resource(module, op_uri, 'sql#operation') + op_result = fetch_resource(module, op_uri, 'sql#operation', False) status = navigate_hash(op_result, ['status']) return op_result diff --git a/lib/ansible/modules/cloud/google/gcp_storage_bucket_access_control.py b/lib/ansible/modules/cloud/google/gcp_storage_bucket_access_control.py index fd87e8fc4e32db..f0507f8be85235 100644 --- a/lib/ansible/modules/cloud/google/gcp_storage_bucket_access_control.py +++ b/lib/ansible/modules/cloud/google/gcp_storage_bucket_access_control.py @@ -117,7 +117,7 @@ - name: create a bucket access control gcp_storage_bucket_access_control: - bucket: "{{ bucket }}" + bucket: "test_object" entity: user-alexstephen@google.com role: WRITER project: "test_project" diff --git a/test/integration/targets/gcp_spanner_instance/tasks/main.yml b/test/integration/targets/gcp_spanner_instance/tasks/main.yml index e95b89073092dd..d3280e5fac4a22 100644 --- a/test/integration/targets/gcp_spanner_instance/tasks/main.yml +++ b/test/integration/targets/gcp_spanner_instance/tasks/main.yml @@ -15,7 +15,7 @@ # Pre-test setup - name: delete a instance gcp_spanner_instance: - name: "{{ resource_name }}" + name: testinstance display_name: My Spanner Instance node_count: 2 labels: @@ -28,7 +28,7 @@ #---------------------------------------------------------- - name: create a instance gcp_spanner_instance: - name: "{{ resource_name }}" + name: testinstance display_name: My Spanner Instance node_count: 2 labels: @@ -58,7 +58,7 @@ # ---------------------------------------------------------------------------- - name: create a instance that already exists gcp_spanner_instance: - name: "{{ resource_name }}" + name: testinstance display_name: My Spanner Instance node_count: 2 labels: @@ -76,7 +76,7 @@ #---------------------------------------------------------- - name: delete a instance gcp_spanner_instance: - name: "{{ resource_name }}" + name: testinstance display_name: My Spanner Instance node_count: 2 labels: @@ -106,7 +106,7 @@ # ---------------------------------------------------------------------------- - name: delete a instance that does not exist gcp_spanner_instance: - name: "{{ resource_name }}" + name: testinstance display_name: My Spanner Instance node_count: 2 labels: diff --git a/test/integration/targets/gcp_storage_bucket_access_control/tasks/main.yml b/test/integration/targets/gcp_storage_bucket_access_control/tasks/main.yml index c4a28f0c854b39..f71247cc6a21db 100644 --- a/test/integration/targets/gcp_storage_bucket_access_control/tasks/main.yml +++ b/test/integration/targets/gcp_storage_bucket_access_control/tasks/main.yml @@ -23,7 +23,7 @@ register: bucket - name: delete a bucket access control gcp_storage_bucket_access_control: - bucket: "{{ bucket }}" + bucket: "{{ resource_name }}" entity: user-alexstephen@google.com role: WRITER project: "{{ gcp_project }}" @@ -33,7 +33,7 @@ #---------------------------------------------------------- - name: create a bucket access control gcp_storage_bucket_access_control: - bucket: "{{ bucket }}" + bucket: "{{ resource_name }}" entity: user-alexstephen@google.com role: WRITER project: "{{ gcp_project }}" @@ -49,7 +49,7 @@ # ---------------------------------------------------------------------------- - name: create a bucket access control that already exists gcp_storage_bucket_access_control: - bucket: "{{ bucket }}" + bucket: "{{ resource_name }}" entity: user-alexstephen@google.com role: WRITER project: "{{ gcp_project }}" @@ -65,7 +65,7 @@ #---------------------------------------------------------- - name: delete a bucket access control gcp_storage_bucket_access_control: - bucket: "{{ bucket }}" + bucket: "{{ resource_name }}" entity: user-alexstephen@google.com role: WRITER project: "{{ gcp_project }}" @@ -81,7 +81,7 @@ # ---------------------------------------------------------------------------- - name: delete a bucket access control that does not exist gcp_storage_bucket_access_control: - bucket: "{{ bucket }}" + bucket: "{{ resource_name }}" entity: user-alexstephen@google.com role: WRITER project: "{{ gcp_project }}" From 57afbc75fff3aef5d1fb4f5e5dc4ad856a318100 Mon Sep 17 00:00:00 2001 From: The Magician Date: Thu, 31 Jan 2019 09:54:33 -0800 Subject: [PATCH 104/144] Changing NodePool from Zone to Location (#182) /cc @rambleraptor --- .../cloud/google/gcp_container_cluster.py | 5 +++- .../google/gcp_container_cluster_facts.py | 4 ++- .../cloud/google/gcp_container_node_pool.py | 26 +++++++++++-------- .../google/gcp_container_node_pool_facts.py | 20 ++++++++------ .../gcp_container_node_pool/tasks/main.yml | 18 ++++++------- 5 files changed, 43 insertions(+), 30 deletions(-) diff --git a/lib/ansible/modules/cloud/google/gcp_container_cluster.py b/lib/ansible/modules/cloud/google/gcp_container_cluster.py index e0f8726ccc51a6..36e12dbbd45c72 100644 --- a/lib/ansible/modules/cloud/google/gcp_container_cluster.py +++ b/lib/ansible/modules/cloud/google/gcp_container_cluster.py @@ -256,6 +256,9 @@ description: - The location where the cluster is deployed. required: true + aliases: + - zone + version_added: 2.8 extends_documentation_fragment: gcp ''' @@ -622,7 +625,7 @@ def main(): ), ), subnetwork=dict(type='str'), - location=dict(required=True, type='str'), + location=dict(required=True, type='str', aliases=['zone']), ) ) diff --git a/lib/ansible/modules/cloud/google/gcp_container_cluster_facts.py b/lib/ansible/modules/cloud/google/gcp_container_cluster_facts.py index 5f5f1d754fdf0c..67fe06fbff85a4 100644 --- a/lib/ansible/modules/cloud/google/gcp_container_cluster_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_container_cluster_facts.py @@ -45,7 +45,9 @@ - The location where the cluster is deployed. required: true aliases: + - region - zone + version_added: 2.8 extends_documentation_fragment: gcp ''' @@ -362,7 +364,7 @@ def main(): - module = GcpModule(argument_spec=dict(location=dict(required=True, type='str', aliases=['zone']))) + module = GcpModule(argument_spec=dict(location=dict(required=True, type='str', aliases=['region', 'zone']))) if not module.params['scopes']: module.params['scopes'] = ['https://www.googleapis.com/auth/cloud-platform'] diff --git a/lib/ansible/modules/cloud/google/gcp_container_node_pool.py b/lib/ansible/modules/cloud/google/gcp_container_node_pool.py index 1619ebbca7f9e8..a635a4bf0d123b 100644 --- a/lib/ansible/modules/cloud/google/gcp_container_node_pool.py +++ b/lib/ansible/modules/cloud/google/gcp_container_node_pool.py @@ -207,10 +207,14 @@ Alternatively, you can add `register: name-of-resource` to a gcp_container_cluster task and then set this cluster field to "{{ name-of-resource }}"' required: true - zone: + location: description: - - The zone where the node pool is deployed. + - The location where the node pool is deployed. required: true + aliases: + - region + - zone + version_added: 2.8 extends_documentation_fragment: gcp ''' @@ -219,7 +223,7 @@ gcp_container_cluster: name: "cluster-nodepool" initial_node_count: 4 - zone: us-central1-a + location: us-central1-a project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" @@ -231,7 +235,7 @@ name: my-pool initial_node_count: 4 cluster: "{{ cluster }}" - zone: us-central1-a + location: us-central1-a project: "test_project" auth_kind: "serviceaccount" service_account_file: "/tmp/auth.pem" @@ -415,9 +419,9 @@ - The cluster this node pool belongs to. returned: success type: str -zone: +location: description: - - The zone where the node pool is deployed. + - The location where the node pool is deployed. returned: success type: str ''' @@ -468,7 +472,7 @@ def main(): ), ), cluster=dict(required=True), - zone=dict(required=True, type='str'), + location=dict(required=True, type='str', aliases=['region', 'zone']), ) ) @@ -542,16 +546,16 @@ def fetch_resource(module, link, allow_not_found=True): def self_link(module): res = { 'project': module.params['project'], - 'zone': module.params['zone'], + 'location': module.params['location'], 'cluster': replace_resource_dict(module.params['cluster'], 'name'), 'name': module.params['name'], } - return "https://container.googleapis.com/v1/projects/{project}/zones/{zone}/clusters/{cluster}/nodePools/{name}".format(**res) + return "https://container.googleapis.com/v1/projects/{project}/zones/{location}/clusters/{cluster}/nodePools/{name}".format(**res) def collection(module): - res = {'project': module.params['project'], 'zone': module.params['zone'], 'cluster': replace_resource_dict(module.params['cluster'], 'name')} - return "https://container.googleapis.com/v1/projects/{project}/zones/{zone}/clusters/{cluster}/nodePools".format(**res) + res = {'project': module.params['project'], 'location': module.params['location'], 'cluster': replace_resource_dict(module.params['cluster'], 'name')} + return "https://container.googleapis.com/v1/projects/{project}/zones/{location}/clusters/{cluster}/nodePools".format(**res) def return_if_object(module, response, allow_not_found=False): diff --git a/lib/ansible/modules/cloud/google/gcp_container_node_pool_facts.py b/lib/ansible/modules/cloud/google/gcp_container_node_pool_facts.py index 1ab26232cc03f1..33d4593a09ff97 100644 --- a/lib/ansible/modules/cloud/google/gcp_container_node_pool_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_container_node_pool_facts.py @@ -40,10 +40,14 @@ - requests >= 2.18.4 - google-auth >= 1.3.0 options: - zone: + location: description: - - The zone where the node pool is deployed. + - The location where the node pool is deployed. required: true + aliases: + - region + - zone + version_added: 2.8 cluster: description: - The cluster this node pool belongs to. @@ -59,7 +63,7 @@ - name: a node pool facts gcp_container_node_pool_facts: cluster: "{{ cluster }}" - zone: us-central1-a + location: us-central1-a project: test_project auth_kind: serviceaccount service_account_file: "/tmp/auth.pem" @@ -248,9 +252,9 @@ - The cluster this node pool belongs to. returned: success type: str - zone: + location: description: - - The zone where the node pool is deployed. + - The location where the node pool is deployed. returned: success type: str ''' @@ -267,7 +271,7 @@ def main(): - module = GcpModule(argument_spec=dict(zone=dict(required=True, type='str'), cluster=dict(required=True))) + module = GcpModule(argument_spec=dict(location=dict(required=True, type='str', aliases=['region', 'zone']), cluster=dict(required=True))) if not module.params['scopes']: module.params['scopes'] = ['https://www.googleapis.com/auth/cloud-platform'] @@ -282,8 +286,8 @@ def main(): def collection(module): - res = {'project': module.params['project'], 'zone': module.params['zone'], 'cluster': replace_resource_dict(module.params['cluster'], 'name')} - return "https://container.googleapis.com/v1/projects/{project}/zones/{zone}/clusters/{cluster}/nodePools".format(**res) + res = {'project': module.params['project'], 'location': module.params['location'], 'cluster': replace_resource_dict(module.params['cluster'], 'name')} + return "https://container.googleapis.com/v1/projects/{project}/zones/{location}/clusters/{cluster}/nodePools".format(**res) def fetch_list(module, link): diff --git a/test/integration/targets/gcp_container_node_pool/tasks/main.yml b/test/integration/targets/gcp_container_node_pool/tasks/main.yml index 9047ac40f644dd..775d6a4ffb826e 100644 --- a/test/integration/targets/gcp_container_node_pool/tasks/main.yml +++ b/test/integration/targets/gcp_container_node_pool/tasks/main.yml @@ -17,7 +17,7 @@ gcp_container_cluster: name: "cluster-nodepool" initial_node_count: 4 - zone: us-central1-a + location: us-central1-a project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" @@ -28,7 +28,7 @@ name: my-pool initial_node_count: 4 cluster: "{{ cluster }}" - zone: us-central1-a + location: us-central1-a project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" @@ -39,7 +39,7 @@ name: my-pool initial_node_count: 4 cluster: "{{ cluster }}" - zone: us-central1-a + location: us-central1-a project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" @@ -52,7 +52,7 @@ - name: verify that node_pool was created gcp_container_node_pool_facts: cluster: "{{ cluster }}" - zone: us-central1-a + location: us-central1-a project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" @@ -69,7 +69,7 @@ name: my-pool initial_node_count: 4 cluster: "{{ cluster }}" - zone: us-central1-a + location: us-central1-a project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" @@ -85,7 +85,7 @@ name: my-pool initial_node_count: 4 cluster: "{{ cluster }}" - zone: us-central1-a + location: us-central1-a project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" @@ -98,7 +98,7 @@ - name: verify that node_pool was deleted gcp_container_node_pool_facts: cluster: "{{ cluster }}" - zone: us-central1-a + location: us-central1-a project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" @@ -115,7 +115,7 @@ name: my-pool initial_node_count: 4 cluster: "{{ cluster }}" - zone: us-central1-a + location: us-central1-a project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" @@ -132,7 +132,7 @@ gcp_container_cluster: name: "cluster-nodepool" initial_node_count: 4 - zone: us-central1-a + location: us-central1-a project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" From d490275d24baa14b0480527166245da6a1e7e80f Mon Sep 17 00:00:00 2001 From: The Magician Date: Fri, 1 Feb 2019 16:16:23 -0800 Subject: [PATCH 105/144] Add fields to InterconnectAttachment to allow for PARTNER interconnects (#180) Signed-off-by: Modular Magician --- .../gcp_compute_interconnect_attachment.py | 69 +++++++++++++++++-- ...p_compute_interconnect_attachment_facts.py | 37 +++++++++- 2 files changed, 101 insertions(+), 5 deletions(-) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_interconnect_attachment.py b/lib/ansible/modules/cloud/google/gcp_compute_interconnect_attachment.py index c9a483bd22a756..f4ad618e0ed2db 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_interconnect_attachment.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_interconnect_attachment.py @@ -51,12 +51,30 @@ interconnect: description: - URL of the underlying Interconnect object that this attachment's traffic will - traverse through. - required: true + traverse through. Required if type is DEDICATED, must not be set if type is + PARTNER. + required: false description: description: - An optional description of this resource. required: false + edge_availability_domain: + description: + - Desired availability domain for the attachment. Only available for type PARTNER, + at creation time. For improved reliability, customers should configure a pair + of attachments with one per availability domain. The selected availability domain + will be provided to the Partner via the pairing key so that the provisioned + circuit will lie in the specified domain. If not specified, the value will default + to AVAILABILITY_DOMAIN_ANY. + required: false + type: + description: + - The type of InterconnectAttachment you wish to create. Defaults to DEDICATED. + required: false + choices: + - DEDICATED + - PARTNER + - PARTNER_PROVIDER router: description: - URL of the cloud router to be used for dynamic routing. This router must be @@ -128,7 +146,7 @@ interconnect: description: - URL of the underlying Interconnect object that this attachment's traffic will - traverse through. + traverse through. Required if type is DEDICATED, must not be set if type is PARTNER. returned: success type: str description: @@ -136,6 +154,30 @@ - An optional description of this resource. returned: success type: str +edgeAvailabilityDomain: + description: + - Desired availability domain for the attachment. Only available for type PARTNER, + at creation time. For improved reliability, customers should configure a pair + of attachments with one per availability domain. The selected availability domain + will be provided to the Partner via the pairing key so that the provisioned circuit + will lie in the specified domain. If not specified, the value will default to + AVAILABILITY_DOMAIN_ANY. + returned: success + type: str +pairingKey: + description: + - '[Output only for type PARTNER. Not present for DEDICATED]. The opaque identifier + of an PARTNER attachment used to initiate provisioning with a selected partner. + Of the form "XXXXX/region/domain" .' + returned: success + type: str +partnerAsn: + description: + - "[Output only for type PARTNER. Not present for DEDICATED]. Optional BGP ASN for + the router that should be supplied by a layer 3 Partner if they configured BGP + on behalf of the customer." + returned: success + type: str privateInterconnectInfo: description: - Information specific to an InterconnectAttachment. This property is populated @@ -149,6 +191,16 @@ going to and from this network and region. returned: success type: int +type: + description: + - The type of InterconnectAttachment you wish to create. Defaults to DEDICATED. + returned: success + type: str +state: + description: + - "[Output Only] The current state of this attachment's functionality." + returned: success + type: str googleReferenceId: description: - Google reference ID, to be used when raising support tickets with Google or otherwise @@ -226,8 +278,10 @@ def main(): module = GcpModule( argument_spec=dict( state=dict(default='present', choices=['present', 'absent'], type='str'), - interconnect=dict(required=True, type='str'), + interconnect=dict(type='str'), description=dict(type='str'), + edge_availability_domain=dict(type='str'), + type=dict(type='str', choices=['DEDICATED', 'PARTNER', 'PARTNER_PROVIDER']), router=dict(required=True), name=dict(required=True, type='str'), candidate_subnets=dict(type='list', elements='str'), @@ -286,6 +340,8 @@ def resource_to_request(module): u'kind': 'compute#interconnectAttachment', u'interconnect': module.params.get('interconnect'), u'description': module.params.get('description'), + u'edgeAvailabilityDomain': module.params.get('edge_availability_domain'), + u'type': module.params.get('type'), u'router': replace_resource_dict(module.params.get(u'router', {}), 'selfLink'), u'name': module.params.get('name'), u'candidateSubnets': module.params.get('candidate_subnets'), @@ -359,7 +415,12 @@ def response_to_hash(module, response): u'customerRouterIpAddress': response.get(u'customerRouterIpAddress'), u'interconnect': response.get(u'interconnect'), u'description': response.get(u'description'), + u'edgeAvailabilityDomain': response.get(u'edgeAvailabilityDomain'), + u'pairingKey': response.get(u'pairingKey'), + u'partnerAsn': response.get(u'partnerAsn'), u'privateInterconnectInfo': InterconnectAttachmentPrivateinterconnectinfo(response.get(u'privateInterconnectInfo', {}), module).from_response(), + u'type': response.get(u'type'), + u'state': response.get(u'state'), u'googleReferenceId': response.get(u'googleReferenceId'), u'router': response.get(u'router'), u'creationTimestamp': response.get(u'creationTimestamp'), diff --git a/lib/ansible/modules/cloud/google/gcp_compute_interconnect_attachment_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_interconnect_attachment_facts.py index 1605afc995ac79..0e638dc73f820a 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_interconnect_attachment_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_interconnect_attachment_facts.py @@ -84,7 +84,8 @@ interconnect: description: - URL of the underlying Interconnect object that this attachment's traffic will - traverse through. + traverse through. Required if type is DEDICATED, must not be set if type is + PARTNER. returned: success type: str description: @@ -92,6 +93,30 @@ - An optional description of this resource. returned: success type: str + edgeAvailabilityDomain: + description: + - Desired availability domain for the attachment. Only available for type PARTNER, + at creation time. For improved reliability, customers should configure a pair + of attachments with one per availability domain. The selected availability + domain will be provided to the Partner via the pairing key so that the provisioned + circuit will lie in the specified domain. If not specified, the value will + default to AVAILABILITY_DOMAIN_ANY. + returned: success + type: str + pairingKey: + description: + - '[Output only for type PARTNER. Not present for DEDICATED]. The opaque identifier + of an PARTNER attachment used to initiate provisioning with a selected partner. + Of the form "XXXXX/region/domain" .' + returned: success + type: str + partnerAsn: + description: + - "[Output only for type PARTNER. Not present for DEDICATED]. Optional BGP ASN + for the router that should be supplied by a layer 3 Partner if they configured + BGP on behalf of the customer." + returned: success + type: str privateInterconnectInfo: description: - Information specific to an InterconnectAttachment. This property is populated @@ -105,6 +130,16 @@ customer, going to and from this network and region. returned: success type: int + type: + description: + - The type of InterconnectAttachment you wish to create. Defaults to DEDICATED. + returned: success + type: str + state: + description: + - "[Output Only] The current state of this attachment's functionality." + returned: success + type: str googleReferenceId: description: - Google reference ID, to be used when raising support tickets with Google or From ba323e91181415de921d11e7ea77f570a1c558b5 Mon Sep 17 00:00:00 2001 From: The Magician Date: Wed, 6 Feb 2019 10:16:25 -0800 Subject: [PATCH 106/144] Ansible CloudBuild Triggers (#184) Signed-off-by: Modular Magician --- .../cloud/google/gcp_cloudbuild_trigger.py | 628 ++++++++++++++++++ .../google/gcp_cloudbuild_trigger_facts.py | 271 ++++++++ .../gcp_storage_bucket_access_control.py | 5 +- .../targets/gcp_cloudbuild_trigger/aliases | 2 + .../gcp_cloudbuild_trigger/defaults/main.yml | 3 + .../gcp_cloudbuild_trigger/meta/main.yml | 0 6 files changed, 908 insertions(+), 1 deletion(-) create mode 100644 lib/ansible/modules/cloud/google/gcp_cloudbuild_trigger.py create mode 100644 lib/ansible/modules/cloud/google/gcp_cloudbuild_trigger_facts.py create mode 100644 test/integration/targets/gcp_cloudbuild_trigger/aliases create mode 100644 test/integration/targets/gcp_cloudbuild_trigger/defaults/main.yml create mode 100644 test/integration/targets/gcp_cloudbuild_trigger/meta/main.yml diff --git a/lib/ansible/modules/cloud/google/gcp_cloudbuild_trigger.py b/lib/ansible/modules/cloud/google/gcp_cloudbuild_trigger.py new file mode 100644 index 00000000000000..c2b65b59952545 --- /dev/null +++ b/lib/ansible/modules/cloud/google/gcp_cloudbuild_trigger.py @@ -0,0 +1,628 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# +# Copyright (C) 2017 Google +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) +# ---------------------------------------------------------------------------- +# +# *** AUTO GENERATED CODE *** AUTO GENERATED CODE *** +# +# ---------------------------------------------------------------------------- +# +# This file is automatically generated by Magic Modules and manual +# changes will be clobbered when the file is regenerated. +# +# Please read more about how to change this file at +# https://www.github.com/GoogleCloudPlatform/magic-modules +# +# ---------------------------------------------------------------------------- + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +################################################################################ +# Documentation +################################################################################ + +ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ["preview"], 'supported_by': 'community'} + +DOCUMENTATION = ''' +--- +module: gcp_cloudbuild_trigger +description: +- Configuration for an automated build in response to source repository changes. +short_description: Creates a GCP Trigger +version_added: 2.8 +author: Google Inc. (@googlecloudplatform) +requirements: +- python >= 2.6 +- requests >= 2.18.4 +- google-auth >= 1.3.0 +options: + state: + description: + - Whether the given object should exist in GCP + choices: + - present + - absent + default: present + id: + description: + - The unique identifier for the trigger. + required: false + description: + description: + - Human-readable description of the trigger. + required: false + disabled: + description: + - Whether the trigger is disabled or not. If true, the trigger will never result + in a build. + required: false + substitutions: + description: + - Substitutions data for Build resource. + required: false + filename: + description: + - Path, from the source root, to a file whose contents is used for the template. + required: false + ignored_files: + description: + - ignoredFiles and includedFiles are file glob matches using http://godoc/pkg/path/filepath#Match + extended with support for `**`. + - If ignoredFiles and changed files are both empty, then they are not used to + determine whether or not to trigger a build. + - If ignoredFiles is not empty, then we ignore any files that match any of the + ignored_file globs. If the change has no files that are outside of the ignoredFiles + globs, then we do not trigger a build. + required: false + included_files: + description: + - ignoredFiles and includedFiles are file glob matches using http://godoc/pkg/path/filepath#Match + extended with support for `**`. + - If any of the files altered in the commit pass the ignoredFiles filter and includedFiles + is empty, then as far as this filter is concerned, we should trigger the build. + - If any of the files altered in the commit pass the ignoredFiles filter and includedFiles + is not empty, then we make sure that at least one of those files matches a includedFiles + glob. If not, then we do not trigger a build. + required: false + trigger_template: + description: + - Template describing the types of source changes to trigger a build. + - Branch and tag names in trigger templates are interpreted as regular expressions. + Any branch or tag change that matches that regular expression will trigger a + build. + required: false + suboptions: + project_id: + description: + - ID of the project that owns the Cloud Source Repository. If omitted, the + project ID requesting the build is assumed. + required: false + repo_name: + description: + - Name of the Cloud Source Repository. If omitted, the name "default" is assumed. + required: false + default: default + dir: + description: + - Directory, relative to the source root, in which to run the build. + - This must be a relative path. If a step's dir is specified and is an absolute + path, this value is ignored for that step's execution. + required: false + branch_name: + description: + - Name of the branch to build. + required: false + tag_name: + description: + - Name of the tag to build. + required: false + commit_sha: + description: + - Explicit commit SHA to build. + required: false + build: + description: + - Contents of the build template. + required: false + suboptions: + tags: + description: + - Tags for annotation of a Build. These are not docker tags. + required: false + images: + description: + - A list of images to be pushed upon the successful completion of all build + steps. + - The images are pushed using the builder service account's credentials. + - The digests of the pushed images will be stored in the Build resource's + results field. + - If any of the images fail to be pushed, the build status is marked FAILURE. + required: false + steps: + description: + - The operations to be performed on the workspace. + required: false + suboptions: + name: + description: + - The name of the container image that will run this particular build + step. + - If the image is available in the host's Docker daemon's cache, it will + be run directly. If not, the host will attempt to pull the image first, + using the builder service account's credentials if necessary. + - The Docker daemon's cache will already have the latest versions of all + of the officially supported build steps (U(https://github.com/GoogleCloudPlatform/cloud-builders).) + - The Docker daemon will also have cached many of the layers for some + popular images, like "ubuntu", "debian", but they will be refreshed + at the time you attempt to use them. + - If you built an image in a previous build step, it will be stored in + the host's Docker daemon's cache and is available to use as the name + for a later build step. + required: false + args: + description: + - A list of arguments that will be presented to the step when it is started. + - If the image used to run the step's container has an entrypoint, the + args are used as arguments to that entrypoint. If the image does not + define an entrypoint, the first element in args is used as the entrypoint, + and the remainder will be used as arguments. + required: false +extends_documentation_fragment: gcp +notes: +- 'API Reference: U(https://cloud.google.com/cloud-build/docs/api/reference/rest/)' +- 'Automating builds using build triggers: U(https://cloud.google.com/cloud-build/docs/running-builds/automate-builds)' +- The id for this resource is created by the API after you create the resource the + first time. If you want to manage this resource after creation, you'll have to copy + the generated id into the playbook. If you do not, new triggers will be created + on subsequent runs. +''' + +EXAMPLES = ''' +- name: create a repository + gcp_sourcerepo_repository: + name: projects/{{ gcp_project }}/repos/{{ resource_name }} + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present + +- name: create a trigger + gcp_cloudbuild_trigger: + trigger_template: + branch_name: master + project_id: "test_project" + repo_name: "test_object" + filename: cloudbuild.yaml + project: "test_project" + auth_kind: "serviceaccount" + service_account_file: "/tmp/auth.pem" + state: present +''' + +RETURN = ''' +id: + description: + - The unique identifier for the trigger. + returned: success + type: str +description: + description: + - Human-readable description of the trigger. + returned: success + type: str +disabled: + description: + - Whether the trigger is disabled or not. If true, the trigger will never result + in a build. + returned: success + type: str +createTime: + description: + - Time when the trigger was created. + returned: success + type: str +substitutions: + description: + - Substitutions data for Build resource. + returned: success + type: dict +filename: + description: + - Path, from the source root, to a file whose contents is used for the template. + returned: success + type: str +ignoredFiles: + description: + - ignoredFiles and includedFiles are file glob matches using http://godoc/pkg/path/filepath#Match + extended with support for `**`. + - If ignoredFiles and changed files are both empty, then they are not used to determine + whether or not to trigger a build. + - If ignoredFiles is not empty, then we ignore any files that match any of the ignored_file + globs. If the change has no files that are outside of the ignoredFiles globs, + then we do not trigger a build. + returned: success + type: list +includedFiles: + description: + - ignoredFiles and includedFiles are file glob matches using http://godoc/pkg/path/filepath#Match + extended with support for `**`. + - If any of the files altered in the commit pass the ignoredFiles filter and includedFiles + is empty, then as far as this filter is concerned, we should trigger the build. + - If any of the files altered in the commit pass the ignoredFiles filter and includedFiles + is not empty, then we make sure that at least one of those files matches a includedFiles + glob. If not, then we do not trigger a build. + returned: success + type: list +triggerTemplate: + description: + - Template describing the types of source changes to trigger a build. + - Branch and tag names in trigger templates are interpreted as regular expressions. + Any branch or tag change that matches that regular expression will trigger a build. + returned: success + type: complex + contains: + projectId: + description: + - ID of the project that owns the Cloud Source Repository. If omitted, the project + ID requesting the build is assumed. + returned: success + type: str + repoName: + description: + - Name of the Cloud Source Repository. If omitted, the name "default" is assumed. + returned: success + type: str + dir: + description: + - Directory, relative to the source root, in which to run the build. + - This must be a relative path. If a step's dir is specified and is an absolute + path, this value is ignored for that step's execution. + returned: success + type: str + branchName: + description: + - Name of the branch to build. + returned: success + type: str + tagName: + description: + - Name of the tag to build. + returned: success + type: str + commitSha: + description: + - Explicit commit SHA to build. + returned: success + type: str +build: + description: + - Contents of the build template. + returned: success + type: complex + contains: + tags: + description: + - Tags for annotation of a Build. These are not docker tags. + returned: success + type: list + images: + description: + - A list of images to be pushed upon the successful completion of all build + steps. + - The images are pushed using the builder service account's credentials. + - The digests of the pushed images will be stored in the Build resource's results + field. + - If any of the images fail to be pushed, the build status is marked FAILURE. + returned: success + type: list + steps: + description: + - The operations to be performed on the workspace. + returned: success + type: complex + contains: + name: + description: + - The name of the container image that will run this particular build step. + - If the image is available in the host's Docker daemon's cache, it will + be run directly. If not, the host will attempt to pull the image first, + using the builder service account's credentials if necessary. + - The Docker daemon's cache will already have the latest versions of all + of the officially supported build steps (U(https://github.com/GoogleCloudPlatform/cloud-builders).) + - The Docker daemon will also have cached many of the layers for some popular + images, like "ubuntu", "debian", but they will be refreshed at the time + you attempt to use them. + - If you built an image in a previous build step, it will be stored in the + host's Docker daemon's cache and is available to use as the name for a + later build step. + returned: success + type: str + args: + description: + - A list of arguments that will be presented to the step when it is started. + - If the image used to run the step's container has an entrypoint, the args + are used as arguments to that entrypoint. If the image does not define + an entrypoint, the first element in args is used as the entrypoint, and + the remainder will be used as arguments. + returned: success + type: list +''' + +################################################################################ +# Imports +################################################################################ + +from ansible.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest, remove_nones_from_dict, replace_resource_dict +import json + +################################################################################ +# Main +################################################################################ + + +def main(): + """Main function""" + + module = GcpModule( + argument_spec=dict( + state=dict(default='present', choices=['present', 'absent'], type='str'), + id=dict(type='str'), + description=dict(type='str'), + disabled=dict(type='str'), + substitutions=dict(type='dict'), + filename=dict(type='str'), + ignored_files=dict(type='list', elements='str'), + included_files=dict(type='list', elements='str'), + trigger_template=dict( + type='dict', + options=dict( + project_id=dict(type='str'), + repo_name=dict(default='default', type='str'), + dir=dict(type='str'), + branch_name=dict(type='str'), + tag_name=dict(type='str'), + commit_sha=dict(type='str'), + ), + ), + build=dict( + type='dict', + options=dict( + tags=dict(type='list', elements='str'), + images=dict(type='list', elements='str'), + steps=dict(type='list', elements='dict', options=dict(name=dict(type='str'), args=dict(type='list', elements='str'))), + ), + ), + ), + mutually_exclusive=[['build', 'filename']], + ) + + if not module.params['scopes']: + module.params['scopes'] = ['https://www.googleapis.com/auth/cloud-platform'] + + state = module.params['state'] + + if module.params['id']: + fetch = fetch_resource(module, self_link(module)) + else: + fetch = {} + changed = False + + if fetch: + if state == 'present': + if is_different(module, fetch): + update(module, self_link(module)) + fetch = fetch_resource(module, self_link(module)) + changed = True + else: + delete(module, self_link(module)) + fetch = {} + changed = True + else: + if state == 'present': + fetch = create(module, collection(module)) + changed = True + else: + fetch = {} + + fetch.update({'changed': changed}) + + module.exit_json(**fetch) + + +def create(module, link): + auth = GcpSession(module, 'cloudbuild') + return return_if_object(module, auth.post(link, resource_to_request(module))) + + +def update(module, link): + auth = GcpSession(module, 'cloudbuild') + return return_if_object(module, auth.patch(link, resource_to_request(module))) + + +def delete(module, link): + auth = GcpSession(module, 'cloudbuild') + return return_if_object(module, auth.delete(link)) + + +def resource_to_request(module): + request = { + u'id': module.params.get('id'), + u'description': module.params.get('description'), + u'disabled': module.params.get('disabled'), + u'substitutions': module.params.get('substitutions'), + u'filename': module.params.get('filename'), + u'ignoredFiles': module.params.get('ignored_files'), + u'includedFiles': module.params.get('included_files'), + u'triggerTemplate': TriggerTriggertemplate(module.params.get('trigger_template', {}), module).to_request(), + u'build': TriggerBuild(module.params.get('build', {}), module).to_request(), + } + return_vals = {} + for k, v in request.items(): + if v or v is False: + return_vals[k] = v + + return return_vals + + +def fetch_resource(module, link, allow_not_found=True): + auth = GcpSession(module, 'cloudbuild') + return return_if_object(module, auth.get(link), allow_not_found) + + +def self_link(module): + return "https://cloudbuild.googleapis.com/v1/projects/{project}/triggers/{id}".format(**module.params) + + +def collection(module): + return "https://cloudbuild.googleapis.com/v1/projects/{project}/triggers".format(**module.params) + + +def return_if_object(module, response, allow_not_found=False): + # If not found, return nothing. + if allow_not_found and response.status_code == 404: + return None + + # If no content, return nothing. + if response.status_code == 204: + return None + + try: + module.raise_for_status(response) + result = response.json() + except getattr(json.decoder, 'JSONDecodeError', ValueError): + module.fail_json(msg="Invalid JSON response with error: %s" % response.text) + + if navigate_hash(result, ['error', 'errors']): + module.fail_json(msg=navigate_hash(result, ['error', 'errors'])) + + return result + + +def is_different(module, response): + request = resource_to_request(module) + response = response_to_hash(module, response) + + # Remove all output-only from response. + response_vals = {} + for k, v in response.items(): + if k in request: + response_vals[k] = v + + request_vals = {} + for k, v in request.items(): + if k in response: + request_vals[k] = v + + return GcpRequest(request_vals) != GcpRequest(response_vals) + + +# Remove unnecessary properties from the response. +# This is for doing comparisons with Ansible's current parameters. +def response_to_hash(module, response): + return { + u'id': response.get(u'id'), + u'description': response.get(u'description'), + u'disabled': response.get(u'disabled'), + u'createTime': response.get(u'createTime'), + u'substitutions': response.get(u'substitutions'), + u'filename': response.get(u'filename'), + u'ignoredFiles': response.get(u'ignoredFiles'), + u'includedFiles': response.get(u'includedFiles'), + u'triggerTemplate': TriggerTriggertemplate(response.get(u'triggerTemplate', {}), module).from_response(), + u'build': TriggerBuild(response.get(u'build', {}), module).from_response(), + } + + +class TriggerTriggertemplate(object): + def __init__(self, request, module): + self.module = module + if request: + self.request = request + else: + self.request = {} + + def to_request(self): + return remove_nones_from_dict( + { + u'projectId': self.request.get('project_id'), + u'repoName': self.request.get('repo_name'), + u'dir': self.request.get('dir'), + u'branchName': self.request.get('branch_name'), + u'tagName': self.request.get('tag_name'), + u'commitSha': self.request.get('commit_sha'), + } + ) + + def from_response(self): + return remove_nones_from_dict( + { + u'projectId': self.request.get(u'projectId'), + u'repoName': self.request.get(u'repoName'), + u'dir': self.request.get(u'dir'), + u'branchName': self.request.get(u'branchName'), + u'tagName': self.request.get(u'tagName'), + u'commitSha': self.request.get(u'commitSha'), + } + ) + + +class TriggerBuild(object): + def __init__(self, request, module): + self.module = module + if request: + self.request = request + else: + self.request = {} + + def to_request(self): + return remove_nones_from_dict( + { + u'tags': self.request.get('tags'), + u'images': self.request.get('images'), + u'steps': TriggerStepsArray(self.request.get('steps', []), self.module).to_request(), + } + ) + + def from_response(self): + return remove_nones_from_dict( + { + u'tags': self.request.get(u'tags'), + u'images': self.request.get(u'images'), + u'steps': TriggerStepsArray(self.request.get(u'steps', []), self.module).from_response(), + } + ) + + +class TriggerStepsArray(object): + def __init__(self, request, module): + self.module = module + if request: + self.request = request + else: + self.request = [] + + def to_request(self): + items = [] + for item in self.request: + items.append(self._request_for_item(item)) + return items + + def from_response(self): + items = [] + for item in self.request: + items.append(self._response_from_item(item)) + return items + + def _request_for_item(self, item): + return remove_nones_from_dict({u'name': item.get('name'), u'args': item.get('args')}) + + def _response_from_item(self, item): + return remove_nones_from_dict({u'name': item.get(u'name'), u'args': item.get(u'args')}) + + +if __name__ == '__main__': + main() diff --git a/lib/ansible/modules/cloud/google/gcp_cloudbuild_trigger_facts.py b/lib/ansible/modules/cloud/google/gcp_cloudbuild_trigger_facts.py new file mode 100644 index 00000000000000..ee929ff1945c40 --- /dev/null +++ b/lib/ansible/modules/cloud/google/gcp_cloudbuild_trigger_facts.py @@ -0,0 +1,271 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# +# Copyright (C) 2017 Google +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) +# ---------------------------------------------------------------------------- +# +# *** AUTO GENERATED CODE *** AUTO GENERATED CODE *** +# +# ---------------------------------------------------------------------------- +# +# This file is automatically generated by Magic Modules and manual +# changes will be clobbered when the file is regenerated. +# +# Please read more about how to change this file at +# https://www.github.com/GoogleCloudPlatform/magic-modules +# +# ---------------------------------------------------------------------------- + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +################################################################################ +# Documentation +################################################################################ + +ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ["preview"], 'supported_by': 'community'} + +DOCUMENTATION = ''' +--- +module: gcp_cloudbuild_trigger_facts +description: +- Gather facts for GCP Trigger +short_description: Gather facts for GCP Trigger +version_added: 2.8 +author: Google Inc. (@googlecloudplatform) +requirements: +- python >= 2.6 +- requests >= 2.18.4 +- google-auth >= 1.3.0 +options: {} +extends_documentation_fragment: gcp +''' + +EXAMPLES = ''' +- name: a trigger facts + gcp_cloudbuild_trigger_facts: + project: test_project + auth_kind: serviceaccount + service_account_file: "/tmp/auth.pem" +''' + +RETURN = ''' +items: + description: List of items + returned: always + type: complex + contains: + id: + description: + - The unique identifier for the trigger. + returned: success + type: str + description: + description: + - Human-readable description of the trigger. + returned: success + type: str + disabled: + description: + - Whether the trigger is disabled or not. If true, the trigger will never result + in a build. + returned: success + type: str + createTime: + description: + - Time when the trigger was created. + returned: success + type: str + substitutions: + description: + - Substitutions data for Build resource. + returned: success + type: dict + filename: + description: + - Path, from the source root, to a file whose contents is used for the template. + returned: success + type: str + ignoredFiles: + description: + - ignoredFiles and includedFiles are file glob matches using http://godoc/pkg/path/filepath#Match + extended with support for `**`. + - If ignoredFiles and changed files are both empty, then they are not used to + determine whether or not to trigger a build. + - If ignoredFiles is not empty, then we ignore any files that match any of the + ignored_file globs. If the change has no files that are outside of the ignoredFiles + globs, then we do not trigger a build. + returned: success + type: list + includedFiles: + description: + - ignoredFiles and includedFiles are file glob matches using http://godoc/pkg/path/filepath#Match + extended with support for `**`. + - If any of the files altered in the commit pass the ignoredFiles filter and + includedFiles is empty, then as far as this filter is concerned, we should + trigger the build. + - If any of the files altered in the commit pass the ignoredFiles filter and + includedFiles is not empty, then we make sure that at least one of those files + matches a includedFiles glob. If not, then we do not trigger a build. + returned: success + type: list + triggerTemplate: + description: + - Template describing the types of source changes to trigger a build. + - Branch and tag names in trigger templates are interpreted as regular expressions. + Any branch or tag change that matches that regular expression will trigger + a build. + returned: success + type: complex + contains: + projectId: + description: + - ID of the project that owns the Cloud Source Repository. If omitted, the + project ID requesting the build is assumed. + returned: success + type: str + repoName: + description: + - Name of the Cloud Source Repository. If omitted, the name "default" is + assumed. + returned: success + type: str + dir: + description: + - Directory, relative to the source root, in which to run the build. + - This must be a relative path. If a step's dir is specified and is an absolute + path, this value is ignored for that step's execution. + returned: success + type: str + branchName: + description: + - Name of the branch to build. + returned: success + type: str + tagName: + description: + - Name of the tag to build. + returned: success + type: str + commitSha: + description: + - Explicit commit SHA to build. + returned: success + type: str + build: + description: + - Contents of the build template. + returned: success + type: complex + contains: + tags: + description: + - Tags for annotation of a Build. These are not docker tags. + returned: success + type: list + images: + description: + - A list of images to be pushed upon the successful completion of all build + steps. + - The images are pushed using the builder service account's credentials. + - The digests of the pushed images will be stored in the Build resource's + results field. + - If any of the images fail to be pushed, the build status is marked FAILURE. + returned: success + type: list + steps: + description: + - The operations to be performed on the workspace. + returned: success + type: complex + contains: + name: + description: + - The name of the container image that will run this particular build + step. + - If the image is available in the host's Docker daemon's cache, it + will be run directly. If not, the host will attempt to pull the image + first, using the builder service account's credentials if necessary. + - The Docker daemon's cache will already have the latest versions of + all of the officially supported build steps (U(https://github.com/GoogleCloudPlatform/cloud-builders).) + - The Docker daemon will also have cached many of the layers for some + popular images, like "ubuntu", "debian", but they will be refreshed + at the time you attempt to use them. + - If you built an image in a previous build step, it will be stored + in the host's Docker daemon's cache and is available to use as the + name for a later build step. + returned: success + type: str + args: + description: + - A list of arguments that will be presented to the step when it is + started. + - If the image used to run the step's container has an entrypoint, the + args are used as arguments to that entrypoint. If the image does not + define an entrypoint, the first element in args is used as the entrypoint, + and the remainder will be used as arguments. + returned: success + type: list +''' + +################################################################################ +# Imports +################################################################################ +from ansible.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest +import json + +################################################################################ +# Main +################################################################################ + + +def main(): + module = GcpModule(argument_spec=dict()) + + if not module.params['scopes']: + module.params['scopes'] = ['https://www.googleapis.com/auth/cloud-platform'] + + items = fetch_list(module, collection(module)) + if items.get('triggers'): + items = items.get('triggers') + else: + items = [] + return_value = {'items': items} + module.exit_json(**return_value) + + +def collection(module): + return "https://cloudbuild.googleapis.com/v1/projects/{project}/triggers".format(**module.params) + + +def fetch_list(module, link): + auth = GcpSession(module, 'cloudbuild') + response = auth.get(link) + return return_if_object(module, response) + + +def return_if_object(module, response): + # If not found, return nothing. + if response.status_code == 404: + return None + + # If no content, return nothing. + if response.status_code == 204: + return None + + try: + module.raise_for_status(response) + result = response.json() + except getattr(json.decoder, 'JSONDecodeError', ValueError) as inst: + module.fail_json(msg="Invalid JSON response with error: %s" % inst) + + if navigate_hash(result, ['error', 'errors']): + module.fail_json(msg=navigate_hash(result, ['error', 'errors'])) + + return result + + +if __name__ == "__main__": + main() diff --git a/lib/ansible/modules/cloud/google/gcp_storage_bucket_access_control.py b/lib/ansible/modules/cloud/google/gcp_storage_bucket_access_control.py index f0507f8be85235..5bfa359bb172d0 100644 --- a/lib/ansible/modules/cloud/google/gcp_storage_bucket_access_control.py +++ b/lib/ansible/modules/cloud/google/gcp_storage_bucket_access_control.py @@ -217,7 +217,10 @@ def main(): state = module.params['state'] kind = 'storage#bucketAccessControl' - fetch = fetch_resource(module, self_link(module), kind) + if module.params['id']: + fetch = fetch_resource(module, self_link(module), kind) + else: + fetch = {} changed = False if fetch: diff --git a/test/integration/targets/gcp_cloudbuild_trigger/aliases b/test/integration/targets/gcp_cloudbuild_trigger/aliases new file mode 100644 index 00000000000000..9812f019ca4bae --- /dev/null +++ b/test/integration/targets/gcp_cloudbuild_trigger/aliases @@ -0,0 +1,2 @@ +cloud/gcp +unsupported diff --git a/test/integration/targets/gcp_cloudbuild_trigger/defaults/main.yml b/test/integration/targets/gcp_cloudbuild_trigger/defaults/main.yml new file mode 100644 index 00000000000000..aa87a2a8e0e0e0 --- /dev/null +++ b/test/integration/targets/gcp_cloudbuild_trigger/defaults/main.yml @@ -0,0 +1,3 @@ +--- +# defaults file +resource_name: '{{resource_prefix}}' diff --git a/test/integration/targets/gcp_cloudbuild_trigger/meta/main.yml b/test/integration/targets/gcp_cloudbuild_trigger/meta/main.yml new file mode 100644 index 00000000000000..e69de29bb2d1d6 From 49381c2f2ec0c4a864bd5a1c521898a43a754545 Mon Sep 17 00:00:00 2001 From: The Magician Date: Wed, 6 Feb 2019 15:14:44 -0800 Subject: [PATCH 107/144] Ansible: better field names on gcp_compute_instance (#185) /cc @rambleraptor --- lib/ansible/modules/cloud/google/gcp_compute_instance.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_instance.py b/lib/ansible/modules/cloud/google/gcp_compute_instance.py index 2908a151262543..73237ad5aff578 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_instance.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_instance.py @@ -54,6 +54,8 @@ routes. required: false type: bool + aliases: + - ip_forward disks: description: - An array of disks that are associated with the instances that are created from @@ -137,6 +139,9 @@ create a disk with one of the public operating system images, specify the image by its family name. required: false + aliases: + - image + - image_family source_image_encryption_key: description: - The customer-supplied encryption key of the source image. Required if @@ -889,7 +894,7 @@ def main(): module = GcpModule( argument_spec=dict( state=dict(default='present', choices=['present', 'absent'], type='str'), - can_ip_forward=dict(type='bool'), + can_ip_forward=dict(type='bool', aliases=['ip_forward']), disks=dict( type='list', elements='dict', @@ -905,7 +910,7 @@ def main(): disk_name=dict(type='str'), disk_size_gb=dict(type='int'), disk_type=dict(type='str'), - source_image=dict(type='str'), + source_image=dict(type='str', aliases=['image', 'image_family']), source_image_encryption_key=dict(type='dict', options=dict(raw_key=dict(type='str'), sha256=dict(type='str'))), ), ), From 2a909a6286b59e3e05025cb7916acd4fe2869486 Mon Sep 17 00:00:00 2001 From: The Magician Date: Fri, 8 Feb 2019 12:05:31 -0800 Subject: [PATCH 108/144] Changed Image.licenses to an array of resourcerefs instead of strings. (#186) /cc @rileykarson --- lib/ansible/modules/cloud/google/gcp_compute_image.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_image.py b/lib/ansible/modules/cloud/google/gcp_compute_image.py index 5695b6663b688c..7a1ec37526956b 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_image.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_image.py @@ -435,6 +435,7 @@ from ansible.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest, remove_nones_from_dict, replace_resource_dict import json +import re import time ################################################################################ @@ -628,6 +629,15 @@ def response_to_hash(module, response): } +def license_selflink(name, params): + if name is None: + return + url = r"https://www.googleapis.com/compute/v1//projects/.*/global/licenses/[a-z1-9\-]*" + if not re.match(url, name): + name = "https://www.googleapis.com/compute/v1//projects/{project}/global/licenses/%s".format(**params) % name + return name + + def async_op_url(module, extra_data=None): if extra_data is None: extra_data = {} From a2791c4e522b26d47af5510c806cf599b8e06857 Mon Sep 17 00:00:00 2001 From: The Magician Date: Tue, 12 Feb 2019 11:11:12 -0800 Subject: [PATCH 109/144] Add sql settings for (#189) Signed-off-by: Modular Magician --- .../modules/cloud/google/gcp_sql_instance.py | 81 +++++++++++++++++++ .../cloud/google/gcp_sql_instance_facts.py | 28 +++++++ 2 files changed, 109 insertions(+) diff --git a/lib/ansible/modules/cloud/google/gcp_sql_instance.py b/lib/ansible/modules/cloud/google/gcp_sql_instance.py index 470cc21ed91db8..5252317069196c 100644 --- a/lib/ansible/modules/cloud/google/gcp_sql_instance.py +++ b/lib/ansible/modules/cloud/google/gcp_sql_instance.py @@ -259,6 +259,33 @@ For MySQL instances, this field determines whether the instance is Second Generation (recommended) or First Generation. required: false + availability_type: + description: + - The availabilityType define if your postgres instance is run zonal or regional. + required: false + choices: + - ZONAL + - REGIONAL + backup_configuration: + description: + - The daily backup configuration for the instance. + required: false + suboptions: + enabled: + description: + - Enable Autobackup for your instance. + required: false + type: bool + binary_log_enabled: + description: + - Whether binary log is enabled. If backup configuration is disabled, + binary log must be disabled as well. MySQL only. + required: false + type: bool + start_time: + description: + - Define the backup start time in UTC (HH:MM) . + required: false settings_version: description: - The version of instance settings. This is a required field for update method @@ -538,6 +565,33 @@ Generation (recommended) or First Generation. returned: success type: str + availabilityType: + description: + - The availabilityType define if your postgres instance is run zonal or regional. + returned: success + type: str + backupConfiguration: + description: + - The daily backup configuration for the instance. + returned: success + type: complex + contains: + enabled: + description: + - Enable Autobackup for your instance. + returned: success + type: bool + binaryLogEnabled: + description: + - Whether binary log is enabled. If backup configuration is disabled, binary + log must be disabled as well. MySQL only. + returned: success + type: bool + startTime: + description: + - Define the backup start time in UTC (HH:MM) . + returned: success + type: str settingsVersion: description: - The version of instance settings. This is a required field for update method @@ -614,6 +668,10 @@ def main(): ), ), tier=dict(type='str'), + availability_type=dict(type='str', choices=['ZONAL', 'REGIONAL']), + backup_configuration=dict( + type='dict', options=dict(enabled=dict(type='bool'), binary_log_enabled=dict(type='bool'), start_time=dict(type='str')) + ), settings_version=dict(type='int'), ), ), @@ -927,6 +985,8 @@ def to_request(self): { u'ipConfiguration': InstanceIpconfiguration(self.request.get('ip_configuration', {}), self.module).to_request(), u'tier': self.request.get('tier'), + u'availabilityType': self.request.get('availability_type'), + u'backupConfiguration': InstanceBackupconfiguration(self.request.get('backup_configuration', {}), self.module).to_request(), u'settingsVersion': self.request.get('settings_version'), } ) @@ -936,6 +996,8 @@ def from_response(self): { u'ipConfiguration': InstanceIpconfiguration(self.request.get(u'ipConfiguration', {}), self.module).from_response(), u'tier': self.request.get(u'tier'), + u'availabilityType': self.request.get(u'availabilityType'), + u'backupConfiguration': InstanceBackupconfiguration(self.request.get(u'backupConfiguration', {}), self.module).from_response(), u'settingsVersion': self.request.get(u'settingsVersion'), } ) @@ -995,5 +1057,24 @@ def _response_from_item(self, item): return remove_nones_from_dict({u'expirationTime': item.get(u'expirationTime'), u'name': item.get(u'name'), u'value': item.get(u'value')}) +class InstanceBackupconfiguration(object): + def __init__(self, request, module): + self.module = module + if request: + self.request = request + else: + self.request = {} + + def to_request(self): + return remove_nones_from_dict( + {u'enabled': self.request.get('enabled'), u'binaryLogEnabled': self.request.get('binary_log_enabled'), u'startTime': self.request.get('start_time')} + ) + + def from_response(self): + return remove_nones_from_dict( + {u'enabled': self.request.get(u'enabled'), u'binaryLogEnabled': self.request.get(u'binaryLogEnabled'), u'startTime': self.request.get(u'startTime')} + ) + + if __name__ == '__main__': main() diff --git a/lib/ansible/modules/cloud/google/gcp_sql_instance_facts.py b/lib/ansible/modules/cloud/google/gcp_sql_instance_facts.py index f5bf3c6fe15a1a..f921083480eba2 100644 --- a/lib/ansible/modules/cloud/google/gcp_sql_instance_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_sql_instance_facts.py @@ -312,6 +312,34 @@ Generation (recommended) or First Generation. returned: success type: str + availabilityType: + description: + - The availabilityType define if your postgres instance is run zonal or + regional. + returned: success + type: str + backupConfiguration: + description: + - The daily backup configuration for the instance. + returned: success + type: complex + contains: + enabled: + description: + - Enable Autobackup for your instance. + returned: success + type: bool + binaryLogEnabled: + description: + - Whether binary log is enabled. If backup configuration is disabled, + binary log must be disabled as well. MySQL only. + returned: success + type: bool + startTime: + description: + - Define the backup start time in UTC (HH:MM) . + returned: success + type: str settingsVersion: description: - The version of instance settings. This is a required field for update From 1703c667f137d5e7ae18d286e027262353a4badf Mon Sep 17 00:00:00 2001 From: The Magician Date: Thu, 14 Feb 2019 12:50:48 -0800 Subject: [PATCH 110/144] Clarify Private Google Access docs on Subnetwork. (#187) /cc @rileykarson --- .../modules/cloud/google/gcp_compute_subnetwork.py | 8 ++++---- .../modules/cloud/google/gcp_compute_subnetwork_facts.py | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_subnetwork.py b/lib/ansible/modules/cloud/google/gcp_compute_subnetwork.py index f33349d0b975d0..3097e9abf66d5b 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_subnetwork.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_subnetwork.py @@ -122,8 +122,8 @@ required: true private_ip_google_access: description: - - Whether the VMs in this subnet can access Google services without assigned external - IP addresses. + - When enabled, VMs in this subnetwork without external IP addresses can access + Google APIs and services by using Private Google Access. required: false type: bool region: @@ -243,8 +243,8 @@ type: str privateIpGoogleAccess: description: - - Whether the VMs in this subnet can access Google services without assigned external - IP addresses. + - When enabled, VMs in this subnetwork without external IP addresses can access + Google APIs and services by using Private Google Access. returned: success type: bool region: diff --git a/lib/ansible/modules/cloud/google/gcp_compute_subnetwork_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_subnetwork_facts.py index 0c6a4e52d59f96..77de9f76fc18e7 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_subnetwork_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_subnetwork_facts.py @@ -152,8 +152,8 @@ type: str privateIpGoogleAccess: description: - - Whether the VMs in this subnet can access Google services without assigned - external IP addresses. + - When enabled, VMs in this subnetwork without external IP addresses can access + Google APIs and services by using Private Google Access. returned: success type: bool region: From ff41d93301b954ed91203e50bde16be23fa78c05 Mon Sep 17 00:00:00 2001 From: The Magician Date: Fri, 15 Feb 2019 12:51:37 -0800 Subject: [PATCH 111/144] Add TLSA to the list of allowed DNS record types (#192) /cc @matco --- .../modules/cloud/google/gcp_dns_resource_record_set.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/ansible/modules/cloud/google/gcp_dns_resource_record_set.py b/lib/ansible/modules/cloud/google/gcp_dns_resource_record_set.py index a6fccb7032ada6..ae4d7529fa7271 100644 --- a/lib/ansible/modules/cloud/google/gcp_dns_resource_record_set.py +++ b/lib/ansible/modules/cloud/google/gcp_dns_resource_record_set.py @@ -71,6 +71,7 @@ - SOA - SPF - SRV + - TLSA - TXT ttl: description: @@ -170,7 +171,7 @@ def main(): argument_spec=dict( state=dict(default='present', choices=['present', 'absent'], type='str'), name=dict(required=True, type='str'), - type=dict(required=True, type='str', choices=['A', 'AAAA', 'CAA', 'CNAME', 'MX', 'NAPTR', 'NS', 'PTR', 'SOA', 'SPF', 'SRV', 'TXT']), + type=dict(required=True, type='str', choices=['A', 'AAAA', 'CAA', 'CNAME', 'MX', 'NAPTR', 'NS', 'PTR', 'SOA', 'SPF', 'SRV', 'TLSA', 'TXT']), ttl=dict(type='int'), target=dict(type='list', elements='str'), managed_zone=dict(required=True), From 80de604152cdfd8d408fdf93e341d4c91bec74da Mon Sep 17 00:00:00 2001 From: The Magician Date: Fri, 15 Feb 2019 15:49:13 -0800 Subject: [PATCH 112/144] Retrieve SOA record using DNS zone instead of building it from record name (#188) /cc @matco --- .../modules/cloud/google/gcp_dns_resource_record_set.py | 5 +---- .../cloud/google/gcp_dns_resource_record_set_facts.py | 2 -- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/lib/ansible/modules/cloud/google/gcp_dns_resource_record_set.py b/lib/ansible/modules/cloud/google/gcp_dns_resource_record_set.py index ae4d7529fa7271..d729fdf7d569c4 100644 --- a/lib/ansible/modules/cloud/google/gcp_dns_resource_record_set.py +++ b/lib/ansible/modules/cloud/google/gcp_dns_resource_record_set.py @@ -84,7 +84,6 @@ managed_zone: description: - Identifies the managed zone addressed by this request. - - Can be the managed zone name or id. - 'This field represents a link to a ManagedZone resource in GCP. It can be specified in two ways. First, you can place in the name of the resource here as a string Alternatively, you can add `register: name-of-resource` to a gcp_dns_managed_zone @@ -144,7 +143,6 @@ managed_zone: description: - Identifies the managed zone addressed by this request. - - Can be the managed zone name or id. returned: success type: str ''' @@ -359,13 +357,12 @@ def raise_for_status(self, *args, **kwargs): def prefetch_soa_resource(module): - name = module.params['name'].split('.')[1:] resource = SOAForwardable( { 'type': 'SOA', 'managed_zone': module.params['managed_zone'], - 'name': '.'.join(name), + 'name': replace_resource_dict(module.params['managed_zone'], 'dnsName'), 'project': module.params['project'], 'scopes': module.params['scopes'], 'service_account_file': module.params['service_account_file'], diff --git a/lib/ansible/modules/cloud/google/gcp_dns_resource_record_set_facts.py b/lib/ansible/modules/cloud/google/gcp_dns_resource_record_set_facts.py index f40930857a7982..c84edfec1e0ce7 100644 --- a/lib/ansible/modules/cloud/google/gcp_dns_resource_record_set_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_dns_resource_record_set_facts.py @@ -43,7 +43,6 @@ managed_zone: description: - Identifies the managed zone addressed by this request. - - Can be the managed zone name or id. - 'This field represents a link to a ManagedZone resource in GCP. It can be specified in two ways. First, you can place in the name of the resource here as a string Alternatively, you can add `register: name-of-resource` to a gcp_dns_managed_zone @@ -90,7 +89,6 @@ managed_zone: description: - Identifies the managed zone addressed by this request. - - Can be the managed zone name or id. returned: success type: str ''' From 39f72add526ccfbb481032470e8df71a70de5d81 Mon Sep 17 00:00:00 2001 From: The Magician Date: Tue, 19 Feb 2019 15:11:18 -0800 Subject: [PATCH 113/144] Add labels, update to Pubsub Subscription/Topic (#191) Signed-off-by: Modular Magician --- .../cloud/google/gcp_pubsub_subscription.py | 91 ++++++++++++++++--- .../google/gcp_pubsub_subscription_facts.py | 25 +++++ .../modules/cloud/google/gcp_pubsub_topic.py | 26 +++++- .../cloud/google/gcp_pubsub_topic_facts.py | 5 + 4 files changed, 131 insertions(+), 16 deletions(-) diff --git a/lib/ansible/modules/cloud/google/gcp_pubsub_subscription.py b/lib/ansible/modules/cloud/google/gcp_pubsub_subscription.py index 879c252d985d18..7d0ee1a6036710 100644 --- a/lib/ansible/modules/cloud/google/gcp_pubsub_subscription.py +++ b/lib/ansible/modules/cloud/google/gcp_pubsub_subscription.py @@ -51,7 +51,7 @@ name: description: - Name of the subscription. - required: false + required: true topic: description: - A reference to a Topic resource. @@ -59,7 +59,12 @@ in two ways. First, you can place in the name of the resource here as a string Alternatively, you can add `register: name-of-resource` to a gcp_pubsub_topic task and then set this topic field to "{{ name-of-resource }}"' + required: true + labels: + description: + - A set of key/value label pairs to assign to this Subscription. required: false + version_added: 2.8 push_config: description: - If push delivery is used with this subscription, this field is used to configure @@ -71,6 +76,25 @@ description: - A URL locating the endpoint to which messages should be pushed. - For example, a Webhook endpoint might use "U(https://example.com/push".) + required: true + attributes: + description: + - Endpoint configuration attributes. + - Every endpoint has a set of API supported attributes that can be used to + control different aspects of the message delivery. + - The currently supported attribute is x-goog-version, which you can use to + change the format of the pushed message. This attribute indicates the version + of the data expected by the endpoint. This controls the shape of the pushed + message (i.e., its fields and metadata). The endpoint version is based on + the version of the Pub/Sub API. + - If not present during the subscriptions.create call, it will default to + the version of the API used to make such call. If not present during a subscriptions.modifyPushConfig + call, its value will not be changed. subscriptions.get calls will always + return a valid version, even if the subscription was created without this + attribute. + - 'The possible values for this attribute are: - v1beta1: uses the push format + defined in the v1beta1 Pub/Sub API.' + - "- v1 or v1beta2: uses the push format defined in the v1 Pub/Sub API." required: false ack_deadline_seconds: description: @@ -90,6 +114,9 @@ redeliver the message. required: false extends_documentation_fragment: gcp +notes: +- 'API Reference: U(https://cloud.google.com/pubsub/docs/reference/rest/v1/projects.subscriptions)' +- 'Managing Subscriptions: U(https://cloud.google.com/pubsub/docs/admin#managing_subscriptions)' ''' EXAMPLES = ''' @@ -124,6 +151,11 @@ - A reference to a Topic resource. returned: success type: str +labels: + description: + - A set of key/value label pairs to assign to this Subscription. + returned: success + type: dict pushConfig: description: - If push delivery is used with this subscription, this field is used to configure @@ -138,6 +170,25 @@ - For example, a Webhook endpoint might use "U(https://example.com/push".) returned: success type: str + attributes: + description: + - Endpoint configuration attributes. + - Every endpoint has a set of API supported attributes that can be used to control + different aspects of the message delivery. + - The currently supported attribute is x-goog-version, which you can use to + change the format of the pushed message. This attribute indicates the version + of the data expected by the endpoint. This controls the shape of the pushed + message (i.e., its fields and metadata). The endpoint version is based on + the version of the Pub/Sub API. + - If not present during the subscriptions.create call, it will default to the + version of the API used to make such call. If not present during a subscriptions.modifyPushConfig + call, its value will not be changed. subscriptions.get calls will always return + a valid version, even if the subscription was created without this attribute. + - 'The possible values for this attribute are: - v1beta1: uses the push format + defined in the v1beta1 Pub/Sub API.' + - "- v1 or v1beta2: uses the push format defined in the v1 Pub/Sub API." + returned: success + type: dict ackDeadlineSeconds: description: - This value is the maximum time after a subscriber receives a message before the @@ -176,9 +227,10 @@ def main(): module = GcpModule( argument_spec=dict( state=dict(default='present', choices=['present', 'absent'], type='str'), - name=dict(type='str'), - topic=dict(), - push_config=dict(type='dict', options=dict(push_endpoint=dict(type='str'))), + name=dict(required=True, type='str'), + topic=dict(required=True), + labels=dict(type='dict'), + push_config=dict(type='dict', options=dict(push_endpoint=dict(required=True, type='str'), attributes=dict(type='dict'))), ack_deadline_seconds=dict(type='int'), ) ) @@ -194,7 +246,7 @@ def main(): if fetch: if state == 'present': if is_different(module, fetch): - update(module, self_link(module)) + update(module, self_link(module), fetch) fetch = fetch_resource(module, self_link(module)) changed = True else: @@ -218,8 +270,23 @@ def create(module, link): return return_if_object(module, auth.put(link, resource_to_request(module))) -def update(module, link): - module.fail_json(msg="Subscription cannot be edited") +def update(module, link, fetch): + auth = GcpSession(module, 'pubsub') + params = {'updateMask': updateMask(resource_to_request(module), response_to_hash(module, fetch))} + request = resource_to_request(module) + del request['name'] + return return_if_object(module, auth.patch(link, request, params=params)) + + +def updateMask(request, response): + update_mask = [] + if request.get('labels') != response.get('labels'): + update_mask.append('labels') + if request.get('pushConfig') != response.get('pushConfig'): + update_mask.append('pushConfig') + if request.get('ackDeadlineSeconds') != response.get('ackDeadlineSeconds'): + update_mask.append('ackDeadlineSeconds') + return ','.join(update_mask) def delete(module, link): @@ -231,6 +298,7 @@ def resource_to_request(module): request = { u'name': module.params.get('name'), u'topic': replace_resource_dict(module.params.get(u'topic', {}), 'name'), + u'labels': module.params.get('labels'), u'pushConfig': SubscriptionPushconfig(module.params.get('push_config', {}), module).to_request(), u'ackDeadlineSeconds': module.params.get('ack_deadline_seconds'), } @@ -302,8 +370,9 @@ def is_different(module, response): # This is for doing comparisons with Ansible's current parameters. def response_to_hash(module, response): return { - u'name': response.get(u'name'), - u'topic': response.get(u'topic'), + u'name': module.params.get('name'), + u'topic': replace_resource_dict(module.params.get(u'topic', {}), 'name'), + u'labels': response.get(u'labels'), u'pushConfig': SubscriptionPushconfig(response.get(u'pushConfig', {}), module).from_response(), u'ackDeadlineSeconds': response.get(u'ackDeadlineSeconds'), } @@ -335,10 +404,10 @@ def __init__(self, request, module): self.request = {} def to_request(self): - return remove_nones_from_dict({u'pushEndpoint': self.request.get('push_endpoint')}) + return remove_nones_from_dict({u'pushEndpoint': self.request.get('push_endpoint'), u'attributes': self.request.get('attributes')}) def from_response(self): - return remove_nones_from_dict({u'pushEndpoint': self.request.get(u'pushEndpoint')}) + return remove_nones_from_dict({u'pushEndpoint': self.request.get(u'pushEndpoint'), u'attributes': self.request.get(u'attributes')}) if __name__ == '__main__': diff --git a/lib/ansible/modules/cloud/google/gcp_pubsub_subscription_facts.py b/lib/ansible/modules/cloud/google/gcp_pubsub_subscription_facts.py index 45070052487e8a..5917598276bee0 100644 --- a/lib/ansible/modules/cloud/google/gcp_pubsub_subscription_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_pubsub_subscription_facts.py @@ -67,6 +67,11 @@ - A reference to a Topic resource. returned: success type: str + labels: + description: + - A set of key/value label pairs to assign to this Subscription. + returned: success + type: dict pushConfig: description: - If push delivery is used with this subscription, this field is used to configure @@ -81,6 +86,26 @@ - For example, a Webhook endpoint might use "U(https://example.com/push".) returned: success type: str + attributes: + description: + - Endpoint configuration attributes. + - Every endpoint has a set of API supported attributes that can be used + to control different aspects of the message delivery. + - The currently supported attribute is x-goog-version, which you can use + to change the format of the pushed message. This attribute indicates the + version of the data expected by the endpoint. This controls the shape + of the pushed message (i.e., its fields and metadata). The endpoint version + is based on the version of the Pub/Sub API. + - If not present during the subscriptions.create call, it will default to + the version of the API used to make such call. If not present during a + subscriptions.modifyPushConfig call, its value will not be changed. subscriptions.get + calls will always return a valid version, even if the subscription was + created without this attribute. + - 'The possible values for this attribute are: - v1beta1: uses the push + format defined in the v1beta1 Pub/Sub API.' + - "- v1 or v1beta2: uses the push format defined in the v1 Pub/Sub API." + returned: success + type: dict ackDeadlineSeconds: description: - This value is the maximum time after a subscriber receives a message before diff --git a/lib/ansible/modules/cloud/google/gcp_pubsub_topic.py b/lib/ansible/modules/cloud/google/gcp_pubsub_topic.py index 55380c7eae3a4b..3c6f4b0eafea54 100644 --- a/lib/ansible/modules/cloud/google/gcp_pubsub_topic.py +++ b/lib/ansible/modules/cloud/google/gcp_pubsub_topic.py @@ -50,8 +50,16 @@ name: description: - Name of the topic. + required: true + labels: + description: + - A set of key/value label pairs to assign to this Topic. required: false + version_added: 2.8 extends_documentation_fragment: gcp +notes: +- 'API Reference: U(https://cloud.google.com/pubsub/docs/reference/rest/v1/projects.topics)' +- 'Managing Topics: U(https://cloud.google.com/pubsub/docs/admin#managing_topics)' ''' EXAMPLES = ''' @@ -70,6 +78,11 @@ - Name of the topic. returned: success type: str +labels: + description: + - A set of key/value label pairs to assign to this Topic. + returned: success + type: dict ''' ################################################################################ @@ -87,7 +100,11 @@ def main(): """Main function""" - module = GcpModule(argument_spec=dict(state=dict(default='present', choices=['present', 'absent'], type='str'), name=dict(type='str'))) + module = GcpModule( + argument_spec=dict( + state=dict(default='present', choices=['present', 'absent'], type='str'), name=dict(required=True, type='str'), labels=dict(type='dict') + ) + ) if not module.params['scopes']: module.params['scopes'] = ['https://www.googleapis.com/auth/pubsub'] @@ -125,8 +142,7 @@ def create(module, link): def update(module, link): - auth = GcpSession(module, 'pubsub') - return return_if_object(module, auth.put(link, resource_to_request(module))) + module.fail_json(msg="Topic cannot be edited") def delete(module, link): @@ -135,7 +151,7 @@ def delete(module, link): def resource_to_request(module): - request = {u'name': module.params.get('name')} + request = {u'name': module.params.get('name'), u'labels': module.params.get('labels')} request = encode_request(request, module) return_vals = {} for k, v in request.items(): @@ -203,7 +219,7 @@ def is_different(module, response): # Remove unnecessary properties from the response. # This is for doing comparisons with Ansible's current parameters. def response_to_hash(module, response): - return {u'name': response.get(u'name')} + return {u'name': response.get(u'name'), u'labels': response.get(u'labels')} def decode_request(response, module): diff --git a/lib/ansible/modules/cloud/google/gcp_pubsub_topic_facts.py b/lib/ansible/modules/cloud/google/gcp_pubsub_topic_facts.py index 9d40382281bd50..0cbc7469d1c5b0 100644 --- a/lib/ansible/modules/cloud/google/gcp_pubsub_topic_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_pubsub_topic_facts.py @@ -62,6 +62,11 @@ - Name of the topic. returned: success type: str + labels: + description: + - A set of key/value label pairs to assign to this Topic. + returned: success + type: dict ''' ################################################################################ From 851964d89c32117ae5e27bd0739a3ba1c296ad65 Mon Sep 17 00:00:00 2001 From: The Magician Date: Mon, 25 Feb 2019 12:24:03 -0800 Subject: [PATCH 114/144] Ansible IAM Role (#195) Signed-off-by: Modular Magician --- lib/ansible/module_utils/gcp_utils.py | 2 + .../modules/cloud/google/gcp_iam_role.py | 316 ++++++++++++++++++ .../cloud/google/gcp_iam_role_facts.py | 151 +++++++++ test/integration/targets/gcp_iam_role/aliases | 2 + .../targets/gcp_iam_role/defaults/main.yml | 3 + .../targets/gcp_iam_role/meta/main.yml | 0 .../targets/gcp_iam_role/tasks/main.yml | 128 +++++++ 7 files changed, 602 insertions(+) create mode 100644 lib/ansible/modules/cloud/google/gcp_iam_role.py create mode 100644 lib/ansible/modules/cloud/google/gcp_iam_role_facts.py create mode 100644 test/integration/targets/gcp_iam_role/aliases create mode 100644 test/integration/targets/gcp_iam_role/defaults/main.yml create mode 100644 test/integration/targets/gcp_iam_role/meta/main.yml create mode 100644 test/integration/targets/gcp_iam_role/tasks/main.yml diff --git a/lib/ansible/module_utils/gcp_utils.py b/lib/ansible/module_utils/gcp_utils.py index 65cd877781d2fc..ca9d4f0c75ddea 100644 --- a/lib/ansible/module_utils/gcp_utils.py +++ b/lib/ansible/module_utils/gcp_utils.py @@ -264,6 +264,8 @@ def _compare_dicts(self, dict1, dict2): # Takes in two lists and compares them. def _compare_lists(self, list1, list2): difference = [] + list1.sort() + list2.sort() for index in range(len(list1)): value1 = list1[index] if index < len(list2): diff --git a/lib/ansible/modules/cloud/google/gcp_iam_role.py b/lib/ansible/modules/cloud/google/gcp_iam_role.py new file mode 100644 index 00000000000000..532dadf504636a --- /dev/null +++ b/lib/ansible/modules/cloud/google/gcp_iam_role.py @@ -0,0 +1,316 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# +# Copyright (C) 2017 Google +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) +# ---------------------------------------------------------------------------- +# +# *** AUTO GENERATED CODE *** AUTO GENERATED CODE *** +# +# ---------------------------------------------------------------------------- +# +# This file is automatically generated by Magic Modules and manual +# changes will be clobbered when the file is regenerated. +# +# Please read more about how to change this file at +# https://www.github.com/GoogleCloudPlatform/magic-modules +# +# ---------------------------------------------------------------------------- + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +################################################################################ +# Documentation +################################################################################ + +ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ["preview"], 'supported_by': 'community'} + +DOCUMENTATION = ''' +--- +module: gcp_iam_role +description: +- A role in the Identity and Access Management API . +short_description: Creates a GCP Role +version_added: 2.8 +author: Google Inc. (@googlecloudplatform) +requirements: +- python >= 2.6 +- requests >= 2.18.4 +- google-auth >= 1.3.0 +options: + state: + description: + - Whether the given object should exist in GCP + choices: + - present + - absent + default: present + name: + description: + - The name of the role. + required: true + title: + description: + - A human-readable title for the role. Typically this is limited to 100 UTF-8 + bytes. + required: false + description: + description: + - Human-readable description for the role. + required: false + included_permissions: + description: + - Names of permissions this role grants when bound in an IAM policy. + required: false + stage: + description: + - The current launch stage of the role. + required: false + choices: + - ALPHA + - BETA + - GA + - DEPRECATED + - DISABLED + - EAP +extends_documentation_fragment: gcp +''' + +EXAMPLES = ''' +- name: create a role + gcp_iam_role: + name: myCustomRole2 + title: My Custom Role + description: My custom role description + included_permissions: + - iam.roles.list + - iam.roles.create + - iam.roles.delete + project: "test_project" + auth_kind: "serviceaccount" + service_account_file: "/tmp/auth.pem" + state: present +''' + +RETURN = ''' +name: + description: + - The name of the role. + returned: success + type: str +title: + description: + - A human-readable title for the role. Typically this is limited to 100 UTF-8 bytes. + returned: success + type: str +description: + description: + - Human-readable description for the role. + returned: success + type: str +includedPermissions: + description: + - Names of permissions this role grants when bound in an IAM policy. + returned: success + type: list +stage: + description: + - The current launch stage of the role. + returned: success + type: str +deleted: + description: + - The current deleted state of the role. + returned: success + type: bool +''' + +################################################################################ +# Imports +################################################################################ + +from ansible.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest, replace_resource_dict +import json + +################################################################################ +# Main +################################################################################ + + +def main(): + """Main function""" + + module = GcpModule( + argument_spec=dict( + state=dict(default='present', choices=['present', 'absent'], type='str'), + name=dict(required=True, type='str'), + title=dict(type='str'), + description=dict(type='str'), + included_permissions=dict(type='list', elements='str'), + stage=dict(type='str', choices=['ALPHA', 'BETA', 'GA', 'DEPRECATED', 'DISABLED', 'EAP']), + ) + ) + + if not module.params['scopes']: + module.params['scopes'] = ['https://www.googleapis.com/auth/iam'] + + state = module.params['state'] + + fetch = fetch_resource(module, self_link(module)) + changed = False + + if fetch: + if state == 'present': + if is_different(module, fetch): + update(module, self_link(module), fetch) + fetch = fetch_resource(module, self_link(module)) + changed = True + else: + delete(module, self_link(module)) + fetch = {} + changed = True + else: + if state == 'present': + fetch = create(module, collection(module)) + changed = True + else: + fetch = {} + + fetch.update({'changed': changed}) + + module.exit_json(**fetch) + + +def create(module, link): + auth = GcpSession(module, 'iam') + return return_if_object(module, auth.post(link, resource_to_create(module))) + + +def update(module, link, fetch): + auth = GcpSession(module, 'iam') + params = {'updateMask': updateMask(resource_to_request(module), response_to_hash(module, fetch))} + request = resource_to_request(module) + del request['name'] + return return_if_object(module, auth.put(link, request, params=params)) + + +def updateMask(request, response): + update_mask = [] + if request.get('name') != response.get('name'): + update_mask.append('name') + if request.get('title') != response.get('title'): + update_mask.append('title') + if request.get('description') != response.get('description'): + update_mask.append('description') + if request.get('includedPermissions') != response.get('includedPermissions'): + update_mask.append('includedPermissions') + if request.get('stage') != response.get('stage'): + update_mask.append('stage') + return ','.join(update_mask) + + +def delete(module, link): + auth = GcpSession(module, 'iam') + return return_if_object(module, auth.delete(link)) + + +def resource_to_request(module): + request = { + u'name': module.params.get('name'), + u'title': module.params.get('title'), + u'description': module.params.get('description'), + u'includedPermissions': module.params.get('included_permissions'), + u'stage': module.params.get('stage'), + } + return_vals = {} + for k, v in request.items(): + if v or v is False: + return_vals[k] = v + + return return_vals + + +def fetch_resource(module, link, allow_not_found=True): + auth = GcpSession(module, 'iam') + return return_if_object(module, auth.get(link), allow_not_found) + + +def self_link(module): + return "https://iam.googleapis.com/v1/projects/{project}/roles/{name}".format(**module.params) + + +def collection(module): + return "https://iam.googleapis.com/v1/projects/{project}/roles".format(**module.params) + + +def return_if_object(module, response, allow_not_found=False): + # If not found, return nothing. + if allow_not_found and response.status_code == 404: + return None + + # If no content, return nothing. + if response.status_code == 204: + return None + + try: + module.raise_for_status(response) + result = response.json() + except getattr(json.decoder, 'JSONDecodeError', ValueError): + module.fail_json(msg="Invalid JSON response with error: %s" % response.text) + + result = decode_response(result, module) + + if navigate_hash(result, ['error', 'errors']): + module.fail_json(msg=navigate_hash(result, ['error', 'errors'])) + + return result + + +def is_different(module, response): + request = resource_to_request(module) + response = response_to_hash(module, response) + request = decode_response(request, module) + + # Remove all output-only from response. + response_vals = {} + for k, v in response.items(): + if k in request: + response_vals[k] = v + + request_vals = {} + for k, v in request.items(): + if k in response: + request_vals[k] = v + + return GcpRequest(request_vals) != GcpRequest(response_vals) + + +# Remove unnecessary properties from the response. +# This is for doing comparisons with Ansible's current parameters. +def response_to_hash(module, response): + return { + u'name': response.get(u'name'), + u'title': response.get(u'title'), + u'description': response.get(u'description'), + u'includedPermissions': response.get(u'includedPermissions'), + u'stage': response.get(u'stage'), + u'deleted': response.get(u'deleted'), + } + + +def resource_to_create(module): + role = resource_to_request(module) + del role['name'] + return {'roleId': module.params['name'], 'role': role} + + +def decode_response(response, module): + if 'name' in response: + response['name'] = response['name'].split('/')[-1] + return response + + +if __name__ == '__main__': + main() diff --git a/lib/ansible/modules/cloud/google/gcp_iam_role_facts.py b/lib/ansible/modules/cloud/google/gcp_iam_role_facts.py new file mode 100644 index 00000000000000..08da2733c390ec --- /dev/null +++ b/lib/ansible/modules/cloud/google/gcp_iam_role_facts.py @@ -0,0 +1,151 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# +# Copyright (C) 2017 Google +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) +# ---------------------------------------------------------------------------- +# +# *** AUTO GENERATED CODE *** AUTO GENERATED CODE *** +# +# ---------------------------------------------------------------------------- +# +# This file is automatically generated by Magic Modules and manual +# changes will be clobbered when the file is regenerated. +# +# Please read more about how to change this file at +# https://www.github.com/GoogleCloudPlatform/magic-modules +# +# ---------------------------------------------------------------------------- + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +################################################################################ +# Documentation +################################################################################ + +ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ["preview"], 'supported_by': 'community'} + +DOCUMENTATION = ''' +--- +module: gcp_iam_role_facts +description: +- Gather facts for GCP Role +short_description: Gather facts for GCP Role +version_added: 2.8 +author: Google Inc. (@googlecloudplatform) +requirements: +- python >= 2.6 +- requests >= 2.18.4 +- google-auth >= 1.3.0 +options: {} +extends_documentation_fragment: gcp +''' + +EXAMPLES = ''' +- name: a role facts + gcp_iam_role_facts: + project: test_project + auth_kind: serviceaccount + service_account_file: "/tmp/auth.pem" +''' + +RETURN = ''' +items: + description: List of items + returned: always + type: complex + contains: + name: + description: + - The name of the role. + returned: success + type: str + title: + description: + - A human-readable title for the role. Typically this is limited to 100 UTF-8 + bytes. + returned: success + type: str + description: + description: + - Human-readable description for the role. + returned: success + type: str + includedPermissions: + description: + - Names of permissions this role grants when bound in an IAM policy. + returned: success + type: list + stage: + description: + - The current launch stage of the role. + returned: success + type: str + deleted: + description: + - The current deleted state of the role. + returned: success + type: bool +''' + +################################################################################ +# Imports +################################################################################ +from ansible.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest +import json + +################################################################################ +# Main +################################################################################ + + +def main(): + module = GcpModule(argument_spec=dict()) + + if not module.params['scopes']: + module.params['scopes'] = ['https://www.googleapis.com/auth/iam'] + + items = fetch_list(module, collection(module)) + if items.get('roles'): + items = items.get('roles') + else: + items = [] + return_value = {'items': items} + module.exit_json(**return_value) + + +def collection(module): + return "https://iam.googleapis.com/v1/projects/{project}/roles".format(**module.params) + + +def fetch_list(module, link): + auth = GcpSession(module, 'iam') + response = auth.get(link) + return return_if_object(module, response) + + +def return_if_object(module, response): + # If not found, return nothing. + if response.status_code == 404: + return None + + # If no content, return nothing. + if response.status_code == 204: + return None + + try: + module.raise_for_status(response) + result = response.json() + except getattr(json.decoder, 'JSONDecodeError', ValueError) as inst: + module.fail_json(msg="Invalid JSON response with error: %s" % inst) + + if navigate_hash(result, ['error', 'errors']): + module.fail_json(msg=navigate_hash(result, ['error', 'errors'])) + + return result + + +if __name__ == "__main__": + main() diff --git a/test/integration/targets/gcp_iam_role/aliases b/test/integration/targets/gcp_iam_role/aliases new file mode 100644 index 00000000000000..9812f019ca4bae --- /dev/null +++ b/test/integration/targets/gcp_iam_role/aliases @@ -0,0 +1,2 @@ +cloud/gcp +unsupported diff --git a/test/integration/targets/gcp_iam_role/defaults/main.yml b/test/integration/targets/gcp_iam_role/defaults/main.yml new file mode 100644 index 00000000000000..aa87a2a8e0e0e0 --- /dev/null +++ b/test/integration/targets/gcp_iam_role/defaults/main.yml @@ -0,0 +1,3 @@ +--- +# defaults file +resource_name: '{{resource_prefix}}' diff --git a/test/integration/targets/gcp_iam_role/meta/main.yml b/test/integration/targets/gcp_iam_role/meta/main.yml new file mode 100644 index 00000000000000..e69de29bb2d1d6 diff --git a/test/integration/targets/gcp_iam_role/tasks/main.yml b/test/integration/targets/gcp_iam_role/tasks/main.yml new file mode 100644 index 00000000000000..665a679731ba6a --- /dev/null +++ b/test/integration/targets/gcp_iam_role/tasks/main.yml @@ -0,0 +1,128 @@ +--- +# ---------------------------------------------------------------------------- +# +# *** AUTO GENERATED CODE *** AUTO GENERATED CODE *** +# +# ---------------------------------------------------------------------------- +# +# This file is automatically generated by Magic Modules and manual +# changes will be clobbered when the file is regenerated. +# +# Please read more about how to change this file at +# https://www.github.com/GoogleCloudPlatform/magic-modules +# +# ---------------------------------------------------------------------------- +# Pre-test setup +- name: delete a role + gcp_iam_role: + name: myCustomRole2 + title: My Custom Role + description: My custom role description + included_permissions: + - iam.roles.list + - iam.roles.create + - iam.roles.delete + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent +#---------------------------------------------------------- +- name: create a role + gcp_iam_role: + name: myCustomRole2 + title: My Custom Role + description: My custom role description + included_permissions: + - iam.roles.list + - iam.roles.create + - iam.roles.delete + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present + register: result +- name: assert changed is true + assert: + that: + - result.changed == true +- name: verify that role was created + gcp_iam_role_facts: + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + scopes: + - https://www.googleapis.com/auth/iam + register: results +- name: verify that command succeeded + assert: + that: + - results['items'] | length >= 1 +# ---------------------------------------------------------------------------- +- name: create a role that already exists + gcp_iam_role: + name: myCustomRole2 + title: My Custom Role + description: My custom role description + included_permissions: + - iam.roles.list + - iam.roles.create + - iam.roles.delete + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present + register: result +- name: assert changed is false + assert: + that: + - result.changed == false +#---------------------------------------------------------- +- name: delete a role + gcp_iam_role: + name: myCustomRole2 + title: My Custom Role + description: My custom role description + included_permissions: + - iam.roles.list + - iam.roles.create + - iam.roles.delete + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: result +- name: assert changed is true + assert: + that: + - result.changed == true +- name: verify that role was deleted + gcp_iam_role_facts: + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + scopes: + - https://www.googleapis.com/auth/iam + register: results +- name: verify that command succeeded + assert: + that: + - results['items'] | length == 0 +# ---------------------------------------------------------------------------- +- name: delete a role that does not exist + gcp_iam_role: + name: myCustomRole2 + title: My Custom Role + description: My custom role description + included_permissions: + - iam.roles.list + - iam.roles.create + - iam.roles.delete + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: result +- name: assert changed is false + assert: + that: + - result.changed == false From c015cf9306878da6bf1fe1cc8905a841e2b908da Mon Sep 17 00:00:00 2001 From: The Magician Date: Wed, 27 Feb 2019 14:38:46 -0800 Subject: [PATCH 115/144] Ansible - Unit test fix on diffing (#198) /cc @rambleraptor --- lib/ansible/module_utils/gcp_utils.py | 12 +++++++++--- test/units/module_utils/gcp/test_gcp_utils.py | 3 --- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/lib/ansible/module_utils/gcp_utils.py b/lib/ansible/module_utils/gcp_utils.py index ca9d4f0c75ddea..15c27e3881971f 100644 --- a/lib/ansible/module_utils/gcp_utils.py +++ b/lib/ansible/module_utils/gcp_utils.py @@ -268,9 +268,15 @@ def _compare_lists(self, list1, list2): list2.sort() for index in range(len(list1)): value1 = list1[index] - if index < len(list2): - value2 = list2[index] - difference.append(self._compare_value(value1, value2)) + # If items are dicts or arrays, we're assuming the next value + # is the correct one. + if isinstance(value1, dict) or isinstance(value1, list): + if index < len(list2): + value2 = list2[index] + difference.append(self._compare_value(value1, value2)) + else: + if value1 not in list2: + difference.append(value1) difference2 = [] for value in difference: diff --git a/test/units/module_utils/gcp/test_gcp_utils.py b/test/units/module_utils/gcp/test_gcp_utils.py index 5aca41d19bb60c..0f12efc3d6d229 100644 --- a/test/units/module_utils/gcp/test_gcp_utils.py +++ b/test/units/module_utils/gcp/test_gcp_utils.py @@ -149,9 +149,6 @@ def test_arrays_dicts_with_difference(self): 'test': 'value', 'foo': 'bar' }, - { - 'different': 'dict' - } ] } value2 = { From 2c4cf3e175d8a75b84a33d4f5ba2559fd4e0b3d6 Mon Sep 17 00:00:00 2001 From: The Magician Date: Wed, 27 Feb 2019 14:45:12 -0800 Subject: [PATCH 116/144] Use Ruby YAML library to serialize Ansible examples (#196) /cc @rambleraptor --- .../cloud/google/gcp_bigquery_dataset.py | 14 +- .../google/gcp_bigquery_dataset_facts.py | 9 +- .../cloud/google/gcp_bigquery_table.py | 34 +- .../cloud/google/gcp_bigquery_table_facts.py | 11 +- .../cloud/google/gcp_cloudbuild_trigger.py | 28 +- .../google/gcp_cloudbuild_trigger_facts.py | 9 +- .../cloud/google/gcp_compute_address.py | 12 +- .../cloud/google/gcp_compute_address_facts.py | 15 +- .../google/gcp_compute_backend_bucket.py | 26 +- .../gcp_compute_backend_bucket_facts.py | 13 +- .../google/gcp_compute_backend_service.py | 50 +-- .../gcp_compute_backend_service_facts.py | 13 +- .../modules/cloud/google/gcp_compute_disk.py | 18 +- .../cloud/google/gcp_compute_disk_facts.py | 15 +- .../cloud/google/gcp_compute_firewall.py | 28 +- .../google/gcp_compute_firewall_facts.py | 13 +- .../google/gcp_compute_forwarding_rule.py | 44 +-- .../gcp_compute_forwarding_rule_facts.py | 15 +- .../google/gcp_compute_global_address.py | 10 +- .../gcp_compute_global_address_facts.py | 13 +- .../gcp_compute_global_forwarding_rule.py | 102 +++--- ...cp_compute_global_forwarding_rule_facts.py | 13 +- .../cloud/google/gcp_compute_health_check.py | 26 +- .../google/gcp_compute_health_check_facts.py | 13 +- .../google/gcp_compute_http_health_check.py | 18 +- .../gcp_compute_http_health_check_facts.py | 13 +- .../google/gcp_compute_https_health_check.py | 18 +- .../gcp_compute_https_health_check_facts.py | 13 +- .../modules/cloud/google/gcp_compute_image.py | 24 +- .../cloud/google/gcp_compute_image_facts.py | 13 +- .../cloud/google/gcp_compute_instance.py | 78 ++--- .../google/gcp_compute_instance_facts.py | 15 +- .../google/gcp_compute_instance_group.py | 30 +- .../gcp_compute_instance_group_facts.py | 15 +- .../gcp_compute_instance_group_manager.py | 76 ++--- ...cp_compute_instance_group_manager_facts.py | 15 +- .../google/gcp_compute_instance_template.py | 58 ++-- .../gcp_compute_instance_template_facts.py | 13 +- .../gcp_compute_interconnect_attachment.py | 16 +- ...p_compute_interconnect_attachment_facts.py | 15 +- .../cloud/google/gcp_compute_network.py | 12 +- .../cloud/google/gcp_compute_network_facts.py | 13 +- .../cloud/google/gcp_compute_region_disk.py | 24 +- .../google/gcp_compute_region_disk_facts.py | 15 +- .../modules/cloud/google/gcp_compute_route.py | 32 +- .../cloud/google/gcp_compute_route_facts.py | 13 +- .../cloud/google/gcp_compute_router.py | 40 +-- .../cloud/google/gcp_compute_router_facts.py | 15 +- .../google/gcp_compute_ssl_certificate.py | 48 ++- .../gcp_compute_ssl_certificate_facts.py | 13 +- .../cloud/google/gcp_compute_ssl_policy.py | 20 +- .../google/gcp_compute_ssl_policy_facts.py | 13 +- .../cloud/google/gcp_compute_subnetwork.py | 28 +- .../google/gcp_compute_subnetwork_facts.py | 15 +- .../google/gcp_compute_target_http_proxy.py | 74 ++--- .../gcp_compute_target_http_proxy_facts.py | 13 +- .../google/gcp_compute_target_https_proxy.py | 126 ++++---- .../gcp_compute_target_https_proxy_facts.py | 13 +- .../cloud/google/gcp_compute_target_pool.py | 12 +- .../google/gcp_compute_target_pool_facts.py | 15 +- .../google/gcp_compute_target_ssl_proxy.py | 122 ++++--- .../gcp_compute_target_ssl_proxy_facts.py | 13 +- .../google/gcp_compute_target_tcp_proxy.py | 72 ++--- .../gcp_compute_target_tcp_proxy_facts.py | 13 +- .../google/gcp_compute_target_vpn_gateway.py | 36 +-- .../gcp_compute_target_vpn_gateway_facts.py | 15 +- .../cloud/google/gcp_compute_url_map.py | 62 ++-- .../cloud/google/gcp_compute_url_map_facts.py | 13 +- .../cloud/google/gcp_compute_vpn_tunnel.py | 72 ++--- .../google/gcp_compute_vpn_tunnel_facts.py | 15 +- .../cloud/google/gcp_container_cluster.py | 26 +- .../google/gcp_container_cluster_facts.py | 11 +- .../cloud/google/gcp_container_node_pool.py | 30 +- .../google/gcp_container_node_pool_facts.py | 13 +- .../cloud/google/gcp_dns_managed_zone.py | 14 +- .../google/gcp_dns_managed_zone_facts.py | 11 +- .../google/gcp_dns_resource_record_set.py | 36 +-- .../gcp_dns_resource_record_set_facts.py | 11 +- .../modules/cloud/google/gcp_iam_role.py | 22 +- .../cloud/google/gcp_iam_role_facts.py | 9 +- .../cloud/google/gcp_iam_service_account.py | 14 +- .../google/gcp_iam_service_account_facts.py | 9 +- .../google/gcp_iam_service_account_key.py | 26 +- .../cloud/google/gcp_pubsub_subscription.py | 24 +- .../google/gcp_pubsub_subscription_facts.py | 9 +- .../modules/cloud/google/gcp_pubsub_topic.py | 10 +- .../cloud/google/gcp_pubsub_topic_facts.py | 9 +- .../cloud/google/gcp_redis_instance.py | 40 +-- .../cloud/google/gcp_redis_instance_facts.py | 11 +- .../google/gcp_resourcemanager_project.py | 16 +- .../gcp_resourcemanager_project_facts.py | 9 +- .../cloud/google/gcp_sourcerepo_repository.py | 10 +- .../google/gcp_sourcerepo_repository_facts.py | 9 +- .../cloud/google/gcp_spanner_database.py | 32 +- .../google/gcp_spanner_database_facts.py | 11 +- .../cloud/google/gcp_spanner_instance.py | 20 +- .../google/gcp_spanner_instance_facts.py | 9 +- .../modules/cloud/google/gcp_sql_database.py | 38 +-- .../cloud/google/gcp_sql_database_facts.py | 11 +- .../modules/cloud/google/gcp_sql_instance.py | 24 +- .../cloud/google/gcp_sql_instance_facts.py | 9 +- .../modules/cloud/google/gcp_sql_user.py | 40 +-- .../cloud/google/gcp_sql_user_facts.py | 11 +- .../cloud/google/gcp_storage_bucket.py | 10 +- .../gcp_storage_bucket_access_control.py | 24 +- .../cloud/google/gcp_storage_object.py | 18 +- .../gcp_bigquery_dataset/tasks/main.yml | 70 ++-- .../targets/gcp_bigquery_table/tasks/main.yml | 128 ++++---- .../gcp_compute_address/tasks/main.yml | 60 ++-- .../gcp_compute_backend_bucket/tasks/main.yml | 100 +++--- .../tasks/main.yml | 160 +++++----- .../targets/gcp_compute_disk/tasks/main.yml | 90 +++--- .../gcp_compute_firewall/tasks/main.yml | 140 ++++---- .../tasks/main.yml | 148 ++++----- .../gcp_compute_global_address/tasks/main.yml | 50 +-- .../tasks/main.yml | 258 +++++++-------- .../gcp_compute_health_check/tasks/main.yml | 130 ++++---- .../tasks/main.yml | 90 +++--- .../tasks/main.yml | 90 +++--- .../targets/gcp_compute_image/tasks/main.yml | 84 ++--- .../gcp_compute_instance/tasks/main.yml | 276 ++++++++-------- .../gcp_compute_instance_group/tasks/main.yml | 120 +++---- .../tasks/main.yml | 206 ++++++------ .../tasks/main.yml | 224 ++++++------- .../gcp_compute_network/tasks/main.yml | 60 ++-- .../gcp_compute_region_disk/tasks/main.yml | 120 +++---- .../targets/gcp_compute_route/tasks/main.yml | 130 ++++---- .../targets/gcp_compute_router/tasks/main.yml | 170 +++++----- .../tasks/main.yml | 240 ++++++-------- .../gcp_compute_ssl_policy/tasks/main.yml | 100 +++--- .../gcp_compute_subnetwork/tasks/main.yml | 104 +++--- .../tasks/main.yml | 184 +++++------ .../tasks/main.yml | 300 ++++++++---------- .../gcp_compute_target_pool/tasks/main.yml | 60 ++-- .../tasks/main.yml | 292 ++++++++--------- .../tasks/main.yml | 186 +++++------ .../tasks/main.yml | 114 +++---- .../gcp_compute_url_map/tasks/main.yml | 160 +++++----- .../gcp_compute_vpn_tunnel/tasks/main.yml | 198 ++++++------ .../gcp_container_cluster/tasks/main.yml | 130 ++++---- .../gcp_container_node_pool/tasks/main.yml | 108 +++---- .../gcp_dns_managed_zone/tasks/main.yml | 70 ++-- .../tasks/main.yml | 138 ++++---- .../targets/gcp_iam_role/tasks/main.yml | 110 +++---- .../gcp_iam_service_account/tasks/main.yml | 70 ++-- .../gcp_pubsub_subscription/tasks/main.yml | 90 +++--- .../targets/gcp_pubsub_topic/tasks/main.yml | 50 +-- .../targets/gcp_redis_instance/tasks/main.yml | 170 +++++----- .../tasks/main.yml | 80 ++--- .../gcp_sourcerepo_repository/tasks/main.yml | 50 +-- .../gcp_spanner_database/tasks/main.yml | 100 +++--- .../gcp_spanner_instance/tasks/main.yml | 100 +++--- .../targets/gcp_sql_database/tasks/main.yml | 118 +++---- .../targets/gcp_sql_instance/tasks/main.yml | 120 +++---- .../targets/gcp_sql_user/tasks/main.yml | 128 ++++---- .../targets/gcp_storage_bucket/tasks/main.yml | 50 +-- .../tasks/main.yml | 90 +++--- 157 files changed, 4553 insertions(+), 4658 deletions(-) diff --git a/lib/ansible/modules/cloud/google/gcp_bigquery_dataset.py b/lib/ansible/modules/cloud/google/gcp_bigquery_dataset.py index bdba1e07ca5133..96763d72022aad 100644 --- a/lib/ansible/modules/cloud/google/gcp_bigquery_dataset.py +++ b/lib/ansible/modules/cloud/google/gcp_bigquery_dataset.py @@ -148,13 +148,13 @@ EXAMPLES = ''' - name: create a dataset gcp_bigquery_dataset: - name: my_example_dataset - dataset_reference: - dataset_id: my_example_dataset - project: "test_project" - auth_kind: "serviceaccount" - service_account_file: "/tmp/auth.pem" - state: present + name: my_example_dataset + dataset_reference: + dataset_id: my_example_dataset + project: test_project + auth_kind: serviceaccount + service_account_file: "/tmp/auth.pem" + state: present ''' RETURN = ''' diff --git a/lib/ansible/modules/cloud/google/gcp_bigquery_dataset_facts.py b/lib/ansible/modules/cloud/google/gcp_bigquery_dataset_facts.py index 8c2e1e0e9e7871..ab5f7f3db84de6 100644 --- a/lib/ansible/modules/cloud/google/gcp_bigquery_dataset_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_bigquery_dataset_facts.py @@ -44,11 +44,12 @@ ''' EXAMPLES = ''' -- name: a dataset facts +- name: " a dataset facts" gcp_bigquery_dataset_facts: - project: test_project - auth_kind: serviceaccount - service_account_file: "/tmp/auth.pem" + project: test_project + auth_kind: serviceaccount + service_account_file: "/tmp/auth.pem" + state: facts ''' RETURN = ''' diff --git a/lib/ansible/modules/cloud/google/gcp_bigquery_table.py b/lib/ansible/modules/cloud/google/gcp_bigquery_table.py index 5e8c5b492f7195..502b0b3836e20b 100644 --- a/lib/ansible/modules/cloud/google/gcp_bigquery_table.py +++ b/lib/ansible/modules/cloud/google/gcp_bigquery_table.py @@ -428,27 +428,27 @@ EXAMPLES = ''' - name: create a dataset gcp_bigquery_dataset: - name: example_dataset - dataset_reference: - dataset_id: example_dataset - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: example_dataset + dataset_reference: + dataset_id: example_dataset + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: dataset - name: create a table gcp_bigquery_table: - name: example_table - dataset: example_dataset - table_reference: - dataset_id: example_dataset - project_id: "test_project" - table_id: example_table - project: "test_project" - auth_kind: "serviceaccount" - service_account_file: "/tmp/auth.pem" - state: present + name: example_table + dataset: example_dataset + table_reference: + dataset_id: example_dataset + project_id: test_project + table_id: example_table + project: test_project + auth_kind: serviceaccount + service_account_file: "/tmp/auth.pem" + state: present ''' RETURN = ''' diff --git a/lib/ansible/modules/cloud/google/gcp_bigquery_table_facts.py b/lib/ansible/modules/cloud/google/gcp_bigquery_table_facts.py index c19ccb0c576a25..9aebcab67f1791 100644 --- a/lib/ansible/modules/cloud/google/gcp_bigquery_table_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_bigquery_table_facts.py @@ -48,12 +48,13 @@ ''' EXAMPLES = ''' -- name: a table facts +- name: " a table facts" gcp_bigquery_table_facts: - dataset: example_dataset - project: test_project - auth_kind: serviceaccount - service_account_file: "/tmp/auth.pem" + dataset: example_dataset + project: test_project + auth_kind: serviceaccount + service_account_file: "/tmp/auth.pem" + state: facts ''' RETURN = ''' diff --git a/lib/ansible/modules/cloud/google/gcp_cloudbuild_trigger.py b/lib/ansible/modules/cloud/google/gcp_cloudbuild_trigger.py index c2b65b59952545..31830524aec5aa 100644 --- a/lib/ansible/modules/cloud/google/gcp_cloudbuild_trigger.py +++ b/lib/ansible/modules/cloud/google/gcp_cloudbuild_trigger.py @@ -184,23 +184,23 @@ EXAMPLES = ''' - name: create a repository gcp_sourcerepo_repository: - name: projects/{{ gcp_project }}/repos/{{ resource_name }} - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: projects/{{ gcp_project }}/repos/{{ resource_name }} + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present - name: create a trigger gcp_cloudbuild_trigger: - trigger_template: - branch_name: master - project_id: "test_project" - repo_name: "test_object" - filename: cloudbuild.yaml - project: "test_project" - auth_kind: "serviceaccount" - service_account_file: "/tmp/auth.pem" - state: present + trigger_template: + branch_name: master + project_id: test_project + repo_name: test_object + filename: cloudbuild.yaml + project: test_project + auth_kind: serviceaccount + service_account_file: "/tmp/auth.pem" + state: present ''' RETURN = ''' diff --git a/lib/ansible/modules/cloud/google/gcp_cloudbuild_trigger_facts.py b/lib/ansible/modules/cloud/google/gcp_cloudbuild_trigger_facts.py index ee929ff1945c40..58b5b02e86e865 100644 --- a/lib/ansible/modules/cloud/google/gcp_cloudbuild_trigger_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_cloudbuild_trigger_facts.py @@ -44,11 +44,12 @@ ''' EXAMPLES = ''' -- name: a trigger facts +- name: " a trigger facts" gcp_cloudbuild_trigger_facts: - project: test_project - auth_kind: serviceaccount - service_account_file: "/tmp/auth.pem" + project: test_project + auth_kind: serviceaccount + service_account_file: "/tmp/auth.pem" + state: facts ''' RETURN = ''' diff --git a/lib/ansible/modules/cloud/google/gcp_compute_address.py b/lib/ansible/modules/cloud/google/gcp_compute_address.py index 6e2a6f1c783591..1c2054a1b6e627 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_address.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_address.py @@ -121,12 +121,12 @@ EXAMPLES = ''' - name: create a address gcp_compute_address: - name: test-address1 - region: us-west1 - project: "test_project" - auth_kind: "serviceaccount" - service_account_file: "/tmp/auth.pem" - state: present + name: test-address1 + region: us-west1 + project: test_project + auth_kind: serviceaccount + service_account_file: "/tmp/auth.pem" + state: present ''' RETURN = ''' diff --git a/lib/ansible/modules/cloud/google/gcp_compute_address_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_address_facts.py index 6eefbae74d523b..a6a3d67f1bf306 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_address_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_address_facts.py @@ -54,14 +54,15 @@ ''' EXAMPLES = ''' -- name: a address facts +- name: " a address facts" gcp_compute_address_facts: - region: us-west1 - filters: - - name = test_object - project: test_project - auth_kind: serviceaccount - service_account_file: "/tmp/auth.pem" + region: us-west1 + filters: + - name = test_object + project: test_project + auth_kind: serviceaccount + service_account_file: "/tmp/auth.pem" + state: facts ''' RETURN = ''' diff --git a/lib/ansible/modules/cloud/google/gcp_compute_backend_bucket.py b/lib/ansible/modules/cloud/google/gcp_compute_backend_bucket.py index d13c8d1a22efb1..c04d0ae88304b4 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_backend_bucket.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_backend_bucket.py @@ -83,23 +83,23 @@ EXAMPLES = ''' - name: create a bucket gcp_storage_bucket: - name: "bucket-backendbucket" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: bucket-backendbucket + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: bucket - name: create a backend bucket gcp_compute_backend_bucket: - name: "test_object" - bucket_name: "{{ bucket.name }}" - description: A BackendBucket to connect LNB w/ Storage Bucket - enable_cdn: true - project: "test_project" - auth_kind: "serviceaccount" - service_account_file: "/tmp/auth.pem" - state: present + name: test_object + bucket_name: "{{ bucket.name }}" + description: A BackendBucket to connect LNB w/ Storage Bucket + enable_cdn: 'true' + project: test_project + auth_kind: serviceaccount + service_account_file: "/tmp/auth.pem" + state: present ''' RETURN = ''' diff --git a/lib/ansible/modules/cloud/google/gcp_compute_backend_bucket_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_backend_bucket_facts.py index 5588340851ba35..fe21d60bdc082d 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_backend_bucket_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_backend_bucket_facts.py @@ -49,13 +49,14 @@ ''' EXAMPLES = ''' -- name: a backend bucket facts +- name: " a backend bucket facts" gcp_compute_backend_bucket_facts: - filters: - - name = test_object - project: test_project - auth_kind: serviceaccount - service_account_file: "/tmp/auth.pem" + filters: + - name = test_object + project: test_project + auth_kind: serviceaccount + service_account_file: "/tmp/auth.pem" + state: facts ''' RETURN = ''' diff --git a/lib/ansible/modules/cloud/google/gcp_compute_backend_service.py b/lib/ansible/modules/cloud/google/gcp_compute_backend_service.py index 508652ac3acd83..7bbc02fa98c2e6 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_backend_service.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_backend_service.py @@ -302,39 +302,39 @@ EXAMPLES = ''' - name: create a instance group gcp_compute_instance_group: - name: "instancegroup-backendservice" - zone: us-central1-a - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: instancegroup-backendservice + zone: us-central1-a + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: instancegroup - name: create a http health check gcp_compute_http_health_check: - name: "httphealthcheck-backendservice" - healthy_threshold: 10 - port: 8080 - timeout_sec: 2 - unhealthy_threshold: 5 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: httphealthcheck-backendservice + healthy_threshold: 10 + port: 8080 + timeout_sec: 2 + unhealthy_threshold: 5 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: healthcheck - name: create a backend service gcp_compute_backend_service: - name: "test_object" - backends: - - group: "{{ instancegroup }}" - health_checks: - - "{{ healthcheck.selfLink }}" - enable_cdn: true - project: "test_project" - auth_kind: "serviceaccount" - service_account_file: "/tmp/auth.pem" - state: present + name: test_object + backends: + - group: "{{ instancegroup }}" + health_checks: + - "{{ healthcheck.selfLink }}" + enable_cdn: 'true' + project: test_project + auth_kind: serviceaccount + service_account_file: "/tmp/auth.pem" + state: present ''' RETURN = ''' diff --git a/lib/ansible/modules/cloud/google/gcp_compute_backend_service_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_backend_service_facts.py index 3abdd1f5228d80..e9bbb3e6c60507 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_backend_service_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_backend_service_facts.py @@ -49,13 +49,14 @@ ''' EXAMPLES = ''' -- name: a backend service facts +- name: " a backend service facts" gcp_compute_backend_service_facts: - filters: - - name = test_object - project: test_project - auth_kind: serviceaccount - service_account_file: "/tmp/auth.pem" + filters: + - name = test_object + project: test_project + auth_kind: serviceaccount + service_account_file: "/tmp/auth.pem" + state: facts ''' RETURN = ''' diff --git a/lib/ansible/modules/cloud/google/gcp_compute_disk.py b/lib/ansible/modules/cloud/google/gcp_compute_disk.py index e4da74189fbb18..4f3795a1da4ec6 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_disk.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_disk.py @@ -197,15 +197,15 @@ EXAMPLES = ''' - name: create a disk gcp_compute_disk: - name: "test_object" - size_gb: 50 - disk_encryption_key: - raw_key: SGVsbG8gZnJvbSBHb29nbGUgQ2xvdWQgUGxhdGZvcm0= - zone: us-central1-a - project: "test_project" - auth_kind: "serviceaccount" - service_account_file: "/tmp/auth.pem" - state: present + name: test_object + size_gb: 50 + disk_encryption_key: + raw_key: SGVsbG8gZnJvbSBHb29nbGUgQ2xvdWQgUGxhdGZvcm0= + zone: us-central1-a + project: test_project + auth_kind: serviceaccount + service_account_file: "/tmp/auth.pem" + state: present ''' RETURN = ''' diff --git a/lib/ansible/modules/cloud/google/gcp_compute_disk_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_disk_facts.py index 286ff33d3db3ee..4cd90eec417248 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_disk_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_disk_facts.py @@ -53,14 +53,15 @@ ''' EXAMPLES = ''' -- name: a disk facts +- name: " a disk facts" gcp_compute_disk_facts: - zone: us-central1-a - filters: - - name = test_object - project: test_project - auth_kind: serviceaccount - service_account_file: "/tmp/auth.pem" + zone: us-central1-a + filters: + - name = test_object + project: test_project + auth_kind: serviceaccount + service_account_file: "/tmp/auth.pem" + state: facts ''' RETURN = ''' diff --git a/lib/ansible/modules/cloud/google/gcp_compute_firewall.py b/lib/ansible/modules/cloud/google/gcp_compute_firewall.py index ccecb4be77316a..98e621e24f11f3 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_firewall.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_firewall.py @@ -221,20 +221,20 @@ EXAMPLES = ''' - name: create a firewall gcp_compute_firewall: - name: "test_object" - allowed: - - ip_protocol: tcp - ports: - - '22' - target_tags: - - test-ssh-server - - staging-ssh-server - source_tags: - - test-ssh-clients - project: "test_project" - auth_kind: "serviceaccount" - service_account_file: "/tmp/auth.pem" - state: present + name: test_object + allowed: + - ip_protocol: tcp + ports: + - '22' + target_tags: + - test-ssh-server + - staging-ssh-server + source_tags: + - test-ssh-clients + project: test_project + auth_kind: serviceaccount + service_account_file: "/tmp/auth.pem" + state: present ''' RETURN = ''' diff --git a/lib/ansible/modules/cloud/google/gcp_compute_firewall_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_firewall_facts.py index 782236e4da1c97..ecc39b5aac9613 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_firewall_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_firewall_facts.py @@ -49,13 +49,14 @@ ''' EXAMPLES = ''' -- name: a firewall facts +- name: " a firewall facts" gcp_compute_firewall_facts: - filters: - - name = test_object - project: test_project - auth_kind: serviceaccount - service_account_file: "/tmp/auth.pem" + filters: + - name = test_object + project: test_project + auth_kind: serviceaccount + service_account_file: "/tmp/auth.pem" + state: facts ''' RETURN = ''' diff --git a/lib/ansible/modules/cloud/google/gcp_compute_forwarding_rule.py b/lib/ansible/modules/cloud/google/gcp_compute_forwarding_rule.py index d18d954b072c9a..0caa9bb26e9bf5 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_forwarding_rule.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_forwarding_rule.py @@ -212,36 +212,36 @@ EXAMPLES = ''' - name: create a address gcp_compute_address: - name: "address-forwardingrule" - region: us-west1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: address-forwardingrule + region: us-west1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: address - name: create a target pool gcp_compute_target_pool: - name: "targetpool-forwardingrule" - region: us-west1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: targetpool-forwardingrule + region: us-west1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: targetpool - name: create a forwarding rule gcp_compute_forwarding_rule: - name: "test_object" - region: us-west1 - target: "{{ targetpool }}" - ip_protocol: TCP - port_range: 80-80 - ip_address: "{{ address.address }}" - project: "test_project" - auth_kind: "serviceaccount" - service_account_file: "/tmp/auth.pem" - state: present + name: test_object + region: us-west1 + target: "{{ targetpool }}" + ip_protocol: TCP + port_range: 80-80 + ip_address: "{{ address.address }}" + project: test_project + auth_kind: serviceaccount + service_account_file: "/tmp/auth.pem" + state: present ''' RETURN = ''' diff --git a/lib/ansible/modules/cloud/google/gcp_compute_forwarding_rule_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_forwarding_rule_facts.py index c4dc80b55d42d5..15cef1e1cea8ed 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_forwarding_rule_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_forwarding_rule_facts.py @@ -54,14 +54,15 @@ ''' EXAMPLES = ''' -- name: a forwarding rule facts +- name: " a forwarding rule facts" gcp_compute_forwarding_rule_facts: - region: us-west1 - filters: - - name = test_object - project: test_project - auth_kind: serviceaccount - service_account_file: "/tmp/auth.pem" + region: us-west1 + filters: + - name = test_object + project: test_project + auth_kind: serviceaccount + service_account_file: "/tmp/auth.pem" + state: facts ''' RETURN = ''' diff --git a/lib/ansible/modules/cloud/google/gcp_compute_global_address.py b/lib/ansible/modules/cloud/google/gcp_compute_global_address.py index f597b111f03b3f..9deaf15217d48c 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_global_address.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_global_address.py @@ -95,11 +95,11 @@ EXAMPLES = ''' - name: create a global address gcp_compute_global_address: - name: "test_object" - project: "test_project" - auth_kind: "serviceaccount" - service_account_file: "/tmp/auth.pem" - state: present + name: test_object + project: test_project + auth_kind: serviceaccount + service_account_file: "/tmp/auth.pem" + state: present ''' RETURN = ''' diff --git a/lib/ansible/modules/cloud/google/gcp_compute_global_address_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_global_address_facts.py index 4d5b8955289ae5..11682fee960761 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_global_address_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_global_address_facts.py @@ -49,13 +49,14 @@ ''' EXAMPLES = ''' -- name: a global address facts +- name: " a global address facts" gcp_compute_global_address_facts: - filters: - - name = test_object - project: test_project - auth_kind: serviceaccount - service_account_file: "/tmp/auth.pem" + filters: + - name = test_object + project: test_project + auth_kind: serviceaccount + service_account_file: "/tmp/auth.pem" + state: facts ''' RETURN = ''' diff --git a/lib/ansible/modules/cloud/google/gcp_compute_global_forwarding_rule.py b/lib/ansible/modules/cloud/google/gcp_compute_global_forwarding_rule.py index 9506472abe77a6..2f4749a7f6c7e6 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_global_forwarding_rule.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_global_forwarding_rule.py @@ -188,81 +188,81 @@ EXAMPLES = ''' - name: create a global address gcp_compute_global_address: - name: "globaladdress-globalforwardingrule" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: globaladdress-globalforwardingrule + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: globaladdress - name: create a instance group gcp_compute_instance_group: - name: "instancegroup-globalforwardingrule" - zone: us-central1-a - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: instancegroup-globalforwardingrule + zone: us-central1-a + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: instancegroup - name: create a http health check gcp_compute_http_health_check: - name: "httphealthcheck-globalforwardingrule" - healthy_threshold: 10 - port: 8080 - timeout_sec: 2 - unhealthy_threshold: 5 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: httphealthcheck-globalforwardingrule + healthy_threshold: 10 + port: 8080 + timeout_sec: 2 + unhealthy_threshold: 5 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: healthcheck - name: create a backend service gcp_compute_backend_service: - name: "backendservice-globalforwardingrule" - 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 + name: backendservice-globalforwardingrule + 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 register: backendservice - name: create a url map gcp_compute_url_map: - name: "urlmap-globalforwardingrule" - default_service: "{{ backendservice }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: urlmap-globalforwardingrule + default_service: "{{ backendservice }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: urlmap - name: create a target http proxy gcp_compute_target_http_proxy: - name: "targethttpproxy-globalforwardingrule" - url_map: "{{ urlmap }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: targethttpproxy-globalforwardingrule + url_map: "{{ urlmap }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: httpproxy - name: create a global forwarding rule gcp_compute_global_forwarding_rule: - name: "test_object" - ip_address: "{{ globaladdress.address }}" - ip_protocol: TCP - port_range: 80-80 - target: "{{ httpproxy.selfLink }}" - project: "test_project" - auth_kind: "serviceaccount" - service_account_file: "/tmp/auth.pem" - state: present + name: test_object + ip_address: "{{ globaladdress.address }}" + ip_protocol: TCP + port_range: 80-80 + target: "{{ httpproxy.selfLink }}" + project: test_project + auth_kind: serviceaccount + service_account_file: "/tmp/auth.pem" + state: present ''' RETURN = ''' diff --git a/lib/ansible/modules/cloud/google/gcp_compute_global_forwarding_rule_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_global_forwarding_rule_facts.py index 84f514404bde6a..a9bc1652bb1e10 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_global_forwarding_rule_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_global_forwarding_rule_facts.py @@ -49,13 +49,14 @@ ''' EXAMPLES = ''' -- name: a global forwarding rule facts +- name: " a global forwarding rule facts" gcp_compute_global_forwarding_rule_facts: - filters: - - name = test_object - project: test_project - auth_kind: serviceaccount - service_account_file: "/tmp/auth.pem" + filters: + - name = test_object + project: test_project + auth_kind: serviceaccount + service_account_file: "/tmp/auth.pem" + state: facts ''' RETURN = ''' 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 080caa2c839485..f79e904bb917c1 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_health_check.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_health_check.py @@ -271,19 +271,19 @@ EXAMPLES = ''' - name: create a health check gcp_compute_health_check: - name: "test_object" - type: TCP - tcp_health_check: - port_name: service-health - request: ping - response: pong - healthy_threshold: 10 - timeout_sec: 2 - unhealthy_threshold: 5 - project: "test_project" - auth_kind: "serviceaccount" - service_account_file: "/tmp/auth.pem" - state: present + name: test_object + type: TCP + tcp_health_check: + port_name: service-health + request: ping + response: pong + healthy_threshold: 10 + timeout_sec: 2 + unhealthy_threshold: 5 + project: test_project + auth_kind: serviceaccount + service_account_file: "/tmp/auth.pem" + state: present ''' RETURN = ''' 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 8db32afba7d373..fd621700232e76 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 @@ -49,13 +49,14 @@ ''' EXAMPLES = ''' -- name: a health check facts +- name: " a health check facts" gcp_compute_health_check_facts: - filters: - - name = test_object - project: test_project - auth_kind: serviceaccount - service_account_file: "/tmp/auth.pem" + filters: + - name = test_object + project: test_project + auth_kind: serviceaccount + service_account_file: "/tmp/auth.pem" + state: facts ''' RETURN = ''' diff --git a/lib/ansible/modules/cloud/google/gcp_compute_http_health_check.py b/lib/ansible/modules/cloud/google/gcp_compute_http_health_check.py index 6c20f3edeefbe4..30cf9b3459abee 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_http_health_check.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_http_health_check.py @@ -112,15 +112,15 @@ EXAMPLES = ''' - name: create a http health check gcp_compute_http_health_check: - name: "test_object" - healthy_threshold: 10 - port: 8080 - timeout_sec: 2 - unhealthy_threshold: 5 - project: "test_project" - auth_kind: "serviceaccount" - service_account_file: "/tmp/auth.pem" - state: present + name: test_object + healthy_threshold: 10 + port: 8080 + timeout_sec: 2 + unhealthy_threshold: 5 + project: test_project + auth_kind: serviceaccount + service_account_file: "/tmp/auth.pem" + state: present ''' RETURN = ''' diff --git a/lib/ansible/modules/cloud/google/gcp_compute_http_health_check_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_http_health_check_facts.py index 5594d91360003b..a1c4fe5412748c 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_http_health_check_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_http_health_check_facts.py @@ -49,13 +49,14 @@ ''' EXAMPLES = ''' -- name: a http health check facts +- name: " a http health check facts" gcp_compute_http_health_check_facts: - filters: - - name = test_object - project: test_project - auth_kind: serviceaccount - service_account_file: "/tmp/auth.pem" + filters: + - name = test_object + project: test_project + auth_kind: serviceaccount + service_account_file: "/tmp/auth.pem" + state: facts ''' RETURN = ''' diff --git a/lib/ansible/modules/cloud/google/gcp_compute_https_health_check.py b/lib/ansible/modules/cloud/google/gcp_compute_https_health_check.py index 9d75310d6a928e..da0f37895c3823 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_https_health_check.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_https_health_check.py @@ -109,15 +109,15 @@ EXAMPLES = ''' - name: create a https health check gcp_compute_https_health_check: - name: "test_object" - healthy_threshold: 10 - port: 8080 - timeout_sec: 2 - unhealthy_threshold: 5 - project: "test_project" - auth_kind: "serviceaccount" - service_account_file: "/tmp/auth.pem" - state: present + name: test_object + healthy_threshold: 10 + port: 8080 + timeout_sec: 2 + unhealthy_threshold: 5 + project: test_project + auth_kind: serviceaccount + service_account_file: "/tmp/auth.pem" + state: present ''' RETURN = ''' diff --git a/lib/ansible/modules/cloud/google/gcp_compute_https_health_check_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_https_health_check_facts.py index 4bd372b6899aa0..99ca9a721eff68 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_https_health_check_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_https_health_check_facts.py @@ -49,13 +49,14 @@ ''' EXAMPLES = ''' -- name: a https health check facts +- name: " a https health check facts" gcp_compute_https_health_check_facts: - filters: - - name = test_object - project: test_project - auth_kind: serviceaccount - service_account_file: "/tmp/auth.pem" + filters: + - name = test_object + project: test_project + auth_kind: serviceaccount + service_account_file: "/tmp/auth.pem" + state: facts ''' RETURN = ''' diff --git a/lib/ansible/modules/cloud/google/gcp_compute_image.py b/lib/ansible/modules/cloud/google/gcp_compute_image.py index 7a1ec37526956b..5ecbf7b0da7fe8 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_image.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_image.py @@ -200,22 +200,22 @@ EXAMPLES = ''' - name: create a disk gcp_compute_disk: - name: "disk-image" - zone: us-central1-a - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: disk-image + zone: us-central1-a + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: disk - name: create a image gcp_compute_image: - name: "test_object" - source_disk: "{{ disk }}" - project: "test_project" - auth_kind: "serviceaccount" - service_account_file: "/tmp/auth.pem" - state: present + name: test_object + source_disk: "{{ disk }}" + project: test_project + auth_kind: serviceaccount + service_account_file: "/tmp/auth.pem" + state: present ''' RETURN = ''' diff --git a/lib/ansible/modules/cloud/google/gcp_compute_image_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_image_facts.py index d745044c94940c..bcf494a7b8e43b 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_image_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_image_facts.py @@ -49,13 +49,14 @@ ''' EXAMPLES = ''' -- name: a image facts +- name: " a image facts" gcp_compute_image_facts: - filters: - - name = test_object - project: test_project - auth_kind: serviceaccount - service_account_file: "/tmp/auth.pem" + filters: + - name = test_object + project: test_project + auth_kind: serviceaccount + service_account_file: "/tmp/auth.pem" + state: facts ''' RETURN = ''' diff --git a/lib/ansible/modules/cloud/google/gcp_compute_instance.py b/lib/ansible/modules/cloud/google/gcp_compute_instance.py index 73237ad5aff578..21bf96055df5f1 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_instance.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_instance.py @@ -424,57 +424,57 @@ EXAMPLES = ''' - name: create a disk gcp_compute_disk: - name: "disk-instance" - size_gb: 50 - source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-1604-lts - zone: us-central1-a - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: disk-instance + size_gb: 50 + source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-1604-lts + zone: us-central1-a + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: disk - name: create a network gcp_compute_network: - name: "network-instance" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: network-instance + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: network - name: create a address gcp_compute_address: - name: "address-instance" - region: us-central1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: address-instance + region: us-central1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: address - name: create a instance gcp_compute_instance: - name: "test_object" - machine_type: n1-standard-1 - disks: - - auto_delete: true - boot: true - source: "{{ disk }}" - metadata: - startup-script-url: gs:://graphite-playground/bootstrap.sh - cost-center: '12345' - network_interfaces: - - network: "{{ network }}" - access_configs: - - name: External NAT - nat_ip: "{{ address }}" - type: ONE_TO_ONE_NAT - zone: us-central1-a - project: "test_project" - auth_kind: "serviceaccount" - service_account_file: "/tmp/auth.pem" - state: present + name: test_object + machine_type: n1-standard-1 + disks: + - auto_delete: 'true' + boot: 'true' + source: "{{ disk }}" + metadata: + startup-script-url: gs:://graphite-playground/bootstrap.sh + cost-center: '12345' + network_interfaces: + - network: "{{ network }}" + access_configs: + - name: External NAT + nat_ip: "{{ address }}" + type: ONE_TO_ONE_NAT + zone: us-central1-a + project: test_project + auth_kind: serviceaccount + service_account_file: "/tmp/auth.pem" + state: present ''' RETURN = ''' diff --git a/lib/ansible/modules/cloud/google/gcp_compute_instance_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_instance_facts.py index 44187d879a65fc..dbc0431292506f 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_instance_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_instance_facts.py @@ -53,14 +53,15 @@ ''' EXAMPLES = ''' -- name: a instance facts +- name: " a instance facts" gcp_compute_instance_facts: - zone: us-central1-a - filters: - - name = test_object - project: test_project - auth_kind: serviceaccount - service_account_file: "/tmp/auth.pem" + zone: us-central1-a + filters: + - name = test_object + project: test_project + auth_kind: serviceaccount + service_account_file: "/tmp/auth.pem" + state: facts ''' RETURN = ''' diff --git a/lib/ansible/modules/cloud/google/gcp_compute_instance_group.py b/lib/ansible/modules/cloud/google/gcp_compute_instance_group.py index fbbe6370dd3e39..7c7b9d73497fff 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_instance_group.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_instance_group.py @@ -118,25 +118,25 @@ EXAMPLES = ''' - name: create a network gcp_compute_network: - name: "network-instancegroup" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: network-instancegroup + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: network - name: create a instance group gcp_compute_instance_group: - name: "test_object" - named_ports: - - name: ansible - port: 1234 - network: "{{ network }}" - zone: us-central1-a - project: "test_project" - auth_kind: "serviceaccount" - service_account_file: "/tmp/auth.pem" - state: present + name: test_object + named_ports: + - name: ansible + port: 1234 + network: "{{ network }}" + zone: us-central1-a + project: test_project + auth_kind: serviceaccount + service_account_file: "/tmp/auth.pem" + state: present ''' RETURN = ''' diff --git a/lib/ansible/modules/cloud/google/gcp_compute_instance_group_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_instance_group_facts.py index e01d25043854af..a875420c5dadb5 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_instance_group_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_instance_group_facts.py @@ -53,14 +53,15 @@ ''' EXAMPLES = ''' -- name: a instance group facts +- name: " a instance group facts" gcp_compute_instance_group_facts: - zone: us-central1-a - filters: - - name = test_object - project: test_project - auth_kind: serviceaccount - service_account_file: "/tmp/auth.pem" + zone: us-central1-a + filters: + - name = test_object + project: test_project + auth_kind: serviceaccount + service_account_file: "/tmp/auth.pem" + state: facts ''' RETURN = ''' diff --git a/lib/ansible/modules/cloud/google/gcp_compute_instance_group_manager.py b/lib/ansible/modules/cloud/google/gcp_compute_instance_group_manager.py index 7c8facab90d2d6..2c9ef402105f1d 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_instance_group_manager.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_instance_group_manager.py @@ -117,56 +117,56 @@ EXAMPLES = ''' - name: create a network gcp_compute_network: - name: "network-instancetemplate" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: network-instancetemplate + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: network - name: create a address gcp_compute_address: - name: "address-instancetemplate" - region: us-west1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: address-instancetemplate + region: us-west1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: address - name: create a instance template gcp_compute_instance_template: - name: "{{ resource_name }}" - properties: - disks: - - auto_delete: true - boot: true - initialize_params: - source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-1604-lts - machine_type: n1-standard-1 - network_interfaces: - - network: "{{ network }}" - access_configs: - - name: test-config - type: ONE_TO_ONE_NAT - nat_ip: "{{ address }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: "{{ resource_name }}" + properties: + disks: + - auto_delete: 'true' + boot: 'true' + initialize_params: + source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-1604-lts + machine_type: n1-standard-1 + network_interfaces: + - network: "{{ network }}" + access_configs: + - name: test-config + type: ONE_TO_ONE_NAT + nat_ip: "{{ address }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: instancetemplate - name: create a instance group manager gcp_compute_instance_group_manager: - name: "test_object" - base_instance_name: test1-child - instance_template: "{{ instancetemplate }}" - target_size: 3 - zone: us-west1-a - project: "test_project" - auth_kind: "serviceaccount" - service_account_file: "/tmp/auth.pem" - state: present + name: test_object + base_instance_name: test1-child + instance_template: "{{ instancetemplate }}" + target_size: 3 + zone: us-west1-a + project: test_project + auth_kind: serviceaccount + service_account_file: "/tmp/auth.pem" + state: present ''' RETURN = ''' diff --git a/lib/ansible/modules/cloud/google/gcp_compute_instance_group_manager_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_instance_group_manager_facts.py index 17250efc2456d9..0d13073cfbca78 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_instance_group_manager_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_instance_group_manager_facts.py @@ -53,14 +53,15 @@ ''' EXAMPLES = ''' -- name: a instance group manager facts +- name: " a instance group manager facts" gcp_compute_instance_group_manager_facts: - zone: us-west1-a - filters: - - name = test_object - project: test_project - auth_kind: serviceaccount - service_account_file: "/tmp/auth.pem" + zone: us-west1-a + filters: + - name = test_object + project: test_project + auth_kind: serviceaccount + service_account_file: "/tmp/auth.pem" + state: facts ''' RETURN = ''' diff --git a/lib/ansible/modules/cloud/google/gcp_compute_instance_template.py b/lib/ansible/modules/cloud/google/gcp_compute_instance_template.py index 44ec013363c56e..ee90ace8439f54 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_instance_template.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_instance_template.py @@ -418,43 +418,43 @@ EXAMPLES = ''' - name: create a network gcp_compute_network: - name: "network-instancetemplate" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: network-instancetemplate + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: network - name: create a address gcp_compute_address: - name: "address-instancetemplate" - region: us-west1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: address-instancetemplate + region: us-west1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: address - name: create a instance template gcp_compute_instance_template: - name: "test_object" - properties: - disks: - - auto_delete: true - boot: true - initialize_params: - source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-1604-lts - machine_type: n1-standard-1 - network_interfaces: - - network: "{{ network }}" - access_configs: - - name: test-config - type: ONE_TO_ONE_NAT - nat_ip: "{{ address }}" - project: "test_project" - auth_kind: "serviceaccount" - service_account_file: "/tmp/auth.pem" - state: present + name: test_object + properties: + disks: + - auto_delete: 'true' + boot: 'true' + initialize_params: + source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-1604-lts + machine_type: n1-standard-1 + network_interfaces: + - network: "{{ network }}" + access_configs: + - name: test-config + type: ONE_TO_ONE_NAT + nat_ip: "{{ address }}" + project: test_project + auth_kind: serviceaccount + service_account_file: "/tmp/auth.pem" + state: present ''' RETURN = ''' diff --git a/lib/ansible/modules/cloud/google/gcp_compute_instance_template_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_instance_template_facts.py index 38e264c9b47fe3..b6f57d9aca69fb 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_instance_template_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_instance_template_facts.py @@ -49,13 +49,14 @@ ''' EXAMPLES = ''' -- name: a instance template facts +- name: " a instance template facts" gcp_compute_instance_template_facts: - filters: - - name = test_object - project: test_project - auth_kind: serviceaccount - service_account_file: "/tmp/auth.pem" + filters: + - name = test_object + project: test_project + auth_kind: serviceaccount + service_account_file: "/tmp/auth.pem" + state: facts ''' RETURN = ''' diff --git a/lib/ansible/modules/cloud/google/gcp_compute_interconnect_attachment.py b/lib/ansible/modules/cloud/google/gcp_compute_interconnect_attachment.py index f4ad618e0ed2db..025755127bf7fc 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_interconnect_attachment.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_interconnect_attachment.py @@ -119,14 +119,14 @@ EXAMPLES = ''' - name: create a interconnect attachment gcp_compute_interconnect_attachment: - name: "test_object" - region: us-central1 - project: "test_project" - auth_kind: "serviceaccount" - interconnect: https://googleapis.com/compute/v1/projects/test_project/global/interconnects/... - router: https://googleapis.com/compute/v1/projects/test_project/regions/us-central1/routers/... - service_account_file: "/tmp/auth.pem" - state: present + name: test_object + region: us-central1 + project: test_project + auth_kind: serviceaccount + interconnect: https://googleapis.com/compute/v1/projects/test_project/global/interconnects/... + router: https://googleapis.com/compute/v1/projects/test_project/regions/us-central1/routers/... + service_account_file: "/tmp/auth.pem" + state: present register: disk ''' diff --git a/lib/ansible/modules/cloud/google/gcp_compute_interconnect_attachment_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_interconnect_attachment_facts.py index 0e638dc73f820a..2d43ab07dd87cf 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_interconnect_attachment_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_interconnect_attachment_facts.py @@ -53,14 +53,15 @@ ''' EXAMPLES = ''' -- name: a interconnect attachment facts +- name: " a interconnect attachment facts" gcp_compute_interconnect_attachment_facts: - region: us-central1 - filters: - - name = test_object - project: test_project - auth_kind: serviceaccount - service_account_file: "/tmp/auth.pem" + region: us-central1 + filters: + - name = test_object + project: test_project + auth_kind: serviceaccount + service_account_file: "/tmp/auth.pem" + state: facts ''' RETURN = ''' diff --git a/lib/ansible/modules/cloud/google/gcp_compute_network.py b/lib/ansible/modules/cloud/google/gcp_compute_network.py index 072c71b99055d4..5c385bc85b4e4c 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_network.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_network.py @@ -113,12 +113,12 @@ EXAMPLES = ''' - name: create a network gcp_compute_network: - name: "test_object" - auto_create_subnetworks: true - project: "test_project" - auth_kind: "serviceaccount" - service_account_file: "/tmp/auth.pem" - state: present + name: test_object + auto_create_subnetworks: 'true' + project: test_project + auth_kind: serviceaccount + service_account_file: "/tmp/auth.pem" + state: present ''' RETURN = ''' diff --git a/lib/ansible/modules/cloud/google/gcp_compute_network_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_network_facts.py index 6f2594ae96a948..da1cbcc7ce1899 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_network_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_network_facts.py @@ -49,13 +49,14 @@ ''' EXAMPLES = ''' -- name: a network facts +- name: " a network facts" gcp_compute_network_facts: - filters: - - name = test_object - project: test_project - auth_kind: serviceaccount - service_account_file: "/tmp/auth.pem" + filters: + - name = test_object + project: test_project + auth_kind: serviceaccount + service_account_file: "/tmp/auth.pem" + state: facts ''' RETURN = ''' diff --git a/lib/ansible/modules/cloud/google/gcp_compute_region_disk.py b/lib/ansible/modules/cloud/google/gcp_compute_region_disk.py index 9ea373238e97ca..627ce87ee4761c 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_region_disk.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_region_disk.py @@ -157,18 +157,18 @@ EXAMPLES = ''' - name: create a region disk gcp_compute_region_disk: - name: "test_object" - size_gb: 50 - disk_encryption_key: - raw_key: SGVsbG8gZnJvbSBHb29nbGUgQ2xvdWQgUGxhdGZvcm0= - region: us-central1 - replica_zones: - - https://www.googleapis.com/compute/v1/projects/google.com:graphite-playground/zones/us-central1-a - - https://www.googleapis.com/compute/v1/projects/google.com:graphite-playground/zones/us-central1-b - project: "test_project" - auth_kind: "serviceaccount" - service_account_file: "/tmp/auth.pem" - state: present + name: test_object + size_gb: 50 + disk_encryption_key: + raw_key: SGVsbG8gZnJvbSBHb29nbGUgQ2xvdWQgUGxhdGZvcm0= + region: us-central1 + replica_zones: + - https://www.googleapis.com/compute/v1/projects/google.com:graphite-playground/zones/us-central1-a + - https://www.googleapis.com/compute/v1/projects/google.com:graphite-playground/zones/us-central1-b + project: test_project + auth_kind: serviceaccount + service_account_file: "/tmp/auth.pem" + state: present ''' RETURN = ''' diff --git a/lib/ansible/modules/cloud/google/gcp_compute_region_disk_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_region_disk_facts.py index 8fd6202707228e..d2f310d1cc20da 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_region_disk_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_region_disk_facts.py @@ -53,14 +53,15 @@ ''' EXAMPLES = ''' -- name: a region disk facts +- name: " a region disk facts" gcp_compute_region_disk_facts: - region: us-central1 - filters: - - name = test_object - project: test_project - auth_kind: serviceaccount - service_account_file: "/tmp/auth.pem" + region: us-central1 + filters: + - name = test_object + project: test_project + auth_kind: serviceaccount + service_account_file: "/tmp/auth.pem" + state: facts ''' RETURN = ''' diff --git a/lib/ansible/modules/cloud/google/gcp_compute_route.py b/lib/ansible/modules/cloud/google/gcp_compute_route.py index 0053d8cb26731c..e0b47593de22e5 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_route.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_route.py @@ -142,26 +142,26 @@ EXAMPLES = ''' - name: create a network gcp_compute_network: - name: "network-route" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: network-route + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: network - name: create a route gcp_compute_route: - name: "test_object" - dest_range: 192.168.6.0/24 - next_hop_gateway: global/gateways/default-internet-gateway - network: "{{ network }}" - tags: - - backends - - databases - project: "test_project" - auth_kind: "serviceaccount" - service_account_file: "/tmp/auth.pem" - state: present + name: test_object + dest_range: 192.168.6.0/24 + next_hop_gateway: global/gateways/default-internet-gateway + network: "{{ network }}" + tags: + - backends + - databases + project: test_project + auth_kind: serviceaccount + service_account_file: "/tmp/auth.pem" + state: present ''' RETURN = ''' diff --git a/lib/ansible/modules/cloud/google/gcp_compute_route_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_route_facts.py index 965189b252f9d6..34de7c0e6eaf4d 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_route_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_route_facts.py @@ -49,13 +49,14 @@ ''' EXAMPLES = ''' -- name: a route facts +- name: " a route facts" gcp_compute_route_facts: - filters: - - name = test_object - project: test_project - auth_kind: serviceaccount - service_account_file: "/tmp/auth.pem" + filters: + - name = test_object + project: test_project + auth_kind: serviceaccount + service_account_file: "/tmp/auth.pem" + state: facts ''' RETURN = ''' diff --git a/lib/ansible/modules/cloud/google/gcp_compute_router.py b/lib/ansible/modules/cloud/google/gcp_compute_router.py index 9977375cb0c377..83ecca83de7bed 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_router.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_router.py @@ -126,30 +126,30 @@ EXAMPLES = ''' - name: create a network gcp_compute_network: - name: "network-router" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: network-router + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: network - name: create a router gcp_compute_router: - name: "test_object" - network: "{{ network }}" - bgp: - asn: 64514 - advertise_mode: CUSTOM - advertised_groups: - - ALL_SUBNETS - advertised_ip_ranges: - - range: 1.2.3.4 - - range: 6.7.0.0/16 - region: us-central1 - project: "test_project" - auth_kind: "serviceaccount" - service_account_file: "/tmp/auth.pem" - state: present + name: test_object + network: "{{ network }}" + bgp: + asn: 64514 + advertise_mode: CUSTOM + advertised_groups: + - ALL_SUBNETS + advertised_ip_ranges: + - range: 1.2.3.4 + - range: 6.7.0.0/16 + region: us-central1 + project: test_project + auth_kind: serviceaccount + service_account_file: "/tmp/auth.pem" + state: present ''' RETURN = ''' diff --git a/lib/ansible/modules/cloud/google/gcp_compute_router_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_router_facts.py index 1ef82f2e044d8e..45c00d8af7cb05 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_router_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_router_facts.py @@ -53,14 +53,15 @@ ''' EXAMPLES = ''' -- name: a router facts +- name: " a router facts" gcp_compute_router_facts: - region: us-central1 - filters: - - name = test_object - project: test_project - auth_kind: serviceaccount - service_account_file: "/tmp/auth.pem" + region: us-central1 + filters: + - name = test_object + project: test_project + auth_kind: serviceaccount + service_account_file: "/tmp/auth.pem" + state: facts ''' RETURN = ''' diff --git a/lib/ansible/modules/cloud/google/gcp_compute_ssl_certificate.py b/lib/ansible/modules/cloud/google/gcp_compute_ssl_certificate.py index c2b2e04949ec59..8a4e6ae79c0486 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_ssl_certificate.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_ssl_certificate.py @@ -81,36 +81,24 @@ EXAMPLES = ''' - name: create a ssl certificate gcp_compute_ssl_certificate: - name: "test_object" - description: A certificate for testing. Do not use this certificate in production - certificate: | - -----BEGIN CERTIFICATE----- - MIICqjCCAk+gAwIBAgIJAIuJ+0352Kq4MAoGCCqGSM49BAMCMIGwMQswCQYDVQQG - EwJVUzETMBEGA1UECAwKV2FzaGluZ3RvbjERMA8GA1UEBwwIS2lya2xhbmQxFTAT - BgNVBAoMDEdvb2dsZSwgSW5jLjEeMBwGA1UECwwVR29vZ2xlIENsb3VkIFBsYXRm - b3JtMR8wHQYDVQQDDBZ3d3cubXktc2VjdXJlLXNpdGUuY29tMSEwHwYJKoZIhvcN - AQkBFhJuZWxzb25hQGdvb2dsZS5jb20wHhcNMTcwNjI4MDQ1NjI2WhcNMjcwNjI2 - MDQ1NjI2WjCBsDELMAkGA1UEBhMCVVMxEzARBgNVBAgMCldhc2hpbmd0b24xETAP - BgNVBAcMCEtpcmtsYW5kMRUwEwYDVQQKDAxHb29nbGUsIEluYy4xHjAcBgNVBAsM - FUdvb2dsZSBDbG91ZCBQbGF0Zm9ybTEfMB0GA1UEAwwWd3d3Lm15LXNlY3VyZS1z - aXRlLmNvbTEhMB8GCSqGSIb3DQEJARYSbmVsc29uYUBnb29nbGUuY29tMFkwEwYH - KoZIzj0CAQYIKoZIzj0DAQcDQgAEHGzpcRJ4XzfBJCCPMQeXQpTXwlblimODQCuQ - 4mzkzTv0dXyB750fOGN02HtkpBOZzzvUARTR10JQoSe2/5PIwaNQME4wHQYDVR0O - BBYEFKIQC3A2SDpxcdfn0YLKineDNq/BMB8GA1UdIwQYMBaAFKIQC3A2SDpxcdfn - 0YLKineDNq/BMAwGA1UdEwQFMAMBAf8wCgYIKoZIzj0EAwIDSQAwRgIhALs4vy+O - M3jcqgA4fSW/oKw6UJxp+M6a+nGMX+UJR3YgAiEAvvl39QRVAiv84hdoCuyON0lJ - zqGNhIPGq2ULqXKK8BY= - -----END CERTIFICATE----- - private_key: | - -----BEGIN EC PRIVATE KEY----- - MHcCAQEEIObtRo8tkUqoMjeHhsOh2ouPpXCgBcP+EDxZCB/tws15oAoGCCqGSM49 - AwEHoUQDQgAEHGzpcRJ4XzfBJCCPMQeXQpTXwlblimODQCuQ4mzkzTv0dXyB750f - OGN02HtkpBOZzzvUARTR10JQoSe2/5PIwQ== - -----END EC PRIVATE KEY----- - project: "test_project" - auth_kind: "serviceaccount" - service_account_file: "/tmp/auth.pem" - state: present + name: test_object + description: A certificate for testing. Do not use this certificate in production + certificate: "-----BEGIN CERTIFICATE----- MIICqjCCAk+gAwIBAgIJAIuJ+0352Kq4MAoGCCqGSM49BAMCMIGwMQswCQYDVQQG + EwJVUzETMBEGA1UECAwKV2FzaGluZ3RvbjERMA8GA1UEBwwIS2lya2xhbmQxFTAT BgNVBAoMDEdvb2dsZSwgSW5jLjEeMBwGA1UECwwVR29vZ2xlIENsb3VkIFBsYXRm + b3JtMR8wHQYDVQQDDBZ3d3cubXktc2VjdXJlLXNpdGUuY29tMSEwHwYJKoZIhvcN AQkBFhJuZWxzb25hQGdvb2dsZS5jb20wHhcNMTcwNjI4MDQ1NjI2WhcNMjcwNjI2 + MDQ1NjI2WjCBsDELMAkGA1UEBhMCVVMxEzARBgNVBAgMCldhc2hpbmd0b24xETAP BgNVBAcMCEtpcmtsYW5kMRUwEwYDVQQKDAxHb29nbGUsIEluYy4xHjAcBgNVBAsM + FUdvb2dsZSBDbG91ZCBQbGF0Zm9ybTEfMB0GA1UEAwwWd3d3Lm15LXNlY3VyZS1z aXRlLmNvbTEhMB8GCSqGSIb3DQEJARYSbmVsc29uYUBnb29nbGUuY29tMFkwEwYH + KoZIzj0CAQYIKoZIzj0DAQcDQgAEHGzpcRJ4XzfBJCCPMQeXQpTXwlblimODQCuQ 4mzkzTv0dXyB750fOGN02HtkpBOZzzvUARTR10JQoSe2/5PIwaNQME4wHQYDVR0O + BBYEFKIQC3A2SDpxcdfn0YLKineDNq/BMB8GA1UdIwQYMBaAFKIQC3A2SDpxcdfn 0YLKineDNq/BMAwGA1UdEwQFMAMBAf8wCgYIKoZIzj0EAwIDSQAwRgIhALs4vy+O + M3jcqgA4fSW/oKw6UJxp+M6a+nGMX+UJR3YgAiEAvvl39QRVAiv84hdoCuyON0lJ zqGNhIPGq2ULqXKK8BY= + -----END CERTIFICATE-----" + private_key: "-----BEGIN EC PRIVATE KEY----- MHcCAQEEIObtRo8tkUqoMjeHhsOh2ouPpXCgBcP+EDxZCB/tws15oAoGCCqGSM49 + AwEHoUQDQgAEHGzpcRJ4XzfBJCCPMQeXQpTXwlblimODQCuQ4mzkzTv0dXyB750f OGN02HtkpBOZzzvUARTR10JQoSe2/5PIwQ== + -----END EC PRIVATE KEY-----" + project: test_project + auth_kind: serviceaccount + service_account_file: "/tmp/auth.pem" + state: present ''' RETURN = ''' diff --git a/lib/ansible/modules/cloud/google/gcp_compute_ssl_certificate_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_ssl_certificate_facts.py index 51e16a94b4dd79..12c1704e366764 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_ssl_certificate_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_ssl_certificate_facts.py @@ -49,13 +49,14 @@ ''' EXAMPLES = ''' -- name: a ssl certificate facts +- name: " a ssl certificate facts" gcp_compute_ssl_certificate_facts: - filters: - - name = test_object - project: test_project - auth_kind: serviceaccount - service_account_file: "/tmp/auth.pem" + filters: + - name = test_object + project: test_project + auth_kind: serviceaccount + service_account_file: "/tmp/auth.pem" + state: facts ''' RETURN = ''' diff --git a/lib/ansible/modules/cloud/google/gcp_compute_ssl_policy.py b/lib/ansible/modules/cloud/google/gcp_compute_ssl_policy.py index 02def517b039d1..329ec37fa3a62c 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_ssl_policy.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_ssl_policy.py @@ -98,16 +98,16 @@ EXAMPLES = ''' - name: create a ssl policy gcp_compute_ssl_policy: - name: "test_object" - profile: CUSTOM - min_tls_version: TLS_1_2 - custom_features: - - TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 - - TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 - project: "test_project" - auth_kind: "serviceaccount" - service_account_file: "/tmp/auth.pem" - state: present + name: test_object + profile: CUSTOM + min_tls_version: TLS_1_2 + custom_features: + - TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 + - TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 + project: test_project + auth_kind: serviceaccount + service_account_file: "/tmp/auth.pem" + state: present ''' RETURN = ''' diff --git a/lib/ansible/modules/cloud/google/gcp_compute_ssl_policy_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_ssl_policy_facts.py index c620ec05b8bb49..22758a32d56f33 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_ssl_policy_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_ssl_policy_facts.py @@ -49,13 +49,14 @@ ''' EXAMPLES = ''' -- name: a ssl policy facts +- name: " a ssl policy facts" gcp_compute_ssl_policy_facts: - filters: - - name = test_object - project: test_project - auth_kind: serviceaccount - service_account_file: "/tmp/auth.pem" + filters: + - name = test_object + project: test_project + auth_kind: serviceaccount + service_account_file: "/tmp/auth.pem" + state: facts ''' RETURN = ''' diff --git a/lib/ansible/modules/cloud/google/gcp_compute_subnetwork.py b/lib/ansible/modules/cloud/google/gcp_compute_subnetwork.py index 3097e9abf66d5b..5f4762a2b1bbf4 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_subnetwork.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_subnetwork.py @@ -140,24 +140,24 @@ EXAMPLES = ''' - name: create a network gcp_compute_network: - name: "network-subnetwork" - auto_create_subnetworks: true - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: network-subnetwork + auto_create_subnetworks: 'true' + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: network - name: create a subnetwork gcp_compute_subnetwork: - name: ansiblenet - region: us-west1 - network: "{{ network }}" - ip_cidr_range: 172.16.0.0/16 - project: "test_project" - auth_kind: "serviceaccount" - service_account_file: "/tmp/auth.pem" - state: present + name: ansiblenet + region: us-west1 + network: "{{ network }}" + ip_cidr_range: 172.16.0.0/16 + project: test_project + auth_kind: serviceaccount + service_account_file: "/tmp/auth.pem" + state: present ''' RETURN = ''' diff --git a/lib/ansible/modules/cloud/google/gcp_compute_subnetwork_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_subnetwork_facts.py index 77de9f76fc18e7..9d24ddd967da2e 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_subnetwork_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_subnetwork_facts.py @@ -53,14 +53,15 @@ ''' EXAMPLES = ''' -- name: a subnetwork facts +- name: " a subnetwork facts" gcp_compute_subnetwork_facts: - region: us-west1 - filters: - - name = test_object - project: test_project - auth_kind: serviceaccount - service_account_file: "/tmp/auth.pem" + region: us-west1 + filters: + - name = test_object + project: test_project + auth_kind: serviceaccount + service_account_file: "/tmp/auth.pem" + state: facts ''' RETURN = ''' diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_http_proxy.py b/lib/ansible/modules/cloud/google/gcp_compute_target_http_proxy.py index ec150e13d41c73..9bc3fbe00a0b58 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_http_proxy.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_http_proxy.py @@ -79,59 +79,59 @@ EXAMPLES = ''' - name: create a instance group gcp_compute_instance_group: - name: "instancegroup-targethttpproxy" - zone: us-central1-a - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: instancegroup-targethttpproxy + zone: us-central1-a + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: instancegroup - name: create a http health check gcp_compute_http_health_check: - name: "httphealthcheck-targethttpproxy" - healthy_threshold: 10 - port: 8080 - timeout_sec: 2 - unhealthy_threshold: 5 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: httphealthcheck-targethttpproxy + healthy_threshold: 10 + port: 8080 + timeout_sec: 2 + unhealthy_threshold: 5 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: healthcheck - name: create a backend service gcp_compute_backend_service: - name: "backendservice-targethttpproxy" - 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 + name: backendservice-targethttpproxy + 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 register: backendservice - name: create a url map gcp_compute_url_map: - name: "urlmap-targethttpproxy" - default_service: "{{ backendservice }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: urlmap-targethttpproxy + default_service: "{{ backendservice }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: urlmap - name: create a target http proxy gcp_compute_target_http_proxy: - name: "test_object" - url_map: "{{ urlmap }}" - project: "test_project" - auth_kind: "serviceaccount" - service_account_file: "/tmp/auth.pem" - state: present + name: test_object + url_map: "{{ urlmap }}" + project: test_project + auth_kind: serviceaccount + service_account_file: "/tmp/auth.pem" + state: present ''' RETURN = ''' diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_http_proxy_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_target_http_proxy_facts.py index b7f56b9c6f159b..1a6e68af68839c 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_http_proxy_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_http_proxy_facts.py @@ -49,13 +49,14 @@ ''' EXAMPLES = ''' -- name: a target http proxy facts +- name: " a target http proxy facts" gcp_compute_target_http_proxy_facts: - filters: - - name = test_object - project: test_project - auth_kind: serviceaccount - service_account_file: "/tmp/auth.pem" + filters: + - name = test_object + project: test_project + auth_kind: serviceaccount + service_account_file: "/tmp/auth.pem" + state: facts ''' RETURN = ''' diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_https_proxy.py b/lib/ansible/modules/cloud/google/gcp_compute_target_https_proxy.py index 229d81a4d7a804..e849ca63349755 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_https_proxy.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_https_proxy.py @@ -109,95 +109,83 @@ EXAMPLES = ''' - name: create a instance group gcp_compute_instance_group: - name: "instancegroup-targethttpsproxy" - zone: us-central1-a - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: instancegroup-targethttpsproxy + zone: us-central1-a + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: instancegroup - name: create a http health check gcp_compute_http_health_check: - name: "httphealthcheck-targethttpsproxy" - healthy_threshold: 10 - port: 8080 - timeout_sec: 2 - unhealthy_threshold: 5 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: httphealthcheck-targethttpsproxy + healthy_threshold: 10 + port: 8080 + timeout_sec: 2 + unhealthy_threshold: 5 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: healthcheck - name: create a backend service gcp_compute_backend_service: - name: "backendservice-targethttpsproxy" - 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 + name: backendservice-targethttpsproxy + 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 register: backendservice - name: create a url map gcp_compute_url_map: - name: "urlmap-targethttpsproxy" - default_service: "{{ backendservice }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: urlmap-targethttpsproxy + default_service: "{{ backendservice }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: urlmap - name: create a ssl certificate gcp_compute_ssl_certificate: - name: "sslcert-targethttpsproxy" - description: A certificate for testing. Do not use this certificate in production - certificate: | - -----BEGIN CERTIFICATE----- - MIICqjCCAk+gAwIBAgIJAIuJ+0352Kq4MAoGCCqGSM49BAMCMIGwMQswCQYDVQQG - EwJVUzETMBEGA1UECAwKV2FzaGluZ3RvbjERMA8GA1UEBwwIS2lya2xhbmQxFTAT - BgNVBAoMDEdvb2dsZSwgSW5jLjEeMBwGA1UECwwVR29vZ2xlIENsb3VkIFBsYXRm - b3JtMR8wHQYDVQQDDBZ3d3cubXktc2VjdXJlLXNpdGUuY29tMSEwHwYJKoZIhvcN - AQkBFhJuZWxzb25hQGdvb2dsZS5jb20wHhcNMTcwNjI4MDQ1NjI2WhcNMjcwNjI2 - MDQ1NjI2WjCBsDELMAkGA1UEBhMCVVMxEzARBgNVBAgMCldhc2hpbmd0b24xETAP - BgNVBAcMCEtpcmtsYW5kMRUwEwYDVQQKDAxHb29nbGUsIEluYy4xHjAcBgNVBAsM - FUdvb2dsZSBDbG91ZCBQbGF0Zm9ybTEfMB0GA1UEAwwWd3d3Lm15LXNlY3VyZS1z - aXRlLmNvbTEhMB8GCSqGSIb3DQEJARYSbmVsc29uYUBnb29nbGUuY29tMFkwEwYH - KoZIzj0CAQYIKoZIzj0DAQcDQgAEHGzpcRJ4XzfBJCCPMQeXQpTXwlblimODQCuQ - 4mzkzTv0dXyB750fOGN02HtkpBOZzzvUARTR10JQoSe2/5PIwaNQME4wHQYDVR0O - BBYEFKIQC3A2SDpxcdfn0YLKineDNq/BMB8GA1UdIwQYMBaAFKIQC3A2SDpxcdfn - 0YLKineDNq/BMAwGA1UdEwQFMAMBAf8wCgYIKoZIzj0EAwIDSQAwRgIhALs4vy+O - M3jcqgA4fSW/oKw6UJxp+M6a+nGMX+UJR3YgAiEAvvl39QRVAiv84hdoCuyON0lJ - zqGNhIPGq2ULqXKK8BY= - -----END CERTIFICATE----- - private_key: | - -----BEGIN EC PRIVATE KEY----- - MHcCAQEEIObtRo8tkUqoMjeHhsOh2ouPpXCgBcP+EDxZCB/tws15oAoGCCqGSM49 - AwEHoUQDQgAEHGzpcRJ4XzfBJCCPMQeXQpTXwlblimODQCuQ4mzkzTv0dXyB750f - OGN02HtkpBOZzzvUARTR10JQoSe2/5PIwQ== - -----END EC PRIVATE KEY----- - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: sslcert-targethttpsproxy + description: A certificate for testing. Do not use this certificate in production + certificate: "-----BEGIN CERTIFICATE----- MIICqjCCAk+gAwIBAgIJAIuJ+0352Kq4MAoGCCqGSM49BAMCMIGwMQswCQYDVQQG + EwJVUzETMBEGA1UECAwKV2FzaGluZ3RvbjERMA8GA1UEBwwIS2lya2xhbmQxFTAT BgNVBAoMDEdvb2dsZSwgSW5jLjEeMBwGA1UECwwVR29vZ2xlIENsb3VkIFBsYXRm + b3JtMR8wHQYDVQQDDBZ3d3cubXktc2VjdXJlLXNpdGUuY29tMSEwHwYJKoZIhvcN AQkBFhJuZWxzb25hQGdvb2dsZS5jb20wHhcNMTcwNjI4MDQ1NjI2WhcNMjcwNjI2 + MDQ1NjI2WjCBsDELMAkGA1UEBhMCVVMxEzARBgNVBAgMCldhc2hpbmd0b24xETAP BgNVBAcMCEtpcmtsYW5kMRUwEwYDVQQKDAxHb29nbGUsIEluYy4xHjAcBgNVBAsM + FUdvb2dsZSBDbG91ZCBQbGF0Zm9ybTEfMB0GA1UEAwwWd3d3Lm15LXNlY3VyZS1z aXRlLmNvbTEhMB8GCSqGSIb3DQEJARYSbmVsc29uYUBnb29nbGUuY29tMFkwEwYH + KoZIzj0CAQYIKoZIzj0DAQcDQgAEHGzpcRJ4XzfBJCCPMQeXQpTXwlblimODQCuQ 4mzkzTv0dXyB750fOGN02HtkpBOZzzvUARTR10JQoSe2/5PIwaNQME4wHQYDVR0O + BBYEFKIQC3A2SDpxcdfn0YLKineDNq/BMB8GA1UdIwQYMBaAFKIQC3A2SDpxcdfn 0YLKineDNq/BMAwGA1UdEwQFMAMBAf8wCgYIKoZIzj0EAwIDSQAwRgIhALs4vy+O + M3jcqgA4fSW/oKw6UJxp+M6a+nGMX+UJR3YgAiEAvvl39QRVAiv84hdoCuyON0lJ zqGNhIPGq2ULqXKK8BY= + -----END CERTIFICATE-----" + private_key: "-----BEGIN EC PRIVATE KEY----- MHcCAQEEIObtRo8tkUqoMjeHhsOh2ouPpXCgBcP+EDxZCB/tws15oAoGCCqGSM49 + AwEHoUQDQgAEHGzpcRJ4XzfBJCCPMQeXQpTXwlblimODQCuQ4mzkzTv0dXyB750f OGN02HtkpBOZzzvUARTR10JQoSe2/5PIwQ== + -----END EC PRIVATE KEY-----" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: sslcert - name: create a target https proxy gcp_compute_target_https_proxy: - name: "test_object" - ssl_certificates: - - "{{ sslcert }}" - url_map: "{{ urlmap }}" - project: "test_project" - auth_kind: "serviceaccount" - service_account_file: "/tmp/auth.pem" - state: present + name: test_object + ssl_certificates: + - "{{ sslcert }}" + url_map: "{{ urlmap }}" + project: test_project + auth_kind: serviceaccount + service_account_file: "/tmp/auth.pem" + state: present ''' RETURN = ''' diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_https_proxy_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_target_https_proxy_facts.py index e68a89728d3a22..bd79ec0d85a155 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_https_proxy_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_https_proxy_facts.py @@ -49,13 +49,14 @@ ''' EXAMPLES = ''' -- name: a target https proxy facts +- name: " a target https proxy facts" gcp_compute_target_https_proxy_facts: - filters: - - name = test_object - project: test_project - auth_kind: serviceaccount - service_account_file: "/tmp/auth.pem" + filters: + - name = test_object + project: test_project + auth_kind: serviceaccount + service_account_file: "/tmp/auth.pem" + state: facts ''' RETURN = ''' diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_pool.py b/lib/ansible/modules/cloud/google/gcp_compute_target_pool.py index 89afc7701a1056..270e1a03edb0be 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_pool.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_pool.py @@ -135,12 +135,12 @@ EXAMPLES = ''' - name: create a target pool gcp_compute_target_pool: - name: "test_object" - region: us-west1 - project: "test_project" - auth_kind: "serviceaccount" - service_account_file: "/tmp/auth.pem" - state: present + name: test_object + region: us-west1 + project: test_project + auth_kind: serviceaccount + service_account_file: "/tmp/auth.pem" + state: present ''' RETURN = ''' diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_pool_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_target_pool_facts.py index 05332d6a112cef..48923e140719a2 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_pool_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_pool_facts.py @@ -53,14 +53,15 @@ ''' EXAMPLES = ''' -- name: a target pool facts +- name: " a target pool facts" gcp_compute_target_pool_facts: - region: us-west1 - filters: - - name = test_object - project: test_project - auth_kind: serviceaccount - service_account_file: "/tmp/auth.pem" + region: us-west1 + filters: + - name = test_object + project: test_project + auth_kind: serviceaccount + service_account_file: "/tmp/auth.pem" + state: facts ''' RETURN = ''' diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_ssl_proxy.py b/lib/ansible/modules/cloud/google/gcp_compute_target_ssl_proxy.py index 0e00b0b15b17ae..9ce3d1a9a61b1d 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_ssl_proxy.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_ssl_proxy.py @@ -104,89 +104,77 @@ EXAMPLES = ''' - name: create a instance group gcp_compute_instance_group: - name: "instancegroup-targetsslproxy" - zone: us-central1-a - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: instancegroup-targetsslproxy + zone: us-central1-a + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: instancegroup - name: create a health check gcp_compute_health_check: - name: "healthcheck-targetsslproxy" - type: TCP - tcp_health_check: - port_name: service-health - request: ping - response: pong - healthy_threshold: 10 - timeout_sec: 2 - unhealthy_threshold: 5 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: healthcheck-targetsslproxy + type: TCP + tcp_health_check: + port_name: service-health + request: ping + response: pong + healthy_threshold: 10 + timeout_sec: 2 + unhealthy_threshold: 5 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: healthcheck - name: create a backend service gcp_compute_backend_service: - name: "backendservice-targetsslproxy" - backends: - - group: "{{ instancegroup }}" - health_checks: - - "{{ healthcheck.selfLink }}" - protocol: SSL - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: backendservice-targetsslproxy + backends: + - group: "{{ instancegroup }}" + health_checks: + - "{{ healthcheck.selfLink }}" + protocol: SSL + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: backendservice - name: create a ssl certificate gcp_compute_ssl_certificate: - name: "sslcert-targetsslproxy" - description: A certificate for testing. Do not use this certificate in production - certificate: | - -----BEGIN CERTIFICATE----- - MIICqjCCAk+gAwIBAgIJAIuJ+0352Kq4MAoGCCqGSM49BAMCMIGwMQswCQYDVQQG - EwJVUzETMBEGA1UECAwKV2FzaGluZ3RvbjERMA8GA1UEBwwIS2lya2xhbmQxFTAT - BgNVBAoMDEdvb2dsZSwgSW5jLjEeMBwGA1UECwwVR29vZ2xlIENsb3VkIFBsYXRm - b3JtMR8wHQYDVQQDDBZ3d3cubXktc2VjdXJlLXNpdGUuY29tMSEwHwYJKoZIhvcN - AQkBFhJuZWxzb25hQGdvb2dsZS5jb20wHhcNMTcwNjI4MDQ1NjI2WhcNMjcwNjI2 - MDQ1NjI2WjCBsDELMAkGA1UEBhMCVVMxEzARBgNVBAgMCldhc2hpbmd0b24xETAP - BgNVBAcMCEtpcmtsYW5kMRUwEwYDVQQKDAxHb29nbGUsIEluYy4xHjAcBgNVBAsM - FUdvb2dsZSBDbG91ZCBQbGF0Zm9ybTEfMB0GA1UEAwwWd3d3Lm15LXNlY3VyZS1z - aXRlLmNvbTEhMB8GCSqGSIb3DQEJARYSbmVsc29uYUBnb29nbGUuY29tMFkwEwYH - KoZIzj0CAQYIKoZIzj0DAQcDQgAEHGzpcRJ4XzfBJCCPMQeXQpTXwlblimODQCuQ - 4mzkzTv0dXyB750fOGN02HtkpBOZzzvUARTR10JQoSe2/5PIwaNQME4wHQYDVR0O - BBYEFKIQC3A2SDpxcdfn0YLKineDNq/BMB8GA1UdIwQYMBaAFKIQC3A2SDpxcdfn - 0YLKineDNq/BMAwGA1UdEwQFMAMBAf8wCgYIKoZIzj0EAwIDSQAwRgIhALs4vy+O - M3jcqgA4fSW/oKw6UJxp+M6a+nGMX+UJR3YgAiEAvvl39QRVAiv84hdoCuyON0lJ - zqGNhIPGq2ULqXKK8BY= - -----END CERTIFICATE----- - private_key: | - -----BEGIN EC PRIVATE KEY----- - MHcCAQEEIObtRo8tkUqoMjeHhsOh2ouPpXCgBcP+EDxZCB/tws15oAoGCCqGSM49 - AwEHoUQDQgAEHGzpcRJ4XzfBJCCPMQeXQpTXwlblimODQCuQ4mzkzTv0dXyB750f - OGN02HtkpBOZzzvUARTR10JQoSe2/5PIwQ== - -----END EC PRIVATE KEY----- - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: sslcert-targetsslproxy + description: A certificate for testing. Do not use this certificate in production + certificate: "-----BEGIN CERTIFICATE----- MIICqjCCAk+gAwIBAgIJAIuJ+0352Kq4MAoGCCqGSM49BAMCMIGwMQswCQYDVQQG + EwJVUzETMBEGA1UECAwKV2FzaGluZ3RvbjERMA8GA1UEBwwIS2lya2xhbmQxFTAT BgNVBAoMDEdvb2dsZSwgSW5jLjEeMBwGA1UECwwVR29vZ2xlIENsb3VkIFBsYXRm + b3JtMR8wHQYDVQQDDBZ3d3cubXktc2VjdXJlLXNpdGUuY29tMSEwHwYJKoZIhvcN AQkBFhJuZWxzb25hQGdvb2dsZS5jb20wHhcNMTcwNjI4MDQ1NjI2WhcNMjcwNjI2 + MDQ1NjI2WjCBsDELMAkGA1UEBhMCVVMxEzARBgNVBAgMCldhc2hpbmd0b24xETAP BgNVBAcMCEtpcmtsYW5kMRUwEwYDVQQKDAxHb29nbGUsIEluYy4xHjAcBgNVBAsM + FUdvb2dsZSBDbG91ZCBQbGF0Zm9ybTEfMB0GA1UEAwwWd3d3Lm15LXNlY3VyZS1z aXRlLmNvbTEhMB8GCSqGSIb3DQEJARYSbmVsc29uYUBnb29nbGUuY29tMFkwEwYH + KoZIzj0CAQYIKoZIzj0DAQcDQgAEHGzpcRJ4XzfBJCCPMQeXQpTXwlblimODQCuQ 4mzkzTv0dXyB750fOGN02HtkpBOZzzvUARTR10JQoSe2/5PIwaNQME4wHQYDVR0O + BBYEFKIQC3A2SDpxcdfn0YLKineDNq/BMB8GA1UdIwQYMBaAFKIQC3A2SDpxcdfn 0YLKineDNq/BMAwGA1UdEwQFMAMBAf8wCgYIKoZIzj0EAwIDSQAwRgIhALs4vy+O + M3jcqgA4fSW/oKw6UJxp+M6a+nGMX+UJR3YgAiEAvvl39QRVAiv84hdoCuyON0lJ zqGNhIPGq2ULqXKK8BY= + -----END CERTIFICATE-----" + private_key: "-----BEGIN EC PRIVATE KEY----- MHcCAQEEIObtRo8tkUqoMjeHhsOh2ouPpXCgBcP+EDxZCB/tws15oAoGCCqGSM49 + AwEHoUQDQgAEHGzpcRJ4XzfBJCCPMQeXQpTXwlblimODQCuQ4mzkzTv0dXyB750f OGN02HtkpBOZzzvUARTR10JQoSe2/5PIwQ== + -----END EC PRIVATE KEY-----" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: sslcert - name: create a target ssl proxy gcp_compute_target_ssl_proxy: - name: "test_object" - ssl_certificates: - - "{{ sslcert }}" - service: "{{ backendservice }}" - project: "test_project" - auth_kind: "serviceaccount" - service_account_file: "/tmp/auth.pem" - state: present + name: test_object + ssl_certificates: + - "{{ sslcert }}" + service: "{{ backendservice }}" + project: test_project + auth_kind: serviceaccount + service_account_file: "/tmp/auth.pem" + state: present ''' RETURN = ''' diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_ssl_proxy_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_target_ssl_proxy_facts.py index 237ed188bfee45..fe582bfccf3408 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_ssl_proxy_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_ssl_proxy_facts.py @@ -49,13 +49,14 @@ ''' EXAMPLES = ''' -- name: a target ssl proxy facts +- name: " a target ssl proxy facts" gcp_compute_target_ssl_proxy_facts: - filters: - - name = test_object - project: test_project - auth_kind: serviceaccount - service_account_file: "/tmp/auth.pem" + filters: + - name = test_object + project: test_project + auth_kind: serviceaccount + service_account_file: "/tmp/auth.pem" + state: facts ''' RETURN = ''' diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_tcp_proxy.py b/lib/ansible/modules/cloud/google/gcp_compute_target_tcp_proxy.py index 1a4679f713ea25..02562eacb69aac 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_tcp_proxy.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_tcp_proxy.py @@ -87,54 +87,54 @@ EXAMPLES = ''' - name: create a instance group gcp_compute_instance_group: - name: "instancegroup-targettcpproxy" - zone: us-central1-a - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: instancegroup-targettcpproxy + zone: us-central1-a + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: instancegroup - name: create a health check gcp_compute_health_check: - name: "healthcheck-targettcpproxy" - type: TCP - tcp_health_check: - port_name: service-health - request: ping - response: pong - healthy_threshold: 10 - timeout_sec: 2 - unhealthy_threshold: 5 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: healthcheck-targettcpproxy + type: TCP + tcp_health_check: + port_name: service-health + request: ping + response: pong + healthy_threshold: 10 + timeout_sec: 2 + unhealthy_threshold: 5 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: healthcheck - name: create a backend service gcp_compute_backend_service: - name: "backendservice-targettcpproxy" - backends: - - group: "{{ instancegroup }}" - health_checks: - - "{{ healthcheck.selfLink }}" - protocol: TCP - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: backendservice-targettcpproxy + backends: + - group: "{{ instancegroup }}" + health_checks: + - "{{ healthcheck.selfLink }}" + protocol: TCP + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: backendservice - name: create a target tcp proxy gcp_compute_target_tcp_proxy: - name: "test_object" - proxy_header: PROXY_V1 - service: "{{ backendservice }}" - project: "test_project" - auth_kind: "serviceaccount" - service_account_file: "/tmp/auth.pem" - state: present + name: test_object + proxy_header: PROXY_V1 + service: "{{ backendservice }}" + project: test_project + auth_kind: serviceaccount + service_account_file: "/tmp/auth.pem" + state: present ''' RETURN = ''' diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_tcp_proxy_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_target_tcp_proxy_facts.py index 82c16cc1ab6457..f563a0b8bf4c8a 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_tcp_proxy_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_tcp_proxy_facts.py @@ -49,13 +49,14 @@ ''' EXAMPLES = ''' -- name: a target tcp proxy facts +- name: " a target tcp proxy facts" gcp_compute_target_tcp_proxy_facts: - filters: - - name = test_object - project: test_project - auth_kind: serviceaccount - service_account_file: "/tmp/auth.pem" + filters: + - name = test_object + project: test_project + auth_kind: serviceaccount + service_account_file: "/tmp/auth.pem" + state: facts ''' RETURN = ''' diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_vpn_gateway.py b/lib/ansible/modules/cloud/google/gcp_compute_target_vpn_gateway.py index 2ab6321c15b5d2..9bf4d8c2149e08 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_vpn_gateway.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_vpn_gateway.py @@ -81,32 +81,32 @@ EXAMPLES = ''' - name: create a address gcp_compute_address: - name: "address-vpngateway" - region: us-west1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: address-vpngateway + region: us-west1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: address - name: create a network gcp_compute_network: - name: "network-vpngateway" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: network-vpngateway + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: network - name: create a target vpn gateway gcp_compute_target_vpn_gateway: - name: "test_object" - region: us-west1 - network: "{{ network }}" - project: "test_project" - auth_kind: "serviceaccount" - service_account_file: "/tmp/auth.pem" - state: present + name: test_object + region: us-west1 + network: "{{ network }}" + project: test_project + auth_kind: serviceaccount + service_account_file: "/tmp/auth.pem" + state: present ''' RETURN = ''' diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_vpn_gateway_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_target_vpn_gateway_facts.py index cdb5992650154c..09c6913ee6bec0 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_vpn_gateway_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_vpn_gateway_facts.py @@ -53,14 +53,15 @@ ''' EXAMPLES = ''' -- name: a target vpn gateway facts +- name: " a target vpn gateway facts" gcp_compute_target_vpn_gateway_facts: - region: us-west1 - filters: - - name = test_object - project: test_project - auth_kind: serviceaccount - service_account_file: "/tmp/auth.pem" + region: us-west1 + filters: + - name = test_object + project: test_project + auth_kind: serviceaccount + service_account_file: "/tmp/auth.pem" + state: facts ''' RETURN = ''' diff --git a/lib/ansible/modules/cloud/google/gcp_compute_url_map.py b/lib/ansible/modules/cloud/google/gcp_compute_url_map.py index 4410306ffaca33..5d0c6bd1935d91 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_url_map.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_url_map.py @@ -170,49 +170,49 @@ EXAMPLES = ''' - name: create a instance group gcp_compute_instance_group: - name: "instancegroup-urlmap" - zone: us-central1-a - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: instancegroup-urlmap + zone: us-central1-a + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: instancegroup - name: create a http health check gcp_compute_http_health_check: - name: "httphealthcheck-urlmap" - healthy_threshold: 10 - port: 8080 - timeout_sec: 2 - unhealthy_threshold: 5 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: httphealthcheck-urlmap + healthy_threshold: 10 + port: 8080 + timeout_sec: 2 + unhealthy_threshold: 5 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: healthcheck - name: create a backend service gcp_compute_backend_service: - name: "backendservice-urlmap" - 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 + name: backendservice-urlmap + 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 register: backendservice - name: create a url map gcp_compute_url_map: - name: "test_object" - default_service: "{{ backendservice }}" - project: "test_project" - auth_kind: "serviceaccount" - service_account_file: "/tmp/auth.pem" - state: present + name: test_object + default_service: "{{ backendservice }}" + project: test_project + auth_kind: serviceaccount + service_account_file: "/tmp/auth.pem" + state: present ''' RETURN = ''' diff --git a/lib/ansible/modules/cloud/google/gcp_compute_url_map_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_url_map_facts.py index 11116766b7c4de..2fd5175a96fd52 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_url_map_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_url_map_facts.py @@ -49,13 +49,14 @@ ''' EXAMPLES = ''' -- name: a url map facts +- name: " a url map facts" gcp_compute_url_map_facts: - filters: - - name = test_object - project: test_project - auth_kind: serviceaccount - service_account_file: "/tmp/auth.pem" + filters: + - name = test_object + project: test_project + auth_kind: serviceaccount + service_account_file: "/tmp/auth.pem" + state: facts ''' RETURN = ''' diff --git a/lib/ansible/modules/cloud/google/gcp_compute_vpn_tunnel.py b/lib/ansible/modules/cloud/google/gcp_compute_vpn_tunnel.py index b01e884e967429..18c651928add36 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_vpn_tunnel.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_vpn_tunnel.py @@ -123,54 +123,54 @@ EXAMPLES = ''' - name: create a network gcp_compute_network: - name: "network-vpn-tunnel" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: network-vpn-tunnel + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: network - name: create a router gcp_compute_router: - name: "router-vpn-tunnel" - network: "{{ network }}" - bgp: - asn: 64514 - advertise_mode: CUSTOM - advertised_groups: - - ALL_SUBNETS - advertised_ip_ranges: - - range: 1.2.3.4 - - range: 6.7.0.0/16 - region: us-central1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: router-vpn-tunnel + network: "{{ network }}" + bgp: + asn: 64514 + advertise_mode: CUSTOM + advertised_groups: + - ALL_SUBNETS + advertised_ip_ranges: + - range: 1.2.3.4 + - range: 6.7.0.0/16 + region: us-central1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: router - name: create a target vpn gateway gcp_compute_target_vpn_gateway: - name: "gateway-vpn-tunnel" - region: us-west1 - network: "{{ network }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: gateway-vpn-tunnel + region: us-west1 + network: "{{ network }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: gateway - name: create a vpn tunnel gcp_compute_vpn_tunnel: - name: "test_object" - region: us-west1 - target_vpn_gateway: "{{ gateway }}" - router: "{{ router }}" - shared_secret: super secret - project: "test_project" - auth_kind: "serviceaccount" - service_account_file: "/tmp/auth.pem" - state: present + name: test_object + region: us-west1 + target_vpn_gateway: "{{ gateway }}" + router: "{{ router }}" + shared_secret: super secret + project: test_project + auth_kind: serviceaccount + service_account_file: "/tmp/auth.pem" + state: present ''' RETURN = ''' diff --git a/lib/ansible/modules/cloud/google/gcp_compute_vpn_tunnel_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_vpn_tunnel_facts.py index 5ef29369bdf969..da4b071b17509c 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_vpn_tunnel_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_vpn_tunnel_facts.py @@ -53,14 +53,15 @@ ''' EXAMPLES = ''' -- name: a vpn tunnel facts +- name: " a vpn tunnel facts" gcp_compute_vpn_tunnel_facts: - region: us-west1 - filters: - - name = test_object - project: test_project - auth_kind: serviceaccount - service_account_file: "/tmp/auth.pem" + region: us-west1 + filters: + - name = test_object + project: test_project + auth_kind: serviceaccount + service_account_file: "/tmp/auth.pem" + state: facts ''' RETURN = ''' diff --git a/lib/ansible/modules/cloud/google/gcp_container_cluster.py b/lib/ansible/modules/cloud/google/gcp_container_cluster.py index 36e12dbbd45c72..ea3429b90fcb9c 100644 --- a/lib/ansible/modules/cloud/google/gcp_container_cluster.py +++ b/lib/ansible/modules/cloud/google/gcp_container_cluster.py @@ -265,19 +265,19 @@ EXAMPLES = ''' - name: create a cluster gcp_container_cluster: - name: my-cluster - initial_node_count: 2 - master_auth: - username: cluster_admin - password: my-secret-password - node_config: - machine_type: n1-standard-4 - disk_size_gb: 500 - location: us-central1-a - project: "test_project" - auth_kind: "serviceaccount" - service_account_file: "/tmp/auth.pem" - state: present + name: my-cluster + initial_node_count: 2 + master_auth: + username: cluster_admin + password: my-secret-password + node_config: + machine_type: n1-standard-4 + disk_size_gb: 500 + location: us-central1-a + project: test_project + auth_kind: serviceaccount + service_account_file: "/tmp/auth.pem" + state: present ''' RETURN = ''' diff --git a/lib/ansible/modules/cloud/google/gcp_container_cluster_facts.py b/lib/ansible/modules/cloud/google/gcp_container_cluster_facts.py index 67fe06fbff85a4..119fa71e0b81e4 100644 --- a/lib/ansible/modules/cloud/google/gcp_container_cluster_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_container_cluster_facts.py @@ -52,12 +52,13 @@ ''' EXAMPLES = ''' -- name: a cluster facts +- name: " a cluster facts" gcp_container_cluster_facts: - location: us-central1-a - project: test_project - auth_kind: serviceaccount - service_account_file: "/tmp/auth.pem" + location: us-central1-a + project: test_project + auth_kind: serviceaccount + service_account_file: "/tmp/auth.pem" + state: facts ''' RETURN = ''' diff --git a/lib/ansible/modules/cloud/google/gcp_container_node_pool.py b/lib/ansible/modules/cloud/google/gcp_container_node_pool.py index a635a4bf0d123b..32b1c04e24c9d2 100644 --- a/lib/ansible/modules/cloud/google/gcp_container_node_pool.py +++ b/lib/ansible/modules/cloud/google/gcp_container_node_pool.py @@ -221,25 +221,25 @@ EXAMPLES = ''' - name: create a cluster gcp_container_cluster: - name: "cluster-nodepool" - initial_node_count: 4 - location: us-central1-a - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: cluster-nodepool + initial_node_count: 4 + location: us-central1-a + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: cluster - name: create a node pool gcp_container_node_pool: - name: my-pool - initial_node_count: 4 - cluster: "{{ cluster }}" - location: us-central1-a - project: "test_project" - auth_kind: "serviceaccount" - service_account_file: "/tmp/auth.pem" - state: present + name: my-pool + initial_node_count: 4 + cluster: "{{ cluster }}" + location: us-central1-a + project: test_project + auth_kind: serviceaccount + service_account_file: "/tmp/auth.pem" + state: present ''' RETURN = ''' diff --git a/lib/ansible/modules/cloud/google/gcp_container_node_pool_facts.py b/lib/ansible/modules/cloud/google/gcp_container_node_pool_facts.py index 33d4593a09ff97..a95501ed8dabd3 100644 --- a/lib/ansible/modules/cloud/google/gcp_container_node_pool_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_container_node_pool_facts.py @@ -60,13 +60,14 @@ ''' EXAMPLES = ''' -- name: a node pool facts +- name: " a node pool facts" gcp_container_node_pool_facts: - cluster: "{{ cluster }}" - location: us-central1-a - project: test_project - auth_kind: serviceaccount - service_account_file: "/tmp/auth.pem" + cluster: "{{ cluster }}" + location: us-central1-a + project: test_project + auth_kind: serviceaccount + service_account_file: "/tmp/auth.pem" + state: facts ''' RETURN = ''' diff --git a/lib/ansible/modules/cloud/google/gcp_dns_managed_zone.py b/lib/ansible/modules/cloud/google/gcp_dns_managed_zone.py index 1030f95bab2d41..4e0c58117ea430 100644 --- a/lib/ansible/modules/cloud/google/gcp_dns_managed_zone.py +++ b/lib/ansible/modules/cloud/google/gcp_dns_managed_zone.py @@ -82,13 +82,13 @@ EXAMPLES = ''' - name: create a managed zone gcp_dns_managed_zone: - name: "test_object" - dns_name: test.somewild2.example.com. - description: test zone - project: "test_project" - auth_kind: "serviceaccount" - service_account_file: "/tmp/auth.pem" - state: present + name: test_object + dns_name: test.somewild2.example.com. + description: test zone + project: test_project + auth_kind: serviceaccount + service_account_file: "/tmp/auth.pem" + state: present ''' RETURN = ''' diff --git a/lib/ansible/modules/cloud/google/gcp_dns_managed_zone_facts.py b/lib/ansible/modules/cloud/google/gcp_dns_managed_zone_facts.py index 8a7b6750893c18..9a5f73a4b4d446 100644 --- a/lib/ansible/modules/cloud/google/gcp_dns_managed_zone_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_dns_managed_zone_facts.py @@ -47,12 +47,13 @@ ''' EXAMPLES = ''' -- name: a managed zone facts +- name: " a managed zone facts" gcp_dns_managed_zone_facts: - dns_name: test.somewild2.example.com. - project: test_project - auth_kind: serviceaccount - service_account_file: "/tmp/auth.pem" + dns_name: test.somewild2.example.com. + project: test_project + auth_kind: serviceaccount + service_account_file: "/tmp/auth.pem" + state: facts ''' RETURN = ''' diff --git a/lib/ansible/modules/cloud/google/gcp_dns_resource_record_set.py b/lib/ansible/modules/cloud/google/gcp_dns_resource_record_set.py index d729fdf7d569c4..d9a97252e4b1a7 100644 --- a/lib/ansible/modules/cloud/google/gcp_dns_resource_record_set.py +++ b/lib/ansible/modules/cloud/google/gcp_dns_resource_record_set.py @@ -95,28 +95,28 @@ EXAMPLES = ''' - name: create a managed zone gcp_dns_managed_zone: - name: "managedzone-rrs" - dns_name: testzone-4.com. - description: test zone - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: managedzone-rrs + dns_name: testzone-4.com. + description: test zone + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: managed_zone - name: create a resource record set gcp_dns_resource_record_set: - name: www.testzone-4.com. - managed_zone: "{{ managed_zone }}" - type: A - ttl: 600 - target: - - 10.1.2.3 - - 40.5.6.7 - project: "test_project" - auth_kind: "serviceaccount" - service_account_file: "/tmp/auth.pem" - state: present + name: www.testzone-4.com. + managed_zone: "{{ managed_zone }}" + type: A + ttl: 600 + target: + - 10.1.2.3 + - 40.5.6.7 + project: test_project + auth_kind: serviceaccount + service_account_file: "/tmp/auth.pem" + state: present ''' RETURN = ''' diff --git a/lib/ansible/modules/cloud/google/gcp_dns_resource_record_set_facts.py b/lib/ansible/modules/cloud/google/gcp_dns_resource_record_set_facts.py index c84edfec1e0ce7..402cc4db53ce1b 100644 --- a/lib/ansible/modules/cloud/google/gcp_dns_resource_record_set_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_dns_resource_record_set_facts.py @@ -52,12 +52,13 @@ ''' EXAMPLES = ''' -- name: a resource record set facts +- name: " a resource record set facts" gcp_dns_resource_record_set_facts: - managed_zone: "{{ managed_zone }}" - project: test_project - auth_kind: serviceaccount - service_account_file: "/tmp/auth.pem" + managed_zone: "{{ managed_zone }}" + project: test_project + auth_kind: serviceaccount + service_account_file: "/tmp/auth.pem" + state: facts ''' RETURN = ''' diff --git a/lib/ansible/modules/cloud/google/gcp_iam_role.py b/lib/ansible/modules/cloud/google/gcp_iam_role.py index 532dadf504636a..a9e8a859eae2ae 100644 --- a/lib/ansible/modules/cloud/google/gcp_iam_role.py +++ b/lib/ansible/modules/cloud/google/gcp_iam_role.py @@ -81,17 +81,17 @@ EXAMPLES = ''' - name: create a role gcp_iam_role: - name: myCustomRole2 - title: My Custom Role - description: My custom role description - included_permissions: - - iam.roles.list - - iam.roles.create - - iam.roles.delete - project: "test_project" - auth_kind: "serviceaccount" - service_account_file: "/tmp/auth.pem" - state: present + name: myCustomRole2 + title: My Custom Role + description: My custom role description + included_permissions: + - iam.roles.list + - iam.roles.create + - iam.roles.delete + project: test_project + auth_kind: serviceaccount + service_account_file: "/tmp/auth.pem" + state: present ''' RETURN = ''' diff --git a/lib/ansible/modules/cloud/google/gcp_iam_role_facts.py b/lib/ansible/modules/cloud/google/gcp_iam_role_facts.py index 08da2733c390ec..9e24ebd65d80f0 100644 --- a/lib/ansible/modules/cloud/google/gcp_iam_role_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_iam_role_facts.py @@ -44,11 +44,12 @@ ''' EXAMPLES = ''' -- name: a role facts +- name: " a role facts" gcp_iam_role_facts: - project: test_project - auth_kind: serviceaccount - service_account_file: "/tmp/auth.pem" + project: test_project + auth_kind: serviceaccount + service_account_file: "/tmp/auth.pem" + state: facts ''' RETURN = ''' diff --git a/lib/ansible/modules/cloud/google/gcp_iam_service_account.py b/lib/ansible/modules/cloud/google/gcp_iam_service_account.py index e7b6ddcaf574bc..041171994b8aa3 100644 --- a/lib/ansible/modules/cloud/google/gcp_iam_service_account.py +++ b/lib/ansible/modules/cloud/google/gcp_iam_service_account.py @@ -61,14 +61,12 @@ EXAMPLES = ''' - name: create a service account gcp_iam_service_account: - name: '"{{resource_name}}@{{gcp_project}}.google.com.iam.gserviceaccount.com" - - ' - display_name: My Ansible test key - project: "test_project" - auth_kind: "serviceaccount" - service_account_file: "/tmp/auth.pem" - state: present + name: '"{{resource_name}}@{{gcp_project}}.google.com.iam.gserviceaccount.com"' + display_name: My Ansible test key + project: test_project + auth_kind: serviceaccount + service_account_file: "/tmp/auth.pem" + state: present ''' RETURN = ''' diff --git a/lib/ansible/modules/cloud/google/gcp_iam_service_account_facts.py b/lib/ansible/modules/cloud/google/gcp_iam_service_account_facts.py index 062fc5799452ab..151423a24d6925 100644 --- a/lib/ansible/modules/cloud/google/gcp_iam_service_account_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_iam_service_account_facts.py @@ -44,11 +44,12 @@ ''' EXAMPLES = ''' -- name: a service account facts +- name: " a service account facts" gcp_iam_service_account_facts: - project: test_project - auth_kind: serviceaccount - service_account_file: "/tmp/auth.pem" + project: test_project + auth_kind: serviceaccount + service_account_file: "/tmp/auth.pem" + state: facts ''' RETURN = ''' diff --git a/lib/ansible/modules/cloud/google/gcp_iam_service_account_key.py b/lib/ansible/modules/cloud/google/gcp_iam_service_account_key.py index daaa3d6a5f3df6..50d8ee02ebcb1e 100644 --- a/lib/ansible/modules/cloud/google/gcp_iam_service_account_key.py +++ b/lib/ansible/modules/cloud/google/gcp_iam_service_account_key.py @@ -83,23 +83,23 @@ EXAMPLES = ''' - name: create a service account gcp_iam_service_account: - name: test-ansible@graphite-playground.google.com.iam.gserviceaccount.com - display_name: My Ansible test key - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: test-ansible@graphite-playground.google.com.iam.gserviceaccount.com + display_name: My Ansible test key + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: serviceaccount - name: create a service account key gcp_iam_service_account_key: - service_account: "{{ serviceaccount }}" - private_key_type: TYPE_GOOGLE_CREDENTIALS_FILE - path: "~/test_account.json" - project: "test_project" - auth_kind: "serviceaccount" - service_account_file: "/tmp/auth.pem" - state: present + service_account: "{{ serviceaccount }}" + private_key_type: TYPE_GOOGLE_CREDENTIALS_FILE + path: "~/test_account.json" + project: test_project + auth_kind: serviceaccount + service_account_file: "/tmp/auth.pem" + state: present ''' RETURN = ''' diff --git a/lib/ansible/modules/cloud/google/gcp_pubsub_subscription.py b/lib/ansible/modules/cloud/google/gcp_pubsub_subscription.py index 7d0ee1a6036710..fd93b87748bef0 100644 --- a/lib/ansible/modules/cloud/google/gcp_pubsub_subscription.py +++ b/lib/ansible/modules/cloud/google/gcp_pubsub_subscription.py @@ -122,22 +122,22 @@ EXAMPLES = ''' - name: create a topic gcp_pubsub_topic: - name: "topic-subscription" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: topic-subscription + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: topic - name: create a subscription gcp_pubsub_subscription: - name: "test_object" - topic: "{{ topic }}" - ack_deadline_seconds: 300 - project: "test_project" - auth_kind: "serviceaccount" - service_account_file: "/tmp/auth.pem" - state: present + name: test_object + topic: "{{ topic }}" + ack_deadline_seconds: 300 + project: test_project + auth_kind: serviceaccount + service_account_file: "/tmp/auth.pem" + state: present ''' RETURN = ''' diff --git a/lib/ansible/modules/cloud/google/gcp_pubsub_subscription_facts.py b/lib/ansible/modules/cloud/google/gcp_pubsub_subscription_facts.py index 5917598276bee0..c9850fe0c58fab 100644 --- a/lib/ansible/modules/cloud/google/gcp_pubsub_subscription_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_pubsub_subscription_facts.py @@ -44,11 +44,12 @@ ''' EXAMPLES = ''' -- name: a subscription facts +- name: " a subscription facts" gcp_pubsub_subscription_facts: - project: test_project - auth_kind: serviceaccount - service_account_file: "/tmp/auth.pem" + project: test_project + auth_kind: serviceaccount + service_account_file: "/tmp/auth.pem" + state: facts ''' RETURN = ''' diff --git a/lib/ansible/modules/cloud/google/gcp_pubsub_topic.py b/lib/ansible/modules/cloud/google/gcp_pubsub_topic.py index 3c6f4b0eafea54..5982ed0a79c070 100644 --- a/lib/ansible/modules/cloud/google/gcp_pubsub_topic.py +++ b/lib/ansible/modules/cloud/google/gcp_pubsub_topic.py @@ -65,11 +65,11 @@ EXAMPLES = ''' - name: create a topic gcp_pubsub_topic: - name: test-topic1 - project: "test_project" - auth_kind: "serviceaccount" - service_account_file: "/tmp/auth.pem" - state: present + name: test-topic1 + project: test_project + auth_kind: serviceaccount + service_account_file: "/tmp/auth.pem" + state: present ''' RETURN = ''' diff --git a/lib/ansible/modules/cloud/google/gcp_pubsub_topic_facts.py b/lib/ansible/modules/cloud/google/gcp_pubsub_topic_facts.py index 0cbc7469d1c5b0..466d8a662e4228 100644 --- a/lib/ansible/modules/cloud/google/gcp_pubsub_topic_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_pubsub_topic_facts.py @@ -44,11 +44,12 @@ ''' EXAMPLES = ''' -- name: a topic facts +- name: " a topic facts" gcp_pubsub_topic_facts: - project: test_project - auth_kind: serviceaccount - service_account_file: "/tmp/auth.pem" + project: test_project + auth_kind: serviceaccount + service_account_file: "/tmp/auth.pem" + state: facts ''' RETURN = ''' diff --git a/lib/ansible/modules/cloud/google/gcp_redis_instance.py b/lib/ansible/modules/cloud/google/gcp_redis_instance.py index bec3b2a38cd1be..6dfcfdfef19aa8 100644 --- a/lib/ansible/modules/cloud/google/gcp_redis_instance.py +++ b/lib/ansible/modules/cloud/google/gcp_redis_instance.py @@ -123,30 +123,30 @@ EXAMPLES = ''' - name: create a network gcp_compute_network: - name: "network-instance" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: network-instance + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: network - name: create a instance gcp_redis_instance: - name: instance37 - tier: STANDARD_HA - memory_size_gb: 1 - region: us-central1 - location_id: us-central1-a - redis_version: REDIS_3_2 - display_name: Ansible Test Instance - reserved_ip_range: 192.168.0.0/29 - labels: - my_key: my_val - other_key: other_val - project: "test_project" - auth_kind: "serviceaccount" - service_account_file: "/tmp/auth.pem" - state: present + name: instance37 + tier: STANDARD_HA + memory_size_gb: 1 + region: us-central1 + location_id: us-central1-a + redis_version: REDIS_3_2 + display_name: Ansible Test Instance + reserved_ip_range: 192.168.0.0/29 + labels: + my_key: my_val + other_key: other_val + project: test_project + auth_kind: serviceaccount + service_account_file: "/tmp/auth.pem" + state: present ''' RETURN = ''' diff --git a/lib/ansible/modules/cloud/google/gcp_redis_instance_facts.py b/lib/ansible/modules/cloud/google/gcp_redis_instance_facts.py index 6a00cf4a3f601c..bfdf4fe904c89e 100644 --- a/lib/ansible/modules/cloud/google/gcp_redis_instance_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_redis_instance_facts.py @@ -48,12 +48,13 @@ ''' EXAMPLES = ''' -- name: a instance facts +- name: " a instance facts" gcp_redis_instance_facts: - region: us-central1 - project: test_project - auth_kind: serviceaccount - service_account_file: "/tmp/auth.pem" + region: us-central1 + project: test_project + auth_kind: serviceaccount + service_account_file: "/tmp/auth.pem" + state: facts ''' RETURN = ''' diff --git a/lib/ansible/modules/cloud/google/gcp_resourcemanager_project.py b/lib/ansible/modules/cloud/google/gcp_resourcemanager_project.py index 71bcc3517d5c17..5418514d314fc7 100644 --- a/lib/ansible/modules/cloud/google/gcp_resourcemanager_project.py +++ b/lib/ansible/modules/cloud/google/gcp_resourcemanager_project.py @@ -90,14 +90,14 @@ EXAMPLES = ''' - name: create a project gcp_resourcemanager_project: - name: My Sample Project - id: alextest-{{ 10000000000 | random }} - auth_kind: "serviceaccount" - service_account_file: "/tmp/auth.pem" - parent: - type: organization - id: 636173955921 - state: present + name: My Sample Project + id: alextest-{{ 10000000000 | random }} + auth_kind: serviceaccount + service_account_file: "/tmp/auth.pem" + parent: + type: organization + id: 636173955921 + state: present ''' RETURN = ''' diff --git a/lib/ansible/modules/cloud/google/gcp_resourcemanager_project_facts.py b/lib/ansible/modules/cloud/google/gcp_resourcemanager_project_facts.py index b5e787e640647a..8f4be97ea5ad49 100644 --- a/lib/ansible/modules/cloud/google/gcp_resourcemanager_project_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_resourcemanager_project_facts.py @@ -44,11 +44,12 @@ ''' EXAMPLES = ''' -- name: a project facts +- name: " a project facts" gcp_resourcemanager_project_facts: - project: test_project - auth_kind: serviceaccount - service_account_file: "/tmp/auth.pem" + project: test_project + auth_kind: serviceaccount + service_account_file: "/tmp/auth.pem" + state: facts ''' RETURN = ''' diff --git a/lib/ansible/modules/cloud/google/gcp_sourcerepo_repository.py b/lib/ansible/modules/cloud/google/gcp_sourcerepo_repository.py index 43cb36efc1b5d1..d1e1a06be437f0 100644 --- a/lib/ansible/modules/cloud/google/gcp_sourcerepo_repository.py +++ b/lib/ansible/modules/cloud/google/gcp_sourcerepo_repository.py @@ -62,11 +62,11 @@ EXAMPLES = ''' - name: create a repository gcp_sourcerepo_repository: - name: projects/test_project/repos/test_object - project: "test_project" - auth_kind: "serviceaccount" - service_account_file: "/tmp/auth.pem" - state: present + name: projects/test_project/repos/test_object + project: test_project + auth_kind: serviceaccount + service_account_file: "/tmp/auth.pem" + state: present ''' RETURN = ''' diff --git a/lib/ansible/modules/cloud/google/gcp_sourcerepo_repository_facts.py b/lib/ansible/modules/cloud/google/gcp_sourcerepo_repository_facts.py index cdf028f27e2943..e6c3a9a00d07dd 100644 --- a/lib/ansible/modules/cloud/google/gcp_sourcerepo_repository_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_sourcerepo_repository_facts.py @@ -44,11 +44,12 @@ ''' EXAMPLES = ''' -- name: a repository facts +- name: " a repository facts" gcp_sourcerepo_repository_facts: - project: test_project - auth_kind: serviceaccount - service_account_file: "/tmp/auth.pem" + project: test_project + auth_kind: serviceaccount + service_account_file: "/tmp/auth.pem" + state: facts ''' RETURN = ''' diff --git a/lib/ansible/modules/cloud/google/gcp_spanner_database.py b/lib/ansible/modules/cloud/google/gcp_spanner_database.py index c472ddf10fce94..e9d852ed249ade 100644 --- a/lib/ansible/modules/cloud/google/gcp_spanner_database.py +++ b/lib/ansible/modules/cloud/google/gcp_spanner_database.py @@ -76,26 +76,26 @@ EXAMPLES = ''' - name: create a instance gcp_spanner_instance: - name: "instance-database" - display_name: My Spanner Instance - node_count: 2 - labels: - cost_center: ti-1700004 - config: regional-us-central1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: instance-database + display_name: My Spanner Instance + node_count: 2 + labels: + cost_center: ti-1700004 + config: regional-us-central1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: instance - name: create a database gcp_spanner_database: - name: webstore - instance: "{{ instance }}" - project: "test_project" - auth_kind: "serviceaccount" - service_account_file: "/tmp/auth.pem" - state: present + name: webstore + instance: "{{ instance }}" + project: test_project + auth_kind: serviceaccount + service_account_file: "/tmp/auth.pem" + state: present ''' RETURN = ''' diff --git a/lib/ansible/modules/cloud/google/gcp_spanner_database_facts.py b/lib/ansible/modules/cloud/google/gcp_spanner_database_facts.py index 07deedf1805c34..23d4f296bd8fec 100644 --- a/lib/ansible/modules/cloud/google/gcp_spanner_database_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_spanner_database_facts.py @@ -52,12 +52,13 @@ ''' EXAMPLES = ''' -- name: a database facts +- name: " a database facts" gcp_spanner_database_facts: - instance: "{{ instance }}" - project: test_project - auth_kind: serviceaccount - service_account_file: "/tmp/auth.pem" + instance: "{{ instance }}" + project: test_project + auth_kind: serviceaccount + service_account_file: "/tmp/auth.pem" + state: facts ''' RETURN = ''' diff --git a/lib/ansible/modules/cloud/google/gcp_spanner_instance.py b/lib/ansible/modules/cloud/google/gcp_spanner_instance.py index 8a118cc2655a56..ed2cf449f81bf0 100644 --- a/lib/ansible/modules/cloud/google/gcp_spanner_instance.py +++ b/lib/ansible/modules/cloud/google/gcp_spanner_instance.py @@ -85,16 +85,16 @@ EXAMPLES = ''' - name: create a instance gcp_spanner_instance: - name: testinstance - display_name: My Spanner Instance - node_count: 2 - labels: - cost_center: ti-1700004 - config: regional-us-central1 - project: "test_project" - auth_kind: "serviceaccount" - service_account_file: "/tmp/auth.pem" - state: present + name: testinstance + display_name: My Spanner Instance + node_count: 2 + labels: + cost_center: ti-1700004 + config: regional-us-central1 + project: test_project + auth_kind: serviceaccount + service_account_file: "/tmp/auth.pem" + state: present ''' RETURN = ''' diff --git a/lib/ansible/modules/cloud/google/gcp_spanner_instance_facts.py b/lib/ansible/modules/cloud/google/gcp_spanner_instance_facts.py index 918bfae2b1caba..c1c5d40c764e7d 100644 --- a/lib/ansible/modules/cloud/google/gcp_spanner_instance_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_spanner_instance_facts.py @@ -44,11 +44,12 @@ ''' EXAMPLES = ''' -- name: a instance facts +- name: " a instance facts" gcp_spanner_instance_facts: - project: test_project - auth_kind: serviceaccount - service_account_file: "/tmp/auth.pem" + project: test_project + auth_kind: serviceaccount + service_account_file: "/tmp/auth.pem" + state: facts ''' RETURN = ''' diff --git a/lib/ansible/modules/cloud/google/gcp_sql_database.py b/lib/ansible/modules/cloud/google/gcp_sql_database.py index 89ad8fad734c26..94a65adf448bc2 100644 --- a/lib/ansible/modules/cloud/google/gcp_sql_database.py +++ b/lib/ansible/modules/cloud/google/gcp_sql_database.py @@ -74,29 +74,29 @@ EXAMPLES = ''' - name: create a instance gcp_sql_instance: - name: "{{resource_name}}-3" - settings: - ip_configuration: - authorized_networks: - - name: google dns server - value: 8.8.8.8/32 - tier: db-n1-standard-1 - region: us-central1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: "{{resource_name}}-3" + settings: + ip_configuration: + authorized_networks: + - name: google dns server + value: 8.8.8.8/32 + tier: db-n1-standard-1 + region: us-central1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: instance - name: create a database gcp_sql_database: - name: "test_object" - charset: utf8 - instance: "{{ instance }}" - project: "test_project" - auth_kind: "serviceaccount" - service_account_file: "/tmp/auth.pem" - state: present + name: test_object + charset: utf8 + instance: "{{ instance }}" + project: test_project + auth_kind: serviceaccount + service_account_file: "/tmp/auth.pem" + state: present ''' RETURN = ''' diff --git a/lib/ansible/modules/cloud/google/gcp_sql_database_facts.py b/lib/ansible/modules/cloud/google/gcp_sql_database_facts.py index b1b4305880b7fe..df677e04694292 100644 --- a/lib/ansible/modules/cloud/google/gcp_sql_database_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_sql_database_facts.py @@ -52,12 +52,13 @@ ''' EXAMPLES = ''' -- name: a database facts +- name: " a database facts" gcp_sql_database_facts: - instance: "{{ instance }}" - project: test_project - auth_kind: serviceaccount - service_account_file: "/tmp/auth.pem" + instance: "{{ instance }}" + project: test_project + auth_kind: serviceaccount + service_account_file: "/tmp/auth.pem" + state: facts ''' RETURN = ''' diff --git a/lib/ansible/modules/cloud/google/gcp_sql_instance.py b/lib/ansible/modules/cloud/google/gcp_sql_instance.py index 5252317069196c..f1fd075a59183d 100644 --- a/lib/ansible/modules/cloud/google/gcp_sql_instance.py +++ b/lib/ansible/modules/cloud/google/gcp_sql_instance.py @@ -299,18 +299,18 @@ EXAMPLES = ''' - name: create a instance gcp_sql_instance: - name: "{{resource_name}}-2" - settings: - ip_configuration: - authorized_networks: - - name: google dns server - value: 8.8.8.8/32 - tier: db-n1-standard-1 - region: us-central1 - project: "test_project" - auth_kind: "serviceaccount" - service_account_file: "/tmp/auth.pem" - state: present + name: "{{resource_name}}-2" + settings: + ip_configuration: + authorized_networks: + - name: google dns server + value: 8.8.8.8/32 + tier: db-n1-standard-1 + region: us-central1 + project: test_project + auth_kind: serviceaccount + service_account_file: "/tmp/auth.pem" + state: present ''' RETURN = ''' diff --git a/lib/ansible/modules/cloud/google/gcp_sql_instance_facts.py b/lib/ansible/modules/cloud/google/gcp_sql_instance_facts.py index f921083480eba2..9f1b9ce362c627 100644 --- a/lib/ansible/modules/cloud/google/gcp_sql_instance_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_sql_instance_facts.py @@ -44,11 +44,12 @@ ''' EXAMPLES = ''' -- name: a instance facts +- name: " a instance facts" gcp_sql_instance_facts: - project: test_project - auth_kind: serviceaccount - service_account_file: "/tmp/auth.pem" + project: test_project + auth_kind: serviceaccount + service_account_file: "/tmp/auth.pem" + state: facts ''' RETURN = ''' diff --git a/lib/ansible/modules/cloud/google/gcp_sql_user.py b/lib/ansible/modules/cloud/google/gcp_sql_user.py index e1d6d940495a80..9699a4ea8c1e12 100644 --- a/lib/ansible/modules/cloud/google/gcp_sql_user.py +++ b/lib/ansible/modules/cloud/google/gcp_sql_user.py @@ -75,30 +75,30 @@ EXAMPLES = ''' - name: create a instance gcp_sql_instance: - name: "{{resource_name}}-1" - settings: - ip_configuration: - authorized_networks: - - name: google dns server - value: 8.8.8.8/32 - tier: db-n1-standard-1 - region: us-central1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: "{{resource_name}}-1" + settings: + ip_configuration: + authorized_networks: + - name: google dns server + value: 8.8.8.8/32 + tier: db-n1-standard-1 + region: us-central1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: instance - name: create a user gcp_sql_user: - name: test-user - host: 10.1.2.3 - password: secret-password - instance: "{{ instance }}" - project: "test_project" - auth_kind: "serviceaccount" - service_account_file: "/tmp/auth.pem" - state: present + name: test-user + host: 10.1.2.3 + password: secret-password + instance: "{{ instance }}" + project: test_project + auth_kind: serviceaccount + service_account_file: "/tmp/auth.pem" + state: present ''' RETURN = ''' diff --git a/lib/ansible/modules/cloud/google/gcp_sql_user_facts.py b/lib/ansible/modules/cloud/google/gcp_sql_user_facts.py index 22692b6898bb84..9511a872f10396 100644 --- a/lib/ansible/modules/cloud/google/gcp_sql_user_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_sql_user_facts.py @@ -52,12 +52,13 @@ ''' EXAMPLES = ''' -- name: a user facts +- name: " a user facts" gcp_sql_user_facts: - instance: "{{ instance }}" - project: test_project - auth_kind: serviceaccount - service_account_file: "/tmp/auth.pem" + instance: "{{ instance }}" + project: test_project + auth_kind: serviceaccount + service_account_file: "/tmp/auth.pem" + state: facts ''' RETURN = ''' diff --git a/lib/ansible/modules/cloud/google/gcp_storage_bucket.py b/lib/ansible/modules/cloud/google/gcp_storage_bucket.py index 691b216100df9a..0da5659e92edfd 100644 --- a/lib/ansible/modules/cloud/google/gcp_storage_bucket.py +++ b/lib/ansible/modules/cloud/google/gcp_storage_bucket.py @@ -394,11 +394,11 @@ EXAMPLES = ''' - name: create a bucket gcp_storage_bucket: - name: ansible-storage-module - project: "test_project" - auth_kind: "serviceaccount" - service_account_file: "/tmp/auth.pem" - state: present + name: ansible-storage-module + project: test_project + auth_kind: serviceaccount + service_account_file: "/tmp/auth.pem" + state: present ''' RETURN = ''' diff --git a/lib/ansible/modules/cloud/google/gcp_storage_bucket_access_control.py b/lib/ansible/modules/cloud/google/gcp_storage_bucket_access_control.py index 5bfa359bb172d0..8e25f11418a49e 100644 --- a/lib/ansible/modules/cloud/google/gcp_storage_bucket_access_control.py +++ b/lib/ansible/modules/cloud/google/gcp_storage_bucket_access_control.py @@ -108,22 +108,22 @@ EXAMPLES = ''' - name: create a bucket gcp_storage_bucket: - name: "{{ resource_name }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: "{{ resource_name }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: bucket - name: create a bucket access control gcp_storage_bucket_access_control: - bucket: "test_object" - entity: user-alexstephen@google.com - role: WRITER - project: "test_project" - auth_kind: "serviceaccount" - service_account_file: "/tmp/auth.pem" - state: present + bucket: test_object + entity: user-alexstephen@google.com + role: WRITER + project: test_project + auth_kind: serviceaccount + service_account_file: "/tmp/auth.pem" + state: present ''' RETURN = ''' diff --git a/lib/ansible/modules/cloud/google/gcp_storage_object.py b/lib/ansible/modules/cloud/google/gcp_storage_object.py index f589a36b8d05b9..756b2016fa9a1f 100644 --- a/lib/ansible/modules/cloud/google/gcp_storage_object.py +++ b/lib/ansible/modules/cloud/google/gcp_storage_object.py @@ -78,15 +78,15 @@ EXAMPLES = ''' - name: create a object gcp_storage_object: - name: ansible-storage-module - action: download - bucket: ansible-bucket - src: modules.zip - dest: "~/modules.zip" - project: "test_project" - auth_kind: "serviceaccount" - service_account_file: "/tmp/auth.pem" - state: present + name: ansible-storage-module + action: download + bucket: ansible-bucket + src: modules.zip + dest: "~/modules.zip" + project: test_project + auth_kind: serviceaccount + service_account_file: "/tmp/auth.pem" + state: present ''' RETURN = ''' diff --git a/test/integration/targets/gcp_bigquery_dataset/tasks/main.yml b/test/integration/targets/gcp_bigquery_dataset/tasks/main.yml index db480b71f6ef32..98421640d30619 100644 --- a/test/integration/targets/gcp_bigquery_dataset/tasks/main.yml +++ b/test/integration/targets/gcp_bigquery_dataset/tasks/main.yml @@ -15,23 +15,23 @@ # Pre-test setup - name: delete a dataset gcp_bigquery_dataset: - name: my_example_dataset - dataset_reference: - dataset_id: my_example_dataset - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + name: my_example_dataset + dataset_reference: + dataset_id: my_example_dataset + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent #---------------------------------------------------------- - name: create a dataset gcp_bigquery_dataset: - name: my_example_dataset - dataset_reference: - dataset_id: my_example_dataset - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: my_example_dataset + dataset_reference: + dataset_id: my_example_dataset + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: result - name: assert changed is true assert: @@ -53,13 +53,13 @@ # ---------------------------------------------------------------------------- - name: create a dataset that already exists gcp_bigquery_dataset: - name: my_example_dataset - dataset_reference: - dataset_id: my_example_dataset - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: my_example_dataset + dataset_reference: + dataset_id: my_example_dataset + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: result - name: assert changed is false assert: @@ -69,13 +69,13 @@ #---------------------------------------------------------- - name: delete a dataset gcp_bigquery_dataset: - name: my_example_dataset - dataset_reference: - dataset_id: my_example_dataset - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + name: my_example_dataset + dataset_reference: + dataset_id: my_example_dataset + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent register: result - name: assert changed is true assert: @@ -97,13 +97,13 @@ # ---------------------------------------------------------------------------- - name: delete a dataset that does not exist gcp_bigquery_dataset: - name: my_example_dataset - dataset_reference: - dataset_id: my_example_dataset - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + name: my_example_dataset + dataset_reference: + dataset_id: my_example_dataset + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent register: result - name: assert changed is false assert: diff --git a/test/integration/targets/gcp_bigquery_table/tasks/main.yml b/test/integration/targets/gcp_bigquery_table/tasks/main.yml index c926621b483ac8..3a1fda0ea5a190 100644 --- a/test/integration/targets/gcp_bigquery_table/tasks/main.yml +++ b/test/integration/targets/gcp_bigquery_table/tasks/main.yml @@ -15,39 +15,39 @@ # Pre-test setup - name: create a dataset gcp_bigquery_dataset: - name: example_dataset - dataset_reference: - dataset_id: example_dataset - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: example_dataset + dataset_reference: + dataset_id: example_dataset + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: dataset - name: delete a table gcp_bigquery_table: - name: example_table - dataset: example_dataset - table_reference: - dataset_id: example_dataset - project_id: "{{ gcp_project }}" - table_id: example_table - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + name: example_table + dataset: example_dataset + table_reference: + dataset_id: example_dataset + project_id: "{{ gcp_project }}" + table_id: example_table + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent #---------------------------------------------------------- - name: create a table gcp_bigquery_table: - name: example_table - dataset: example_dataset - table_reference: - dataset_id: example_dataset - project_id: "{{ gcp_project }}" - table_id: example_table - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: example_table + dataset: example_dataset + table_reference: + dataset_id: example_dataset + project_id: "{{ gcp_project }}" + table_id: example_table + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: result - name: assert changed is true assert: @@ -70,16 +70,16 @@ # ---------------------------------------------------------------------------- - name: create a table that already exists gcp_bigquery_table: - name: example_table - dataset: example_dataset - table_reference: - dataset_id: example_dataset - project_id: "{{ gcp_project }}" - table_id: example_table - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: example_table + dataset: example_dataset + table_reference: + dataset_id: example_dataset + project_id: "{{ gcp_project }}" + table_id: example_table + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: result - name: assert changed is false assert: @@ -89,16 +89,16 @@ #---------------------------------------------------------- - name: delete a table gcp_bigquery_table: - name: example_table - dataset: example_dataset - table_reference: - dataset_id: example_dataset - project_id: "{{ gcp_project }}" - table_id: example_table - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + name: example_table + dataset: example_dataset + table_reference: + dataset_id: example_dataset + project_id: "{{ gcp_project }}" + table_id: example_table + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent register: result - name: assert changed is true assert: @@ -121,16 +121,16 @@ # ---------------------------------------------------------------------------- - name: delete a table that does not exist gcp_bigquery_table: - name: example_table - dataset: example_dataset - table_reference: - dataset_id: example_dataset - project_id: "{{ gcp_project }}" - table_id: example_table - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + name: example_table + dataset: example_dataset + table_reference: + dataset_id: example_dataset + project_id: "{{ gcp_project }}" + table_id: example_table + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent register: result - name: assert changed is false assert: @@ -142,12 +142,12 @@ # If errors happen, don't crash the playbook! - name: delete a dataset gcp_bigquery_dataset: - name: example_dataset - dataset_reference: - dataset_id: example_dataset - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + name: example_dataset + dataset_reference: + dataset_id: example_dataset + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent register: dataset ignore_errors: true diff --git a/test/integration/targets/gcp_compute_address/tasks/main.yml b/test/integration/targets/gcp_compute_address/tasks/main.yml index 53eb5f345ef5e2..52b7c2357ef221 100644 --- a/test/integration/targets/gcp_compute_address/tasks/main.yml +++ b/test/integration/targets/gcp_compute_address/tasks/main.yml @@ -15,21 +15,21 @@ # Pre-test setup - name: delete a address gcp_compute_address: - name: test-address1 - region: us-west1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + name: test-address1 + region: us-west1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent #---------------------------------------------------------- - name: create a address gcp_compute_address: - name: test-address1 - region: us-west1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: test-address1 + region: us-west1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: result - name: assert changed is true assert: @@ -54,12 +54,12 @@ # ---------------------------------------------------------------------------- - name: create a address that already exists gcp_compute_address: - name: test-address1 - region: us-west1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: test-address1 + region: us-west1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: result - name: assert changed is false assert: @@ -69,12 +69,12 @@ #---------------------------------------------------------- - name: delete a address gcp_compute_address: - name: test-address1 - region: us-west1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + name: test-address1 + region: us-west1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent register: result - name: assert changed is true assert: @@ -99,12 +99,12 @@ # ---------------------------------------------------------------------------- - name: delete a address that does not exist gcp_compute_address: - name: test-address1 - region: us-west1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + name: test-address1 + region: us-west1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent register: result - name: assert changed is false assert: diff --git a/test/integration/targets/gcp_compute_backend_bucket/tasks/main.yml b/test/integration/targets/gcp_compute_backend_bucket/tasks/main.yml index c7f53425d869d5..1074135754f17b 100644 --- a/test/integration/targets/gcp_compute_backend_bucket/tasks/main.yml +++ b/test/integration/targets/gcp_compute_backend_bucket/tasks/main.yml @@ -15,33 +15,33 @@ # Pre-test setup - name: create a bucket gcp_storage_bucket: - name: "bucket-backendbucket" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: bucket-backendbucket + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: bucket - name: delete a backend bucket gcp_compute_backend_bucket: - name: "{{ resource_name }}" - bucket_name: "{{ bucket.name }}" - description: A BackendBucket to connect LNB w/ Storage Bucket - enable_cdn: true - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + name: "{{ resource_name }}" + bucket_name: "{{ bucket.name }}" + description: A BackendBucket to connect LNB w/ Storage Bucket + enable_cdn: 'true' + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent #---------------------------------------------------------- - name: create a backend bucket gcp_compute_backend_bucket: - name: "{{ resource_name }}" - bucket_name: "{{ bucket.name }}" - description: A BackendBucket to connect LNB w/ Storage Bucket - enable_cdn: true - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: "{{ resource_name }}" + bucket_name: "{{ bucket.name }}" + description: A BackendBucket to connect LNB w/ Storage Bucket + enable_cdn: 'true' + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: result - name: assert changed is true assert: @@ -65,14 +65,14 @@ # ---------------------------------------------------------------------------- - name: create a backend bucket that already exists gcp_compute_backend_bucket: - name: "{{ resource_name }}" - bucket_name: "{{ bucket.name }}" - description: A BackendBucket to connect LNB w/ Storage Bucket - enable_cdn: true - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: "{{ resource_name }}" + bucket_name: "{{ bucket.name }}" + description: A BackendBucket to connect LNB w/ Storage Bucket + enable_cdn: 'true' + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: result - name: assert changed is false assert: @@ -82,14 +82,14 @@ #---------------------------------------------------------- - name: delete a backend bucket gcp_compute_backend_bucket: - name: "{{ resource_name }}" - bucket_name: "{{ bucket.name }}" - description: A BackendBucket to connect LNB w/ Storage Bucket - enable_cdn: true - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + name: "{{ resource_name }}" + bucket_name: "{{ bucket.name }}" + description: A BackendBucket to connect LNB w/ Storage Bucket + enable_cdn: 'true' + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent register: result - name: assert changed is true assert: @@ -113,14 +113,14 @@ # ---------------------------------------------------------------------------- - name: delete a backend bucket that does not exist gcp_compute_backend_bucket: - name: "{{ resource_name }}" - bucket_name: "{{ bucket.name }}" - description: A BackendBucket to connect LNB w/ Storage Bucket - enable_cdn: true - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + name: "{{ resource_name }}" + bucket_name: "{{ bucket.name }}" + description: A BackendBucket to connect LNB w/ Storage Bucket + enable_cdn: 'true' + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent register: result - name: assert changed is false assert: @@ -132,10 +132,10 @@ # If errors happen, don't crash the playbook! - name: delete a bucket gcp_storage_bucket: - name: "bucket-backendbucket" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + name: bucket-backendbucket + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent register: bucket ignore_errors: true diff --git a/test/integration/targets/gcp_compute_backend_service/tasks/main.yml b/test/integration/targets/gcp_compute_backend_service/tasks/main.yml index 3c73e067336303..3bdf590fdd796e 100644 --- a/test/integration/targets/gcp_compute_backend_service/tasks/main.yml +++ b/test/integration/targets/gcp_compute_backend_service/tasks/main.yml @@ -15,50 +15,50 @@ # Pre-test setup - name: create a instance group gcp_compute_instance_group: - name: "instancegroup-backendservice" - zone: us-central1-a - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: instancegroup-backendservice + zone: us-central1-a + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: instancegroup - name: create a http health check gcp_compute_http_health_check: - name: "httphealthcheck-backendservice" - healthy_threshold: 10 - port: 8080 - timeout_sec: 2 - unhealthy_threshold: 5 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: httphealthcheck-backendservice + healthy_threshold: 10 + port: 8080 + timeout_sec: 2 + unhealthy_threshold: 5 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: healthcheck - name: delete a backend service 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 + 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 #---------------------------------------------------------- - name: create a backend service 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 + 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 register: result - name: assert changed is true assert: @@ -82,16 +82,16 @@ # ---------------------------------------------------------------------------- - 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 + 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 register: result - name: assert changed is false assert: @@ -101,16 +101,16 @@ #---------------------------------------------------------- - name: delete a backend service 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 + 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 register: result - name: assert changed is true assert: @@ -134,16 +134,16 @@ # ---------------------------------------------------------------------------- - 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 + 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 register: result - name: assert changed is false assert: @@ -155,24 +155,24 @@ # If errors happen, don't crash the playbook! - name: delete a http health check gcp_compute_http_health_check: - name: "httphealthcheck-backendservice" - healthy_threshold: 10 - port: 8080 - timeout_sec: 2 - unhealthy_threshold: 5 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + name: httphealthcheck-backendservice + healthy_threshold: 10 + port: 8080 + timeout_sec: 2 + unhealthy_threshold: 5 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent register: healthcheck ignore_errors: true - name: delete a instance group gcp_compute_instance_group: - name: "instancegroup-backendservice" - zone: us-central1-a - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + name: instancegroup-backendservice + zone: us-central1-a + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent register: instancegroup ignore_errors: true diff --git a/test/integration/targets/gcp_compute_disk/tasks/main.yml b/test/integration/targets/gcp_compute_disk/tasks/main.yml index 572d5673720729..fc9e4dd6a076eb 100644 --- a/test/integration/targets/gcp_compute_disk/tasks/main.yml +++ b/test/integration/targets/gcp_compute_disk/tasks/main.yml @@ -15,27 +15,27 @@ # Pre-test setup - name: delete a disk gcp_compute_disk: - name: "{{ resource_name }}" - size_gb: 50 - disk_encryption_key: - raw_key: SGVsbG8gZnJvbSBHb29nbGUgQ2xvdWQgUGxhdGZvcm0= - zone: us-central1-a - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + name: "{{ resource_name }}" + size_gb: 50 + disk_encryption_key: + raw_key: SGVsbG8gZnJvbSBHb29nbGUgQ2xvdWQgUGxhdGZvcm0= + zone: us-central1-a + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent #---------------------------------------------------------- - name: create a disk gcp_compute_disk: - name: "{{ resource_name }}" - size_gb: 50 - disk_encryption_key: - raw_key: SGVsbG8gZnJvbSBHb29nbGUgQ2xvdWQgUGxhdGZvcm0= - zone: us-central1-a - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: "{{ resource_name }}" + size_gb: 50 + disk_encryption_key: + raw_key: SGVsbG8gZnJvbSBHb29nbGUgQ2xvdWQgUGxhdGZvcm0= + zone: us-central1-a + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: result - name: assert changed is true assert: @@ -60,15 +60,15 @@ # ---------------------------------------------------------------------------- - name: create a disk that already exists gcp_compute_disk: - name: "{{ resource_name }}" - size_gb: 50 - disk_encryption_key: - raw_key: SGVsbG8gZnJvbSBHb29nbGUgQ2xvdWQgUGxhdGZvcm0= - zone: us-central1-a - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: "{{ resource_name }}" + size_gb: 50 + disk_encryption_key: + raw_key: SGVsbG8gZnJvbSBHb29nbGUgQ2xvdWQgUGxhdGZvcm0= + zone: us-central1-a + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: result - name: assert changed is false assert: @@ -78,15 +78,15 @@ #---------------------------------------------------------- - name: delete a disk gcp_compute_disk: - name: "{{ resource_name }}" - size_gb: 50 - disk_encryption_key: - raw_key: SGVsbG8gZnJvbSBHb29nbGUgQ2xvdWQgUGxhdGZvcm0= - zone: us-central1-a - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + name: "{{ resource_name }}" + size_gb: 50 + disk_encryption_key: + raw_key: SGVsbG8gZnJvbSBHb29nbGUgQ2xvdWQgUGxhdGZvcm0= + zone: us-central1-a + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent register: result - name: assert changed is true assert: @@ -111,15 +111,15 @@ # ---------------------------------------------------------------------------- - name: delete a disk that does not exist gcp_compute_disk: - name: "{{ resource_name }}" - size_gb: 50 - disk_encryption_key: - raw_key: SGVsbG8gZnJvbSBHb29nbGUgQ2xvdWQgUGxhdGZvcm0= - zone: us-central1-a - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + name: "{{ resource_name }}" + size_gb: 50 + disk_encryption_key: + raw_key: SGVsbG8gZnJvbSBHb29nbGUgQ2xvdWQgUGxhdGZvcm0= + zone: us-central1-a + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent register: result - name: assert changed is false assert: diff --git a/test/integration/targets/gcp_compute_firewall/tasks/main.yml b/test/integration/targets/gcp_compute_firewall/tasks/main.yml index 35ff0e4a1c1d32..e88ffd7c6fd323 100644 --- a/test/integration/targets/gcp_compute_firewall/tasks/main.yml +++ b/test/integration/targets/gcp_compute_firewall/tasks/main.yml @@ -15,37 +15,37 @@ # Pre-test setup - name: delete a firewall gcp_compute_firewall: - name: "{{ resource_name }}" - allowed: - - ip_protocol: tcp - ports: - - '22' - target_tags: - - test-ssh-server - - staging-ssh-server - source_tags: - - test-ssh-clients - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + name: "{{ resource_name }}" + allowed: + - ip_protocol: tcp + ports: + - '22' + target_tags: + - test-ssh-server + - staging-ssh-server + source_tags: + - test-ssh-clients + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent #---------------------------------------------------------- - name: create a firewall gcp_compute_firewall: - name: "{{ resource_name }}" - allowed: - - ip_protocol: tcp - ports: - - '22' - target_tags: - - test-ssh-server - - staging-ssh-server - source_tags: - - test-ssh-clients - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: "{{ resource_name }}" + allowed: + - ip_protocol: tcp + ports: + - '22' + target_tags: + - test-ssh-server + - staging-ssh-server + source_tags: + - test-ssh-clients + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: result - name: assert changed is true assert: @@ -69,20 +69,20 @@ # ---------------------------------------------------------------------------- - name: create a firewall that already exists gcp_compute_firewall: - name: "{{ resource_name }}" - allowed: - - ip_protocol: tcp - ports: - - '22' - target_tags: - - test-ssh-server - - staging-ssh-server - source_tags: - - test-ssh-clients - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: "{{ resource_name }}" + allowed: + - ip_protocol: tcp + ports: + - '22' + target_tags: + - test-ssh-server + - staging-ssh-server + source_tags: + - test-ssh-clients + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: result - name: assert changed is false assert: @@ -92,20 +92,20 @@ #---------------------------------------------------------- - name: delete a firewall gcp_compute_firewall: - name: "{{ resource_name }}" - allowed: - - ip_protocol: tcp - ports: - - '22' - target_tags: - - test-ssh-server - - staging-ssh-server - source_tags: - - test-ssh-clients - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + name: "{{ resource_name }}" + allowed: + - ip_protocol: tcp + ports: + - '22' + target_tags: + - test-ssh-server + - staging-ssh-server + source_tags: + - test-ssh-clients + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent register: result - name: assert changed is true assert: @@ -129,20 +129,20 @@ # ---------------------------------------------------------------------------- - name: delete a firewall that does not exist gcp_compute_firewall: - name: "{{ resource_name }}" - allowed: - - ip_protocol: tcp - ports: - - '22' - target_tags: - - test-ssh-server - - staging-ssh-server - source_tags: - - test-ssh-clients - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + name: "{{ resource_name }}" + allowed: + - ip_protocol: tcp + ports: + - '22' + target_tags: + - test-ssh-server + - staging-ssh-server + source_tags: + - test-ssh-clients + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent register: result - name: assert changed is false assert: diff --git a/test/integration/targets/gcp_compute_forwarding_rule/tasks/main.yml b/test/integration/targets/gcp_compute_forwarding_rule/tasks/main.yml index a8b9bf36f379fe..58f6da401130be 100644 --- a/test/integration/targets/gcp_compute_forwarding_rule/tasks/main.yml +++ b/test/integration/targets/gcp_compute_forwarding_rule/tasks/main.yml @@ -15,47 +15,47 @@ # Pre-test setup - name: create a address gcp_compute_address: - name: "address-forwardingrule" - region: us-west1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: address-forwardingrule + region: us-west1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: address - name: create a target pool gcp_compute_target_pool: - name: "targetpool-forwardingrule" - region: us-west1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: targetpool-forwardingrule + region: us-west1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: targetpool - name: delete a forwarding rule gcp_compute_forwarding_rule: - name: "{{ resource_name }}" - region: us-west1 - target: "{{ targetpool }}" - ip_protocol: TCP - port_range: 80-80 - ip_address: "{{ address.address }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + name: "{{ resource_name }}" + region: us-west1 + target: "{{ targetpool }}" + ip_protocol: TCP + port_range: 80-80 + ip_address: "{{ address.address }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent #---------------------------------------------------------- - name: create a forwarding rule gcp_compute_forwarding_rule: - name: "{{ resource_name }}" - region: us-west1 - target: "{{ targetpool }}" - ip_protocol: TCP - port_range: 80-80 - ip_address: "{{ address.address }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: "{{ resource_name }}" + region: us-west1 + target: "{{ targetpool }}" + ip_protocol: TCP + port_range: 80-80 + ip_address: "{{ address.address }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: result - name: assert changed is true assert: @@ -80,16 +80,16 @@ # ---------------------------------------------------------------------------- - name: create a forwarding rule that already exists gcp_compute_forwarding_rule: - name: "{{ resource_name }}" - region: us-west1 - target: "{{ targetpool }}" - ip_protocol: TCP - port_range: 80-80 - ip_address: "{{ address.address }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: "{{ resource_name }}" + region: us-west1 + target: "{{ targetpool }}" + ip_protocol: TCP + port_range: 80-80 + ip_address: "{{ address.address }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: result - name: assert changed is false assert: @@ -99,16 +99,16 @@ #---------------------------------------------------------- - name: delete a forwarding rule gcp_compute_forwarding_rule: - name: "{{ resource_name }}" - region: us-west1 - target: "{{ targetpool }}" - ip_protocol: TCP - port_range: 80-80 - ip_address: "{{ address.address }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + name: "{{ resource_name }}" + region: us-west1 + target: "{{ targetpool }}" + ip_protocol: TCP + port_range: 80-80 + ip_address: "{{ address.address }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent register: result - name: assert changed is true assert: @@ -133,16 +133,16 @@ # ---------------------------------------------------------------------------- - name: delete a forwarding rule that does not exist gcp_compute_forwarding_rule: - name: "{{ resource_name }}" - region: us-west1 - target: "{{ targetpool }}" - ip_protocol: TCP - port_range: 80-80 - ip_address: "{{ address.address }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + name: "{{ resource_name }}" + region: us-west1 + target: "{{ targetpool }}" + ip_protocol: TCP + port_range: 80-80 + ip_address: "{{ address.address }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent register: result - name: assert changed is false assert: @@ -154,21 +154,21 @@ # If errors happen, don't crash the playbook! - name: delete a target pool gcp_compute_target_pool: - name: "targetpool-forwardingrule" - region: us-west1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + name: targetpool-forwardingrule + region: us-west1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent register: targetpool ignore_errors: true - name: delete a address gcp_compute_address: - name: "address-forwardingrule" - region: us-west1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + name: address-forwardingrule + region: us-west1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent register: address ignore_errors: true diff --git a/test/integration/targets/gcp_compute_global_address/tasks/main.yml b/test/integration/targets/gcp_compute_global_address/tasks/main.yml index 7d35785e33c18d..65940d4e181743 100644 --- a/test/integration/targets/gcp_compute_global_address/tasks/main.yml +++ b/test/integration/targets/gcp_compute_global_address/tasks/main.yml @@ -15,19 +15,19 @@ # Pre-test setup - name: delete a global address gcp_compute_global_address: - name: "{{ resource_name }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + name: "{{ resource_name }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent #---------------------------------------------------------- - name: create a global address gcp_compute_global_address: - name: "{{ resource_name }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: "{{ resource_name }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: result - name: assert changed is true assert: @@ -51,11 +51,11 @@ # ---------------------------------------------------------------------------- - name: create a global address that already exists gcp_compute_global_address: - name: "{{ resource_name }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: "{{ resource_name }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: result - name: assert changed is false assert: @@ -65,11 +65,11 @@ #---------------------------------------------------------- - name: delete a global address gcp_compute_global_address: - name: "{{ resource_name }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + name: "{{ resource_name }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent register: result - name: assert changed is true assert: @@ -93,11 +93,11 @@ # ---------------------------------------------------------------------------- - name: delete a global address that does not exist gcp_compute_global_address: - name: "{{ resource_name }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + name: "{{ resource_name }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent register: result - name: assert changed is false assert: diff --git a/test/integration/targets/gcp_compute_global_forwarding_rule/tasks/main.yml b/test/integration/targets/gcp_compute_global_forwarding_rule/tasks/main.yml index e0a7c7af1ca083..ca636248437d1e 100644 --- a/test/integration/targets/gcp_compute_global_forwarding_rule/tasks/main.yml +++ b/test/integration/targets/gcp_compute_global_forwarding_rule/tasks/main.yml @@ -15,87 +15,87 @@ # Pre-test setup - name: create a global address gcp_compute_global_address: - name: "globaladdress-globalforwardingrule" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: globaladdress-globalforwardingrule + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: globaladdress - name: create a instance group gcp_compute_instance_group: - name: "instancegroup-globalforwardingrule" - zone: us-central1-a - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: instancegroup-globalforwardingrule + zone: us-central1-a + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: instancegroup - name: create a http health check gcp_compute_http_health_check: - name: "httphealthcheck-globalforwardingrule" - healthy_threshold: 10 - port: 8080 - timeout_sec: 2 - unhealthy_threshold: 5 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: httphealthcheck-globalforwardingrule + healthy_threshold: 10 + port: 8080 + timeout_sec: 2 + unhealthy_threshold: 5 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: healthcheck - name: create a backend service gcp_compute_backend_service: - name: "backendservice-globalforwardingrule" - 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 + name: backendservice-globalforwardingrule + 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 register: backendservice - name: create a url map gcp_compute_url_map: - name: "urlmap-globalforwardingrule" - default_service: "{{ backendservice }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: urlmap-globalforwardingrule + default_service: "{{ backendservice }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: urlmap - name: create a target http proxy gcp_compute_target_http_proxy: - name: "targethttpproxy-globalforwardingrule" - url_map: "{{ urlmap }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: targethttpproxy-globalforwardingrule + url_map: "{{ urlmap }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: httpproxy - name: delete a global forwarding rule gcp_compute_global_forwarding_rule: - name: "{{ resource_name }}" - ip_address: "{{ globaladdress.address }}" - ip_protocol: TCP - port_range: 80-80 - target: "{{ httpproxy.selfLink }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + name: "{{ resource_name }}" + ip_address: "{{ globaladdress.address }}" + ip_protocol: TCP + port_range: 80-80 + target: "{{ httpproxy.selfLink }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent #---------------------------------------------------------- - name: create a global forwarding rule gcp_compute_global_forwarding_rule: - name: "{{ resource_name }}" - ip_address: "{{ globaladdress.address }}" - ip_protocol: TCP - port_range: 80-80 - target: "{{ httpproxy.selfLink }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: "{{ resource_name }}" + ip_address: "{{ globaladdress.address }}" + ip_protocol: TCP + port_range: 80-80 + target: "{{ httpproxy.selfLink }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: result - name: assert changed is true assert: @@ -119,15 +119,15 @@ # ---------------------------------------------------------------------------- - name: create a global forwarding rule that already exists gcp_compute_global_forwarding_rule: - name: "{{ resource_name }}" - ip_address: "{{ globaladdress.address }}" - ip_protocol: TCP - port_range: 80-80 - target: "{{ httpproxy.selfLink }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: "{{ resource_name }}" + ip_address: "{{ globaladdress.address }}" + ip_protocol: TCP + port_range: 80-80 + target: "{{ httpproxy.selfLink }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: result - name: assert changed is false assert: @@ -137,15 +137,15 @@ #---------------------------------------------------------- - name: delete a global forwarding rule gcp_compute_global_forwarding_rule: - name: "{{ resource_name }}" - ip_address: "{{ globaladdress.address }}" - ip_protocol: TCP - port_range: 80-80 - target: "{{ httpproxy.selfLink }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + name: "{{ resource_name }}" + ip_address: "{{ globaladdress.address }}" + ip_protocol: TCP + port_range: 80-80 + target: "{{ httpproxy.selfLink }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent register: result - name: assert changed is true assert: @@ -169,15 +169,15 @@ # ---------------------------------------------------------------------------- - name: delete a global forwarding rule that does not exist gcp_compute_global_forwarding_rule: - name: "{{ resource_name }}" - ip_address: "{{ globaladdress.address }}" - ip_protocol: TCP - port_range: 80-80 - target: "{{ httpproxy.selfLink }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + name: "{{ resource_name }}" + ip_address: "{{ globaladdress.address }}" + ip_protocol: TCP + port_range: 80-80 + target: "{{ httpproxy.selfLink }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent register: result - name: assert changed is false assert: @@ -189,67 +189,67 @@ # If errors happen, don't crash the playbook! - name: delete a target http proxy gcp_compute_target_http_proxy: - name: "targethttpproxy-globalforwardingrule" - url_map: "{{ urlmap }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + name: targethttpproxy-globalforwardingrule + url_map: "{{ urlmap }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent register: httpproxy ignore_errors: true - name: delete a url map gcp_compute_url_map: - name: "urlmap-globalforwardingrule" - default_service: "{{ backendservice }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + name: urlmap-globalforwardingrule + default_service: "{{ backendservice }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent register: urlmap ignore_errors: true - name: delete a backend service gcp_compute_backend_service: - name: "backendservice-globalforwardingrule" - 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 + name: backendservice-globalforwardingrule + 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 register: backendservice ignore_errors: true - name: delete a http health check gcp_compute_http_health_check: - name: "httphealthcheck-globalforwardingrule" - healthy_threshold: 10 - port: 8080 - timeout_sec: 2 - unhealthy_threshold: 5 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + name: httphealthcheck-globalforwardingrule + healthy_threshold: 10 + port: 8080 + timeout_sec: 2 + unhealthy_threshold: 5 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent register: healthcheck ignore_errors: true - name: delete a instance group gcp_compute_instance_group: - name: "instancegroup-globalforwardingrule" - zone: us-central1-a - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + name: instancegroup-globalforwardingrule + zone: us-central1-a + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent register: instancegroup ignore_errors: true - name: delete a global address gcp_compute_global_address: - name: "globaladdress-globalforwardingrule" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + name: globaladdress-globalforwardingrule + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent register: globaladdress ignore_errors: true diff --git a/test/integration/targets/gcp_compute_health_check/tasks/main.yml b/test/integration/targets/gcp_compute_health_check/tasks/main.yml index 91c3977e12558d..833a2288ebca66 100644 --- a/test/integration/targets/gcp_compute_health_check/tasks/main.yml +++ b/test/integration/targets/gcp_compute_health_check/tasks/main.yml @@ -15,35 +15,35 @@ # Pre-test setup - name: delete a health check gcp_compute_health_check: - name: "{{ resource_name }}" - type: TCP - tcp_health_check: - port_name: service-health - request: ping - response: pong - healthy_threshold: 10 - timeout_sec: 2 - unhealthy_threshold: 5 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + name: "{{ resource_name }}" + type: TCP + tcp_health_check: + port_name: service-health + request: ping + response: pong + healthy_threshold: 10 + timeout_sec: 2 + unhealthy_threshold: 5 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent #---------------------------------------------------------- - name: create a health check gcp_compute_health_check: - name: "{{ resource_name }}" - type: TCP - tcp_health_check: - port_name: service-health - request: ping - response: pong - healthy_threshold: 10 - timeout_sec: 2 - unhealthy_threshold: 5 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: "{{ resource_name }}" + type: TCP + tcp_health_check: + port_name: service-health + request: ping + response: pong + healthy_threshold: 10 + timeout_sec: 2 + unhealthy_threshold: 5 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: result - name: assert changed is true assert: @@ -67,19 +67,19 @@ # ---------------------------------------------------------------------------- - name: create a health check that already exists gcp_compute_health_check: - name: "{{ resource_name }}" - type: TCP - tcp_health_check: - port_name: service-health - request: ping - response: pong - healthy_threshold: 10 - timeout_sec: 2 - unhealthy_threshold: 5 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: "{{ resource_name }}" + type: TCP + tcp_health_check: + port_name: service-health + request: ping + response: pong + healthy_threshold: 10 + timeout_sec: 2 + unhealthy_threshold: 5 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: result - name: assert changed is false assert: @@ -89,19 +89,19 @@ #---------------------------------------------------------- - name: delete a health check gcp_compute_health_check: - name: "{{ resource_name }}" - type: TCP - tcp_health_check: - port_name: service-health - request: ping - response: pong - healthy_threshold: 10 - timeout_sec: 2 - unhealthy_threshold: 5 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + name: "{{ resource_name }}" + type: TCP + tcp_health_check: + port_name: service-health + request: ping + response: pong + healthy_threshold: 10 + timeout_sec: 2 + unhealthy_threshold: 5 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent register: result - name: assert changed is true assert: @@ -125,19 +125,19 @@ # ---------------------------------------------------------------------------- - name: delete a health check that does not exist gcp_compute_health_check: - name: "{{ resource_name }}" - type: TCP - tcp_health_check: - port_name: service-health - request: ping - response: pong - healthy_threshold: 10 - timeout_sec: 2 - unhealthy_threshold: 5 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + name: "{{ resource_name }}" + type: TCP + tcp_health_check: + port_name: service-health + request: ping + response: pong + healthy_threshold: 10 + timeout_sec: 2 + unhealthy_threshold: 5 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent register: result - name: assert changed is false assert: diff --git a/test/integration/targets/gcp_compute_http_health_check/tasks/main.yml b/test/integration/targets/gcp_compute_http_health_check/tasks/main.yml index 391794ed7f4301..9d424e3ff0cde1 100644 --- a/test/integration/targets/gcp_compute_http_health_check/tasks/main.yml +++ b/test/integration/targets/gcp_compute_http_health_check/tasks/main.yml @@ -15,27 +15,27 @@ # Pre-test setup - name: delete a http health check gcp_compute_http_health_check: - name: "{{ resource_name }}" - healthy_threshold: 10 - port: 8080 - timeout_sec: 2 - unhealthy_threshold: 5 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + name: "{{ resource_name }}" + healthy_threshold: 10 + port: 8080 + timeout_sec: 2 + unhealthy_threshold: 5 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent #---------------------------------------------------------- - name: create a http health check gcp_compute_http_health_check: - name: "{{ resource_name }}" - healthy_threshold: 10 - port: 8080 - timeout_sec: 2 - unhealthy_threshold: 5 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: "{{ resource_name }}" + healthy_threshold: 10 + port: 8080 + timeout_sec: 2 + unhealthy_threshold: 5 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: result - name: assert changed is true assert: @@ -59,15 +59,15 @@ # ---------------------------------------------------------------------------- - name: create a http health check that already exists gcp_compute_http_health_check: - name: "{{ resource_name }}" - healthy_threshold: 10 - port: 8080 - timeout_sec: 2 - unhealthy_threshold: 5 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: "{{ resource_name }}" + healthy_threshold: 10 + port: 8080 + timeout_sec: 2 + unhealthy_threshold: 5 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: result - name: assert changed is false assert: @@ -77,15 +77,15 @@ #---------------------------------------------------------- - name: delete a http health check gcp_compute_http_health_check: - name: "{{ resource_name }}" - healthy_threshold: 10 - port: 8080 - timeout_sec: 2 - unhealthy_threshold: 5 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + name: "{{ resource_name }}" + healthy_threshold: 10 + port: 8080 + timeout_sec: 2 + unhealthy_threshold: 5 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent register: result - name: assert changed is true assert: @@ -109,15 +109,15 @@ # ---------------------------------------------------------------------------- - name: delete a http health check that does not exist gcp_compute_http_health_check: - name: "{{ resource_name }}" - healthy_threshold: 10 - port: 8080 - timeout_sec: 2 - unhealthy_threshold: 5 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + name: "{{ resource_name }}" + healthy_threshold: 10 + port: 8080 + timeout_sec: 2 + unhealthy_threshold: 5 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent register: result - name: assert changed is false assert: diff --git a/test/integration/targets/gcp_compute_https_health_check/tasks/main.yml b/test/integration/targets/gcp_compute_https_health_check/tasks/main.yml index dbe3cf7295856c..ca205e01b2d5e5 100644 --- a/test/integration/targets/gcp_compute_https_health_check/tasks/main.yml +++ b/test/integration/targets/gcp_compute_https_health_check/tasks/main.yml @@ -15,27 +15,27 @@ # Pre-test setup - name: delete a https health check gcp_compute_https_health_check: - name: "{{ resource_name }}" - healthy_threshold: 10 - port: 8080 - timeout_sec: 2 - unhealthy_threshold: 5 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + name: "{{ resource_name }}" + healthy_threshold: 10 + port: 8080 + timeout_sec: 2 + unhealthy_threshold: 5 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent #---------------------------------------------------------- - name: create a https health check gcp_compute_https_health_check: - name: "{{ resource_name }}" - healthy_threshold: 10 - port: 8080 - timeout_sec: 2 - unhealthy_threshold: 5 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: "{{ resource_name }}" + healthy_threshold: 10 + port: 8080 + timeout_sec: 2 + unhealthy_threshold: 5 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: result - name: assert changed is true assert: @@ -59,15 +59,15 @@ # ---------------------------------------------------------------------------- - name: create a https health check that already exists gcp_compute_https_health_check: - name: "{{ resource_name }}" - healthy_threshold: 10 - port: 8080 - timeout_sec: 2 - unhealthy_threshold: 5 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: "{{ resource_name }}" + healthy_threshold: 10 + port: 8080 + timeout_sec: 2 + unhealthy_threshold: 5 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: result - name: assert changed is false assert: @@ -77,15 +77,15 @@ #---------------------------------------------------------- - name: delete a https health check gcp_compute_https_health_check: - name: "{{ resource_name }}" - healthy_threshold: 10 - port: 8080 - timeout_sec: 2 - unhealthy_threshold: 5 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + name: "{{ resource_name }}" + healthy_threshold: 10 + port: 8080 + timeout_sec: 2 + unhealthy_threshold: 5 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent register: result - name: assert changed is true assert: @@ -109,15 +109,15 @@ # ---------------------------------------------------------------------------- - name: delete a https health check that does not exist gcp_compute_https_health_check: - name: "{{ resource_name }}" - healthy_threshold: 10 - port: 8080 - timeout_sec: 2 - unhealthy_threshold: 5 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + name: "{{ resource_name }}" + healthy_threshold: 10 + port: 8080 + timeout_sec: 2 + unhealthy_threshold: 5 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent register: result - name: assert changed is false assert: diff --git a/test/integration/targets/gcp_compute_image/tasks/main.yml b/test/integration/targets/gcp_compute_image/tasks/main.yml index 67dad40c4dd0cc..fae58eac1d2002 100644 --- a/test/integration/targets/gcp_compute_image/tasks/main.yml +++ b/test/integration/targets/gcp_compute_image/tasks/main.yml @@ -15,30 +15,30 @@ # Pre-test setup - name: create a disk gcp_compute_disk: - name: "disk-image" - zone: us-central1-a - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: disk-image + zone: us-central1-a + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: disk - name: delete a image gcp_compute_image: - name: "{{ resource_name }}" - source_disk: "{{ disk }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + name: "{{ resource_name }}" + source_disk: "{{ disk }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent #---------------------------------------------------------- - name: create a image gcp_compute_image: - name: "{{ resource_name }}" - source_disk: "{{ disk }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: "{{ resource_name }}" + source_disk: "{{ disk }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: result - name: assert changed is true assert: @@ -62,12 +62,12 @@ # ---------------------------------------------------------------------------- - name: create a image that already exists gcp_compute_image: - name: "{{ resource_name }}" - source_disk: "{{ disk }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: "{{ resource_name }}" + source_disk: "{{ disk }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: result - name: assert changed is false assert: @@ -77,12 +77,12 @@ #---------------------------------------------------------- - name: delete a image gcp_compute_image: - name: "{{ resource_name }}" - source_disk: "{{ disk }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + name: "{{ resource_name }}" + source_disk: "{{ disk }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent register: result - name: assert changed is true assert: @@ -106,12 +106,12 @@ # ---------------------------------------------------------------------------- - name: delete a image that does not exist gcp_compute_image: - name: "{{ resource_name }}" - source_disk: "{{ disk }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + name: "{{ resource_name }}" + source_disk: "{{ disk }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent register: result - name: assert changed is false assert: @@ -123,11 +123,11 @@ # If errors happen, don't crash the playbook! - name: delete a disk gcp_compute_disk: - name: "disk-image" - zone: us-central1-a - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + name: disk-image + zone: us-central1-a + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent register: disk ignore_errors: true diff --git a/test/integration/targets/gcp_compute_instance/tasks/main.yml b/test/integration/targets/gcp_compute_instance/tasks/main.yml index 5bb5db8b869707..1bb8d670d28367 100644 --- a/test/integration/targets/gcp_compute_instance/tasks/main.yml +++ b/test/integration/targets/gcp_compute_instance/tasks/main.yml @@ -15,77 +15,77 @@ # Pre-test setup - name: create a disk gcp_compute_disk: - name: "disk-instance" - size_gb: 50 - source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-1604-lts - zone: us-central1-a - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: disk-instance + size_gb: 50 + source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-1604-lts + zone: us-central1-a + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: disk - name: create a network gcp_compute_network: - name: "network-instance" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: network-instance + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: network - name: create a address gcp_compute_address: - name: "address-instance" - region: us-central1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: address-instance + region: us-central1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: address - name: delete a instance gcp_compute_instance: - name: "{{ resource_name }}" - machine_type: n1-standard-1 - disks: - - auto_delete: true - boot: true - source: "{{ disk }}" - metadata: - startup-script-url: gs:://graphite-playground/bootstrap.sh - cost-center: '12345' - network_interfaces: - - network: "{{ network }}" - access_configs: - - name: External NAT - nat_ip: "{{ address }}" - type: ONE_TO_ONE_NAT - zone: us-central1-a - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + name: "{{ resource_name }}" + machine_type: n1-standard-1 + disks: + - auto_delete: 'true' + boot: 'true' + source: "{{ disk }}" + metadata: + startup-script-url: gs:://graphite-playground/bootstrap.sh + cost-center: '12345' + network_interfaces: + - network: "{{ network }}" + access_configs: + - name: External NAT + nat_ip: "{{ address }}" + type: ONE_TO_ONE_NAT + zone: us-central1-a + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent #---------------------------------------------------------- - name: create a instance gcp_compute_instance: - name: "{{ resource_name }}" - machine_type: n1-standard-1 - disks: - - auto_delete: true - boot: true - source: "{{ disk }}" - metadata: - startup-script-url: gs:://graphite-playground/bootstrap.sh - cost-center: '12345' - network_interfaces: - - network: "{{ network }}" - access_configs: - - name: External NAT - nat_ip: "{{ address }}" - type: ONE_TO_ONE_NAT - zone: us-central1-a - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: "{{ resource_name }}" + machine_type: n1-standard-1 + disks: + - auto_delete: 'true' + boot: 'true' + source: "{{ disk }}" + metadata: + startup-script-url: gs:://graphite-playground/bootstrap.sh + cost-center: '12345' + network_interfaces: + - network: "{{ network }}" + access_configs: + - name: External NAT + nat_ip: "{{ address }}" + type: ONE_TO_ONE_NAT + zone: us-central1-a + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: result - name: assert changed is true assert: @@ -110,26 +110,26 @@ # ---------------------------------------------------------------------------- - name: create a instance that already exists gcp_compute_instance: - name: "{{ resource_name }}" - machine_type: n1-standard-1 - disks: - - auto_delete: true - boot: true - source: "{{ disk }}" - metadata: - startup-script-url: gs:://graphite-playground/bootstrap.sh - cost-center: '12345' - network_interfaces: - - network: "{{ network }}" - access_configs: - - name: External NAT - nat_ip: "{{ address }}" - type: ONE_TO_ONE_NAT - zone: us-central1-a - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: "{{ resource_name }}" + machine_type: n1-standard-1 + disks: + - auto_delete: 'true' + boot: 'true' + source: "{{ disk }}" + metadata: + startup-script-url: gs:://graphite-playground/bootstrap.sh + cost-center: '12345' + network_interfaces: + - network: "{{ network }}" + access_configs: + - name: External NAT + nat_ip: "{{ address }}" + type: ONE_TO_ONE_NAT + zone: us-central1-a + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: result - name: assert changed is false assert: @@ -139,26 +139,26 @@ #---------------------------------------------------------- - name: delete a instance gcp_compute_instance: - name: "{{ resource_name }}" - machine_type: n1-standard-1 - disks: - - auto_delete: true - boot: true - source: "{{ disk }}" - metadata: - startup-script-url: gs:://graphite-playground/bootstrap.sh - cost-center: '12345' - network_interfaces: - - network: "{{ network }}" - access_configs: - - name: External NAT - nat_ip: "{{ address }}" - type: ONE_TO_ONE_NAT - zone: us-central1-a - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + name: "{{ resource_name }}" + machine_type: n1-standard-1 + disks: + - auto_delete: 'true' + boot: 'true' + source: "{{ disk }}" + metadata: + startup-script-url: gs:://graphite-playground/bootstrap.sh + cost-center: '12345' + network_interfaces: + - network: "{{ network }}" + access_configs: + - name: External NAT + nat_ip: "{{ address }}" + type: ONE_TO_ONE_NAT + zone: us-central1-a + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent register: result - name: assert changed is true assert: @@ -183,26 +183,26 @@ # ---------------------------------------------------------------------------- - name: delete a instance that does not exist gcp_compute_instance: - name: "{{ resource_name }}" - machine_type: n1-standard-1 - disks: - - auto_delete: true - boot: true - source: "{{ disk }}" - metadata: - startup-script-url: gs:://graphite-playground/bootstrap.sh - cost-center: '12345' - network_interfaces: - - network: "{{ network }}" - access_configs: - - name: External NAT - nat_ip: "{{ address }}" - type: ONE_TO_ONE_NAT - zone: us-central1-a - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + name: "{{ resource_name }}" + machine_type: n1-standard-1 + disks: + - auto_delete: 'true' + boot: 'true' + source: "{{ disk }}" + metadata: + startup-script-url: gs:://graphite-playground/bootstrap.sh + cost-center: '12345' + network_interfaces: + - network: "{{ network }}" + access_configs: + - name: External NAT + nat_ip: "{{ address }}" + type: ONE_TO_ONE_NAT + zone: us-central1-a + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent register: result - name: assert changed is false assert: @@ -214,32 +214,32 @@ # If errors happen, don't crash the playbook! - name: delete a address gcp_compute_address: - name: "address-instance" - region: us-central1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + name: address-instance + region: us-central1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent register: address ignore_errors: true - name: delete a network gcp_compute_network: - name: "network-instance" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + name: network-instance + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent register: network ignore_errors: true - name: delete a disk gcp_compute_disk: - name: "disk-instance" - size_gb: 50 - source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-1604-lts - zone: us-central1-a - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + name: disk-instance + size_gb: 50 + source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-1604-lts + zone: us-central1-a + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent register: disk ignore_errors: true diff --git a/test/integration/targets/gcp_compute_instance_group/tasks/main.yml b/test/integration/targets/gcp_compute_instance_group/tasks/main.yml index 1857ec323fb13a..51d404dabf1eb0 100644 --- a/test/integration/targets/gcp_compute_instance_group/tasks/main.yml +++ b/test/integration/targets/gcp_compute_instance_group/tasks/main.yml @@ -15,37 +15,37 @@ # Pre-test setup - name: create a network gcp_compute_network: - name: "network-instancegroup" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: network-instancegroup + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: network - name: delete a instance group gcp_compute_instance_group: - name: "{{ resource_name }}" - named_ports: - - name: ansible - port: 1234 - network: "{{ network }}" - zone: us-central1-a - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + name: "{{ resource_name }}" + named_ports: + - name: ansible + port: 1234 + network: "{{ network }}" + zone: us-central1-a + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent #---------------------------------------------------------- - name: create a instance group gcp_compute_instance_group: - name: "{{ resource_name }}" - named_ports: - - name: ansible - port: 1234 - network: "{{ network }}" - zone: us-central1-a - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: "{{ resource_name }}" + named_ports: + - name: ansible + port: 1234 + network: "{{ network }}" + zone: us-central1-a + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: result - name: assert changed is true assert: @@ -70,16 +70,16 @@ # ---------------------------------------------------------------------------- - name: create a instance group that already exists gcp_compute_instance_group: - name: "{{ resource_name }}" - named_ports: - - name: ansible - port: 1234 - network: "{{ network }}" - zone: us-central1-a - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: "{{ resource_name }}" + named_ports: + - name: ansible + port: 1234 + network: "{{ network }}" + zone: us-central1-a + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: result - name: assert changed is false assert: @@ -89,16 +89,16 @@ #---------------------------------------------------------- - name: delete a instance group gcp_compute_instance_group: - name: "{{ resource_name }}" - named_ports: - - name: ansible - port: 1234 - network: "{{ network }}" - zone: us-central1-a - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + name: "{{ resource_name }}" + named_ports: + - name: ansible + port: 1234 + network: "{{ network }}" + zone: us-central1-a + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent register: result - name: assert changed is true assert: @@ -123,16 +123,16 @@ # ---------------------------------------------------------------------------- - name: delete a instance group that does not exist gcp_compute_instance_group: - name: "{{ resource_name }}" - named_ports: - - name: ansible - port: 1234 - network: "{{ network }}" - zone: us-central1-a - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + name: "{{ resource_name }}" + named_ports: + - name: ansible + port: 1234 + network: "{{ network }}" + zone: us-central1-a + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent register: result - name: assert changed is false assert: @@ -144,10 +144,10 @@ # If errors happen, don't crash the playbook! - name: delete a network gcp_compute_network: - name: "network-instancegroup" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + name: network-instancegroup + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent register: network ignore_errors: true diff --git a/test/integration/targets/gcp_compute_instance_group_manager/tasks/main.yml b/test/integration/targets/gcp_compute_instance_group_manager/tasks/main.yml index 54b3cd887bf369..616344f6214a90 100644 --- a/test/integration/targets/gcp_compute_instance_group_manager/tasks/main.yml +++ b/test/integration/targets/gcp_compute_instance_group_manager/tasks/main.yml @@ -15,65 +15,65 @@ # Pre-test setup - name: create a network gcp_compute_network: - name: "network-instancetemplate" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: network-instancetemplate + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: network - name: create a address gcp_compute_address: - name: "address-instancetemplate" - region: us-west1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: address-instancetemplate + region: us-west1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: address - name: create a instance template gcp_compute_instance_template: - name: "{{ resource_name }}" - properties: - disks: - - auto_delete: true - boot: true - initialize_params: - source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-1604-lts - machine_type: n1-standard-1 - network_interfaces: - - network: "{{ network }}" - access_configs: - - name: test-config - type: ONE_TO_ONE_NAT - nat_ip: "{{ address }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: "{{ resource_name }}" + properties: + disks: + - auto_delete: 'true' + boot: 'true' + initialize_params: + source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-1604-lts + machine_type: n1-standard-1 + network_interfaces: + - network: "{{ network }}" + access_configs: + - name: test-config + type: ONE_TO_ONE_NAT + nat_ip: "{{ address }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: instancetemplate - name: delete a instance group manager gcp_compute_instance_group_manager: - name: "{{ resource_name }}" - base_instance_name: test1-child - instance_template: "{{ instancetemplate }}" - target_size: 3 - zone: us-west1-a - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + name: "{{ resource_name }}" + base_instance_name: test1-child + instance_template: "{{ instancetemplate }}" + target_size: 3 + zone: us-west1-a + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent #---------------------------------------------------------- - name: create a instance group manager gcp_compute_instance_group_manager: - name: "{{ resource_name }}" - base_instance_name: test1-child - instance_template: "{{ instancetemplate }}" - target_size: 3 - zone: us-west1-a - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: "{{ resource_name }}" + base_instance_name: test1-child + instance_template: "{{ instancetemplate }}" + target_size: 3 + zone: us-west1-a + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: result - name: assert changed is true assert: @@ -98,15 +98,15 @@ # ---------------------------------------------------------------------------- - name: create a instance group manager that already exists gcp_compute_instance_group_manager: - name: "{{ resource_name }}" - base_instance_name: test1-child - instance_template: "{{ instancetemplate }}" - target_size: 3 - zone: us-west1-a - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: "{{ resource_name }}" + base_instance_name: test1-child + instance_template: "{{ instancetemplate }}" + target_size: 3 + zone: us-west1-a + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: result - name: assert changed is false assert: @@ -116,15 +116,15 @@ #---------------------------------------------------------- - name: delete a instance group manager gcp_compute_instance_group_manager: - name: "{{ resource_name }}" - base_instance_name: test1-child - instance_template: "{{ instancetemplate }}" - target_size: 3 - zone: us-west1-a - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + name: "{{ resource_name }}" + base_instance_name: test1-child + instance_template: "{{ instancetemplate }}" + target_size: 3 + zone: us-west1-a + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent register: result - name: assert changed is true assert: @@ -149,15 +149,15 @@ # ---------------------------------------------------------------------------- - name: delete a instance group manager that does not exist gcp_compute_instance_group_manager: - name: "{{ resource_name }}" - base_instance_name: test1-child - instance_template: "{{ instancetemplate }}" - target_size: 3 - zone: us-west1-a - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + name: "{{ resource_name }}" + base_instance_name: test1-child + instance_template: "{{ instancetemplate }}" + target_size: 3 + zone: us-west1-a + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent register: result - name: assert changed is false assert: @@ -169,42 +169,42 @@ # If errors happen, don't crash the playbook! - name: delete a instance template gcp_compute_instance_template: - name: "{{ resource_name }}" - properties: - disks: - - auto_delete: true - boot: true - initialize_params: - source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-1604-lts - machine_type: n1-standard-1 - network_interfaces: - - network: "{{ network }}" - access_configs: - - name: test-config - type: ONE_TO_ONE_NAT - nat_ip: "{{ address }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + name: "{{ resource_name }}" + properties: + disks: + - auto_delete: 'true' + boot: 'true' + initialize_params: + source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-1604-lts + machine_type: n1-standard-1 + network_interfaces: + - network: "{{ network }}" + access_configs: + - name: test-config + type: ONE_TO_ONE_NAT + nat_ip: "{{ address }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent register: instancetemplate ignore_errors: true - name: delete a address gcp_compute_address: - name: "address-instancetemplate" - region: us-west1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + name: address-instancetemplate + region: us-west1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent register: address ignore_errors: true - name: delete a network gcp_compute_network: - name: "network-instancetemplate" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + name: network-instancetemplate + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent register: network ignore_errors: true diff --git a/test/integration/targets/gcp_compute_instance_template/tasks/main.yml b/test/integration/targets/gcp_compute_instance_template/tasks/main.yml index 4873fc30d73684..772baab1f8be7e 100644 --- a/test/integration/targets/gcp_compute_instance_template/tasks/main.yml +++ b/test/integration/targets/gcp_compute_instance_template/tasks/main.yml @@ -15,62 +15,62 @@ # Pre-test setup - name: create a network gcp_compute_network: - name: "network-instancetemplate" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: network-instancetemplate + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: network - name: create a address gcp_compute_address: - name: "address-instancetemplate" - region: us-west1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: address-instancetemplate + region: us-west1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: address - name: delete a instance template gcp_compute_instance_template: - name: "{{ resource_name }}" - properties: - disks: - - auto_delete: true - boot: true - initialize_params: - source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-1604-lts - machine_type: n1-standard-1 - network_interfaces: - - network: "{{ network }}" - access_configs: - - name: test-config - type: ONE_TO_ONE_NAT - nat_ip: "{{ address }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + name: "{{ resource_name }}" + properties: + disks: + - auto_delete: 'true' + boot: 'true' + initialize_params: + source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-1604-lts + machine_type: n1-standard-1 + network_interfaces: + - network: "{{ network }}" + access_configs: + - name: test-config + type: ONE_TO_ONE_NAT + nat_ip: "{{ address }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent #---------------------------------------------------------- - name: create a instance template gcp_compute_instance_template: - name: "{{ resource_name }}" - properties: - disks: - - auto_delete: true - boot: true - initialize_params: - source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-1604-lts - machine_type: n1-standard-1 - network_interfaces: - - network: "{{ network }}" - access_configs: - - name: test-config - type: ONE_TO_ONE_NAT - nat_ip: "{{ address }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: "{{ resource_name }}" + properties: + disks: + - auto_delete: 'true' + boot: 'true' + initialize_params: + source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-1604-lts + machine_type: n1-standard-1 + network_interfaces: + - network: "{{ network }}" + access_configs: + - name: test-config + type: ONE_TO_ONE_NAT + nat_ip: "{{ address }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: result - name: assert changed is true assert: @@ -94,24 +94,24 @@ # ---------------------------------------------------------------------------- - name: create a instance template that already exists gcp_compute_instance_template: - name: "{{ resource_name }}" - properties: - disks: - - auto_delete: true - boot: true - initialize_params: - source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-1604-lts - machine_type: n1-standard-1 - network_interfaces: - - network: "{{ network }}" - access_configs: - - name: test-config - type: ONE_TO_ONE_NAT - nat_ip: "{{ address }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: "{{ resource_name }}" + properties: + disks: + - auto_delete: 'true' + boot: 'true' + initialize_params: + source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-1604-lts + machine_type: n1-standard-1 + network_interfaces: + - network: "{{ network }}" + access_configs: + - name: test-config + type: ONE_TO_ONE_NAT + nat_ip: "{{ address }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: result - name: assert changed is false assert: @@ -121,24 +121,24 @@ #---------------------------------------------------------- - name: delete a instance template gcp_compute_instance_template: - name: "{{ resource_name }}" - properties: - disks: - - auto_delete: true - boot: true - initialize_params: - source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-1604-lts - machine_type: n1-standard-1 - network_interfaces: - - network: "{{ network }}" - access_configs: - - name: test-config - type: ONE_TO_ONE_NAT - nat_ip: "{{ address }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + name: "{{ resource_name }}" + properties: + disks: + - auto_delete: 'true' + boot: 'true' + initialize_params: + source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-1604-lts + machine_type: n1-standard-1 + network_interfaces: + - network: "{{ network }}" + access_configs: + - name: test-config + type: ONE_TO_ONE_NAT + nat_ip: "{{ address }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent register: result - name: assert changed is true assert: @@ -162,24 +162,24 @@ # ---------------------------------------------------------------------------- - name: delete a instance template that does not exist gcp_compute_instance_template: - name: "{{ resource_name }}" - properties: - disks: - - auto_delete: true - boot: true - initialize_params: - source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-1604-lts - machine_type: n1-standard-1 - network_interfaces: - - network: "{{ network }}" - access_configs: - - name: test-config - type: ONE_TO_ONE_NAT - nat_ip: "{{ address }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + name: "{{ resource_name }}" + properties: + disks: + - auto_delete: 'true' + boot: 'true' + initialize_params: + source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-1604-lts + machine_type: n1-standard-1 + network_interfaces: + - network: "{{ network }}" + access_configs: + - name: test-config + type: ONE_TO_ONE_NAT + nat_ip: "{{ address }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent register: result - name: assert changed is false assert: @@ -191,20 +191,20 @@ # If errors happen, don't crash the playbook! - name: delete a address gcp_compute_address: - name: "address-instancetemplate" - region: us-west1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + name: address-instancetemplate + region: us-west1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent register: address ignore_errors: true - name: delete a network gcp_compute_network: - name: "network-instancetemplate" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + name: network-instancetemplate + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent register: network ignore_errors: true diff --git a/test/integration/targets/gcp_compute_network/tasks/main.yml b/test/integration/targets/gcp_compute_network/tasks/main.yml index 46ec3727688cf6..aedbf990f35e20 100644 --- a/test/integration/targets/gcp_compute_network/tasks/main.yml +++ b/test/integration/targets/gcp_compute_network/tasks/main.yml @@ -15,21 +15,21 @@ # Pre-test setup - name: delete a network gcp_compute_network: - name: "{{ resource_name }}" - auto_create_subnetworks: true - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + name: "{{ resource_name }}" + auto_create_subnetworks: 'true' + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent #---------------------------------------------------------- - name: create a network gcp_compute_network: - name: "{{ resource_name }}" - auto_create_subnetworks: true - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: "{{ resource_name }}" + auto_create_subnetworks: 'true' + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: result - name: assert changed is true assert: @@ -53,12 +53,12 @@ # ---------------------------------------------------------------------------- - name: create a network that already exists gcp_compute_network: - name: "{{ resource_name }}" - auto_create_subnetworks: true - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: "{{ resource_name }}" + auto_create_subnetworks: 'true' + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: result - name: assert changed is false assert: @@ -68,12 +68,12 @@ #---------------------------------------------------------- - name: delete a network gcp_compute_network: - name: "{{ resource_name }}" - auto_create_subnetworks: true - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + name: "{{ resource_name }}" + auto_create_subnetworks: 'true' + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent register: result - name: assert changed is true assert: @@ -97,12 +97,12 @@ # ---------------------------------------------------------------------------- - name: delete a network that does not exist gcp_compute_network: - name: "{{ resource_name }}" - auto_create_subnetworks: true - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + name: "{{ resource_name }}" + auto_create_subnetworks: 'true' + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent register: result - name: assert changed is false assert: diff --git a/test/integration/targets/gcp_compute_region_disk/tasks/main.yml b/test/integration/targets/gcp_compute_region_disk/tasks/main.yml index c20b77d5215eef..f693bbe8442fda 100644 --- a/test/integration/targets/gcp_compute_region_disk/tasks/main.yml +++ b/test/integration/targets/gcp_compute_region_disk/tasks/main.yml @@ -15,33 +15,33 @@ # Pre-test setup - name: delete a region disk gcp_compute_region_disk: - name: "{{ resource_name }}" - size_gb: 50 - disk_encryption_key: - raw_key: SGVsbG8gZnJvbSBHb29nbGUgQ2xvdWQgUGxhdGZvcm0= - region: us-central1 - replica_zones: - - https://www.googleapis.com/compute/v1/projects/google.com:graphite-playground/zones/us-central1-a - - https://www.googleapis.com/compute/v1/projects/google.com:graphite-playground/zones/us-central1-b - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + name: "{{ resource_name }}" + size_gb: 50 + disk_encryption_key: + raw_key: SGVsbG8gZnJvbSBHb29nbGUgQ2xvdWQgUGxhdGZvcm0= + region: us-central1 + replica_zones: + - https://www.googleapis.com/compute/v1/projects/google.com:graphite-playground/zones/us-central1-a + - https://www.googleapis.com/compute/v1/projects/google.com:graphite-playground/zones/us-central1-b + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent #---------------------------------------------------------- - name: create a region disk gcp_compute_region_disk: - name: "{{ resource_name }}" - size_gb: 50 - disk_encryption_key: - raw_key: SGVsbG8gZnJvbSBHb29nbGUgQ2xvdWQgUGxhdGZvcm0= - region: us-central1 - replica_zones: - - https://www.googleapis.com/compute/v1/projects/google.com:graphite-playground/zones/us-central1-a - - https://www.googleapis.com/compute/v1/projects/google.com:graphite-playground/zones/us-central1-b - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: "{{ resource_name }}" + size_gb: 50 + disk_encryption_key: + raw_key: SGVsbG8gZnJvbSBHb29nbGUgQ2xvdWQgUGxhdGZvcm0= + region: us-central1 + replica_zones: + - https://www.googleapis.com/compute/v1/projects/google.com:graphite-playground/zones/us-central1-a + - https://www.googleapis.com/compute/v1/projects/google.com:graphite-playground/zones/us-central1-b + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: result - name: assert changed is true assert: @@ -66,18 +66,18 @@ # ---------------------------------------------------------------------------- - name: create a region disk that already exists gcp_compute_region_disk: - name: "{{ resource_name }}" - size_gb: 50 - disk_encryption_key: - raw_key: SGVsbG8gZnJvbSBHb29nbGUgQ2xvdWQgUGxhdGZvcm0= - region: us-central1 - replica_zones: - - https://www.googleapis.com/compute/v1/projects/google.com:graphite-playground/zones/us-central1-a - - https://www.googleapis.com/compute/v1/projects/google.com:graphite-playground/zones/us-central1-b - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: "{{ resource_name }}" + size_gb: 50 + disk_encryption_key: + raw_key: SGVsbG8gZnJvbSBHb29nbGUgQ2xvdWQgUGxhdGZvcm0= + region: us-central1 + replica_zones: + - https://www.googleapis.com/compute/v1/projects/google.com:graphite-playground/zones/us-central1-a + - https://www.googleapis.com/compute/v1/projects/google.com:graphite-playground/zones/us-central1-b + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: result - name: assert changed is false assert: @@ -87,18 +87,18 @@ #---------------------------------------------------------- - name: delete a region disk gcp_compute_region_disk: - name: "{{ resource_name }}" - size_gb: 50 - disk_encryption_key: - raw_key: SGVsbG8gZnJvbSBHb29nbGUgQ2xvdWQgUGxhdGZvcm0= - region: us-central1 - replica_zones: - - https://www.googleapis.com/compute/v1/projects/google.com:graphite-playground/zones/us-central1-a - - https://www.googleapis.com/compute/v1/projects/google.com:graphite-playground/zones/us-central1-b - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + name: "{{ resource_name }}" + size_gb: 50 + disk_encryption_key: + raw_key: SGVsbG8gZnJvbSBHb29nbGUgQ2xvdWQgUGxhdGZvcm0= + region: us-central1 + replica_zones: + - https://www.googleapis.com/compute/v1/projects/google.com:graphite-playground/zones/us-central1-a + - https://www.googleapis.com/compute/v1/projects/google.com:graphite-playground/zones/us-central1-b + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent register: result - name: assert changed is true assert: @@ -123,18 +123,18 @@ # ---------------------------------------------------------------------------- - name: delete a region disk that does not exist gcp_compute_region_disk: - name: "{{ resource_name }}" - size_gb: 50 - disk_encryption_key: - raw_key: SGVsbG8gZnJvbSBHb29nbGUgQ2xvdWQgUGxhdGZvcm0= - region: us-central1 - replica_zones: - - https://www.googleapis.com/compute/v1/projects/google.com:graphite-playground/zones/us-central1-a - - https://www.googleapis.com/compute/v1/projects/google.com:graphite-playground/zones/us-central1-b - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + name: "{{ resource_name }}" + size_gb: 50 + disk_encryption_key: + raw_key: SGVsbG8gZnJvbSBHb29nbGUgQ2xvdWQgUGxhdGZvcm0= + region: us-central1 + replica_zones: + - https://www.googleapis.com/compute/v1/projects/google.com:graphite-playground/zones/us-central1-a + - https://www.googleapis.com/compute/v1/projects/google.com:graphite-playground/zones/us-central1-b + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent register: result - name: assert changed is false assert: diff --git a/test/integration/targets/gcp_compute_route/tasks/main.yml b/test/integration/targets/gcp_compute_route/tasks/main.yml index 70cf6e7b173e24..1a657f02578b7f 100644 --- a/test/integration/targets/gcp_compute_route/tasks/main.yml +++ b/test/integration/targets/gcp_compute_route/tasks/main.yml @@ -15,39 +15,39 @@ # Pre-test setup - name: create a network gcp_compute_network: - name: "network-route" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: network-route + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: network - name: delete a route gcp_compute_route: - name: "{{ resource_name }}" - dest_range: 192.168.6.0/24 - next_hop_gateway: global/gateways/default-internet-gateway - network: "{{ network }}" - tags: - - backends - - databases - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + name: "{{ resource_name }}" + dest_range: 192.168.6.0/24 + next_hop_gateway: global/gateways/default-internet-gateway + network: "{{ network }}" + tags: + - backends + - databases + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent #---------------------------------------------------------- - name: create a route gcp_compute_route: - name: "{{ resource_name }}" - dest_range: 192.168.6.0/24 - next_hop_gateway: global/gateways/default-internet-gateway - network: "{{ network }}" - tags: - - backends - - databases - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: "{{ resource_name }}" + dest_range: 192.168.6.0/24 + next_hop_gateway: global/gateways/default-internet-gateway + network: "{{ network }}" + tags: + - backends + - databases + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: result - name: assert changed is true assert: @@ -71,17 +71,17 @@ # ---------------------------------------------------------------------------- - name: create a route that already exists gcp_compute_route: - name: "{{ resource_name }}" - dest_range: 192.168.6.0/24 - next_hop_gateway: global/gateways/default-internet-gateway - network: "{{ network }}" - tags: - - backends - - databases - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: "{{ resource_name }}" + dest_range: 192.168.6.0/24 + next_hop_gateway: global/gateways/default-internet-gateway + network: "{{ network }}" + tags: + - backends + - databases + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: result - name: assert changed is false assert: @@ -91,17 +91,17 @@ #---------------------------------------------------------- - name: delete a route gcp_compute_route: - name: "{{ resource_name }}" - dest_range: 192.168.6.0/24 - next_hop_gateway: global/gateways/default-internet-gateway - network: "{{ network }}" - tags: - - backends - - databases - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + name: "{{ resource_name }}" + dest_range: 192.168.6.0/24 + next_hop_gateway: global/gateways/default-internet-gateway + network: "{{ network }}" + tags: + - backends + - databases + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent register: result - name: assert changed is true assert: @@ -125,17 +125,17 @@ # ---------------------------------------------------------------------------- - name: delete a route that does not exist gcp_compute_route: - name: "{{ resource_name }}" - dest_range: 192.168.6.0/24 - next_hop_gateway: global/gateways/default-internet-gateway - network: "{{ network }}" - tags: - - backends - - databases - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + name: "{{ resource_name }}" + dest_range: 192.168.6.0/24 + next_hop_gateway: global/gateways/default-internet-gateway + network: "{{ network }}" + tags: + - backends + - databases + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent register: result - name: assert changed is false assert: @@ -147,10 +147,10 @@ # If errors happen, don't crash the playbook! - name: delete a network gcp_compute_network: - name: "network-route" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + name: network-route + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent register: network ignore_errors: true diff --git a/test/integration/targets/gcp_compute_router/tasks/main.yml b/test/integration/targets/gcp_compute_router/tasks/main.yml index bad78bd73fe75e..ac9e5f57b0bc37 100644 --- a/test/integration/targets/gcp_compute_router/tasks/main.yml +++ b/test/integration/targets/gcp_compute_router/tasks/main.yml @@ -15,47 +15,47 @@ # Pre-test setup - name: create a network gcp_compute_network: - name: "network-router" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: network-router + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: network - name: delete a router gcp_compute_router: - name: "{{ resource_name }}" - network: "{{ network }}" - bgp: - asn: 64514 - advertise_mode: CUSTOM - advertised_groups: - - ALL_SUBNETS - advertised_ip_ranges: - - range: 1.2.3.4 - - range: 6.7.0.0/16 - region: us-central1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + name: "{{ resource_name }}" + network: "{{ network }}" + bgp: + asn: 64514 + advertise_mode: CUSTOM + advertised_groups: + - ALL_SUBNETS + advertised_ip_ranges: + - range: 1.2.3.4 + - range: 6.7.0.0/16 + region: us-central1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent #---------------------------------------------------------- - name: create a router gcp_compute_router: - name: "{{ resource_name }}" - network: "{{ network }}" - bgp: - asn: 64514 - advertise_mode: CUSTOM - advertised_groups: - - ALL_SUBNETS - advertised_ip_ranges: - - range: 1.2.3.4 - - range: 6.7.0.0/16 - region: us-central1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: "{{ resource_name }}" + network: "{{ network }}" + bgp: + asn: 64514 + advertise_mode: CUSTOM + advertised_groups: + - ALL_SUBNETS + advertised_ip_ranges: + - range: 1.2.3.4 + - range: 6.7.0.0/16 + region: us-central1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: result - name: assert changed is true assert: @@ -80,21 +80,21 @@ # ---------------------------------------------------------------------------- - name: create a router that already exists gcp_compute_router: - name: "{{ resource_name }}" - network: "{{ network }}" - bgp: - asn: 64514 - advertise_mode: CUSTOM - advertised_groups: - - ALL_SUBNETS - advertised_ip_ranges: - - range: 1.2.3.4 - - range: 6.7.0.0/16 - region: us-central1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: "{{ resource_name }}" + network: "{{ network }}" + bgp: + asn: 64514 + advertise_mode: CUSTOM + advertised_groups: + - ALL_SUBNETS + advertised_ip_ranges: + - range: 1.2.3.4 + - range: 6.7.0.0/16 + region: us-central1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: result - name: assert changed is false assert: @@ -104,21 +104,21 @@ #---------------------------------------------------------- - name: delete a router gcp_compute_router: - name: "{{ resource_name }}" - network: "{{ network }}" - bgp: - asn: 64514 - advertise_mode: CUSTOM - advertised_groups: - - ALL_SUBNETS - advertised_ip_ranges: - - range: 1.2.3.4 - - range: 6.7.0.0/16 - region: us-central1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + name: "{{ resource_name }}" + network: "{{ network }}" + bgp: + asn: 64514 + advertise_mode: CUSTOM + advertised_groups: + - ALL_SUBNETS + advertised_ip_ranges: + - range: 1.2.3.4 + - range: 6.7.0.0/16 + region: us-central1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent register: result - name: assert changed is true assert: @@ -143,21 +143,21 @@ # ---------------------------------------------------------------------------- - name: delete a router that does not exist gcp_compute_router: - name: "{{ resource_name }}" - network: "{{ network }}" - bgp: - asn: 64514 - advertise_mode: CUSTOM - advertised_groups: - - ALL_SUBNETS - advertised_ip_ranges: - - range: 1.2.3.4 - - range: 6.7.0.0/16 - region: us-central1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + name: "{{ resource_name }}" + network: "{{ network }}" + bgp: + asn: 64514 + advertise_mode: CUSTOM + advertised_groups: + - ALL_SUBNETS + advertised_ip_ranges: + - range: 1.2.3.4 + - range: 6.7.0.0/16 + region: us-central1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent register: result - name: assert changed is false assert: @@ -169,10 +169,10 @@ # If errors happen, don't crash the playbook! - name: delete a network gcp_compute_network: - name: "network-router" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + name: network-router + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent register: network ignore_errors: true diff --git a/test/integration/targets/gcp_compute_ssl_certificate/tasks/main.yml b/test/integration/targets/gcp_compute_ssl_certificate/tasks/main.yml index 5350f6a72c3ce1..467b1c418d3e1b 100644 --- a/test/integration/targets/gcp_compute_ssl_certificate/tasks/main.yml +++ b/test/integration/targets/gcp_compute_ssl_certificate/tasks/main.yml @@ -15,69 +15,45 @@ # Pre-test setup - name: delete a ssl certificate gcp_compute_ssl_certificate: - name: "{{ resource_name }}" - description: A certificate for testing. Do not use this certificate in production - certificate: | - -----BEGIN CERTIFICATE----- - MIICqjCCAk+gAwIBAgIJAIuJ+0352Kq4MAoGCCqGSM49BAMCMIGwMQswCQYDVQQG - EwJVUzETMBEGA1UECAwKV2FzaGluZ3RvbjERMA8GA1UEBwwIS2lya2xhbmQxFTAT - BgNVBAoMDEdvb2dsZSwgSW5jLjEeMBwGA1UECwwVR29vZ2xlIENsb3VkIFBsYXRm - b3JtMR8wHQYDVQQDDBZ3d3cubXktc2VjdXJlLXNpdGUuY29tMSEwHwYJKoZIhvcN - AQkBFhJuZWxzb25hQGdvb2dsZS5jb20wHhcNMTcwNjI4MDQ1NjI2WhcNMjcwNjI2 - MDQ1NjI2WjCBsDELMAkGA1UEBhMCVVMxEzARBgNVBAgMCldhc2hpbmd0b24xETAP - BgNVBAcMCEtpcmtsYW5kMRUwEwYDVQQKDAxHb29nbGUsIEluYy4xHjAcBgNVBAsM - FUdvb2dsZSBDbG91ZCBQbGF0Zm9ybTEfMB0GA1UEAwwWd3d3Lm15LXNlY3VyZS1z - aXRlLmNvbTEhMB8GCSqGSIb3DQEJARYSbmVsc29uYUBnb29nbGUuY29tMFkwEwYH - KoZIzj0CAQYIKoZIzj0DAQcDQgAEHGzpcRJ4XzfBJCCPMQeXQpTXwlblimODQCuQ - 4mzkzTv0dXyB750fOGN02HtkpBOZzzvUARTR10JQoSe2/5PIwaNQME4wHQYDVR0O - BBYEFKIQC3A2SDpxcdfn0YLKineDNq/BMB8GA1UdIwQYMBaAFKIQC3A2SDpxcdfn - 0YLKineDNq/BMAwGA1UdEwQFMAMBAf8wCgYIKoZIzj0EAwIDSQAwRgIhALs4vy+O - M3jcqgA4fSW/oKw6UJxp+M6a+nGMX+UJR3YgAiEAvvl39QRVAiv84hdoCuyON0lJ - zqGNhIPGq2ULqXKK8BY= - -----END CERTIFICATE----- - private_key: | - -----BEGIN EC PRIVATE KEY----- - MHcCAQEEIObtRo8tkUqoMjeHhsOh2ouPpXCgBcP+EDxZCB/tws15oAoGCCqGSM49 - AwEHoUQDQgAEHGzpcRJ4XzfBJCCPMQeXQpTXwlblimODQCuQ4mzkzTv0dXyB750f - OGN02HtkpBOZzzvUARTR10JQoSe2/5PIwQ== - -----END EC PRIVATE KEY----- - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + name: "{{ resource_name }}" + description: A certificate for testing. Do not use this certificate in production + certificate: "-----BEGIN CERTIFICATE----- MIICqjCCAk+gAwIBAgIJAIuJ+0352Kq4MAoGCCqGSM49BAMCMIGwMQswCQYDVQQG + EwJVUzETMBEGA1UECAwKV2FzaGluZ3RvbjERMA8GA1UEBwwIS2lya2xhbmQxFTAT BgNVBAoMDEdvb2dsZSwgSW5jLjEeMBwGA1UECwwVR29vZ2xlIENsb3VkIFBsYXRm + b3JtMR8wHQYDVQQDDBZ3d3cubXktc2VjdXJlLXNpdGUuY29tMSEwHwYJKoZIhvcN AQkBFhJuZWxzb25hQGdvb2dsZS5jb20wHhcNMTcwNjI4MDQ1NjI2WhcNMjcwNjI2 + MDQ1NjI2WjCBsDELMAkGA1UEBhMCVVMxEzARBgNVBAgMCldhc2hpbmd0b24xETAP BgNVBAcMCEtpcmtsYW5kMRUwEwYDVQQKDAxHb29nbGUsIEluYy4xHjAcBgNVBAsM + FUdvb2dsZSBDbG91ZCBQbGF0Zm9ybTEfMB0GA1UEAwwWd3d3Lm15LXNlY3VyZS1z aXRlLmNvbTEhMB8GCSqGSIb3DQEJARYSbmVsc29uYUBnb29nbGUuY29tMFkwEwYH + KoZIzj0CAQYIKoZIzj0DAQcDQgAEHGzpcRJ4XzfBJCCPMQeXQpTXwlblimODQCuQ 4mzkzTv0dXyB750fOGN02HtkpBOZzzvUARTR10JQoSe2/5PIwaNQME4wHQYDVR0O + BBYEFKIQC3A2SDpxcdfn0YLKineDNq/BMB8GA1UdIwQYMBaAFKIQC3A2SDpxcdfn 0YLKineDNq/BMAwGA1UdEwQFMAMBAf8wCgYIKoZIzj0EAwIDSQAwRgIhALs4vy+O + M3jcqgA4fSW/oKw6UJxp+M6a+nGMX+UJR3YgAiEAvvl39QRVAiv84hdoCuyON0lJ zqGNhIPGq2ULqXKK8BY= + -----END CERTIFICATE-----" + private_key: "-----BEGIN EC PRIVATE KEY----- MHcCAQEEIObtRo8tkUqoMjeHhsOh2ouPpXCgBcP+EDxZCB/tws15oAoGCCqGSM49 + AwEHoUQDQgAEHGzpcRJ4XzfBJCCPMQeXQpTXwlblimODQCuQ4mzkzTv0dXyB750f OGN02HtkpBOZzzvUARTR10JQoSe2/5PIwQ== + -----END EC PRIVATE KEY-----" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent #---------------------------------------------------------- - name: create a ssl certificate gcp_compute_ssl_certificate: - name: "{{ resource_name }}" - description: A certificate for testing. Do not use this certificate in production - certificate: | - -----BEGIN CERTIFICATE----- - MIICqjCCAk+gAwIBAgIJAIuJ+0352Kq4MAoGCCqGSM49BAMCMIGwMQswCQYDVQQG - EwJVUzETMBEGA1UECAwKV2FzaGluZ3RvbjERMA8GA1UEBwwIS2lya2xhbmQxFTAT - BgNVBAoMDEdvb2dsZSwgSW5jLjEeMBwGA1UECwwVR29vZ2xlIENsb3VkIFBsYXRm - b3JtMR8wHQYDVQQDDBZ3d3cubXktc2VjdXJlLXNpdGUuY29tMSEwHwYJKoZIhvcN - AQkBFhJuZWxzb25hQGdvb2dsZS5jb20wHhcNMTcwNjI4MDQ1NjI2WhcNMjcwNjI2 - MDQ1NjI2WjCBsDELMAkGA1UEBhMCVVMxEzARBgNVBAgMCldhc2hpbmd0b24xETAP - BgNVBAcMCEtpcmtsYW5kMRUwEwYDVQQKDAxHb29nbGUsIEluYy4xHjAcBgNVBAsM - FUdvb2dsZSBDbG91ZCBQbGF0Zm9ybTEfMB0GA1UEAwwWd3d3Lm15LXNlY3VyZS1z - aXRlLmNvbTEhMB8GCSqGSIb3DQEJARYSbmVsc29uYUBnb29nbGUuY29tMFkwEwYH - KoZIzj0CAQYIKoZIzj0DAQcDQgAEHGzpcRJ4XzfBJCCPMQeXQpTXwlblimODQCuQ - 4mzkzTv0dXyB750fOGN02HtkpBOZzzvUARTR10JQoSe2/5PIwaNQME4wHQYDVR0O - BBYEFKIQC3A2SDpxcdfn0YLKineDNq/BMB8GA1UdIwQYMBaAFKIQC3A2SDpxcdfn - 0YLKineDNq/BMAwGA1UdEwQFMAMBAf8wCgYIKoZIzj0EAwIDSQAwRgIhALs4vy+O - M3jcqgA4fSW/oKw6UJxp+M6a+nGMX+UJR3YgAiEAvvl39QRVAiv84hdoCuyON0lJ - zqGNhIPGq2ULqXKK8BY= - -----END CERTIFICATE----- - private_key: | - -----BEGIN EC PRIVATE KEY----- - MHcCAQEEIObtRo8tkUqoMjeHhsOh2ouPpXCgBcP+EDxZCB/tws15oAoGCCqGSM49 - AwEHoUQDQgAEHGzpcRJ4XzfBJCCPMQeXQpTXwlblimODQCuQ4mzkzTv0dXyB750f - OGN02HtkpBOZzzvUARTR10JQoSe2/5PIwQ== - -----END EC PRIVATE KEY----- - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: "{{ resource_name }}" + description: A certificate for testing. Do not use this certificate in production + certificate: "-----BEGIN CERTIFICATE----- MIICqjCCAk+gAwIBAgIJAIuJ+0352Kq4MAoGCCqGSM49BAMCMIGwMQswCQYDVQQG + EwJVUzETMBEGA1UECAwKV2FzaGluZ3RvbjERMA8GA1UEBwwIS2lya2xhbmQxFTAT BgNVBAoMDEdvb2dsZSwgSW5jLjEeMBwGA1UECwwVR29vZ2xlIENsb3VkIFBsYXRm + b3JtMR8wHQYDVQQDDBZ3d3cubXktc2VjdXJlLXNpdGUuY29tMSEwHwYJKoZIhvcN AQkBFhJuZWxzb25hQGdvb2dsZS5jb20wHhcNMTcwNjI4MDQ1NjI2WhcNMjcwNjI2 + MDQ1NjI2WjCBsDELMAkGA1UEBhMCVVMxEzARBgNVBAgMCldhc2hpbmd0b24xETAP BgNVBAcMCEtpcmtsYW5kMRUwEwYDVQQKDAxHb29nbGUsIEluYy4xHjAcBgNVBAsM + FUdvb2dsZSBDbG91ZCBQbGF0Zm9ybTEfMB0GA1UEAwwWd3d3Lm15LXNlY3VyZS1z aXRlLmNvbTEhMB8GCSqGSIb3DQEJARYSbmVsc29uYUBnb29nbGUuY29tMFkwEwYH + KoZIzj0CAQYIKoZIzj0DAQcDQgAEHGzpcRJ4XzfBJCCPMQeXQpTXwlblimODQCuQ 4mzkzTv0dXyB750fOGN02HtkpBOZzzvUARTR10JQoSe2/5PIwaNQME4wHQYDVR0O + BBYEFKIQC3A2SDpxcdfn0YLKineDNq/BMB8GA1UdIwQYMBaAFKIQC3A2SDpxcdfn 0YLKineDNq/BMAwGA1UdEwQFMAMBAf8wCgYIKoZIzj0EAwIDSQAwRgIhALs4vy+O + M3jcqgA4fSW/oKw6UJxp+M6a+nGMX+UJR3YgAiEAvvl39QRVAiv84hdoCuyON0lJ zqGNhIPGq2ULqXKK8BY= + -----END CERTIFICATE-----" + private_key: "-----BEGIN EC PRIVATE KEY----- MHcCAQEEIObtRo8tkUqoMjeHhsOh2ouPpXCgBcP+EDxZCB/tws15oAoGCCqGSM49 + AwEHoUQDQgAEHGzpcRJ4XzfBJCCPMQeXQpTXwlblimODQCuQ4mzkzTv0dXyB750f OGN02HtkpBOZzzvUARTR10JQoSe2/5PIwQ== + -----END EC PRIVATE KEY-----" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: result - name: assert changed is true assert: @@ -101,36 +77,24 @@ # ---------------------------------------------------------------------------- - name: create a ssl certificate that already exists gcp_compute_ssl_certificate: - name: "{{ resource_name }}" - description: A certificate for testing. Do not use this certificate in production - certificate: | - -----BEGIN CERTIFICATE----- - MIICqjCCAk+gAwIBAgIJAIuJ+0352Kq4MAoGCCqGSM49BAMCMIGwMQswCQYDVQQG - EwJVUzETMBEGA1UECAwKV2FzaGluZ3RvbjERMA8GA1UEBwwIS2lya2xhbmQxFTAT - BgNVBAoMDEdvb2dsZSwgSW5jLjEeMBwGA1UECwwVR29vZ2xlIENsb3VkIFBsYXRm - b3JtMR8wHQYDVQQDDBZ3d3cubXktc2VjdXJlLXNpdGUuY29tMSEwHwYJKoZIhvcN - AQkBFhJuZWxzb25hQGdvb2dsZS5jb20wHhcNMTcwNjI4MDQ1NjI2WhcNMjcwNjI2 - MDQ1NjI2WjCBsDELMAkGA1UEBhMCVVMxEzARBgNVBAgMCldhc2hpbmd0b24xETAP - BgNVBAcMCEtpcmtsYW5kMRUwEwYDVQQKDAxHb29nbGUsIEluYy4xHjAcBgNVBAsM - FUdvb2dsZSBDbG91ZCBQbGF0Zm9ybTEfMB0GA1UEAwwWd3d3Lm15LXNlY3VyZS1z - aXRlLmNvbTEhMB8GCSqGSIb3DQEJARYSbmVsc29uYUBnb29nbGUuY29tMFkwEwYH - KoZIzj0CAQYIKoZIzj0DAQcDQgAEHGzpcRJ4XzfBJCCPMQeXQpTXwlblimODQCuQ - 4mzkzTv0dXyB750fOGN02HtkpBOZzzvUARTR10JQoSe2/5PIwaNQME4wHQYDVR0O - BBYEFKIQC3A2SDpxcdfn0YLKineDNq/BMB8GA1UdIwQYMBaAFKIQC3A2SDpxcdfn - 0YLKineDNq/BMAwGA1UdEwQFMAMBAf8wCgYIKoZIzj0EAwIDSQAwRgIhALs4vy+O - M3jcqgA4fSW/oKw6UJxp+M6a+nGMX+UJR3YgAiEAvvl39QRVAiv84hdoCuyON0lJ - zqGNhIPGq2ULqXKK8BY= - -----END CERTIFICATE----- - private_key: | - -----BEGIN EC PRIVATE KEY----- - MHcCAQEEIObtRo8tkUqoMjeHhsOh2ouPpXCgBcP+EDxZCB/tws15oAoGCCqGSM49 - AwEHoUQDQgAEHGzpcRJ4XzfBJCCPMQeXQpTXwlblimODQCuQ4mzkzTv0dXyB750f - OGN02HtkpBOZzzvUARTR10JQoSe2/5PIwQ== - -----END EC PRIVATE KEY----- - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: "{{ resource_name }}" + description: A certificate for testing. Do not use this certificate in production + certificate: "-----BEGIN CERTIFICATE----- MIICqjCCAk+gAwIBAgIJAIuJ+0352Kq4MAoGCCqGSM49BAMCMIGwMQswCQYDVQQG + EwJVUzETMBEGA1UECAwKV2FzaGluZ3RvbjERMA8GA1UEBwwIS2lya2xhbmQxFTAT BgNVBAoMDEdvb2dsZSwgSW5jLjEeMBwGA1UECwwVR29vZ2xlIENsb3VkIFBsYXRm + b3JtMR8wHQYDVQQDDBZ3d3cubXktc2VjdXJlLXNpdGUuY29tMSEwHwYJKoZIhvcN AQkBFhJuZWxzb25hQGdvb2dsZS5jb20wHhcNMTcwNjI4MDQ1NjI2WhcNMjcwNjI2 + MDQ1NjI2WjCBsDELMAkGA1UEBhMCVVMxEzARBgNVBAgMCldhc2hpbmd0b24xETAP BgNVBAcMCEtpcmtsYW5kMRUwEwYDVQQKDAxHb29nbGUsIEluYy4xHjAcBgNVBAsM + FUdvb2dsZSBDbG91ZCBQbGF0Zm9ybTEfMB0GA1UEAwwWd3d3Lm15LXNlY3VyZS1z aXRlLmNvbTEhMB8GCSqGSIb3DQEJARYSbmVsc29uYUBnb29nbGUuY29tMFkwEwYH + KoZIzj0CAQYIKoZIzj0DAQcDQgAEHGzpcRJ4XzfBJCCPMQeXQpTXwlblimODQCuQ 4mzkzTv0dXyB750fOGN02HtkpBOZzzvUARTR10JQoSe2/5PIwaNQME4wHQYDVR0O + BBYEFKIQC3A2SDpxcdfn0YLKineDNq/BMB8GA1UdIwQYMBaAFKIQC3A2SDpxcdfn 0YLKineDNq/BMAwGA1UdEwQFMAMBAf8wCgYIKoZIzj0EAwIDSQAwRgIhALs4vy+O + M3jcqgA4fSW/oKw6UJxp+M6a+nGMX+UJR3YgAiEAvvl39QRVAiv84hdoCuyON0lJ zqGNhIPGq2ULqXKK8BY= + -----END CERTIFICATE-----" + private_key: "-----BEGIN EC PRIVATE KEY----- MHcCAQEEIObtRo8tkUqoMjeHhsOh2ouPpXCgBcP+EDxZCB/tws15oAoGCCqGSM49 + AwEHoUQDQgAEHGzpcRJ4XzfBJCCPMQeXQpTXwlblimODQCuQ4mzkzTv0dXyB750f OGN02HtkpBOZzzvUARTR10JQoSe2/5PIwQ== + -----END EC PRIVATE KEY-----" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: result - name: assert changed is false assert: @@ -140,36 +104,24 @@ #---------------------------------------------------------- - name: delete a ssl certificate gcp_compute_ssl_certificate: - name: "{{ resource_name }}" - description: A certificate for testing. Do not use this certificate in production - certificate: | - -----BEGIN CERTIFICATE----- - MIICqjCCAk+gAwIBAgIJAIuJ+0352Kq4MAoGCCqGSM49BAMCMIGwMQswCQYDVQQG - EwJVUzETMBEGA1UECAwKV2FzaGluZ3RvbjERMA8GA1UEBwwIS2lya2xhbmQxFTAT - BgNVBAoMDEdvb2dsZSwgSW5jLjEeMBwGA1UECwwVR29vZ2xlIENsb3VkIFBsYXRm - b3JtMR8wHQYDVQQDDBZ3d3cubXktc2VjdXJlLXNpdGUuY29tMSEwHwYJKoZIhvcN - AQkBFhJuZWxzb25hQGdvb2dsZS5jb20wHhcNMTcwNjI4MDQ1NjI2WhcNMjcwNjI2 - MDQ1NjI2WjCBsDELMAkGA1UEBhMCVVMxEzARBgNVBAgMCldhc2hpbmd0b24xETAP - BgNVBAcMCEtpcmtsYW5kMRUwEwYDVQQKDAxHb29nbGUsIEluYy4xHjAcBgNVBAsM - FUdvb2dsZSBDbG91ZCBQbGF0Zm9ybTEfMB0GA1UEAwwWd3d3Lm15LXNlY3VyZS1z - aXRlLmNvbTEhMB8GCSqGSIb3DQEJARYSbmVsc29uYUBnb29nbGUuY29tMFkwEwYH - KoZIzj0CAQYIKoZIzj0DAQcDQgAEHGzpcRJ4XzfBJCCPMQeXQpTXwlblimODQCuQ - 4mzkzTv0dXyB750fOGN02HtkpBOZzzvUARTR10JQoSe2/5PIwaNQME4wHQYDVR0O - BBYEFKIQC3A2SDpxcdfn0YLKineDNq/BMB8GA1UdIwQYMBaAFKIQC3A2SDpxcdfn - 0YLKineDNq/BMAwGA1UdEwQFMAMBAf8wCgYIKoZIzj0EAwIDSQAwRgIhALs4vy+O - M3jcqgA4fSW/oKw6UJxp+M6a+nGMX+UJR3YgAiEAvvl39QRVAiv84hdoCuyON0lJ - zqGNhIPGq2ULqXKK8BY= - -----END CERTIFICATE----- - private_key: | - -----BEGIN EC PRIVATE KEY----- - MHcCAQEEIObtRo8tkUqoMjeHhsOh2ouPpXCgBcP+EDxZCB/tws15oAoGCCqGSM49 - AwEHoUQDQgAEHGzpcRJ4XzfBJCCPMQeXQpTXwlblimODQCuQ4mzkzTv0dXyB750f - OGN02HtkpBOZzzvUARTR10JQoSe2/5PIwQ== - -----END EC PRIVATE KEY----- - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + name: "{{ resource_name }}" + description: A certificate for testing. Do not use this certificate in production + certificate: "-----BEGIN CERTIFICATE----- MIICqjCCAk+gAwIBAgIJAIuJ+0352Kq4MAoGCCqGSM49BAMCMIGwMQswCQYDVQQG + EwJVUzETMBEGA1UECAwKV2FzaGluZ3RvbjERMA8GA1UEBwwIS2lya2xhbmQxFTAT BgNVBAoMDEdvb2dsZSwgSW5jLjEeMBwGA1UECwwVR29vZ2xlIENsb3VkIFBsYXRm + b3JtMR8wHQYDVQQDDBZ3d3cubXktc2VjdXJlLXNpdGUuY29tMSEwHwYJKoZIhvcN AQkBFhJuZWxzb25hQGdvb2dsZS5jb20wHhcNMTcwNjI4MDQ1NjI2WhcNMjcwNjI2 + MDQ1NjI2WjCBsDELMAkGA1UEBhMCVVMxEzARBgNVBAgMCldhc2hpbmd0b24xETAP BgNVBAcMCEtpcmtsYW5kMRUwEwYDVQQKDAxHb29nbGUsIEluYy4xHjAcBgNVBAsM + FUdvb2dsZSBDbG91ZCBQbGF0Zm9ybTEfMB0GA1UEAwwWd3d3Lm15LXNlY3VyZS1z aXRlLmNvbTEhMB8GCSqGSIb3DQEJARYSbmVsc29uYUBnb29nbGUuY29tMFkwEwYH + KoZIzj0CAQYIKoZIzj0DAQcDQgAEHGzpcRJ4XzfBJCCPMQeXQpTXwlblimODQCuQ 4mzkzTv0dXyB750fOGN02HtkpBOZzzvUARTR10JQoSe2/5PIwaNQME4wHQYDVR0O + BBYEFKIQC3A2SDpxcdfn0YLKineDNq/BMB8GA1UdIwQYMBaAFKIQC3A2SDpxcdfn 0YLKineDNq/BMAwGA1UdEwQFMAMBAf8wCgYIKoZIzj0EAwIDSQAwRgIhALs4vy+O + M3jcqgA4fSW/oKw6UJxp+M6a+nGMX+UJR3YgAiEAvvl39QRVAiv84hdoCuyON0lJ zqGNhIPGq2ULqXKK8BY= + -----END CERTIFICATE-----" + private_key: "-----BEGIN EC PRIVATE KEY----- MHcCAQEEIObtRo8tkUqoMjeHhsOh2ouPpXCgBcP+EDxZCB/tws15oAoGCCqGSM49 + AwEHoUQDQgAEHGzpcRJ4XzfBJCCPMQeXQpTXwlblimODQCuQ4mzkzTv0dXyB750f OGN02HtkpBOZzzvUARTR10JQoSe2/5PIwQ== + -----END EC PRIVATE KEY-----" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent register: result - name: assert changed is true assert: @@ -193,36 +145,24 @@ # ---------------------------------------------------------------------------- - name: delete a ssl certificate that does not exist gcp_compute_ssl_certificate: - name: "{{ resource_name }}" - description: A certificate for testing. Do not use this certificate in production - certificate: | - -----BEGIN CERTIFICATE----- - MIICqjCCAk+gAwIBAgIJAIuJ+0352Kq4MAoGCCqGSM49BAMCMIGwMQswCQYDVQQG - EwJVUzETMBEGA1UECAwKV2FzaGluZ3RvbjERMA8GA1UEBwwIS2lya2xhbmQxFTAT - BgNVBAoMDEdvb2dsZSwgSW5jLjEeMBwGA1UECwwVR29vZ2xlIENsb3VkIFBsYXRm - b3JtMR8wHQYDVQQDDBZ3d3cubXktc2VjdXJlLXNpdGUuY29tMSEwHwYJKoZIhvcN - AQkBFhJuZWxzb25hQGdvb2dsZS5jb20wHhcNMTcwNjI4MDQ1NjI2WhcNMjcwNjI2 - MDQ1NjI2WjCBsDELMAkGA1UEBhMCVVMxEzARBgNVBAgMCldhc2hpbmd0b24xETAP - BgNVBAcMCEtpcmtsYW5kMRUwEwYDVQQKDAxHb29nbGUsIEluYy4xHjAcBgNVBAsM - FUdvb2dsZSBDbG91ZCBQbGF0Zm9ybTEfMB0GA1UEAwwWd3d3Lm15LXNlY3VyZS1z - aXRlLmNvbTEhMB8GCSqGSIb3DQEJARYSbmVsc29uYUBnb29nbGUuY29tMFkwEwYH - KoZIzj0CAQYIKoZIzj0DAQcDQgAEHGzpcRJ4XzfBJCCPMQeXQpTXwlblimODQCuQ - 4mzkzTv0dXyB750fOGN02HtkpBOZzzvUARTR10JQoSe2/5PIwaNQME4wHQYDVR0O - BBYEFKIQC3A2SDpxcdfn0YLKineDNq/BMB8GA1UdIwQYMBaAFKIQC3A2SDpxcdfn - 0YLKineDNq/BMAwGA1UdEwQFMAMBAf8wCgYIKoZIzj0EAwIDSQAwRgIhALs4vy+O - M3jcqgA4fSW/oKw6UJxp+M6a+nGMX+UJR3YgAiEAvvl39QRVAiv84hdoCuyON0lJ - zqGNhIPGq2ULqXKK8BY= - -----END CERTIFICATE----- - private_key: | - -----BEGIN EC PRIVATE KEY----- - MHcCAQEEIObtRo8tkUqoMjeHhsOh2ouPpXCgBcP+EDxZCB/tws15oAoGCCqGSM49 - AwEHoUQDQgAEHGzpcRJ4XzfBJCCPMQeXQpTXwlblimODQCuQ4mzkzTv0dXyB750f - OGN02HtkpBOZzzvUARTR10JQoSe2/5PIwQ== - -----END EC PRIVATE KEY----- - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + name: "{{ resource_name }}" + description: A certificate for testing. Do not use this certificate in production + certificate: "-----BEGIN CERTIFICATE----- MIICqjCCAk+gAwIBAgIJAIuJ+0352Kq4MAoGCCqGSM49BAMCMIGwMQswCQYDVQQG + EwJVUzETMBEGA1UECAwKV2FzaGluZ3RvbjERMA8GA1UEBwwIS2lya2xhbmQxFTAT BgNVBAoMDEdvb2dsZSwgSW5jLjEeMBwGA1UECwwVR29vZ2xlIENsb3VkIFBsYXRm + b3JtMR8wHQYDVQQDDBZ3d3cubXktc2VjdXJlLXNpdGUuY29tMSEwHwYJKoZIhvcN AQkBFhJuZWxzb25hQGdvb2dsZS5jb20wHhcNMTcwNjI4MDQ1NjI2WhcNMjcwNjI2 + MDQ1NjI2WjCBsDELMAkGA1UEBhMCVVMxEzARBgNVBAgMCldhc2hpbmd0b24xETAP BgNVBAcMCEtpcmtsYW5kMRUwEwYDVQQKDAxHb29nbGUsIEluYy4xHjAcBgNVBAsM + FUdvb2dsZSBDbG91ZCBQbGF0Zm9ybTEfMB0GA1UEAwwWd3d3Lm15LXNlY3VyZS1z aXRlLmNvbTEhMB8GCSqGSIb3DQEJARYSbmVsc29uYUBnb29nbGUuY29tMFkwEwYH + KoZIzj0CAQYIKoZIzj0DAQcDQgAEHGzpcRJ4XzfBJCCPMQeXQpTXwlblimODQCuQ 4mzkzTv0dXyB750fOGN02HtkpBOZzzvUARTR10JQoSe2/5PIwaNQME4wHQYDVR0O + BBYEFKIQC3A2SDpxcdfn0YLKineDNq/BMB8GA1UdIwQYMBaAFKIQC3A2SDpxcdfn 0YLKineDNq/BMAwGA1UdEwQFMAMBAf8wCgYIKoZIzj0EAwIDSQAwRgIhALs4vy+O + M3jcqgA4fSW/oKw6UJxp+M6a+nGMX+UJR3YgAiEAvvl39QRVAiv84hdoCuyON0lJ zqGNhIPGq2ULqXKK8BY= + -----END CERTIFICATE-----" + private_key: "-----BEGIN EC PRIVATE KEY----- MHcCAQEEIObtRo8tkUqoMjeHhsOh2ouPpXCgBcP+EDxZCB/tws15oAoGCCqGSM49 + AwEHoUQDQgAEHGzpcRJ4XzfBJCCPMQeXQpTXwlblimODQCuQ4mzkzTv0dXyB750f OGN02HtkpBOZzzvUARTR10JQoSe2/5PIwQ== + -----END EC PRIVATE KEY-----" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent register: result - name: assert changed is false assert: diff --git a/test/integration/targets/gcp_compute_ssl_policy/tasks/main.yml b/test/integration/targets/gcp_compute_ssl_policy/tasks/main.yml index 20d3a8c3f7ca6c..05bd52f6367f81 100644 --- a/test/integration/targets/gcp_compute_ssl_policy/tasks/main.yml +++ b/test/integration/targets/gcp_compute_ssl_policy/tasks/main.yml @@ -15,29 +15,29 @@ # Pre-test setup - name: delete a ssl policy gcp_compute_ssl_policy: - name: "{{ resource_name }}" - profile: CUSTOM - min_tls_version: TLS_1_2 - custom_features: - - TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 - - TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + name: "{{ resource_name }}" + profile: CUSTOM + min_tls_version: TLS_1_2 + custom_features: + - TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 + - TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent #---------------------------------------------------------- - name: create a ssl policy gcp_compute_ssl_policy: - name: "{{ resource_name }}" - profile: CUSTOM - min_tls_version: TLS_1_2 - custom_features: - - TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 - - TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: "{{ resource_name }}" + profile: CUSTOM + min_tls_version: TLS_1_2 + custom_features: + - TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 + - TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: result - name: assert changed is true assert: @@ -61,16 +61,16 @@ # ---------------------------------------------------------------------------- - name: create a ssl policy that already exists gcp_compute_ssl_policy: - name: "{{ resource_name }}" - profile: CUSTOM - min_tls_version: TLS_1_2 - custom_features: - - TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 - - TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: "{{ resource_name }}" + profile: CUSTOM + min_tls_version: TLS_1_2 + custom_features: + - TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 + - TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: result - name: assert changed is false assert: @@ -80,16 +80,16 @@ #---------------------------------------------------------- - name: delete a ssl policy gcp_compute_ssl_policy: - name: "{{ resource_name }}" - profile: CUSTOM - min_tls_version: TLS_1_2 - custom_features: - - TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 - - TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + name: "{{ resource_name }}" + profile: CUSTOM + min_tls_version: TLS_1_2 + custom_features: + - TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 + - TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent register: result - name: assert changed is true assert: @@ -113,16 +113,16 @@ # ---------------------------------------------------------------------------- - name: delete a ssl policy that does not exist gcp_compute_ssl_policy: - name: "{{ resource_name }}" - profile: CUSTOM - min_tls_version: TLS_1_2 - custom_features: - - TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 - - TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + name: "{{ resource_name }}" + profile: CUSTOM + min_tls_version: TLS_1_2 + custom_features: + - TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 + - TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent register: result - name: assert changed is false assert: diff --git a/test/integration/targets/gcp_compute_subnetwork/tasks/main.yml b/test/integration/targets/gcp_compute_subnetwork/tasks/main.yml index 6c0eeb5dbb3b2a..ffcca46aea4b11 100644 --- a/test/integration/targets/gcp_compute_subnetwork/tasks/main.yml +++ b/test/integration/targets/gcp_compute_subnetwork/tasks/main.yml @@ -15,34 +15,34 @@ # Pre-test setup - name: create a network gcp_compute_network: - name: "network-subnetwork" - auto_create_subnetworks: true - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: network-subnetwork + auto_create_subnetworks: 'true' + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: network - name: delete a subnetwork gcp_compute_subnetwork: - name: ansiblenet - region: us-west1 - network: "{{ network }}" - ip_cidr_range: 172.16.0.0/16 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + name: ansiblenet + region: us-west1 + network: "{{ network }}" + ip_cidr_range: 172.16.0.0/16 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent #---------------------------------------------------------- - name: create a subnetwork gcp_compute_subnetwork: - name: ansiblenet - region: us-west1 - network: "{{ network }}" - ip_cidr_range: 172.16.0.0/16 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: ansiblenet + region: us-west1 + network: "{{ network }}" + ip_cidr_range: 172.16.0.0/16 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: result - name: assert changed is true assert: @@ -67,14 +67,14 @@ # ---------------------------------------------------------------------------- - name: create a subnetwork that already exists gcp_compute_subnetwork: - name: ansiblenet - region: us-west1 - network: "{{ network }}" - ip_cidr_range: 172.16.0.0/16 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: ansiblenet + region: us-west1 + network: "{{ network }}" + ip_cidr_range: 172.16.0.0/16 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: result - name: assert changed is false assert: @@ -84,14 +84,14 @@ #---------------------------------------------------------- - name: delete a subnetwork gcp_compute_subnetwork: - name: ansiblenet - region: us-west1 - network: "{{ network }}" - ip_cidr_range: 172.16.0.0/16 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + name: ansiblenet + region: us-west1 + network: "{{ network }}" + ip_cidr_range: 172.16.0.0/16 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent register: result - name: assert changed is true assert: @@ -116,14 +116,14 @@ # ---------------------------------------------------------------------------- - name: delete a subnetwork that does not exist gcp_compute_subnetwork: - name: ansiblenet - region: us-west1 - network: "{{ network }}" - ip_cidr_range: 172.16.0.0/16 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + name: ansiblenet + region: us-west1 + network: "{{ network }}" + ip_cidr_range: 172.16.0.0/16 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent register: result - name: assert changed is false assert: @@ -135,11 +135,11 @@ # If errors happen, don't crash the playbook! - name: delete a network gcp_compute_network: - name: "network-subnetwork" - auto_create_subnetworks: true - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + name: network-subnetwork + auto_create_subnetworks: 'true' + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent register: network ignore_errors: true diff --git a/test/integration/targets/gcp_compute_target_http_proxy/tasks/main.yml b/test/integration/targets/gcp_compute_target_http_proxy/tasks/main.yml index cee3802ba29241..a5182a72249189 100644 --- a/test/integration/targets/gcp_compute_target_http_proxy/tasks/main.yml +++ b/test/integration/targets/gcp_compute_target_http_proxy/tasks/main.yml @@ -15,64 +15,64 @@ # Pre-test setup - name: create a instance group gcp_compute_instance_group: - name: "instancegroup-targethttpproxy" - zone: us-central1-a - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: instancegroup-targethttpproxy + zone: us-central1-a + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: instancegroup - name: create a http health check gcp_compute_http_health_check: - name: "httphealthcheck-targethttpproxy" - healthy_threshold: 10 - port: 8080 - timeout_sec: 2 - unhealthy_threshold: 5 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: httphealthcheck-targethttpproxy + healthy_threshold: 10 + port: 8080 + timeout_sec: 2 + unhealthy_threshold: 5 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: healthcheck - name: create a backend service gcp_compute_backend_service: - name: "backendservice-targethttpproxy" - 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 + name: backendservice-targethttpproxy + 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 register: backendservice - name: create a url map gcp_compute_url_map: - name: "urlmap-targethttpproxy" - default_service: "{{ backendservice }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: urlmap-targethttpproxy + default_service: "{{ backendservice }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: urlmap - name: delete a target http proxy gcp_compute_target_http_proxy: - name: "{{ resource_name }}" - url_map: "{{ urlmap }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + name: "{{ resource_name }}" + url_map: "{{ urlmap }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent #---------------------------------------------------------- - name: create a target http proxy gcp_compute_target_http_proxy: - name: "{{ resource_name }}" - url_map: "{{ urlmap }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: "{{ resource_name }}" + url_map: "{{ urlmap }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: result - name: assert changed is true assert: @@ -96,12 +96,12 @@ # ---------------------------------------------------------------------------- - name: create a target http proxy that already exists gcp_compute_target_http_proxy: - name: "{{ resource_name }}" - url_map: "{{ urlmap }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: "{{ resource_name }}" + url_map: "{{ urlmap }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: result - name: assert changed is false assert: @@ -111,12 +111,12 @@ #---------------------------------------------------------- - name: delete a target http proxy gcp_compute_target_http_proxy: - name: "{{ resource_name }}" - url_map: "{{ urlmap }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + name: "{{ resource_name }}" + url_map: "{{ urlmap }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent register: result - name: assert changed is true assert: @@ -140,12 +140,12 @@ # ---------------------------------------------------------------------------- - name: delete a target http proxy that does not exist gcp_compute_target_http_proxy: - name: "{{ resource_name }}" - url_map: "{{ urlmap }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + name: "{{ resource_name }}" + url_map: "{{ urlmap }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent register: result - name: assert changed is false assert: @@ -157,48 +157,48 @@ # If errors happen, don't crash the playbook! - name: delete a url map gcp_compute_url_map: - name: "urlmap-targethttpproxy" - default_service: "{{ backendservice }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + name: urlmap-targethttpproxy + default_service: "{{ backendservice }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent register: urlmap ignore_errors: true - name: delete a backend service gcp_compute_backend_service: - name: "backendservice-targethttpproxy" - 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 + name: backendservice-targethttpproxy + 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 register: backendservice ignore_errors: true - name: delete a http health check gcp_compute_http_health_check: - name: "httphealthcheck-targethttpproxy" - healthy_threshold: 10 - port: 8080 - timeout_sec: 2 - unhealthy_threshold: 5 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + name: httphealthcheck-targethttpproxy + healthy_threshold: 10 + port: 8080 + timeout_sec: 2 + unhealthy_threshold: 5 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent register: healthcheck ignore_errors: true - name: delete a instance group gcp_compute_instance_group: - name: "instancegroup-targethttpproxy" - zone: us-central1-a - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + name: instancegroup-targethttpproxy + zone: us-central1-a + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent register: instancegroup ignore_errors: true diff --git a/test/integration/targets/gcp_compute_target_https_proxy/tasks/main.yml b/test/integration/targets/gcp_compute_target_https_proxy/tasks/main.yml index 7a50dc4304c061..144bf956fa8e90 100644 --- a/test/integration/targets/gcp_compute_target_https_proxy/tasks/main.yml +++ b/test/integration/targets/gcp_compute_target_https_proxy/tasks/main.yml @@ -15,101 +15,89 @@ # Pre-test setup - name: create a instance group gcp_compute_instance_group: - name: "instancegroup-targethttpsproxy" - zone: us-central1-a - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: instancegroup-targethttpsproxy + zone: us-central1-a + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: instancegroup - name: create a http health check gcp_compute_http_health_check: - name: "httphealthcheck-targethttpsproxy" - healthy_threshold: 10 - port: 8080 - timeout_sec: 2 - unhealthy_threshold: 5 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: httphealthcheck-targethttpsproxy + healthy_threshold: 10 + port: 8080 + timeout_sec: 2 + unhealthy_threshold: 5 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: healthcheck - name: create a backend service gcp_compute_backend_service: - name: "backendservice-targethttpsproxy" - 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 + name: backendservice-targethttpsproxy + 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 register: backendservice - name: create a url map gcp_compute_url_map: - name: "urlmap-targethttpsproxy" - default_service: "{{ backendservice }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: urlmap-targethttpsproxy + default_service: "{{ backendservice }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: urlmap - name: create a ssl certificate gcp_compute_ssl_certificate: - name: "sslcert-targethttpsproxy" - description: A certificate for testing. Do not use this certificate in production - certificate: | - -----BEGIN CERTIFICATE----- - MIICqjCCAk+gAwIBAgIJAIuJ+0352Kq4MAoGCCqGSM49BAMCMIGwMQswCQYDVQQG - EwJVUzETMBEGA1UECAwKV2FzaGluZ3RvbjERMA8GA1UEBwwIS2lya2xhbmQxFTAT - BgNVBAoMDEdvb2dsZSwgSW5jLjEeMBwGA1UECwwVR29vZ2xlIENsb3VkIFBsYXRm - b3JtMR8wHQYDVQQDDBZ3d3cubXktc2VjdXJlLXNpdGUuY29tMSEwHwYJKoZIhvcN - AQkBFhJuZWxzb25hQGdvb2dsZS5jb20wHhcNMTcwNjI4MDQ1NjI2WhcNMjcwNjI2 - MDQ1NjI2WjCBsDELMAkGA1UEBhMCVVMxEzARBgNVBAgMCldhc2hpbmd0b24xETAP - BgNVBAcMCEtpcmtsYW5kMRUwEwYDVQQKDAxHb29nbGUsIEluYy4xHjAcBgNVBAsM - FUdvb2dsZSBDbG91ZCBQbGF0Zm9ybTEfMB0GA1UEAwwWd3d3Lm15LXNlY3VyZS1z - aXRlLmNvbTEhMB8GCSqGSIb3DQEJARYSbmVsc29uYUBnb29nbGUuY29tMFkwEwYH - KoZIzj0CAQYIKoZIzj0DAQcDQgAEHGzpcRJ4XzfBJCCPMQeXQpTXwlblimODQCuQ - 4mzkzTv0dXyB750fOGN02HtkpBOZzzvUARTR10JQoSe2/5PIwaNQME4wHQYDVR0O - BBYEFKIQC3A2SDpxcdfn0YLKineDNq/BMB8GA1UdIwQYMBaAFKIQC3A2SDpxcdfn - 0YLKineDNq/BMAwGA1UdEwQFMAMBAf8wCgYIKoZIzj0EAwIDSQAwRgIhALs4vy+O - M3jcqgA4fSW/oKw6UJxp+M6a+nGMX+UJR3YgAiEAvvl39QRVAiv84hdoCuyON0lJ - zqGNhIPGq2ULqXKK8BY= - -----END CERTIFICATE----- - private_key: | - -----BEGIN EC PRIVATE KEY----- - MHcCAQEEIObtRo8tkUqoMjeHhsOh2ouPpXCgBcP+EDxZCB/tws15oAoGCCqGSM49 - AwEHoUQDQgAEHGzpcRJ4XzfBJCCPMQeXQpTXwlblimODQCuQ4mzkzTv0dXyB750f - OGN02HtkpBOZzzvUARTR10JQoSe2/5PIwQ== - -----END EC PRIVATE KEY----- - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: sslcert-targethttpsproxy + description: A certificate for testing. Do not use this certificate in production + certificate: "-----BEGIN CERTIFICATE----- MIICqjCCAk+gAwIBAgIJAIuJ+0352Kq4MAoGCCqGSM49BAMCMIGwMQswCQYDVQQG + EwJVUzETMBEGA1UECAwKV2FzaGluZ3RvbjERMA8GA1UEBwwIS2lya2xhbmQxFTAT BgNVBAoMDEdvb2dsZSwgSW5jLjEeMBwGA1UECwwVR29vZ2xlIENsb3VkIFBsYXRm + b3JtMR8wHQYDVQQDDBZ3d3cubXktc2VjdXJlLXNpdGUuY29tMSEwHwYJKoZIhvcN AQkBFhJuZWxzb25hQGdvb2dsZS5jb20wHhcNMTcwNjI4MDQ1NjI2WhcNMjcwNjI2 + MDQ1NjI2WjCBsDELMAkGA1UEBhMCVVMxEzARBgNVBAgMCldhc2hpbmd0b24xETAP BgNVBAcMCEtpcmtsYW5kMRUwEwYDVQQKDAxHb29nbGUsIEluYy4xHjAcBgNVBAsM + FUdvb2dsZSBDbG91ZCBQbGF0Zm9ybTEfMB0GA1UEAwwWd3d3Lm15LXNlY3VyZS1z aXRlLmNvbTEhMB8GCSqGSIb3DQEJARYSbmVsc29uYUBnb29nbGUuY29tMFkwEwYH + KoZIzj0CAQYIKoZIzj0DAQcDQgAEHGzpcRJ4XzfBJCCPMQeXQpTXwlblimODQCuQ 4mzkzTv0dXyB750fOGN02HtkpBOZzzvUARTR10JQoSe2/5PIwaNQME4wHQYDVR0O + BBYEFKIQC3A2SDpxcdfn0YLKineDNq/BMB8GA1UdIwQYMBaAFKIQC3A2SDpxcdfn 0YLKineDNq/BMAwGA1UdEwQFMAMBAf8wCgYIKoZIzj0EAwIDSQAwRgIhALs4vy+O + M3jcqgA4fSW/oKw6UJxp+M6a+nGMX+UJR3YgAiEAvvl39QRVAiv84hdoCuyON0lJ zqGNhIPGq2ULqXKK8BY= + -----END CERTIFICATE-----" + private_key: "-----BEGIN EC PRIVATE KEY----- MHcCAQEEIObtRo8tkUqoMjeHhsOh2ouPpXCgBcP+EDxZCB/tws15oAoGCCqGSM49 + AwEHoUQDQgAEHGzpcRJ4XzfBJCCPMQeXQpTXwlblimODQCuQ4mzkzTv0dXyB750f OGN02HtkpBOZzzvUARTR10JQoSe2/5PIwQ== + -----END EC PRIVATE KEY-----" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: sslcert - name: delete a target https proxy gcp_compute_target_https_proxy: - name: "{{ resource_name }}" - ssl_certificates: - - "{{ sslcert }}" - url_map: "{{ urlmap }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + name: "{{ resource_name }}" + ssl_certificates: + - "{{ sslcert }}" + url_map: "{{ urlmap }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent #---------------------------------------------------------- - name: create a target https proxy gcp_compute_target_https_proxy: - name: "{{ resource_name }}" - ssl_certificates: - - "{{ sslcert }}" - url_map: "{{ urlmap }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: "{{ resource_name }}" + ssl_certificates: + - "{{ sslcert }}" + url_map: "{{ urlmap }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: result - name: assert changed is true assert: @@ -133,14 +121,14 @@ # ---------------------------------------------------------------------------- - name: create a target https proxy that already exists gcp_compute_target_https_proxy: - name: "{{ resource_name }}" - ssl_certificates: - - "{{ sslcert }}" - url_map: "{{ urlmap }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: "{{ resource_name }}" + ssl_certificates: + - "{{ sslcert }}" + url_map: "{{ urlmap }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: result - name: assert changed is false assert: @@ -150,14 +138,14 @@ #---------------------------------------------------------- - name: delete a target https proxy gcp_compute_target_https_proxy: - name: "{{ resource_name }}" - ssl_certificates: - - "{{ sslcert }}" - url_map: "{{ urlmap }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + name: "{{ resource_name }}" + ssl_certificates: + - "{{ sslcert }}" + url_map: "{{ urlmap }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent register: result - name: assert changed is true assert: @@ -181,14 +169,14 @@ # ---------------------------------------------------------------------------- - name: delete a target https proxy that does not exist gcp_compute_target_https_proxy: - name: "{{ resource_name }}" - ssl_certificates: - - "{{ sslcert }}" - url_map: "{{ urlmap }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + name: "{{ resource_name }}" + ssl_certificates: + - "{{ sslcert }}" + url_map: "{{ urlmap }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent register: result - name: assert changed is false assert: @@ -200,82 +188,70 @@ # If errors happen, don't crash the playbook! - name: delete a ssl certificate gcp_compute_ssl_certificate: - name: "sslcert-targethttpsproxy" - description: A certificate for testing. Do not use this certificate in production - certificate: | - -----BEGIN CERTIFICATE----- - MIICqjCCAk+gAwIBAgIJAIuJ+0352Kq4MAoGCCqGSM49BAMCMIGwMQswCQYDVQQG - EwJVUzETMBEGA1UECAwKV2FzaGluZ3RvbjERMA8GA1UEBwwIS2lya2xhbmQxFTAT - BgNVBAoMDEdvb2dsZSwgSW5jLjEeMBwGA1UECwwVR29vZ2xlIENsb3VkIFBsYXRm - b3JtMR8wHQYDVQQDDBZ3d3cubXktc2VjdXJlLXNpdGUuY29tMSEwHwYJKoZIhvcN - AQkBFhJuZWxzb25hQGdvb2dsZS5jb20wHhcNMTcwNjI4MDQ1NjI2WhcNMjcwNjI2 - MDQ1NjI2WjCBsDELMAkGA1UEBhMCVVMxEzARBgNVBAgMCldhc2hpbmd0b24xETAP - BgNVBAcMCEtpcmtsYW5kMRUwEwYDVQQKDAxHb29nbGUsIEluYy4xHjAcBgNVBAsM - FUdvb2dsZSBDbG91ZCBQbGF0Zm9ybTEfMB0GA1UEAwwWd3d3Lm15LXNlY3VyZS1z - aXRlLmNvbTEhMB8GCSqGSIb3DQEJARYSbmVsc29uYUBnb29nbGUuY29tMFkwEwYH - KoZIzj0CAQYIKoZIzj0DAQcDQgAEHGzpcRJ4XzfBJCCPMQeXQpTXwlblimODQCuQ - 4mzkzTv0dXyB750fOGN02HtkpBOZzzvUARTR10JQoSe2/5PIwaNQME4wHQYDVR0O - BBYEFKIQC3A2SDpxcdfn0YLKineDNq/BMB8GA1UdIwQYMBaAFKIQC3A2SDpxcdfn - 0YLKineDNq/BMAwGA1UdEwQFMAMBAf8wCgYIKoZIzj0EAwIDSQAwRgIhALs4vy+O - M3jcqgA4fSW/oKw6UJxp+M6a+nGMX+UJR3YgAiEAvvl39QRVAiv84hdoCuyON0lJ - zqGNhIPGq2ULqXKK8BY= - -----END CERTIFICATE----- - private_key: | - -----BEGIN EC PRIVATE KEY----- - MHcCAQEEIObtRo8tkUqoMjeHhsOh2ouPpXCgBcP+EDxZCB/tws15oAoGCCqGSM49 - AwEHoUQDQgAEHGzpcRJ4XzfBJCCPMQeXQpTXwlblimODQCuQ4mzkzTv0dXyB750f - OGN02HtkpBOZzzvUARTR10JQoSe2/5PIwQ== - -----END EC PRIVATE KEY----- - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + name: sslcert-targethttpsproxy + description: A certificate for testing. Do not use this certificate in production + certificate: "-----BEGIN CERTIFICATE----- MIICqjCCAk+gAwIBAgIJAIuJ+0352Kq4MAoGCCqGSM49BAMCMIGwMQswCQYDVQQG + EwJVUzETMBEGA1UECAwKV2FzaGluZ3RvbjERMA8GA1UEBwwIS2lya2xhbmQxFTAT BgNVBAoMDEdvb2dsZSwgSW5jLjEeMBwGA1UECwwVR29vZ2xlIENsb3VkIFBsYXRm + b3JtMR8wHQYDVQQDDBZ3d3cubXktc2VjdXJlLXNpdGUuY29tMSEwHwYJKoZIhvcN AQkBFhJuZWxzb25hQGdvb2dsZS5jb20wHhcNMTcwNjI4MDQ1NjI2WhcNMjcwNjI2 + MDQ1NjI2WjCBsDELMAkGA1UEBhMCVVMxEzARBgNVBAgMCldhc2hpbmd0b24xETAP BgNVBAcMCEtpcmtsYW5kMRUwEwYDVQQKDAxHb29nbGUsIEluYy4xHjAcBgNVBAsM + FUdvb2dsZSBDbG91ZCBQbGF0Zm9ybTEfMB0GA1UEAwwWd3d3Lm15LXNlY3VyZS1z aXRlLmNvbTEhMB8GCSqGSIb3DQEJARYSbmVsc29uYUBnb29nbGUuY29tMFkwEwYH + KoZIzj0CAQYIKoZIzj0DAQcDQgAEHGzpcRJ4XzfBJCCPMQeXQpTXwlblimODQCuQ 4mzkzTv0dXyB750fOGN02HtkpBOZzzvUARTR10JQoSe2/5PIwaNQME4wHQYDVR0O + BBYEFKIQC3A2SDpxcdfn0YLKineDNq/BMB8GA1UdIwQYMBaAFKIQC3A2SDpxcdfn 0YLKineDNq/BMAwGA1UdEwQFMAMBAf8wCgYIKoZIzj0EAwIDSQAwRgIhALs4vy+O + M3jcqgA4fSW/oKw6UJxp+M6a+nGMX+UJR3YgAiEAvvl39QRVAiv84hdoCuyON0lJ zqGNhIPGq2ULqXKK8BY= + -----END CERTIFICATE-----" + private_key: "-----BEGIN EC PRIVATE KEY----- MHcCAQEEIObtRo8tkUqoMjeHhsOh2ouPpXCgBcP+EDxZCB/tws15oAoGCCqGSM49 + AwEHoUQDQgAEHGzpcRJ4XzfBJCCPMQeXQpTXwlblimODQCuQ4mzkzTv0dXyB750f OGN02HtkpBOZzzvUARTR10JQoSe2/5PIwQ== + -----END EC PRIVATE KEY-----" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent register: sslcert ignore_errors: true - name: delete a url map gcp_compute_url_map: - name: "urlmap-targethttpsproxy" - default_service: "{{ backendservice }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + name: urlmap-targethttpsproxy + default_service: "{{ backendservice }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent register: urlmap ignore_errors: true - name: delete a backend service gcp_compute_backend_service: - name: "backendservice-targethttpsproxy" - 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 + name: backendservice-targethttpsproxy + 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 register: backendservice ignore_errors: true - name: delete a http health check gcp_compute_http_health_check: - name: "httphealthcheck-targethttpsproxy" - healthy_threshold: 10 - port: 8080 - timeout_sec: 2 - unhealthy_threshold: 5 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + name: httphealthcheck-targethttpsproxy + healthy_threshold: 10 + port: 8080 + timeout_sec: 2 + unhealthy_threshold: 5 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent register: healthcheck ignore_errors: true - name: delete a instance group gcp_compute_instance_group: - name: "instancegroup-targethttpsproxy" - zone: us-central1-a - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + name: instancegroup-targethttpsproxy + zone: us-central1-a + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent register: instancegroup ignore_errors: true diff --git a/test/integration/targets/gcp_compute_target_pool/tasks/main.yml b/test/integration/targets/gcp_compute_target_pool/tasks/main.yml index e08b6f55856969..e829539097c332 100644 --- a/test/integration/targets/gcp_compute_target_pool/tasks/main.yml +++ b/test/integration/targets/gcp_compute_target_pool/tasks/main.yml @@ -15,21 +15,21 @@ # Pre-test setup - name: delete a target pool gcp_compute_target_pool: - name: "{{ resource_name }}" - region: us-west1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + name: "{{ resource_name }}" + region: us-west1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent #---------------------------------------------------------- - name: create a target pool gcp_compute_target_pool: - name: "{{ resource_name }}" - region: us-west1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: "{{ resource_name }}" + region: us-west1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: result - name: assert changed is true assert: @@ -54,12 +54,12 @@ # ---------------------------------------------------------------------------- - name: create a target pool that already exists gcp_compute_target_pool: - name: "{{ resource_name }}" - region: us-west1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: "{{ resource_name }}" + region: us-west1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: result - name: assert changed is false assert: @@ -69,12 +69,12 @@ #---------------------------------------------------------- - name: delete a target pool gcp_compute_target_pool: - name: "{{ resource_name }}" - region: us-west1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + name: "{{ resource_name }}" + region: us-west1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent register: result - name: assert changed is true assert: @@ -99,12 +99,12 @@ # ---------------------------------------------------------------------------- - name: delete a target pool that does not exist gcp_compute_target_pool: - name: "{{ resource_name }}" - region: us-west1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + name: "{{ resource_name }}" + region: us-west1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent register: result - name: assert changed is false assert: diff --git a/test/integration/targets/gcp_compute_target_ssl_proxy/tasks/main.yml b/test/integration/targets/gcp_compute_target_ssl_proxy/tasks/main.yml index f2b14904a20b66..915789b16971a2 100644 --- a/test/integration/targets/gcp_compute_target_ssl_proxy/tasks/main.yml +++ b/test/integration/targets/gcp_compute_target_ssl_proxy/tasks/main.yml @@ -15,96 +15,84 @@ # Pre-test setup - name: create a instance group gcp_compute_instance_group: - name: "instancegroup-targetsslproxy" - zone: us-central1-a - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: instancegroup-targetsslproxy + zone: us-central1-a + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: instancegroup - name: create a health check gcp_compute_health_check: - name: "healthcheck-targetsslproxy" - type: TCP - tcp_health_check: - port_name: service-health - request: ping - response: pong - healthy_threshold: 10 - timeout_sec: 2 - unhealthy_threshold: 5 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: healthcheck-targetsslproxy + type: TCP + tcp_health_check: + port_name: service-health + request: ping + response: pong + healthy_threshold: 10 + timeout_sec: 2 + unhealthy_threshold: 5 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: healthcheck - name: create a backend service gcp_compute_backend_service: - name: "backendservice-targetsslproxy" - backends: - - group: "{{ instancegroup }}" - health_checks: - - "{{ healthcheck.selfLink }}" - protocol: SSL - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: backendservice-targetsslproxy + backends: + - group: "{{ instancegroup }}" + health_checks: + - "{{ healthcheck.selfLink }}" + protocol: SSL + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: backendservice - name: create a ssl certificate gcp_compute_ssl_certificate: - name: "sslcert-targetsslproxy" - description: A certificate for testing. Do not use this certificate in production - certificate: | - -----BEGIN CERTIFICATE----- - MIICqjCCAk+gAwIBAgIJAIuJ+0352Kq4MAoGCCqGSM49BAMCMIGwMQswCQYDVQQG - EwJVUzETMBEGA1UECAwKV2FzaGluZ3RvbjERMA8GA1UEBwwIS2lya2xhbmQxFTAT - BgNVBAoMDEdvb2dsZSwgSW5jLjEeMBwGA1UECwwVR29vZ2xlIENsb3VkIFBsYXRm - b3JtMR8wHQYDVQQDDBZ3d3cubXktc2VjdXJlLXNpdGUuY29tMSEwHwYJKoZIhvcN - AQkBFhJuZWxzb25hQGdvb2dsZS5jb20wHhcNMTcwNjI4MDQ1NjI2WhcNMjcwNjI2 - MDQ1NjI2WjCBsDELMAkGA1UEBhMCVVMxEzARBgNVBAgMCldhc2hpbmd0b24xETAP - BgNVBAcMCEtpcmtsYW5kMRUwEwYDVQQKDAxHb29nbGUsIEluYy4xHjAcBgNVBAsM - FUdvb2dsZSBDbG91ZCBQbGF0Zm9ybTEfMB0GA1UEAwwWd3d3Lm15LXNlY3VyZS1z - aXRlLmNvbTEhMB8GCSqGSIb3DQEJARYSbmVsc29uYUBnb29nbGUuY29tMFkwEwYH - KoZIzj0CAQYIKoZIzj0DAQcDQgAEHGzpcRJ4XzfBJCCPMQeXQpTXwlblimODQCuQ - 4mzkzTv0dXyB750fOGN02HtkpBOZzzvUARTR10JQoSe2/5PIwaNQME4wHQYDVR0O - BBYEFKIQC3A2SDpxcdfn0YLKineDNq/BMB8GA1UdIwQYMBaAFKIQC3A2SDpxcdfn - 0YLKineDNq/BMAwGA1UdEwQFMAMBAf8wCgYIKoZIzj0EAwIDSQAwRgIhALs4vy+O - M3jcqgA4fSW/oKw6UJxp+M6a+nGMX+UJR3YgAiEAvvl39QRVAiv84hdoCuyON0lJ - zqGNhIPGq2ULqXKK8BY= - -----END CERTIFICATE----- - private_key: | - -----BEGIN EC PRIVATE KEY----- - MHcCAQEEIObtRo8tkUqoMjeHhsOh2ouPpXCgBcP+EDxZCB/tws15oAoGCCqGSM49 - AwEHoUQDQgAEHGzpcRJ4XzfBJCCPMQeXQpTXwlblimODQCuQ4mzkzTv0dXyB750f - OGN02HtkpBOZzzvUARTR10JQoSe2/5PIwQ== - -----END EC PRIVATE KEY----- - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: sslcert-targetsslproxy + description: A certificate for testing. Do not use this certificate in production + certificate: "-----BEGIN CERTIFICATE----- MIICqjCCAk+gAwIBAgIJAIuJ+0352Kq4MAoGCCqGSM49BAMCMIGwMQswCQYDVQQG + EwJVUzETMBEGA1UECAwKV2FzaGluZ3RvbjERMA8GA1UEBwwIS2lya2xhbmQxFTAT BgNVBAoMDEdvb2dsZSwgSW5jLjEeMBwGA1UECwwVR29vZ2xlIENsb3VkIFBsYXRm + b3JtMR8wHQYDVQQDDBZ3d3cubXktc2VjdXJlLXNpdGUuY29tMSEwHwYJKoZIhvcN AQkBFhJuZWxzb25hQGdvb2dsZS5jb20wHhcNMTcwNjI4MDQ1NjI2WhcNMjcwNjI2 + MDQ1NjI2WjCBsDELMAkGA1UEBhMCVVMxEzARBgNVBAgMCldhc2hpbmd0b24xETAP BgNVBAcMCEtpcmtsYW5kMRUwEwYDVQQKDAxHb29nbGUsIEluYy4xHjAcBgNVBAsM + FUdvb2dsZSBDbG91ZCBQbGF0Zm9ybTEfMB0GA1UEAwwWd3d3Lm15LXNlY3VyZS1z aXRlLmNvbTEhMB8GCSqGSIb3DQEJARYSbmVsc29uYUBnb29nbGUuY29tMFkwEwYH + KoZIzj0CAQYIKoZIzj0DAQcDQgAEHGzpcRJ4XzfBJCCPMQeXQpTXwlblimODQCuQ 4mzkzTv0dXyB750fOGN02HtkpBOZzzvUARTR10JQoSe2/5PIwaNQME4wHQYDVR0O + BBYEFKIQC3A2SDpxcdfn0YLKineDNq/BMB8GA1UdIwQYMBaAFKIQC3A2SDpxcdfn 0YLKineDNq/BMAwGA1UdEwQFMAMBAf8wCgYIKoZIzj0EAwIDSQAwRgIhALs4vy+O + M3jcqgA4fSW/oKw6UJxp+M6a+nGMX+UJR3YgAiEAvvl39QRVAiv84hdoCuyON0lJ zqGNhIPGq2ULqXKK8BY= + -----END CERTIFICATE-----" + private_key: "-----BEGIN EC PRIVATE KEY----- MHcCAQEEIObtRo8tkUqoMjeHhsOh2ouPpXCgBcP+EDxZCB/tws15oAoGCCqGSM49 + AwEHoUQDQgAEHGzpcRJ4XzfBJCCPMQeXQpTXwlblimODQCuQ4mzkzTv0dXyB750f OGN02HtkpBOZzzvUARTR10JQoSe2/5PIwQ== + -----END EC PRIVATE KEY-----" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: sslcert - name: delete a target ssl proxy gcp_compute_target_ssl_proxy: - name: "{{ resource_name }}" - ssl_certificates: - - "{{ sslcert }}" - service: "{{ backendservice }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + name: "{{ resource_name }}" + ssl_certificates: + - "{{ sslcert }}" + service: "{{ backendservice }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent #---------------------------------------------------------- - name: create a target ssl proxy gcp_compute_target_ssl_proxy: - name: "{{ resource_name }}" - ssl_certificates: - - "{{ sslcert }}" - service: "{{ backendservice }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: "{{ resource_name }}" + ssl_certificates: + - "{{ sslcert }}" + service: "{{ backendservice }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: result - name: assert changed is true assert: @@ -128,14 +116,14 @@ # ---------------------------------------------------------------------------- - name: create a target ssl proxy that already exists gcp_compute_target_ssl_proxy: - name: "{{ resource_name }}" - ssl_certificates: - - "{{ sslcert }}" - service: "{{ backendservice }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: "{{ resource_name }}" + ssl_certificates: + - "{{ sslcert }}" + service: "{{ backendservice }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: result - name: assert changed is false assert: @@ -145,14 +133,14 @@ #---------------------------------------------------------- - name: delete a target ssl proxy gcp_compute_target_ssl_proxy: - name: "{{ resource_name }}" - ssl_certificates: - - "{{ sslcert }}" - service: "{{ backendservice }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + name: "{{ resource_name }}" + ssl_certificates: + - "{{ sslcert }}" + service: "{{ backendservice }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent register: result - name: assert changed is true assert: @@ -176,14 +164,14 @@ # ---------------------------------------------------------------------------- - name: delete a target ssl proxy that does not exist gcp_compute_target_ssl_proxy: - name: "{{ resource_name }}" - ssl_certificates: - - "{{ sslcert }}" - service: "{{ backendservice }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + name: "{{ resource_name }}" + ssl_certificates: + - "{{ sslcert }}" + service: "{{ backendservice }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent register: result - name: assert changed is false assert: @@ -195,76 +183,64 @@ # If errors happen, don't crash the playbook! - name: delete a ssl certificate gcp_compute_ssl_certificate: - name: "sslcert-targetsslproxy" - description: A certificate for testing. Do not use this certificate in production - certificate: | - -----BEGIN CERTIFICATE----- - MIICqjCCAk+gAwIBAgIJAIuJ+0352Kq4MAoGCCqGSM49BAMCMIGwMQswCQYDVQQG - EwJVUzETMBEGA1UECAwKV2FzaGluZ3RvbjERMA8GA1UEBwwIS2lya2xhbmQxFTAT - BgNVBAoMDEdvb2dsZSwgSW5jLjEeMBwGA1UECwwVR29vZ2xlIENsb3VkIFBsYXRm - b3JtMR8wHQYDVQQDDBZ3d3cubXktc2VjdXJlLXNpdGUuY29tMSEwHwYJKoZIhvcN - AQkBFhJuZWxzb25hQGdvb2dsZS5jb20wHhcNMTcwNjI4MDQ1NjI2WhcNMjcwNjI2 - MDQ1NjI2WjCBsDELMAkGA1UEBhMCVVMxEzARBgNVBAgMCldhc2hpbmd0b24xETAP - BgNVBAcMCEtpcmtsYW5kMRUwEwYDVQQKDAxHb29nbGUsIEluYy4xHjAcBgNVBAsM - FUdvb2dsZSBDbG91ZCBQbGF0Zm9ybTEfMB0GA1UEAwwWd3d3Lm15LXNlY3VyZS1z - aXRlLmNvbTEhMB8GCSqGSIb3DQEJARYSbmVsc29uYUBnb29nbGUuY29tMFkwEwYH - KoZIzj0CAQYIKoZIzj0DAQcDQgAEHGzpcRJ4XzfBJCCPMQeXQpTXwlblimODQCuQ - 4mzkzTv0dXyB750fOGN02HtkpBOZzzvUARTR10JQoSe2/5PIwaNQME4wHQYDVR0O - BBYEFKIQC3A2SDpxcdfn0YLKineDNq/BMB8GA1UdIwQYMBaAFKIQC3A2SDpxcdfn - 0YLKineDNq/BMAwGA1UdEwQFMAMBAf8wCgYIKoZIzj0EAwIDSQAwRgIhALs4vy+O - M3jcqgA4fSW/oKw6UJxp+M6a+nGMX+UJR3YgAiEAvvl39QRVAiv84hdoCuyON0lJ - zqGNhIPGq2ULqXKK8BY= - -----END CERTIFICATE----- - private_key: | - -----BEGIN EC PRIVATE KEY----- - MHcCAQEEIObtRo8tkUqoMjeHhsOh2ouPpXCgBcP+EDxZCB/tws15oAoGCCqGSM49 - AwEHoUQDQgAEHGzpcRJ4XzfBJCCPMQeXQpTXwlblimODQCuQ4mzkzTv0dXyB750f - OGN02HtkpBOZzzvUARTR10JQoSe2/5PIwQ== - -----END EC PRIVATE KEY----- - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + name: sslcert-targetsslproxy + description: A certificate for testing. Do not use this certificate in production + certificate: "-----BEGIN CERTIFICATE----- MIICqjCCAk+gAwIBAgIJAIuJ+0352Kq4MAoGCCqGSM49BAMCMIGwMQswCQYDVQQG + EwJVUzETMBEGA1UECAwKV2FzaGluZ3RvbjERMA8GA1UEBwwIS2lya2xhbmQxFTAT BgNVBAoMDEdvb2dsZSwgSW5jLjEeMBwGA1UECwwVR29vZ2xlIENsb3VkIFBsYXRm + b3JtMR8wHQYDVQQDDBZ3d3cubXktc2VjdXJlLXNpdGUuY29tMSEwHwYJKoZIhvcN AQkBFhJuZWxzb25hQGdvb2dsZS5jb20wHhcNMTcwNjI4MDQ1NjI2WhcNMjcwNjI2 + MDQ1NjI2WjCBsDELMAkGA1UEBhMCVVMxEzARBgNVBAgMCldhc2hpbmd0b24xETAP BgNVBAcMCEtpcmtsYW5kMRUwEwYDVQQKDAxHb29nbGUsIEluYy4xHjAcBgNVBAsM + FUdvb2dsZSBDbG91ZCBQbGF0Zm9ybTEfMB0GA1UEAwwWd3d3Lm15LXNlY3VyZS1z aXRlLmNvbTEhMB8GCSqGSIb3DQEJARYSbmVsc29uYUBnb29nbGUuY29tMFkwEwYH + KoZIzj0CAQYIKoZIzj0DAQcDQgAEHGzpcRJ4XzfBJCCPMQeXQpTXwlblimODQCuQ 4mzkzTv0dXyB750fOGN02HtkpBOZzzvUARTR10JQoSe2/5PIwaNQME4wHQYDVR0O + BBYEFKIQC3A2SDpxcdfn0YLKineDNq/BMB8GA1UdIwQYMBaAFKIQC3A2SDpxcdfn 0YLKineDNq/BMAwGA1UdEwQFMAMBAf8wCgYIKoZIzj0EAwIDSQAwRgIhALs4vy+O + M3jcqgA4fSW/oKw6UJxp+M6a+nGMX+UJR3YgAiEAvvl39QRVAiv84hdoCuyON0lJ zqGNhIPGq2ULqXKK8BY= + -----END CERTIFICATE-----" + private_key: "-----BEGIN EC PRIVATE KEY----- MHcCAQEEIObtRo8tkUqoMjeHhsOh2ouPpXCgBcP+EDxZCB/tws15oAoGCCqGSM49 + AwEHoUQDQgAEHGzpcRJ4XzfBJCCPMQeXQpTXwlblimODQCuQ4mzkzTv0dXyB750f OGN02HtkpBOZzzvUARTR10JQoSe2/5PIwQ== + -----END EC PRIVATE KEY-----" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent register: sslcert ignore_errors: true - name: delete a backend service gcp_compute_backend_service: - name: "backendservice-targetsslproxy" - backends: - - group: "{{ instancegroup }}" - health_checks: - - "{{ healthcheck.selfLink }}" - protocol: SSL - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + name: backendservice-targetsslproxy + backends: + - group: "{{ instancegroup }}" + health_checks: + - "{{ healthcheck.selfLink }}" + protocol: SSL + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent register: backendservice ignore_errors: true - name: delete a health check gcp_compute_health_check: - name: "healthcheck-targetsslproxy" - type: TCP - tcp_health_check: - port_name: service-health - request: ping - response: pong - healthy_threshold: 10 - timeout_sec: 2 - unhealthy_threshold: 5 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + name: healthcheck-targetsslproxy + type: TCP + tcp_health_check: + port_name: service-health + request: ping + response: pong + healthy_threshold: 10 + timeout_sec: 2 + unhealthy_threshold: 5 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent register: healthcheck ignore_errors: true - name: delete a instance group gcp_compute_instance_group: - name: "instancegroup-targetsslproxy" - zone: us-central1-a - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + name: instancegroup-targetsslproxy + zone: us-central1-a + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent register: instancegroup ignore_errors: true diff --git a/test/integration/targets/gcp_compute_target_tcp_proxy/tasks/main.yml b/test/integration/targets/gcp_compute_target_tcp_proxy/tasks/main.yml index e057e090a70dac..0cfb6a319ef78c 100644 --- a/test/integration/targets/gcp_compute_target_tcp_proxy/tasks/main.yml +++ b/test/integration/targets/gcp_compute_target_tcp_proxy/tasks/main.yml @@ -15,61 +15,61 @@ # Pre-test setup - name: create a instance group gcp_compute_instance_group: - name: "instancegroup-targettcpproxy" - zone: us-central1-a - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: instancegroup-targettcpproxy + zone: us-central1-a + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: instancegroup - name: create a health check gcp_compute_health_check: - name: "healthcheck-targettcpproxy" - type: TCP - tcp_health_check: - port_name: service-health - request: ping - response: pong - healthy_threshold: 10 - timeout_sec: 2 - unhealthy_threshold: 5 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: healthcheck-targettcpproxy + type: TCP + tcp_health_check: + port_name: service-health + request: ping + response: pong + healthy_threshold: 10 + timeout_sec: 2 + unhealthy_threshold: 5 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: healthcheck - name: create a backend service gcp_compute_backend_service: - name: "backendservice-targettcpproxy" - backends: - - group: "{{ instancegroup }}" - health_checks: - - "{{ healthcheck.selfLink }}" - protocol: TCP - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: backendservice-targettcpproxy + backends: + - group: "{{ instancegroup }}" + health_checks: + - "{{ healthcheck.selfLink }}" + protocol: TCP + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: backendservice - name: delete a target tcp proxy gcp_compute_target_tcp_proxy: - name: "{{ resource_name }}" - proxy_header: PROXY_V1 - service: "{{ backendservice }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + name: "{{ resource_name }}" + proxy_header: PROXY_V1 + service: "{{ backendservice }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent #---------------------------------------------------------- - name: create a target tcp proxy gcp_compute_target_tcp_proxy: - name: "{{ resource_name }}" - proxy_header: PROXY_V1 - service: "{{ backendservice }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: "{{ resource_name }}" + proxy_header: PROXY_V1 + service: "{{ backendservice }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: result - name: assert changed is true assert: @@ -93,13 +93,13 @@ # ---------------------------------------------------------------------------- - name: create a target tcp proxy that already exists gcp_compute_target_tcp_proxy: - name: "{{ resource_name }}" - proxy_header: PROXY_V1 - service: "{{ backendservice }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: "{{ resource_name }}" + proxy_header: PROXY_V1 + service: "{{ backendservice }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: result - name: assert changed is false assert: @@ -109,13 +109,13 @@ #---------------------------------------------------------- - name: delete a target tcp proxy gcp_compute_target_tcp_proxy: - name: "{{ resource_name }}" - proxy_header: PROXY_V1 - service: "{{ backendservice }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + name: "{{ resource_name }}" + proxy_header: PROXY_V1 + service: "{{ backendservice }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent register: result - name: assert changed is true assert: @@ -139,13 +139,13 @@ # ---------------------------------------------------------------------------- - name: delete a target tcp proxy that does not exist gcp_compute_target_tcp_proxy: - name: "{{ resource_name }}" - proxy_header: PROXY_V1 - service: "{{ backendservice }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + name: "{{ resource_name }}" + proxy_header: PROXY_V1 + service: "{{ backendservice }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent register: result - name: assert changed is false assert: @@ -157,42 +157,42 @@ # If errors happen, don't crash the playbook! - name: delete a backend service gcp_compute_backend_service: - name: "backendservice-targettcpproxy" - backends: - - group: "{{ instancegroup }}" - health_checks: - - "{{ healthcheck.selfLink }}" - protocol: TCP - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + name: backendservice-targettcpproxy + backends: + - group: "{{ instancegroup }}" + health_checks: + - "{{ healthcheck.selfLink }}" + protocol: TCP + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent register: backendservice ignore_errors: true - name: delete a health check gcp_compute_health_check: - name: "healthcheck-targettcpproxy" - type: TCP - tcp_health_check: - port_name: service-health - request: ping - response: pong - healthy_threshold: 10 - timeout_sec: 2 - unhealthy_threshold: 5 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + name: healthcheck-targettcpproxy + type: TCP + tcp_health_check: + port_name: service-health + request: ping + response: pong + healthy_threshold: 10 + timeout_sec: 2 + unhealthy_threshold: 5 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent register: healthcheck ignore_errors: true - name: delete a instance group gcp_compute_instance_group: - name: "instancegroup-targettcpproxy" - zone: us-central1-a - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + name: instancegroup-targettcpproxy + zone: us-central1-a + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent register: instancegroup ignore_errors: true diff --git a/test/integration/targets/gcp_compute_target_vpn_gateway/tasks/main.yml b/test/integration/targets/gcp_compute_target_vpn_gateway/tasks/main.yml index ed7d69449f4ccb..a94f0585e708e3 100644 --- a/test/integration/targets/gcp_compute_target_vpn_gateway/tasks/main.yml +++ b/test/integration/targets/gcp_compute_target_vpn_gateway/tasks/main.yml @@ -15,40 +15,40 @@ # Pre-test setup - name: create a address gcp_compute_address: - name: "address-vpngateway" - region: us-west1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: address-vpngateway + region: us-west1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: address - name: create a network gcp_compute_network: - name: "network-vpngateway" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: network-vpngateway + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: network - name: delete a target vpn gateway gcp_compute_target_vpn_gateway: - name: "{{ resource_name }}" - region: us-west1 - network: "{{ network }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + name: "{{ resource_name }}" + region: us-west1 + network: "{{ network }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent #---------------------------------------------------------- - name: create a target vpn gateway gcp_compute_target_vpn_gateway: - name: "{{ resource_name }}" - region: us-west1 - network: "{{ network }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: "{{ resource_name }}" + region: us-west1 + network: "{{ network }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: result - name: assert changed is true assert: @@ -73,13 +73,13 @@ # ---------------------------------------------------------------------------- - name: create a target vpn gateway that already exists gcp_compute_target_vpn_gateway: - name: "{{ resource_name }}" - region: us-west1 - network: "{{ network }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: "{{ resource_name }}" + region: us-west1 + network: "{{ network }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: result - name: assert changed is false assert: @@ -89,13 +89,13 @@ #---------------------------------------------------------- - name: delete a target vpn gateway gcp_compute_target_vpn_gateway: - name: "{{ resource_name }}" - region: us-west1 - network: "{{ network }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + name: "{{ resource_name }}" + region: us-west1 + network: "{{ network }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent register: result - name: assert changed is true assert: @@ -120,13 +120,13 @@ # ---------------------------------------------------------------------------- - name: delete a target vpn gateway that does not exist gcp_compute_target_vpn_gateway: - name: "{{ resource_name }}" - region: us-west1 - network: "{{ network }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + name: "{{ resource_name }}" + region: us-west1 + network: "{{ network }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent register: result - name: assert changed is false assert: @@ -138,20 +138,20 @@ # If errors happen, don't crash the playbook! - name: delete a network gcp_compute_network: - name: "network-vpngateway" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + name: network-vpngateway + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent register: network ignore_errors: true - name: delete a address gcp_compute_address: - name: "address-vpngateway" - region: us-west1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + name: address-vpngateway + region: us-west1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent register: address ignore_errors: true diff --git a/test/integration/targets/gcp_compute_url_map/tasks/main.yml b/test/integration/targets/gcp_compute_url_map/tasks/main.yml index 6e4a16f5fcae76..5bb2b2ba17eaa1 100644 --- a/test/integration/targets/gcp_compute_url_map/tasks/main.yml +++ b/test/integration/targets/gcp_compute_url_map/tasks/main.yml @@ -15,55 +15,55 @@ # Pre-test setup - name: create a instance group gcp_compute_instance_group: - name: "instancegroup-urlmap" - zone: us-central1-a - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: instancegroup-urlmap + zone: us-central1-a + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: instancegroup - name: create a http health check gcp_compute_http_health_check: - name: "httphealthcheck-urlmap" - healthy_threshold: 10 - port: 8080 - timeout_sec: 2 - unhealthy_threshold: 5 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: httphealthcheck-urlmap + healthy_threshold: 10 + port: 8080 + timeout_sec: 2 + unhealthy_threshold: 5 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: healthcheck - name: create a backend service gcp_compute_backend_service: - name: "backendservice-urlmap" - 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 + name: backendservice-urlmap + 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 register: backendservice - name: delete a url map gcp_compute_url_map: - name: "{{ resource_name }}" - default_service: "{{ backendservice }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + name: "{{ resource_name }}" + default_service: "{{ backendservice }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent #---------------------------------------------------------- - name: create a url map gcp_compute_url_map: - name: "{{ resource_name }}" - default_service: "{{ backendservice }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: "{{ resource_name }}" + default_service: "{{ backendservice }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: result - name: assert changed is true assert: @@ -87,12 +87,12 @@ # ---------------------------------------------------------------------------- - name: create a url map that already exists gcp_compute_url_map: - name: "{{ resource_name }}" - default_service: "{{ backendservice }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: "{{ resource_name }}" + default_service: "{{ backendservice }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: result - name: assert changed is false assert: @@ -102,12 +102,12 @@ #---------------------------------------------------------- - name: delete a url map gcp_compute_url_map: - name: "{{ resource_name }}" - default_service: "{{ backendservice }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + name: "{{ resource_name }}" + default_service: "{{ backendservice }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent register: result - name: assert changed is true assert: @@ -131,12 +131,12 @@ # ---------------------------------------------------------------------------- - name: delete a url map that does not exist gcp_compute_url_map: - name: "{{ resource_name }}" - default_service: "{{ backendservice }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + name: "{{ resource_name }}" + default_service: "{{ backendservice }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent register: result - name: assert changed is false assert: @@ -148,38 +148,38 @@ # If errors happen, don't crash the playbook! - name: delete a backend service gcp_compute_backend_service: - name: "backendservice-urlmap" - 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 + name: backendservice-urlmap + 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 register: backendservice ignore_errors: true - name: delete a http health check gcp_compute_http_health_check: - name: "httphealthcheck-urlmap" - healthy_threshold: 10 - port: 8080 - timeout_sec: 2 - unhealthy_threshold: 5 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + name: httphealthcheck-urlmap + healthy_threshold: 10 + port: 8080 + timeout_sec: 2 + unhealthy_threshold: 5 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent register: healthcheck ignore_errors: true - name: delete a instance group gcp_compute_instance_group: - name: "instancegroup-urlmap" - zone: us-central1-a - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + name: instancegroup-urlmap + zone: us-central1-a + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent register: instancegroup ignore_errors: true diff --git a/test/integration/targets/gcp_compute_vpn_tunnel/tasks/main.yml b/test/integration/targets/gcp_compute_vpn_tunnel/tasks/main.yml index 7cdd3de88a0a93..ffa4a266b2d8e7 100644 --- a/test/integration/targets/gcp_compute_vpn_tunnel/tasks/main.yml +++ b/test/integration/targets/gcp_compute_vpn_tunnel/tasks/main.yml @@ -15,63 +15,63 @@ # Pre-test setup - name: create a network gcp_compute_network: - name: "network-vpn-tunnel" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: network-vpn-tunnel + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: network - name: create a router gcp_compute_router: - name: "router-vpn-tunnel" - network: "{{ network }}" - bgp: - asn: 64514 - advertise_mode: CUSTOM - advertised_groups: - - ALL_SUBNETS - advertised_ip_ranges: - - range: 1.2.3.4 - - range: 6.7.0.0/16 - region: us-central1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: router-vpn-tunnel + network: "{{ network }}" + bgp: + asn: 64514 + advertise_mode: CUSTOM + advertised_groups: + - ALL_SUBNETS + advertised_ip_ranges: + - range: 1.2.3.4 + - range: 6.7.0.0/16 + region: us-central1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: router - name: create a target vpn gateway gcp_compute_target_vpn_gateway: - name: "gateway-vpn-tunnel" - region: us-west1 - network: "{{ network }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: gateway-vpn-tunnel + region: us-west1 + network: "{{ network }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: gateway - name: delete a vpn tunnel gcp_compute_vpn_tunnel: - name: "{{ resource_name }}" - region: us-west1 - target_vpn_gateway: "{{ gateway }}" - router: "{{ router }}" - shared_secret: super secret - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + name: "{{ resource_name }}" + region: us-west1 + target_vpn_gateway: "{{ gateway }}" + router: "{{ router }}" + shared_secret: super secret + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent #---------------------------------------------------------- - name: create a vpn tunnel gcp_compute_vpn_tunnel: - name: "{{ resource_name }}" - region: us-west1 - target_vpn_gateway: "{{ gateway }}" - router: "{{ router }}" - shared_secret: super secret - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: "{{ resource_name }}" + region: us-west1 + target_vpn_gateway: "{{ gateway }}" + router: "{{ router }}" + shared_secret: super secret + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: result - name: assert changed is true assert: @@ -96,15 +96,15 @@ # ---------------------------------------------------------------------------- - name: create a vpn tunnel that already exists gcp_compute_vpn_tunnel: - name: "{{ resource_name }}" - region: us-west1 - target_vpn_gateway: "{{ gateway }}" - router: "{{ router }}" - shared_secret: super secret - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: "{{ resource_name }}" + region: us-west1 + target_vpn_gateway: "{{ gateway }}" + router: "{{ router }}" + shared_secret: super secret + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: result - name: assert changed is false assert: @@ -114,15 +114,15 @@ #---------------------------------------------------------- - name: delete a vpn tunnel gcp_compute_vpn_tunnel: - name: "{{ resource_name }}" - region: us-west1 - target_vpn_gateway: "{{ gateway }}" - router: "{{ router }}" - shared_secret: super secret - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + name: "{{ resource_name }}" + region: us-west1 + target_vpn_gateway: "{{ gateway }}" + router: "{{ router }}" + shared_secret: super secret + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent register: result - name: assert changed is true assert: @@ -147,15 +147,15 @@ # ---------------------------------------------------------------------------- - name: delete a vpn tunnel that does not exist gcp_compute_vpn_tunnel: - name: "{{ resource_name }}" - region: us-west1 - target_vpn_gateway: "{{ gateway }}" - router: "{{ router }}" - shared_secret: super secret - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + name: "{{ resource_name }}" + region: us-west1 + target_vpn_gateway: "{{ gateway }}" + router: "{{ router }}" + shared_secret: super secret + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent register: result - name: assert changed is false assert: @@ -167,40 +167,40 @@ # If errors happen, don't crash the playbook! - name: delete a target vpn gateway gcp_compute_target_vpn_gateway: - name: "gateway-vpn-tunnel" - region: us-west1 - network: "{{ network }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + name: gateway-vpn-tunnel + region: us-west1 + network: "{{ network }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent register: gateway ignore_errors: true - name: delete a router gcp_compute_router: - name: "router-vpn-tunnel" - network: "{{ network }}" - bgp: - asn: 64514 - advertise_mode: CUSTOM - advertised_groups: - - ALL_SUBNETS - advertised_ip_ranges: - - range: 1.2.3.4 - - range: 6.7.0.0/16 - region: us-central1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + name: router-vpn-tunnel + network: "{{ network }}" + bgp: + asn: 64514 + advertise_mode: CUSTOM + advertised_groups: + - ALL_SUBNETS + advertised_ip_ranges: + - range: 1.2.3.4 + - range: 6.7.0.0/16 + region: us-central1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent register: router ignore_errors: true - name: delete a network gcp_compute_network: - name: "network-vpn-tunnel" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + name: network-vpn-tunnel + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent register: network ignore_errors: true diff --git a/test/integration/targets/gcp_container_cluster/tasks/main.yml b/test/integration/targets/gcp_container_cluster/tasks/main.yml index 1785c269452057..ebf2fa5c9325ec 100644 --- a/test/integration/targets/gcp_container_cluster/tasks/main.yml +++ b/test/integration/targets/gcp_container_cluster/tasks/main.yml @@ -15,35 +15,35 @@ # Pre-test setup - name: delete a cluster gcp_container_cluster: - name: my-cluster - initial_node_count: 2 - master_auth: - username: cluster_admin - password: my-secret-password - node_config: - machine_type: n1-standard-4 - disk_size_gb: 500 - location: us-central1-a - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + name: my-cluster + initial_node_count: 2 + master_auth: + username: cluster_admin + password: my-secret-password + node_config: + machine_type: n1-standard-4 + disk_size_gb: 500 + location: us-central1-a + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent #---------------------------------------------------------- - name: create a cluster gcp_container_cluster: - name: my-cluster - initial_node_count: 2 - master_auth: - username: cluster_admin - password: my-secret-password - node_config: - machine_type: n1-standard-4 - disk_size_gb: 500 - location: us-central1-a - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: my-cluster + initial_node_count: 2 + master_auth: + username: cluster_admin + password: my-secret-password + node_config: + machine_type: n1-standard-4 + disk_size_gb: 500 + location: us-central1-a + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: result - name: assert changed is true assert: @@ -65,19 +65,19 @@ # ---------------------------------------------------------------------------- - name: create a cluster that already exists gcp_container_cluster: - name: my-cluster - initial_node_count: 2 - master_auth: - username: cluster_admin - password: my-secret-password - node_config: - machine_type: n1-standard-4 - disk_size_gb: 500 - location: us-central1-a - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: my-cluster + initial_node_count: 2 + master_auth: + username: cluster_admin + password: my-secret-password + node_config: + machine_type: n1-standard-4 + disk_size_gb: 500 + location: us-central1-a + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: result - name: assert changed is false assert: @@ -86,19 +86,19 @@ #---------------------------------------------------------- - name: delete a cluster gcp_container_cluster: - name: my-cluster - initial_node_count: 2 - master_auth: - username: cluster_admin - password: my-secret-password - node_config: - machine_type: n1-standard-4 - disk_size_gb: 500 - location: us-central1-a - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + name: my-cluster + initial_node_count: 2 + master_auth: + username: cluster_admin + password: my-secret-password + node_config: + machine_type: n1-standard-4 + disk_size_gb: 500 + location: us-central1-a + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent register: result - name: assert changed is true assert: @@ -120,19 +120,19 @@ # ---------------------------------------------------------------------------- - name: delete a cluster that does not exist gcp_container_cluster: - name: my-cluster - initial_node_count: 2 - master_auth: - username: cluster_admin - password: my-secret-password - node_config: - machine_type: n1-standard-4 - disk_size_gb: 500 - location: us-central1-a - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + name: my-cluster + initial_node_count: 2 + master_auth: + username: cluster_admin + password: my-secret-password + node_config: + machine_type: n1-standard-4 + disk_size_gb: 500 + location: us-central1-a + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent register: result - name: assert changed is false assert: diff --git a/test/integration/targets/gcp_container_node_pool/tasks/main.yml b/test/integration/targets/gcp_container_node_pool/tasks/main.yml index 775d6a4ffb826e..3d41089b8f76e9 100644 --- a/test/integration/targets/gcp_container_node_pool/tasks/main.yml +++ b/test/integration/targets/gcp_container_node_pool/tasks/main.yml @@ -15,35 +15,35 @@ # Pre-test setup - name: create a cluster gcp_container_cluster: - name: "cluster-nodepool" - initial_node_count: 4 - location: us-central1-a - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: cluster-nodepool + initial_node_count: 4 + location: us-central1-a + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: cluster - name: delete a node pool gcp_container_node_pool: - name: my-pool - initial_node_count: 4 - cluster: "{{ cluster }}" - location: us-central1-a - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + name: my-pool + initial_node_count: 4 + cluster: "{{ cluster }}" + location: us-central1-a + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent #---------------------------------------------------------- - name: create a node pool gcp_container_node_pool: - name: my-pool - initial_node_count: 4 - cluster: "{{ cluster }}" - location: us-central1-a - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: my-pool + initial_node_count: 4 + cluster: "{{ cluster }}" + location: us-central1-a + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: result - name: assert changed is true assert: @@ -66,14 +66,14 @@ # ---------------------------------------------------------------------------- - name: create a node pool that already exists gcp_container_node_pool: - name: my-pool - initial_node_count: 4 - cluster: "{{ cluster }}" - location: us-central1-a - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: my-pool + initial_node_count: 4 + cluster: "{{ cluster }}" + location: us-central1-a + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: result - name: assert changed is false assert: @@ -82,14 +82,14 @@ #---------------------------------------------------------- - name: delete a node pool gcp_container_node_pool: - name: my-pool - initial_node_count: 4 - cluster: "{{ cluster }}" - location: us-central1-a - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + name: my-pool + initial_node_count: 4 + cluster: "{{ cluster }}" + location: us-central1-a + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent register: result - name: assert changed is true assert: @@ -112,14 +112,14 @@ # ---------------------------------------------------------------------------- - name: delete a node pool that does not exist gcp_container_node_pool: - name: my-pool - initial_node_count: 4 - cluster: "{{ cluster }}" - location: us-central1-a - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + name: my-pool + initial_node_count: 4 + cluster: "{{ cluster }}" + location: us-central1-a + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent register: result - name: assert changed is false assert: @@ -130,12 +130,12 @@ # If errors happen, don't crash the playbook! - name: delete a cluster gcp_container_cluster: - name: "cluster-nodepool" - initial_node_count: 4 - location: us-central1-a - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + name: cluster-nodepool + initial_node_count: 4 + location: us-central1-a + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent register: cluster ignore_errors: true diff --git a/test/integration/targets/gcp_dns_managed_zone/tasks/main.yml b/test/integration/targets/gcp_dns_managed_zone/tasks/main.yml index ec4e4c250abcb7..425836bf0ddae8 100644 --- a/test/integration/targets/gcp_dns_managed_zone/tasks/main.yml +++ b/test/integration/targets/gcp_dns_managed_zone/tasks/main.yml @@ -15,23 +15,23 @@ # Pre-test setup - name: delete a managed zone gcp_dns_managed_zone: - name: "{{ resource_name }}" - dns_name: test.somewild2.example.com. - description: test zone - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + name: "{{ resource_name }}" + dns_name: test.somewild2.example.com. + description: test zone + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent #---------------------------------------------------------- - name: create a managed zone gcp_dns_managed_zone: - name: "{{ resource_name }}" - dns_name: test.somewild2.example.com. - description: test zone - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: "{{ resource_name }}" + dns_name: test.somewild2.example.com. + description: test zone + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: result - name: assert changed is true assert: @@ -54,13 +54,13 @@ # ---------------------------------------------------------------------------- - name: create a managed zone that already exists gcp_dns_managed_zone: - name: "{{ resource_name }}" - dns_name: test.somewild2.example.com. - description: test zone - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: "{{ resource_name }}" + dns_name: test.somewild2.example.com. + description: test zone + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: result - name: assert changed is false assert: @@ -70,13 +70,13 @@ #---------------------------------------------------------- - name: delete a managed zone gcp_dns_managed_zone: - name: "{{ resource_name }}" - dns_name: test.somewild2.example.com. - description: test zone - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + name: "{{ resource_name }}" + dns_name: test.somewild2.example.com. + description: test zone + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent register: result - name: assert changed is true assert: @@ -99,13 +99,13 @@ # ---------------------------------------------------------------------------- - name: delete a managed zone that does not exist gcp_dns_managed_zone: - name: "{{ resource_name }}" - dns_name: test.somewild2.example.com. - description: test zone - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + name: "{{ resource_name }}" + dns_name: test.somewild2.example.com. + description: test zone + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent register: result - name: assert changed is false assert: diff --git a/test/integration/targets/gcp_dns_resource_record_set/tasks/main.yml b/test/integration/targets/gcp_dns_resource_record_set/tasks/main.yml index a0a63d0bf64cbd..55a56e05ae6399 100644 --- a/test/integration/targets/gcp_dns_resource_record_set/tasks/main.yml +++ b/test/integration/targets/gcp_dns_resource_record_set/tasks/main.yml @@ -15,41 +15,41 @@ # Pre-test setup - name: create a managed zone gcp_dns_managed_zone: - name: "managedzone-rrs" - dns_name: testzone-4.com. - description: test zone - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: managedzone-rrs + dns_name: testzone-4.com. + description: test zone + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: managed_zone - name: delete a resource record set gcp_dns_resource_record_set: - name: www.testzone-4.com. - managed_zone: "{{ managed_zone }}" - type: A - ttl: 600 - target: - - 10.1.2.3 - - 40.5.6.7 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + name: www.testzone-4.com. + managed_zone: "{{ managed_zone }}" + type: A + ttl: 600 + target: + - 10.1.2.3 + - 40.5.6.7 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent #---------------------------------------------------------- - name: create a resource record set gcp_dns_resource_record_set: - name: www.testzone-4.com. - managed_zone: "{{ managed_zone }}" - type: A - ttl: 600 - target: - - 10.1.2.3 - - 40.5.6.7 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: www.testzone-4.com. + managed_zone: "{{ managed_zone }}" + type: A + ttl: 600 + target: + - 10.1.2.3 + - 40.5.6.7 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: result - name: assert changed is true assert: @@ -72,17 +72,17 @@ # ---------------------------------------------------------------------------- - name: create a resource record set that already exists gcp_dns_resource_record_set: - name: www.testzone-4.com. - managed_zone: "{{ managed_zone }}" - type: A - ttl: 600 - target: - - 10.1.2.3 - - 40.5.6.7 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: www.testzone-4.com. + managed_zone: "{{ managed_zone }}" + type: A + ttl: 600 + target: + - 10.1.2.3 + - 40.5.6.7 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: result - name: assert changed is false assert: @@ -92,17 +92,17 @@ #---------------------------------------------------------- - name: delete a resource record set gcp_dns_resource_record_set: - name: www.testzone-4.com. - managed_zone: "{{ managed_zone }}" - type: A - ttl: 600 - target: - - 10.1.2.3 - - 40.5.6.7 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + name: www.testzone-4.com. + managed_zone: "{{ managed_zone }}" + type: A + ttl: 600 + target: + - 10.1.2.3 + - 40.5.6.7 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent register: result - name: assert changed is true assert: @@ -125,17 +125,17 @@ # ---------------------------------------------------------------------------- - name: delete a resource record set that does not exist gcp_dns_resource_record_set: - name: www.testzone-4.com. - managed_zone: "{{ managed_zone }}" - type: A - ttl: 600 - target: - - 10.1.2.3 - - 40.5.6.7 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + name: www.testzone-4.com. + managed_zone: "{{ managed_zone }}" + type: A + ttl: 600 + target: + - 10.1.2.3 + - 40.5.6.7 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent register: result - name: assert changed is false assert: @@ -147,12 +147,12 @@ # If errors happen, don't crash the playbook! - name: delete a managed zone gcp_dns_managed_zone: - name: "managedzone-rrs" - dns_name: testzone-4.com. - description: test zone - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + name: managedzone-rrs + dns_name: testzone-4.com. + description: test zone + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent register: managed_zone ignore_errors: true diff --git a/test/integration/targets/gcp_iam_role/tasks/main.yml b/test/integration/targets/gcp_iam_role/tasks/main.yml index 665a679731ba6a..6299f760ce206c 100644 --- a/test/integration/targets/gcp_iam_role/tasks/main.yml +++ b/test/integration/targets/gcp_iam_role/tasks/main.yml @@ -15,31 +15,31 @@ # Pre-test setup - name: delete a role gcp_iam_role: - name: myCustomRole2 - title: My Custom Role - description: My custom role description - included_permissions: - - iam.roles.list - - iam.roles.create - - iam.roles.delete - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + name: myCustomRole2 + title: My Custom Role + description: My custom role description + included_permissions: + - iam.roles.list + - iam.roles.create + - iam.roles.delete + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent #---------------------------------------------------------- - name: create a role gcp_iam_role: - name: myCustomRole2 - title: My Custom Role - description: My custom role description - included_permissions: - - iam.roles.list - - iam.roles.create - - iam.roles.delete - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: myCustomRole2 + title: My Custom Role + description: My custom role description + included_permissions: + - iam.roles.list + - iam.roles.create + - iam.roles.delete + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: result - name: assert changed is true assert: @@ -60,17 +60,17 @@ # ---------------------------------------------------------------------------- - name: create a role that already exists gcp_iam_role: - name: myCustomRole2 - title: My Custom Role - description: My custom role description - included_permissions: - - iam.roles.list - - iam.roles.create - - iam.roles.delete - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: myCustomRole2 + title: My Custom Role + description: My custom role description + included_permissions: + - iam.roles.list + - iam.roles.create + - iam.roles.delete + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: result - name: assert changed is false assert: @@ -79,17 +79,17 @@ #---------------------------------------------------------- - name: delete a role gcp_iam_role: - name: myCustomRole2 - title: My Custom Role - description: My custom role description - included_permissions: - - iam.roles.list - - iam.roles.create - - iam.roles.delete - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + name: myCustomRole2 + title: My Custom Role + description: My custom role description + included_permissions: + - iam.roles.list + - iam.roles.create + - iam.roles.delete + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent register: result - name: assert changed is true assert: @@ -110,17 +110,17 @@ # ---------------------------------------------------------------------------- - name: delete a role that does not exist gcp_iam_role: - name: myCustomRole2 - title: My Custom Role - description: My custom role description - included_permissions: - - iam.roles.list - - iam.roles.create - - iam.roles.delete - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + name: myCustomRole2 + title: My Custom Role + description: My custom role description + included_permissions: + - iam.roles.list + - iam.roles.create + - iam.roles.delete + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent register: result - name: assert changed is false assert: diff --git a/test/integration/targets/gcp_iam_service_account/tasks/main.yml b/test/integration/targets/gcp_iam_service_account/tasks/main.yml index 2e06eb7f5d9cef..496b31b15ba133 100644 --- a/test/integration/targets/gcp_iam_service_account/tasks/main.yml +++ b/test/integration/targets/gcp_iam_service_account/tasks/main.yml @@ -15,25 +15,21 @@ # Pre-test setup - name: delete a service account gcp_iam_service_account: - name: '"{{resource_name}}@{{gcp_project}}.google.com.iam.gserviceaccount.com" - - ' - display_name: My Ansible test key - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + name: '"{{resource_name}}@{{gcp_project}}.google.com.iam.gserviceaccount.com"' + display_name: My Ansible test key + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent #---------------------------------------------------------- - name: create a service account gcp_iam_service_account: - name: '"{{resource_name}}@{{gcp_project}}.google.com.iam.gserviceaccount.com" - - ' - display_name: My Ansible test key - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: '"{{resource_name}}@{{gcp_project}}.google.com.iam.gserviceaccount.com"' + display_name: My Ansible test key + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: result - name: assert changed is true assert: @@ -54,14 +50,12 @@ # ---------------------------------------------------------------------------- - name: create a service account that already exists gcp_iam_service_account: - name: '"{{resource_name}}@{{gcp_project}}.google.com.iam.gserviceaccount.com" - - ' - display_name: My Ansible test key - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: '"{{resource_name}}@{{gcp_project}}.google.com.iam.gserviceaccount.com"' + display_name: My Ansible test key + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: result - name: assert changed is false assert: @@ -70,14 +64,12 @@ #---------------------------------------------------------- - name: delete a service account gcp_iam_service_account: - name: '"{{resource_name}}@{{gcp_project}}.google.com.iam.gserviceaccount.com" - - ' - display_name: My Ansible test key - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + name: '"{{resource_name}}@{{gcp_project}}.google.com.iam.gserviceaccount.com"' + display_name: My Ansible test key + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent register: result - name: assert changed is true assert: @@ -98,14 +90,12 @@ # ---------------------------------------------------------------------------- - name: delete a service account that does not exist gcp_iam_service_account: - name: '"{{resource_name}}@{{gcp_project}}.google.com.iam.gserviceaccount.com" - - ' - display_name: My Ansible test key - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + name: '"{{resource_name}}@{{gcp_project}}.google.com.iam.gserviceaccount.com"' + display_name: My Ansible test key + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent register: result - name: assert changed is false assert: diff --git a/test/integration/targets/gcp_pubsub_subscription/tasks/main.yml b/test/integration/targets/gcp_pubsub_subscription/tasks/main.yml index 2b6607b12b7129..8a05e2a46fd03e 100644 --- a/test/integration/targets/gcp_pubsub_subscription/tasks/main.yml +++ b/test/integration/targets/gcp_pubsub_subscription/tasks/main.yml @@ -15,31 +15,31 @@ # Pre-test setup - name: create a topic gcp_pubsub_topic: - name: "topic-subscription" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: topic-subscription + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: topic - name: delete a subscription gcp_pubsub_subscription: - name: "{{ resource_name }}" - topic: "{{ topic }}" - ack_deadline_seconds: 300 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + name: "{{ resource_name }}" + topic: "{{ topic }}" + ack_deadline_seconds: 300 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent #---------------------------------------------------------- - name: create a subscription gcp_pubsub_subscription: - name: "{{ resource_name }}" - topic: "{{ topic }}" - ack_deadline_seconds: 300 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: "{{ resource_name }}" + topic: "{{ topic }}" + ack_deadline_seconds: 300 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: result - name: assert changed is true assert: @@ -60,13 +60,13 @@ # ---------------------------------------------------------------------------- - name: create a subscription that already exists gcp_pubsub_subscription: - name: "{{ resource_name }}" - topic: "{{ topic }}" - ack_deadline_seconds: 300 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: "{{ resource_name }}" + topic: "{{ topic }}" + ack_deadline_seconds: 300 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: result - name: assert changed is false assert: @@ -75,13 +75,13 @@ #---------------------------------------------------------- - name: delete a subscription gcp_pubsub_subscription: - name: "{{ resource_name }}" - topic: "{{ topic }}" - ack_deadline_seconds: 300 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + name: "{{ resource_name }}" + topic: "{{ topic }}" + ack_deadline_seconds: 300 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent register: result - name: assert changed is true assert: @@ -102,13 +102,13 @@ # ---------------------------------------------------------------------------- - name: delete a subscription that does not exist gcp_pubsub_subscription: - name: "{{ resource_name }}" - topic: "{{ topic }}" - ack_deadline_seconds: 300 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + name: "{{ resource_name }}" + topic: "{{ topic }}" + ack_deadline_seconds: 300 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent register: result - name: assert changed is false assert: @@ -119,10 +119,10 @@ # If errors happen, don't crash the playbook! - name: delete a topic gcp_pubsub_topic: - name: "topic-subscription" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + name: topic-subscription + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent register: topic ignore_errors: true diff --git a/test/integration/targets/gcp_pubsub_topic/tasks/main.yml b/test/integration/targets/gcp_pubsub_topic/tasks/main.yml index c26ecfbf96235a..0d3bda081573d0 100644 --- a/test/integration/targets/gcp_pubsub_topic/tasks/main.yml +++ b/test/integration/targets/gcp_pubsub_topic/tasks/main.yml @@ -15,19 +15,19 @@ # Pre-test setup - name: delete a topic gcp_pubsub_topic: - name: test-topic1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + name: test-topic1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent #---------------------------------------------------------- - name: create a topic gcp_pubsub_topic: - name: test-topic1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: test-topic1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: result - name: assert changed is true assert: @@ -48,11 +48,11 @@ # ---------------------------------------------------------------------------- - name: create a topic that already exists gcp_pubsub_topic: - name: test-topic1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: test-topic1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: result - name: assert changed is false assert: @@ -61,11 +61,11 @@ #---------------------------------------------------------- - name: delete a topic gcp_pubsub_topic: - name: test-topic1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + name: test-topic1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent register: result - name: assert changed is true assert: @@ -86,11 +86,11 @@ # ---------------------------------------------------------------------------- - name: delete a topic that does not exist gcp_pubsub_topic: - name: test-topic1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + name: test-topic1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent register: result - name: assert changed is false assert: diff --git a/test/integration/targets/gcp_redis_instance/tasks/main.yml b/test/integration/targets/gcp_redis_instance/tasks/main.yml index b260311b942871..55febdbcde03ea 100644 --- a/test/integration/targets/gcp_redis_instance/tasks/main.yml +++ b/test/integration/targets/gcp_redis_instance/tasks/main.yml @@ -15,47 +15,47 @@ # Pre-test setup - name: create a network gcp_compute_network: - name: "network-instance" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: network-instance + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: network - name: delete a instance gcp_redis_instance: - name: instance37 - tier: STANDARD_HA - memory_size_gb: 1 - region: us-central1 - location_id: us-central1-a - redis_version: REDIS_3_2 - display_name: Ansible Test Instance - reserved_ip_range: 192.168.0.0/29 - labels: - my_key: my_val - other_key: other_val - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + name: instance37 + tier: STANDARD_HA + memory_size_gb: 1 + region: us-central1 + location_id: us-central1-a + redis_version: REDIS_3_2 + display_name: Ansible Test Instance + reserved_ip_range: 192.168.0.0/29 + labels: + my_key: my_val + other_key: other_val + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent #---------------------------------------------------------- - name: create a instance gcp_redis_instance: - name: instance37 - tier: STANDARD_HA - memory_size_gb: 1 - region: us-central1 - location_id: us-central1-a - redis_version: REDIS_3_2 - display_name: Ansible Test Instance - reserved_ip_range: 192.168.0.0/29 - labels: - my_key: my_val - other_key: other_val - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: instance37 + tier: STANDARD_HA + memory_size_gb: 1 + region: us-central1 + location_id: us-central1-a + redis_version: REDIS_3_2 + display_name: Ansible Test Instance + reserved_ip_range: 192.168.0.0/29 + labels: + my_key: my_val + other_key: other_val + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: result - name: assert changed is true assert: @@ -77,21 +77,21 @@ # ---------------------------------------------------------------------------- - name: create a instance that already exists gcp_redis_instance: - name: instance37 - tier: STANDARD_HA - memory_size_gb: 1 - region: us-central1 - location_id: us-central1-a - redis_version: REDIS_3_2 - display_name: Ansible Test Instance - reserved_ip_range: 192.168.0.0/29 - labels: - my_key: my_val - other_key: other_val - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: instance37 + tier: STANDARD_HA + memory_size_gb: 1 + region: us-central1 + location_id: us-central1-a + redis_version: REDIS_3_2 + display_name: Ansible Test Instance + reserved_ip_range: 192.168.0.0/29 + labels: + my_key: my_val + other_key: other_val + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: result - name: assert changed is false assert: @@ -100,21 +100,21 @@ #---------------------------------------------------------- - name: delete a instance gcp_redis_instance: - name: instance37 - tier: STANDARD_HA - memory_size_gb: 1 - region: us-central1 - location_id: us-central1-a - redis_version: REDIS_3_2 - display_name: Ansible Test Instance - reserved_ip_range: 192.168.0.0/29 - labels: - my_key: my_val - other_key: other_val - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + name: instance37 + tier: STANDARD_HA + memory_size_gb: 1 + region: us-central1 + location_id: us-central1-a + redis_version: REDIS_3_2 + display_name: Ansible Test Instance + reserved_ip_range: 192.168.0.0/29 + labels: + my_key: my_val + other_key: other_val + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent register: result - name: assert changed is true assert: @@ -136,21 +136,21 @@ # ---------------------------------------------------------------------------- - name: delete a instance that does not exist gcp_redis_instance: - name: instance37 - tier: STANDARD_HA - memory_size_gb: 1 - region: us-central1 - location_id: us-central1-a - redis_version: REDIS_3_2 - display_name: Ansible Test Instance - reserved_ip_range: 192.168.0.0/29 - labels: - my_key: my_val - other_key: other_val - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + name: instance37 + tier: STANDARD_HA + memory_size_gb: 1 + region: us-central1 + location_id: us-central1-a + redis_version: REDIS_3_2 + display_name: Ansible Test Instance + reserved_ip_range: 192.168.0.0/29 + labels: + my_key: my_val + other_key: other_val + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent register: result - name: assert changed is false assert: @@ -161,10 +161,10 @@ # If errors happen, don't crash the playbook! - name: delete a network gcp_compute_network: - name: "network-instance" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + name: network-instance + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent register: network ignore_errors: true diff --git a/test/integration/targets/gcp_resourcemanager_project/tasks/main.yml b/test/integration/targets/gcp_resourcemanager_project/tasks/main.yml index 369522540321ce..50cb58639d7fe9 100644 --- a/test/integration/targets/gcp_resourcemanager_project/tasks/main.yml +++ b/test/integration/targets/gcp_resourcemanager_project/tasks/main.yml @@ -15,25 +15,25 @@ # Pre-test setup - name: delete a project gcp_resourcemanager_project: - name: My Sample Project - id: alextest-{{ 10000000000 | random }} - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - parent: - type: organization - id: 636173955921 - state: absent + name: My Sample Project + id: alextest-{{ 10000000000 | random }} + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + parent: + type: organization + id: 636173955921 + state: absent #---------------------------------------------------------- - name: create a project gcp_resourcemanager_project: - name: My Sample Project - id: alextest-{{ 10000000000 | random }} - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - parent: - type: organization - id: 636173955921 - state: present + name: My Sample Project + id: alextest-{{ 10000000000 | random }} + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + parent: + type: organization + id: 636173955921 + state: present register: result - name: assert changed is true assert: @@ -54,14 +54,14 @@ # ---------------------------------------------------------------------------- - name: create a project that already exists gcp_resourcemanager_project: - name: My Sample Project - id: alextest-{{ 10000000000 | random }} - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - parent: - type: organization - id: 636173955921 - state: present + name: My Sample Project + id: alextest-{{ 10000000000 | random }} + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + parent: + type: organization + id: 636173955921 + state: present register: result - name: assert changed is false assert: @@ -70,14 +70,14 @@ #---------------------------------------------------------- - name: delete a project gcp_resourcemanager_project: - name: My Sample Project - id: alextest-{{ 10000000000 | random }} - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - parent: - type: organization - id: 636173955921 - state: absent + name: My Sample Project + id: alextest-{{ 10000000000 | random }} + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + parent: + type: organization + id: 636173955921 + state: absent register: result - name: assert changed is true assert: @@ -98,14 +98,14 @@ # ---------------------------------------------------------------------------- - name: delete a project that does not exist gcp_resourcemanager_project: - name: My Sample Project - id: alextest-{{ 10000000000 | random }} - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - parent: - type: organization - id: 636173955921 - state: absent + name: My Sample Project + id: alextest-{{ 10000000000 | random }} + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + parent: + type: organization + id: 636173955921 + state: absent register: result - name: assert changed is false assert: diff --git a/test/integration/targets/gcp_sourcerepo_repository/tasks/main.yml b/test/integration/targets/gcp_sourcerepo_repository/tasks/main.yml index bd3048a3c305b2..5d704fcb6b6a29 100644 --- a/test/integration/targets/gcp_sourcerepo_repository/tasks/main.yml +++ b/test/integration/targets/gcp_sourcerepo_repository/tasks/main.yml @@ -15,19 +15,19 @@ # Pre-test setup - name: delete a repository gcp_sourcerepo_repository: - name: projects/{{ gcp_project }}/repos/{{ resource_name }} - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + name: projects/{{ gcp_project }}/repos/{{ resource_name }} + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent #---------------------------------------------------------- - name: create a repository gcp_sourcerepo_repository: - name: projects/{{ gcp_project }}/repos/{{ resource_name }} - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: projects/{{ gcp_project }}/repos/{{ resource_name }} + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: result - name: assert changed is true assert: @@ -48,11 +48,11 @@ # ---------------------------------------------------------------------------- - name: create a repository that already exists gcp_sourcerepo_repository: - name: projects/{{ gcp_project }}/repos/{{ resource_name }} - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: projects/{{ gcp_project }}/repos/{{ resource_name }} + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: result - name: assert changed is false assert: @@ -61,11 +61,11 @@ #---------------------------------------------------------- - name: delete a repository gcp_sourcerepo_repository: - name: projects/{{ gcp_project }}/repos/{{ resource_name }} - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + name: projects/{{ gcp_project }}/repos/{{ resource_name }} + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent register: result - name: assert changed is true assert: @@ -86,11 +86,11 @@ # ---------------------------------------------------------------------------- - name: delete a repository that does not exist gcp_sourcerepo_repository: - name: projects/{{ gcp_project }}/repos/{{ resource_name }} - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + name: projects/{{ gcp_project }}/repos/{{ resource_name }} + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent register: result - name: assert changed is false assert: diff --git a/test/integration/targets/gcp_spanner_database/tasks/main.yml b/test/integration/targets/gcp_spanner_database/tasks/main.yml index cc4b251db9383e..c059ad2e38c910 100644 --- a/test/integration/targets/gcp_spanner_database/tasks/main.yml +++ b/test/integration/targets/gcp_spanner_database/tasks/main.yml @@ -15,34 +15,34 @@ # Pre-test setup - name: create a instance gcp_spanner_instance: - name: "instance-database" - display_name: My Spanner Instance - node_count: 2 - labels: - cost_center: ti-1700004 - config: regional-us-central1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: instance-database + display_name: My Spanner Instance + node_count: 2 + labels: + cost_center: ti-1700004 + config: regional-us-central1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: instance - name: delete a database gcp_spanner_database: - name: webstore - instance: "{{ instance }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + name: webstore + instance: "{{ instance }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent #---------------------------------------------------------- - name: create a database gcp_spanner_database: - name: webstore - instance: "{{ instance }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: webstore + instance: "{{ instance }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: result - name: assert changed is true assert: @@ -64,12 +64,12 @@ # ---------------------------------------------------------------------------- - name: create a database that already exists gcp_spanner_database: - name: webstore - instance: "{{ instance }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: webstore + instance: "{{ instance }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: result - name: assert changed is false assert: @@ -78,12 +78,12 @@ #---------------------------------------------------------- - name: delete a database gcp_spanner_database: - name: webstore - instance: "{{ instance }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + name: webstore + instance: "{{ instance }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent register: result - name: assert changed is true assert: @@ -105,12 +105,12 @@ # ---------------------------------------------------------------------------- - name: delete a database that does not exist gcp_spanner_database: - name: webstore - instance: "{{ instance }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + name: webstore + instance: "{{ instance }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent register: result - name: assert changed is false assert: @@ -121,15 +121,15 @@ # If errors happen, don't crash the playbook! - name: delete a instance gcp_spanner_instance: - name: "instance-database" - display_name: My Spanner Instance - node_count: 2 - labels: - cost_center: ti-1700004 - config: regional-us-central1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + name: instance-database + display_name: My Spanner Instance + node_count: 2 + labels: + cost_center: ti-1700004 + config: regional-us-central1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent register: instance ignore_errors: true diff --git a/test/integration/targets/gcp_spanner_instance/tasks/main.yml b/test/integration/targets/gcp_spanner_instance/tasks/main.yml index d3280e5fac4a22..15c720610dd6a5 100644 --- a/test/integration/targets/gcp_spanner_instance/tasks/main.yml +++ b/test/integration/targets/gcp_spanner_instance/tasks/main.yml @@ -15,29 +15,29 @@ # Pre-test setup - name: delete a instance gcp_spanner_instance: - name: testinstance - display_name: My Spanner Instance - node_count: 2 - labels: - cost_center: ti-1700004 - config: regional-us-central1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + name: testinstance + display_name: My Spanner Instance + node_count: 2 + labels: + cost_center: ti-1700004 + config: regional-us-central1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent #---------------------------------------------------------- - name: create a instance gcp_spanner_instance: - name: testinstance - display_name: My Spanner Instance - node_count: 2 - labels: - cost_center: ti-1700004 - config: regional-us-central1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: testinstance + display_name: My Spanner Instance + node_count: 2 + labels: + cost_center: ti-1700004 + config: regional-us-central1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: result - name: assert changed is true assert: @@ -58,16 +58,16 @@ # ---------------------------------------------------------------------------- - name: create a instance that already exists gcp_spanner_instance: - name: testinstance - display_name: My Spanner Instance - node_count: 2 - labels: - cost_center: ti-1700004 - config: regional-us-central1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: testinstance + display_name: My Spanner Instance + node_count: 2 + labels: + cost_center: ti-1700004 + config: regional-us-central1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: result - name: assert changed is false assert: @@ -76,16 +76,16 @@ #---------------------------------------------------------- - name: delete a instance gcp_spanner_instance: - name: testinstance - display_name: My Spanner Instance - node_count: 2 - labels: - cost_center: ti-1700004 - config: regional-us-central1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + name: testinstance + display_name: My Spanner Instance + node_count: 2 + labels: + cost_center: ti-1700004 + config: regional-us-central1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent register: result - name: assert changed is true assert: @@ -106,16 +106,16 @@ # ---------------------------------------------------------------------------- - name: delete a instance that does not exist gcp_spanner_instance: - name: testinstance - display_name: My Spanner Instance - node_count: 2 - labels: - cost_center: ti-1700004 - config: regional-us-central1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + name: testinstance + display_name: My Spanner Instance + node_count: 2 + labels: + cost_center: ti-1700004 + config: regional-us-central1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent register: result - name: assert changed is false assert: diff --git a/test/integration/targets/gcp_sql_database/tasks/main.yml b/test/integration/targets/gcp_sql_database/tasks/main.yml index a9dd18bdf4534e..53210046943e5b 100644 --- a/test/integration/targets/gcp_sql_database/tasks/main.yml +++ b/test/integration/targets/gcp_sql_database/tasks/main.yml @@ -15,38 +15,38 @@ # Pre-test setup - name: create a instance gcp_sql_instance: - name: "{{resource_name}}-3" - settings: - ip_configuration: - authorized_networks: - - name: google dns server - value: 8.8.8.8/32 - tier: db-n1-standard-1 - region: us-central1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: "{{resource_name}}-3" + settings: + ip_configuration: + authorized_networks: + - name: google dns server + value: 8.8.8.8/32 + tier: db-n1-standard-1 + region: us-central1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: instance - name: delete a database gcp_sql_database: - name: "{{ resource_name }}" - charset: utf8 - instance: "{{ instance }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + name: "{{ resource_name }}" + charset: utf8 + instance: "{{ instance }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent #---------------------------------------------------------- - name: create a database gcp_sql_database: - name: "{{ resource_name }}" - charset: utf8 - instance: "{{ instance }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: "{{ resource_name }}" + charset: utf8 + instance: "{{ instance }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: result - name: assert changed is true assert: @@ -69,13 +69,13 @@ # ---------------------------------------------------------------------------- - name: create a database that already exists gcp_sql_database: - name: "{{ resource_name }}" - charset: utf8 - instance: "{{ instance }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: "{{ resource_name }}" + charset: utf8 + instance: "{{ instance }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: result - name: assert changed is false assert: @@ -85,13 +85,13 @@ #---------------------------------------------------------- - name: delete a database gcp_sql_database: - name: "{{ resource_name }}" - charset: utf8 - instance: "{{ instance }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + name: "{{ resource_name }}" + charset: utf8 + instance: "{{ instance }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent register: result - name: assert changed is true assert: @@ -114,13 +114,13 @@ # ---------------------------------------------------------------------------- - name: delete a database that does not exist gcp_sql_database: - name: "{{ resource_name }}" - charset: utf8 - instance: "{{ instance }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + name: "{{ resource_name }}" + charset: utf8 + instance: "{{ instance }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent register: result - name: assert changed is false assert: @@ -132,17 +132,17 @@ # If errors happen, don't crash the playbook! - name: delete a instance gcp_sql_instance: - name: "{{resource_name}}-3" - settings: - ip_configuration: - authorized_networks: - - name: google dns server - value: 8.8.8.8/32 - tier: db-n1-standard-1 - region: us-central1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + name: "{{resource_name}}-3" + settings: + ip_configuration: + authorized_networks: + - name: google dns server + value: 8.8.8.8/32 + tier: db-n1-standard-1 + region: us-central1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent register: instance ignore_errors: true diff --git a/test/integration/targets/gcp_sql_instance/tasks/main.yml b/test/integration/targets/gcp_sql_instance/tasks/main.yml index fa7690c1e80c11..eace727c02f39b 100644 --- a/test/integration/targets/gcp_sql_instance/tasks/main.yml +++ b/test/integration/targets/gcp_sql_instance/tasks/main.yml @@ -15,33 +15,33 @@ # Pre-test setup - name: delete a instance gcp_sql_instance: - name: "{{resource_name}}-2" - settings: - ip_configuration: - authorized_networks: - - name: google dns server - value: 8.8.8.8/32 - tier: db-n1-standard-1 - region: us-central1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + name: "{{resource_name}}-2" + settings: + ip_configuration: + authorized_networks: + - name: google dns server + value: 8.8.8.8/32 + tier: db-n1-standard-1 + region: us-central1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent #---------------------------------------------------------- - name: create a instance gcp_sql_instance: - name: "{{resource_name}}-2" - settings: - ip_configuration: - authorized_networks: - - name: google dns server - value: 8.8.8.8/32 - tier: db-n1-standard-1 - region: us-central1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: "{{resource_name}}-2" + settings: + ip_configuration: + authorized_networks: + - name: google dns server + value: 8.8.8.8/32 + tier: db-n1-standard-1 + region: us-central1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: result - name: assert changed is true assert: @@ -63,18 +63,18 @@ # ---------------------------------------------------------------------------- - name: create a instance that already exists gcp_sql_instance: - name: "{{resource_name}}-2" - settings: - ip_configuration: - authorized_networks: - - name: google dns server - value: 8.8.8.8/32 - tier: db-n1-standard-1 - region: us-central1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: "{{resource_name}}-2" + settings: + ip_configuration: + authorized_networks: + - name: google dns server + value: 8.8.8.8/32 + tier: db-n1-standard-1 + region: us-central1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: result - name: assert changed is false assert: @@ -84,18 +84,18 @@ #---------------------------------------------------------- - name: delete a instance gcp_sql_instance: - name: "{{resource_name}}-2" - settings: - ip_configuration: - authorized_networks: - - name: google dns server - value: 8.8.8.8/32 - tier: db-n1-standard-1 - region: us-central1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + name: "{{resource_name}}-2" + settings: + ip_configuration: + authorized_networks: + - name: google dns server + value: 8.8.8.8/32 + tier: db-n1-standard-1 + region: us-central1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent register: result - name: assert changed is true assert: @@ -117,18 +117,18 @@ # ---------------------------------------------------------------------------- - name: delete a instance that does not exist gcp_sql_instance: - name: "{{resource_name}}-2" - settings: - ip_configuration: - authorized_networks: - - name: google dns server - value: 8.8.8.8/32 - tier: db-n1-standard-1 - region: us-central1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + name: "{{resource_name}}-2" + settings: + ip_configuration: + authorized_networks: + - name: google dns server + value: 8.8.8.8/32 + tier: db-n1-standard-1 + region: us-central1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent register: result - name: assert changed is false assert: diff --git a/test/integration/targets/gcp_sql_user/tasks/main.yml b/test/integration/targets/gcp_sql_user/tasks/main.yml index ac8f8b510e36fd..653308c764f67c 100644 --- a/test/integration/targets/gcp_sql_user/tasks/main.yml +++ b/test/integration/targets/gcp_sql_user/tasks/main.yml @@ -15,40 +15,40 @@ # Pre-test setup - name: create a instance gcp_sql_instance: - name: "{{resource_name}}-1" - settings: - ip_configuration: - authorized_networks: - - name: google dns server - value: 8.8.8.8/32 - tier: db-n1-standard-1 - region: us-central1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: "{{resource_name}}-1" + settings: + ip_configuration: + authorized_networks: + - name: google dns server + value: 8.8.8.8/32 + tier: db-n1-standard-1 + region: us-central1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: instance - name: delete a user gcp_sql_user: - name: test-user - host: 10.1.2.3 - password: secret-password - instance: "{{ instance }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + name: test-user + host: 10.1.2.3 + password: secret-password + instance: "{{ instance }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent #---------------------------------------------------------- - name: create a user gcp_sql_user: - name: test-user - host: 10.1.2.3 - password: secret-password - instance: "{{ instance }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: test-user + host: 10.1.2.3 + password: secret-password + instance: "{{ instance }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: result - name: assert changed is true assert: @@ -71,14 +71,14 @@ # ---------------------------------------------------------------------------- - name: create a user that already exists gcp_sql_user: - name: test-user - host: 10.1.2.3 - password: secret-password - instance: "{{ instance }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: test-user + host: 10.1.2.3 + password: secret-password + instance: "{{ instance }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: result - name: assert changed is false assert: @@ -88,14 +88,14 @@ #---------------------------------------------------------- - name: delete a user gcp_sql_user: - name: test-user - host: 10.1.2.3 - password: secret-password - instance: "{{ instance }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + name: test-user + host: 10.1.2.3 + password: secret-password + instance: "{{ instance }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent register: result - name: assert changed is true assert: @@ -118,14 +118,14 @@ # ---------------------------------------------------------------------------- - name: delete a user that does not exist gcp_sql_user: - name: test-user - host: 10.1.2.3 - password: secret-password - instance: "{{ instance }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + name: test-user + host: 10.1.2.3 + password: secret-password + instance: "{{ instance }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent register: result - name: assert changed is false assert: @@ -137,17 +137,17 @@ # If errors happen, don't crash the playbook! - name: delete a instance gcp_sql_instance: - name: "{{resource_name}}-1" - settings: - ip_configuration: - authorized_networks: - - name: google dns server - value: 8.8.8.8/32 - tier: db-n1-standard-1 - region: us-central1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + name: "{{resource_name}}-1" + settings: + ip_configuration: + authorized_networks: + - name: google dns server + value: 8.8.8.8/32 + tier: db-n1-standard-1 + region: us-central1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent register: instance ignore_errors: true diff --git a/test/integration/targets/gcp_storage_bucket/tasks/main.yml b/test/integration/targets/gcp_storage_bucket/tasks/main.yml index 56363734e180b5..1f3fe22aa4d626 100644 --- a/test/integration/targets/gcp_storage_bucket/tasks/main.yml +++ b/test/integration/targets/gcp_storage_bucket/tasks/main.yml @@ -15,19 +15,19 @@ # Pre-test setup - name: delete a bucket gcp_storage_bucket: - name: ansible-storage-module - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + name: ansible-storage-module + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent #---------------------------------------------------------- - name: create a bucket gcp_storage_bucket: - name: ansible-storage-module - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: ansible-storage-module + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: result - name: assert changed is true assert: @@ -37,11 +37,11 @@ # ---------------------------------------------------------------------------- - name: create a bucket that already exists gcp_storage_bucket: - name: ansible-storage-module - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: ansible-storage-module + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: result - name: assert changed is false assert: @@ -51,11 +51,11 @@ #---------------------------------------------------------- - name: delete a bucket gcp_storage_bucket: - name: ansible-storage-module - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + name: ansible-storage-module + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent register: result - name: assert changed is true assert: @@ -65,11 +65,11 @@ # ---------------------------------------------------------------------------- - name: delete a bucket that does not exist gcp_storage_bucket: - name: ansible-storage-module - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + name: ansible-storage-module + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent register: result - name: assert changed is false assert: diff --git a/test/integration/targets/gcp_storage_bucket_access_control/tasks/main.yml b/test/integration/targets/gcp_storage_bucket_access_control/tasks/main.yml index f71247cc6a21db..52c63b638a6420 100644 --- a/test/integration/targets/gcp_storage_bucket_access_control/tasks/main.yml +++ b/test/integration/targets/gcp_storage_bucket_access_control/tasks/main.yml @@ -15,31 +15,31 @@ # Pre-test setup - name: create a bucket gcp_storage_bucket: - name: "{{ resource_name }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + name: "{{ resource_name }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: bucket - name: delete a bucket access control gcp_storage_bucket_access_control: - bucket: "{{ resource_name }}" - entity: user-alexstephen@google.com - role: WRITER - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + bucket: "{{ resource_name }}" + entity: user-alexstephen@google.com + role: WRITER + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent #---------------------------------------------------------- - name: create a bucket access control gcp_storage_bucket_access_control: - bucket: "{{ resource_name }}" - entity: user-alexstephen@google.com - role: WRITER - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + bucket: "{{ resource_name }}" + entity: user-alexstephen@google.com + role: WRITER + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: result - name: assert changed is true assert: @@ -49,13 +49,13 @@ # ---------------------------------------------------------------------------- - name: create a bucket access control that already exists gcp_storage_bucket_access_control: - bucket: "{{ resource_name }}" - entity: user-alexstephen@google.com - role: WRITER - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present + bucket: "{{ resource_name }}" + entity: user-alexstephen@google.com + role: WRITER + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present register: result - name: assert changed is false assert: @@ -65,13 +65,13 @@ #---------------------------------------------------------- - name: delete a bucket access control gcp_storage_bucket_access_control: - bucket: "{{ resource_name }}" - entity: user-alexstephen@google.com - role: WRITER - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + bucket: "{{ resource_name }}" + entity: user-alexstephen@google.com + role: WRITER + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent register: result - name: assert changed is true assert: @@ -81,13 +81,13 @@ # ---------------------------------------------------------------------------- - name: delete a bucket access control that does not exist gcp_storage_bucket_access_control: - bucket: "{{ resource_name }}" - entity: user-alexstephen@google.com - role: WRITER - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + bucket: "{{ resource_name }}" + entity: user-alexstephen@google.com + role: WRITER + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent register: result - name: assert changed is false assert: @@ -99,10 +99,10 @@ # If errors happen, don't crash the playbook! - name: delete a bucket gcp_storage_bucket: - name: "{{ resource_name }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent + name: "{{ resource_name }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent register: bucket ignore_errors: true From 8e5608fb86fea0419283094c553aaf97eb05f673 Mon Sep 17 00:00:00 2001 From: The Magician Date: Thu, 28 Feb 2019 16:05:50 -0800 Subject: [PATCH 117/144] Improve docs for Cloud Build (#197) /cc @rileykarson --- .../cloud/google/gcp_cloudbuild_trigger.py | 25 +++++++++++++------ .../google/gcp_cloudbuild_trigger_facts.py | 13 +++++++--- 2 files changed, 26 insertions(+), 12 deletions(-) diff --git a/lib/ansible/modules/cloud/google/gcp_cloudbuild_trigger.py b/lib/ansible/modules/cloud/google/gcp_cloudbuild_trigger.py index 31830524aec5aa..f37e6b67bb5394 100644 --- a/lib/ansible/modules/cloud/google/gcp_cloudbuild_trigger.py +++ b/lib/ansible/modules/cloud/google/gcp_cloudbuild_trigger.py @@ -67,6 +67,7 @@ filename: description: - Path, from the source root, to a file whose contents is used for the template. + Either a filename or build template must be provided. required: false ignored_files: description: @@ -114,19 +115,23 @@ required: false branch_name: description: - - Name of the branch to build. + - Name of the branch to build. Exactly one a of branch name, tag, or commit + SHA must be provided. required: false tag_name: description: - - Name of the tag to build. + - Name of the tag to build. Exactly one of a branch name, tag, or commit SHA + must be provided. required: false commit_sha: description: - - Explicit commit SHA to build. + - Explicit commit SHA to build. Exactly one of a branch name, tag, or commit + SHA must be provided. required: false build: description: - - Contents of the build template. + - Contents of the build template. Either a filename or build template must be + provided. required: false suboptions: tags: @@ -233,6 +238,7 @@ filename: description: - Path, from the source root, to a file whose contents is used for the template. + Either a filename or build template must be provided. returned: success type: str ignoredFiles: @@ -285,22 +291,25 @@ type: str branchName: description: - - Name of the branch to build. + - Name of the branch to build. Exactly one a of branch name, tag, or commit + SHA must be provided. returned: success type: str tagName: description: - - Name of the tag to build. + - Name of the tag to build. Exactly one of a branch name, tag, or commit SHA + must be provided. returned: success type: str commitSha: description: - - Explicit commit SHA to build. + - Explicit commit SHA to build. Exactly one of a branch name, tag, or commit + SHA must be provided. returned: success type: str build: description: - - Contents of the build template. + - Contents of the build template. Either a filename or build template must be provided. returned: success type: complex contains: diff --git a/lib/ansible/modules/cloud/google/gcp_cloudbuild_trigger_facts.py b/lib/ansible/modules/cloud/google/gcp_cloudbuild_trigger_facts.py index 58b5b02e86e865..ac40c6e7e7efef 100644 --- a/lib/ansible/modules/cloud/google/gcp_cloudbuild_trigger_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_cloudbuild_trigger_facts.py @@ -87,6 +87,7 @@ filename: description: - Path, from the source root, to a file whose contents is used for the template. + Either a filename or build template must be provided. returned: success type: str ignoredFiles: @@ -142,22 +143,26 @@ type: str branchName: description: - - Name of the branch to build. + - Name of the branch to build. Exactly one a of branch name, tag, or commit + SHA must be provided. returned: success type: str tagName: description: - - Name of the tag to build. + - Name of the tag to build. Exactly one of a branch name, tag, or commit + SHA must be provided. returned: success type: str commitSha: description: - - Explicit commit SHA to build. + - Explicit commit SHA to build. Exactly one of a branch name, tag, or commit + SHA must be provided. returned: success type: str build: description: - - Contents of the build template. + - Contents of the build template. Either a filename or build template must be + provided. returned: success type: complex contains: From 8e959e032599ceade785032a52f7d019db1db885 Mon Sep 17 00:00:00 2001 From: The Magician Date: Fri, 1 Mar 2019 15:02:51 -0800 Subject: [PATCH 118/144] Add managed SSL cert to beta. (#194) Signed-off-by: Modular Magician --- .../targets/gcp_compute_managed_ssl_certificate/aliases | 2 ++ .../gcp_compute_managed_ssl_certificate/defaults/main.yml | 3 +++ .../targets/gcp_compute_managed_ssl_certificate/meta/main.yml | 0 3 files changed, 5 insertions(+) create mode 100644 test/integration/targets/gcp_compute_managed_ssl_certificate/aliases create mode 100644 test/integration/targets/gcp_compute_managed_ssl_certificate/defaults/main.yml create mode 100644 test/integration/targets/gcp_compute_managed_ssl_certificate/meta/main.yml diff --git a/test/integration/targets/gcp_compute_managed_ssl_certificate/aliases b/test/integration/targets/gcp_compute_managed_ssl_certificate/aliases new file mode 100644 index 00000000000000..9812f019ca4bae --- /dev/null +++ b/test/integration/targets/gcp_compute_managed_ssl_certificate/aliases @@ -0,0 +1,2 @@ +cloud/gcp +unsupported diff --git a/test/integration/targets/gcp_compute_managed_ssl_certificate/defaults/main.yml b/test/integration/targets/gcp_compute_managed_ssl_certificate/defaults/main.yml new file mode 100644 index 00000000000000..aa87a2a8e0e0e0 --- /dev/null +++ b/test/integration/targets/gcp_compute_managed_ssl_certificate/defaults/main.yml @@ -0,0 +1,3 @@ +--- +# defaults file +resource_name: '{{resource_prefix}}' diff --git a/test/integration/targets/gcp_compute_managed_ssl_certificate/meta/main.yml b/test/integration/targets/gcp_compute_managed_ssl_certificate/meta/main.yml new file mode 100644 index 00000000000000..e69de29bb2d1d6 From c6b4fd0d021aad94a44fc2edf3403cda3e8eec1d Mon Sep 17 00:00:00 2001 From: The Magician Date: Wed, 6 Mar 2019 13:32:39 -0800 Subject: [PATCH 119/144] Add retention duraction, retain acked message to pubsub (#202) /cc @rileykarson --- .../cloud/google/gcp_pubsub_subscription.py | 48 +++++++++++++++++++ .../google/gcp_pubsub_subscription_facts.py | 18 +++++++ 2 files changed, 66 insertions(+) diff --git a/lib/ansible/modules/cloud/google/gcp_pubsub_subscription.py b/lib/ansible/modules/cloud/google/gcp_pubsub_subscription.py index fd93b87748bef0..a71b2a62381db5 100644 --- a/lib/ansible/modules/cloud/google/gcp_pubsub_subscription.py +++ b/lib/ansible/modules/cloud/google/gcp_pubsub_subscription.py @@ -113,6 +113,26 @@ - If the subscriber never acknowledges the message, the Pub/Sub system will eventually redeliver the message. required: false + message_retention_duration: + description: + - How long to retain unacknowledged messages in the subscription's backlog, from + the moment a message is published. If retainAckedMessages is true, then this + also configures the retention of acknowledged messages, and thus configures + how far back in time a subscriptions.seek can be done. Defaults to 7 days. Cannot + be more than 7 days (`"604800s"`) or less than 10 minutes (`"600s"`). + - 'A duration in seconds with up to nine fractional digits, terminated by ''s''. + Example: `"600.5s"`.' + required: false + default: 604800s + version_added: 2.8 + retain_acked_messages: + description: + - Indicates whether to retain acknowledged messages. If `true`, then messages + are not expunged from the subscription's backlog, even if they are acknowledged, + until they fall out of the messageRetentionDuration window. + required: false + type: bool + version_added: 2.8 extends_documentation_fragment: gcp notes: - 'API Reference: U(https://cloud.google.com/pubsub/docs/reference/rest/v1/projects.subscriptions)' @@ -207,6 +227,24 @@ redeliver the message. returned: success type: int +messageRetentionDuration: + description: + - How long to retain unacknowledged messages in the subscription's backlog, from + the moment a message is published. If retainAckedMessages is true, then this also + configures the retention of acknowledged messages, and thus configures how far + back in time a subscriptions.seek can be done. Defaults to 7 days. Cannot be more + than 7 days (`"604800s"`) or less than 10 minutes (`"600s"`). + - 'A duration in seconds with up to nine fractional digits, terminated by ''s''. + Example: `"600.5s"`.' + returned: success + type: str +retainAckedMessages: + description: + - Indicates whether to retain acknowledged messages. If `true`, then messages are + not expunged from the subscription's backlog, even if they are acknowledged, until + they fall out of the messageRetentionDuration window. + returned: success + type: bool ''' ################################################################################ @@ -232,6 +270,8 @@ def main(): labels=dict(type='dict'), push_config=dict(type='dict', options=dict(push_endpoint=dict(required=True, type='str'), attributes=dict(type='dict'))), ack_deadline_seconds=dict(type='int'), + message_retention_duration=dict(default='604800s', type='str'), + retain_acked_messages=dict(type='bool'), ) ) @@ -286,6 +326,10 @@ def updateMask(request, response): update_mask.append('pushConfig') if request.get('ackDeadlineSeconds') != response.get('ackDeadlineSeconds'): update_mask.append('ackDeadlineSeconds') + if request.get('messageRetentionDuration') != response.get('messageRetentionDuration'): + update_mask.append('messageRetentionDuration') + if request.get('retainAckedMessages') != response.get('retainAckedMessages'): + update_mask.append('retainAckedMessages') return ','.join(update_mask) @@ -301,6 +345,8 @@ def resource_to_request(module): u'labels': module.params.get('labels'), u'pushConfig': SubscriptionPushconfig(module.params.get('push_config', {}), module).to_request(), u'ackDeadlineSeconds': module.params.get('ack_deadline_seconds'), + u'messageRetentionDuration': module.params.get('message_retention_duration'), + u'retainAckedMessages': module.params.get('retain_acked_messages'), } request = encode_request(request, module) return_vals = {} @@ -375,6 +421,8 @@ def response_to_hash(module, response): u'labels': response.get(u'labels'), u'pushConfig': SubscriptionPushconfig(response.get(u'pushConfig', {}), module).from_response(), u'ackDeadlineSeconds': response.get(u'ackDeadlineSeconds'), + u'messageRetentionDuration': response.get(u'messageRetentionDuration'), + u'retainAckedMessages': response.get(u'retainAckedMessages'), } diff --git a/lib/ansible/modules/cloud/google/gcp_pubsub_subscription_facts.py b/lib/ansible/modules/cloud/google/gcp_pubsub_subscription_facts.py index c9850fe0c58fab..52f2ed9c940644 100644 --- a/lib/ansible/modules/cloud/google/gcp_pubsub_subscription_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_pubsub_subscription_facts.py @@ -126,6 +126,24 @@ eventually redeliver the message. returned: success type: int + messageRetentionDuration: + description: + - How long to retain unacknowledged messages in the subscription's backlog, + from the moment a message is published. If retainAckedMessages is true, then + this also configures the retention of acknowledged messages, and thus configures + how far back in time a subscriptions.seek can be done. Defaults to 7 days. + Cannot be more than 7 days (`"604800s"`) or less than 10 minutes (`"600s"`). + - 'A duration in seconds with up to nine fractional digits, terminated by ''s''. + Example: `"600.5s"`.' + returned: success + type: str + retainAckedMessages: + description: + - Indicates whether to retain acknowledged messages. If `true`, then messages + are not expunged from the subscription's backlog, even if they are acknowledged, + until they fall out of the messageRetentionDuration window. + returned: success + type: bool ''' ################################################################################ From 117c0a6e020412ac0d687d63ce73d95648bad6d3 Mon Sep 17 00:00:00 2001 From: The Magician Date: Wed, 6 Mar 2019 13:54:51 -0800 Subject: [PATCH 120/144] Ansible - allowing for creds to be passed in as string/env var (#200) Signed-off-by: Modular Magician --- lib/ansible/module_utils/gcp_utils.py | 15 ++++++++++++--- lib/ansible/utils/module_docs_fragments/gcp.py | 11 +++++++++-- 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/lib/ansible/module_utils/gcp_utils.py b/lib/ansible/module_utils/gcp_utils.py index 15c27e3881971f..0a89db4100876a 100644 --- a/lib/ansible/module_utils/gcp_utils.py +++ b/lib/ansible/module_utils/gcp_utils.py @@ -21,6 +21,7 @@ from ansible.module_utils._text import to_text import ast import os +import json def navigate_hash(source, path, default=None): @@ -143,7 +144,8 @@ def _validate(self): msg="Service Account Email only works with Machine Account-based authentication" ) - if self.module.params.get('service_account_file') is not None and self.module.params['auth_kind'] != 'serviceaccount': + if (self.module.params.get('service_account_file') is not None or + self.module.params.get('service_account_contents') is not None) and self.module.params['auth_kind'] != 'serviceaccount': self.module.fail_json( msg="Service Account File only works with Service Account-based authentication" ) @@ -153,9 +155,12 @@ def _credentials(self): if cred_type == 'application': credentials, project_id = google.auth.default(scopes=self.module.params['scopes']) return credentials - elif cred_type == 'serviceaccount': + elif cred_type == 'serviceaccount' and self.module.params.get('service_account_file'): path = os.path.realpath(os.path.expanduser(self.module.params['service_account_file'])) return service_account.Credentials.from_service_account_file(path).with_scopes(self.module.params['scopes']) + elif cred_type == 'serviceaccount' and self.module.params.get('service_account_contents'): + cred = json.loads(self.module.params.get('service_account_contents')) + return service_account.Credentials.from_service_account_info(cred).with_scopes(self.module.params['scopes']) elif cred_type == 'machineaccount': return google.auth.compute_engine.Credentials( self.module.params['service_account_email']) @@ -199,6 +204,10 @@ def __init__(self, *args, **kwargs): required=False, fallback=(env_fallback, ['GCP_SERVICE_ACCOUNT_FILE']), type='path'), + service_account_contents=dict( + required=False, + fallback=(env_fallback, ['GCP_SERVICE_ACCOUNT_CONTENTS']), + type='str'), scopes=dict( required=False, fallback=(env_fallback, ['GCP_SCOPES']), @@ -211,7 +220,7 @@ def __init__(self, *args, **kwargs): mutual = kwargs['mutually_exclusive'] kwargs['mutually_exclusive'] = mutual.append( - ['service_account_email', 'service_account_file'] + ['service_account_email', 'service_account_file', 'service_account_contents'] ) AnsibleModule.__init__(self, *args, **kwargs) diff --git a/lib/ansible/utils/module_docs_fragments/gcp.py b/lib/ansible/utils/module_docs_fragments/gcp.py index e736e5d4de78a9..c096a5fc7e2599 100644 --- a/lib/ansible/utils/module_docs_fragments/gcp.py +++ b/lib/ansible/utils/module_docs_fragments/gcp.py @@ -18,6 +18,11 @@ class ModuleDocFragment(object): service_account_file: description: - The path of a Service Account JSON file if serviceaccount is selected as type. + service_account_contents: + description: + - A string representing the contents of a Service Account JSON file. + - This should not be passed in as a dictionary, but a string has + the exact contents of a service account json file (valid JSON). service_account_email: description: - An optional service account email address if machineaccount is selected @@ -26,8 +31,10 @@ class ModuleDocFragment(object): description: - Array of scopes to be used. notes: - - For authentication, you can set service_account_file using the - C(GCP_SERVICE_ACCOUNT_FILE) env variable. + - for authentication, you can set service_account_file using the + c(gcp_service_account_file) env variable. + - for authentication, you can set service_account_contents using the + c(GCP_SERVICE_ACCOUNT_CONTENTS) env variable. - For authentication, you can set service_account_email using the C(GCP_SERVICE_ACCOUNT_EMAIL) env variable. - For authentication, you can set auth_kind using the C(GCP_AUTH_KIND) env From 27ae9b3a842c3503fa4a6c4d98b4c9e15b12ae64 Mon Sep 17 00:00:00 2001 From: The Magician Date: Fri, 8 Mar 2019 08:34:21 -0800 Subject: [PATCH 121/144] Fix Network updating, improve docs. (#204) Signed-off-by: Modular Magician --- .../cloud/google/gcp_compute_network.py | 95 +++++++++++-------- .../cloud/google/gcp_compute_network_facts.py | 32 ++++--- 2 files changed, 71 insertions(+), 56 deletions(-) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_network.py b/lib/ansible/modules/cloud/google/gcp_compute_network.py index 5c385bc85b4e4c..0d893b86c1d8d2 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_network.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_network.py @@ -31,18 +31,7 @@ --- module: gcp_compute_network description: -- Represents a Network resource. -- Your Cloud Platform Console project can contain multiple networks, and each network - can have multiple instances attached to it. A network allows you to define a gateway - IP and the network range for the instances attached to that network. Every project - is provided with a default network with preset configurations and firewall rules. - You can choose to customize the default network by adding or removing rules, or - you can create new networks in that project. Generally, most users only need one - network, although you can have up to five networks per project by default. -- A network belongs to only one project, and each instance can only belong to one - network. All Compute Engine networks use the IPv4 protocol. Compute Engine currently - does not support IPv6. However, Google is a major advocate of IPv6 and it is an - important future direction. +- Manages a VPC network or legacy network resource on GCP. short_description: Creates a GCP Network version_added: 2.6 author: Google Inc. (@googlecloudplatform) @@ -60,14 +49,18 @@ default: present description: description: - - An optional description of this resource. Provide this property when you create - the resource. + - An optional description of this resource. The resource must be recreated to + modify this field. required: false ipv4_range: description: - - 'The range of internal addresses that are legal on this network. This range - is a CIDR specification, for example: 192.168.0.0/16. Provided by the client - when the network is created.' + - If this field is specified, a deprecated legacy network is created. + - You will no longer be able to create a legacy network on Feb 1, 2020. + - See the [legacy network docs](U(https://cloud.google.com/vpc/docs/legacy)) for + more details. + - The range of internal addresses that are legal on this legacy network. + - 'This range is a CIDR specification, for example: `192.168.0.0/16`.' + - The resource must be recreated to modify this field. required: false name: description: @@ -80,10 +73,11 @@ required: true auto_create_subnetworks: description: - - When set to true, the network is created in "auto subnet mode". When set to - false, the network is in "custom subnet mode". - - In "auto subnet mode", a newly created network is assigned the default CIDR - of 10.128.0.0/9 and it automatically creates one subnetwork per region. + - When set to `true`, the network is created in "auto subnet mode" and it will + create a subnet for each region automatically across the `10.128.0.0/9` address + range. + - When set to `false`, the network is created in "custom subnet mode" so the user + can explicitly connect subnetwork resources. required: false type: bool routing_config: @@ -95,9 +89,9 @@ suboptions: routing_mode: description: - - The network-wide routing mode to use. If set to REGIONAL, this network's + - The network-wide routing mode to use. If set to `REGIONAL`, this network's cloud routers will only advertise routes with subnetworks of this network - in the same region as the router. If set to GLOBAL, this network's cloud + in the same region as the router. If set to `GLOBAL`, this network's cloud routers will advertise routes with all subnetworks of this network, across regions. required: true @@ -124,15 +118,14 @@ RETURN = ''' description: description: - - An optional description of this resource. Provide this property when you create - the resource. + - An optional description of this resource. The resource must be recreated to modify + this field. returned: success type: str gateway_ipv4: description: - - A gateway address for default routing to other networks. This value is read only - and is selected by the Google Compute Engine, typically as the first usable address - in the IPv4Range. + - The gateway address for default routing out of the network. This value is selected + by GCP. returned: success type: str id: @@ -142,9 +135,13 @@ type: int ipv4_range: description: - - 'The range of internal addresses that are legal on this network. This range is - a CIDR specification, for example: 192.168.0.0/16. Provided by the client when - the network is created.' + - If this field is specified, a deprecated legacy network is created. + - You will no longer be able to create a legacy network on Feb 1, 2020. + - See the [legacy network docs](U(https://cloud.google.com/vpc/docs/legacy)) for + more details. + - The range of internal addresses that are legal on this legacy network. + - 'This range is a CIDR specification, for example: `192.168.0.0/16`.' + - The resource must be recreated to modify this field. returned: success type: str name: @@ -164,10 +161,10 @@ type: list autoCreateSubnetworks: description: - - When set to true, the network is created in "auto subnet mode". When set to false, - the network is in "custom subnet mode". - - In "auto subnet mode", a newly created network is assigned the default CIDR of - 10.128.0.0/9 and it automatically creates one subnetwork per region. + - When set to `true`, the network is created in "auto subnet mode" and it will create + a subnet for each region automatically across the `10.128.0.0/9` address range. + - When set to `false`, the network is created in "custom subnet mode" so the user + can explicitly connect subnetwork resources. returned: success type: bool creationTimestamp: @@ -184,10 +181,11 @@ contains: routingMode: description: - - The network-wide routing mode to use. If set to REGIONAL, this network's cloud - routers will only advertise routes with subnetworks of this network in the - same region as the router. If set to GLOBAL, this network's cloud routers - will advertise routes with all subnetworks of this network, across regions. + - The network-wide routing mode to use. If set to `REGIONAL`, this network's + cloud routers will only advertise routes with subnetworks of this network + in the same region as the router. If set to `GLOBAL`, this network's cloud + routers will advertise routes with all subnetworks of this network, across + regions. returned: success type: str ''' @@ -232,7 +230,7 @@ def main(): if fetch: if state == 'present': if is_different(module, fetch): - update(module, self_link(module), kind) + update(module, self_link(module), kind, fetch) fetch = fetch_resource(module, self_link(module), kind) changed = True else: @@ -256,9 +254,22 @@ def create(module, link, kind): return wait_for_operation(module, auth.post(link, resource_to_request(module))) -def update(module, link, kind): +def update(module, link, kind, fetch): + update_fields(module, resource_to_request(module), response_to_hash(module, fetch)) + return fetch_resource(module, self_link(module), kind) + + +def update_fields(module, request, response): + if response.get('routingConfig') != request.get('routingConfig'): + routing_config_update(module, request, response) + + +def routing_config_update(module, request, response): auth = GcpSession(module, 'compute') - return wait_for_operation(module, auth.patch(link, resource_to_request(module))) + auth.patch( + ''.join(["https://www.googleapis.com/compute/v1/", "projects/{project}/global/networks/{name}"]).format(**module.params), + {u'routingConfig': NetworkRoutingconfig(module.params.get('routing_config', {}), module).to_request()}, + ) def delete(module, link, kind): diff --git a/lib/ansible/modules/cloud/google/gcp_compute_network_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_network_facts.py index da1cbcc7ce1899..3be15790b2a728 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_network_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_network_facts.py @@ -67,15 +67,14 @@ contains: description: description: - - An optional description of this resource. Provide this property when you create - the resource. + - An optional description of this resource. The resource must be recreated to + modify this field. returned: success type: str gateway_ipv4: description: - - A gateway address for default routing to other networks. This value is read - only and is selected by the Google Compute Engine, typically as the first - usable address in the IPv4Range. + - The gateway address for default routing out of the network. This value is + selected by GCP. returned: success type: str id: @@ -85,9 +84,13 @@ type: int ipv4_range: description: - - 'The range of internal addresses that are legal on this network. This range - is a CIDR specification, for example: 192.168.0.0/16. Provided by the client - when the network is created.' + - If this field is specified, a deprecated legacy network is created. + - You will no longer be able to create a legacy network on Feb 1, 2020. + - See the [legacy network docs](U(https://cloud.google.com/vpc/docs/legacy)) + for more details. + - The range of internal addresses that are legal on this legacy network. + - 'This range is a CIDR specification, for example: `192.168.0.0/16`.' + - The resource must be recreated to modify this field. returned: success type: str name: @@ -107,10 +110,11 @@ type: list autoCreateSubnetworks: description: - - When set to true, the network is created in "auto subnet mode". When set to - false, the network is in "custom subnet mode". - - In "auto subnet mode", a newly created network is assigned the default CIDR - of 10.128.0.0/9 and it automatically creates one subnetwork per region. + - When set to `true`, the network is created in "auto subnet mode" and it will + create a subnet for each region automatically across the `10.128.0.0/9` address + range. + - When set to `false`, the network is created in "custom subnet mode" so the + user can explicitly connect subnetwork resources. returned: success type: bool creationTimestamp: @@ -127,9 +131,9 @@ contains: routingMode: description: - - The network-wide routing mode to use. If set to REGIONAL, this network's + - The network-wide routing mode to use. If set to `REGIONAL`, this network's cloud routers will only advertise routes with subnetworks of this network - in the same region as the router. If set to GLOBAL, this network's cloud + in the same region as the router. If set to `GLOBAL`, this network's cloud routers will advertise routes with all subnetworks of this network, across regions. returned: success From 5db3c0494c03791d91619ce49b56335d5b4be18a Mon Sep 17 00:00:00 2001 From: The Magician Date: Mon, 11 Mar 2019 13:36:10 -0700 Subject: [PATCH 122/144] private clustering for container clusters (#205) /cc @rambleraptor --- .../cloud/google/gcp_container_cluster.py | 112 ++++++++++++++++++ .../google/gcp_container_cluster_facts.py | 36 ++++++ 2 files changed, 148 insertions(+) diff --git a/lib/ansible/modules/cloud/google/gcp_container_cluster.py b/lib/ansible/modules/cloud/google/gcp_container_cluster.py index ea3429b90fcb9c..6564d7a769e8d3 100644 --- a/lib/ansible/modules/cloud/google/gcp_container_cluster.py +++ b/lib/ansible/modules/cloud/google/gcp_container_cluster.py @@ -210,6 +210,39 @@ - The name of the Google Compute Engine network to which the cluster is connected. If left unspecified, the default network will be used. required: false + private_cluster_config: + description: + - Configuration for a private cluster. + required: false + version_added: 2.8 + suboptions: + enable_private_nodes: + description: + - Whether nodes have internal IP addresses only. If enabled, all nodes are + given only RFC 1918 private addresses and communicate with the master via + private networking. + required: false + type: bool + enable_private_endpoint: + description: + - Whether the master's internal IP address is used as the cluster endpoint. + required: false + type: bool + master_ipv4_cidr_block: + description: + - The IP range in CIDR notation to use for the hosted master network. This + range will be used for assigning internal IP addresses to the master or + set of masters, as well as the ILB VIP. This range must not overlap with + any other ranges in use within the cluster's network. + required: false + private_endpoint: + description: + - The internal IP address of this cluster's master endpoint. + required: false + public_endpoint: + description: + - The external IP address of this cluster's master endpoint. + required: false cluster_ipv4_cidr: description: - The IP address range of the container pods in this cluster, in CIDR notation @@ -459,6 +492,42 @@ If left unspecified, the default network will be used. returned: success type: str +privateClusterConfig: + description: + - Configuration for a private cluster. + returned: success + type: complex + contains: + enablePrivateNodes: + description: + - Whether nodes have internal IP addresses only. If enabled, all nodes are given + only RFC 1918 private addresses and communicate with the master via private + networking. + returned: success + type: bool + enablePrivateEndpoint: + description: + - Whether the master's internal IP address is used as the cluster endpoint. + returned: success + type: bool + masterIpv4CidrBlock: + description: + - The IP range in CIDR notation to use for the hosted master network. This range + will be used for assigning internal IP addresses to the master or set of masters, + as well as the ILB VIP. This range must not overlap with any other ranges + in use within the cluster's network. + returned: success + type: str + privateEndpoint: + description: + - The internal IP address of this cluster's master endpoint. + returned: success + type: str + publicEndpoint: + description: + - The external IP address of this cluster's master endpoint. + returned: success + type: str clusterIpv4Cidr: description: - The IP address range of the container pods in this cluster, in CIDR notation (e.g. @@ -616,6 +685,16 @@ def main(): logging_service=dict(type='str', choices=['logging.googleapis.com', 'none']), monitoring_service=dict(type='str', choices=['monitoring.googleapis.com', 'none']), network=dict(type='str'), + private_cluster_config=dict( + type='dict', + options=dict( + enable_private_nodes=dict(type='bool'), + enable_private_endpoint=dict(type='bool'), + master_ipv4_cidr_block=dict(type='str'), + private_endpoint=dict(type='str'), + public_endpoint=dict(type='str'), + ), + ), cluster_ipv4_cidr=dict(type='str'), addons_config=dict( type='dict', @@ -684,6 +763,7 @@ def resource_to_request(module): u'loggingService': module.params.get('logging_service'), u'monitoringService': module.params.get('monitoring_service'), u'network': module.params.get('network'), + u'privateClusterConfig': ClusterPrivateclusterconfig(module.params.get('private_cluster_config', {}), module).to_request(), u'clusterIpv4Cidr': module.params.get('cluster_ipv4_cidr'), u'addonsConfig': ClusterAddonsconfig(module.params.get('addons_config', {}), module).to_request(), u'subnetwork': module.params.get('subnetwork'), @@ -761,6 +841,7 @@ def response_to_hash(module, response): u'loggingService': response.get(u'loggingService'), u'monitoringService': response.get(u'monitoringService'), u'network': response.get(u'network'), + u'privateClusterConfig': ClusterPrivateclusterconfig(response.get(u'privateClusterConfig', {}), module).from_response(), u'clusterIpv4Cidr': response.get(u'clusterIpv4Cidr'), u'addonsConfig': ClusterAddonsconfig(response.get(u'addonsConfig', {}), module).from_response(), u'subnetwork': response.get(u'subnetwork'), @@ -897,6 +978,37 @@ def from_response(self): ) +class ClusterPrivateclusterconfig(object): + def __init__(self, request, module): + self.module = module + if request: + self.request = request + else: + self.request = {} + + def to_request(self): + return remove_nones_from_dict( + { + u'enablePrivateNodes': self.request.get('enable_private_nodes'), + u'enablePrivateEndpoint': self.request.get('enable_private_endpoint'), + u'masterIpv4CidrBlock': self.request.get('master_ipv4_cidr_block'), + u'privateEndpoint': self.request.get('private_endpoint'), + u'publicEndpoint': self.request.get('public_endpoint'), + } + ) + + def from_response(self): + return remove_nones_from_dict( + { + u'enablePrivateNodes': self.request.get(u'enablePrivateNodes'), + u'enablePrivateEndpoint': self.request.get(u'enablePrivateEndpoint'), + u'masterIpv4CidrBlock': self.request.get(u'masterIpv4CidrBlock'), + u'privateEndpoint': self.request.get(u'privateEndpoint'), + u'publicEndpoint': self.request.get(u'publicEndpoint'), + } + ) + + class ClusterAddonsconfig(object): def __init__(self, request, module): self.module = module diff --git a/lib/ansible/modules/cloud/google/gcp_container_cluster_facts.py b/lib/ansible/modules/cloud/google/gcp_container_cluster_facts.py index 119fa71e0b81e4..a19f87428cc8b0 100644 --- a/lib/ansible/modules/cloud/google/gcp_container_cluster_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_container_cluster_facts.py @@ -246,6 +246,42 @@ If left unspecified, the default network will be used. returned: success type: str + privateClusterConfig: + description: + - Configuration for a private cluster. + returned: success + type: complex + contains: + enablePrivateNodes: + description: + - Whether nodes have internal IP addresses only. If enabled, all nodes are + given only RFC 1918 private addresses and communicate with the master + via private networking. + returned: success + type: bool + enablePrivateEndpoint: + description: + - Whether the master's internal IP address is used as the cluster endpoint. + returned: success + type: bool + masterIpv4CidrBlock: + description: + - The IP range in CIDR notation to use for the hosted master network. This + range will be used for assigning internal IP addresses to the master or + set of masters, as well as the ILB VIP. This range must not overlap with + any other ranges in use within the cluster's network. + returned: success + type: str + privateEndpoint: + description: + - The internal IP address of this cluster's master endpoint. + returned: success + type: str + publicEndpoint: + description: + - The external IP address of this cluster's master endpoint. + returned: success + type: str clusterIpv4Cidr: description: - The IP address range of the container pods in this cluster, in CIDR notation From 66f0f187cc2d20a9a1652d0f51190a0e7f9f6179 Mon Sep 17 00:00:00 2001 From: The Magician Date: Mon, 11 Mar 2019 13:43:50 -0700 Subject: [PATCH 123/144] Nested output: only properties shouldn't be fields (#207) /cc @rambleraptor --- .../google/gcp_compute_backend_service.py | 14 +--- .../modules/cloud/google/gcp_compute_disk.py | 21 +----- .../modules/cloud/google/gcp_compute_image.py | 14 +--- .../cloud/google/gcp_compute_instance.py | 20 +----- .../google/gcp_compute_instance_template.py | 22 +------ .../cloud/google/gcp_compute_region_disk.py | 14 +--- .../cloud/google/gcp_container_cluster.py | 25 +------ .../cloud/google/gcp_container_node_pool.py | 19 +----- .../modules/cloud/google/gcp_sql_instance.py | 17 +---- .../cloud/google/gcp_storage_bucket.py | 66 +------------------ 10 files changed, 17 insertions(+), 215 deletions(-) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_backend_service.py b/lib/ansible/modules/cloud/google/gcp_compute_backend_service.py index 7bbc02fa98c2e6..bab23b2994c05d 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_backend_service.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_backend_service.py @@ -229,10 +229,6 @@ description: - OAuth2 Client Secret for IAP. required: false - oauth2_client_secret_sha256: - description: - - OAuth2 Client Secret SHA-256 for IAP. - required: false load_balancing_scheme: description: - Indicates whether the backend service will be used with internal or external @@ -655,15 +651,7 @@ def main(): description=dict(type='str'), enable_cdn=dict(type='bool'), health_checks=dict(type='list', elements='str'), - iap=dict( - type='dict', - options=dict( - enabled=dict(type='bool'), - oauth2_client_id=dict(type='str'), - oauth2_client_secret=dict(type='str'), - oauth2_client_secret_sha256=dict(type='str'), - ), - ), + iap=dict(type='dict', options=dict(enabled=dict(type='bool'), oauth2_client_id=dict(type='str'), oauth2_client_secret=dict(type='str'))), load_balancing_scheme=dict(type='str', choices=['INTERNAL', 'EXTERNAL']), name=dict(type='str'), port_name=dict(type='str'), diff --git a/lib/ansible/modules/cloud/google/gcp_compute_disk.py b/lib/ansible/modules/cloud/google/gcp_compute_disk.py index 4f3795a1da4ec6..a94b9c2dc07229 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_disk.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_disk.py @@ -124,11 +124,6 @@ - Specifies a 256-bit customer-supplied encryption key, encoded in RFC 4648 base64 to either encrypt or decrypt this resource. required: false - sha256: - description: - - The RFC 4648 base64 encoded SHA-256 hash of the customer-supplied encryption - key that protects this resource. - required: false kms_key_name: description: - The name of the encryption key that is stored in Google Cloud KMS. @@ -150,11 +145,6 @@ - Specifies a 256-bit customer-supplied encryption key, encoded in RFC 4648 base64 to either encrypt or decrypt this resource. required: false - sha256: - description: - - The RFC 4648 base64 encoded SHA-256 hash of the customer-supplied encryption - key that protects this resource. - required: false kms_key_name: description: - The name of the encryption key that is stored in Google Cloud KMS. @@ -183,11 +173,6 @@ description: - The name of the encryption key that is stored in Google Cloud KMS. required: false - sha256: - description: - - The RFC 4648 base64 encoded SHA-256 hash of the customer-supplied encryption - key that protects this resource. - required: false extends_documentation_fragment: gcp notes: - 'API Reference: U(https://cloud.google.com/compute/docs/reference/latest/disks)' @@ -435,10 +420,10 @@ def main(): type=dict(type='str'), source_image=dict(type='str'), zone=dict(required=True, type='str'), - source_image_encryption_key=dict(type='dict', options=dict(raw_key=dict(type='str'), sha256=dict(type='str'), kms_key_name=dict(type='str'))), - disk_encryption_key=dict(type='dict', options=dict(raw_key=dict(type='str'), sha256=dict(type='str'), kms_key_name=dict(type='str'))), + source_image_encryption_key=dict(type='dict', options=dict(raw_key=dict(type='str'), kms_key_name=dict(type='str'))), + disk_encryption_key=dict(type='dict', options=dict(raw_key=dict(type='str'), kms_key_name=dict(type='str'))), source_snapshot=dict(), - source_snapshot_encryption_key=dict(type='dict', options=dict(raw_key=dict(type='str'), kms_key_name=dict(type='str'), sha256=dict(type='str'))), + source_snapshot_encryption_key=dict(type='dict', options=dict(raw_key=dict(type='str'), kms_key_name=dict(type='str'))), ) ) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_image.py b/lib/ansible/modules/cloud/google/gcp_compute_image.py index 5ecbf7b0da7fe8..f27231ee0e0230 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_image.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_image.py @@ -106,11 +106,6 @@ - Specifies a 256-bit customer-supplied encryption key, encoded in RFC 4648 base64 to either encrypt or decrypt this resource. required: false - sha256: - description: - - The RFC 4648 base64 encoded SHA-256 hash of the customer-supplied encryption - key that protects this resource. - required: false labels: description: - Labels to apply to this Image. @@ -173,11 +168,6 @@ - Specifies a 256-bit customer-supplied encryption key, encoded in RFC 4648 base64 to either encrypt or decrypt this resource. required: false - sha256: - description: - - The RFC 4648 base64 encoded SHA-256 hash of the customer-supplied encryption - key that protects this resource. - required: false source_disk_id: description: - The ID value of the disk used to create this image. This value may be used to @@ -453,7 +443,7 @@ def main(): disk_size_gb=dict(type='int'), family=dict(type='str'), guest_os_features=dict(type='list', elements='dict', options=dict(type=dict(type='str', choices=['VIRTIO_SCSI_MULTIQUEUE']))), - image_encryption_key=dict(type='dict', options=dict(raw_key=dict(type='str'), sha256=dict(type='str'))), + image_encryption_key=dict(type='dict', options=dict(raw_key=dict(type='str'))), labels=dict(type='dict'), licenses=dict(type='list', elements='str'), name=dict(required=True, type='str'), @@ -462,7 +452,7 @@ def main(): options=dict(container_type=dict(type='str', choices=['TAR']), sha1_checksum=dict(type='str'), source=dict(required=True, type='str')), ), source_disk=dict(), - source_disk_encryption_key=dict(type='dict', options=dict(raw_key=dict(type='str'), sha256=dict(type='str'))), + source_disk_encryption_key=dict(type='dict', options=dict(raw_key=dict(type='str'))), source_disk_id=dict(type='str'), source_type=dict(type='str', choices=['RAW']), ) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_instance.py b/lib/ansible/modules/cloud/google/gcp_compute_instance.py index 21bf96055df5f1..1687eb9c85ef03 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_instance.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_instance.py @@ -98,11 +98,6 @@ - Specifies an RFC 4648 base64 encoded, RSA-wrapped 2048-bit customer-supplied encryption key to either encrypt or decrypt this resource. required: false - sha256: - description: - - The RFC 4648 base64 encoded SHA-256 hash of the customer-supplied encryption - key that protects this resource. - required: false index: description: - Assigns a zero-based index to this disk, where 0 is reserved for the boot @@ -156,11 +151,6 @@ - Specifies a 256-bit customer-supplied encryption key, encoded in RFC 4648 base64 to either encrypt or decrypt this resource. required: false - sha256: - description: - - The RFC 4648 base64 encoded SHA-256 hash of the customer-supplied - encryption key that protects this resource. - required: false interface: description: - Specifies the disk interface to use for attaching this disk, which is either @@ -302,11 +292,6 @@ from which to allocate the IP CIDR range for this alias IP range. If left unspecified, the primary range of the subnetwork will be used. required: false - name: - description: - - The name of the network interface, generated by the server. For network - devices, these are eth0, eth1, etc . - required: false network: description: - Specifies the title of an existing network. When creating an instance, if @@ -902,7 +887,7 @@ def main(): auto_delete=dict(type='bool'), boot=dict(type='bool'), device_name=dict(type='str'), - disk_encryption_key=dict(type='dict', options=dict(raw_key=dict(type='str'), rsa_encrypted_key=dict(type='str'), sha256=dict(type='str'))), + disk_encryption_key=dict(type='dict', options=dict(raw_key=dict(type='str'), rsa_encrypted_key=dict(type='str'))), index=dict(type='int'), initialize_params=dict( type='dict', @@ -911,7 +896,7 @@ def main(): disk_size_gb=dict(type='int'), disk_type=dict(type='str'), source_image=dict(type='str', aliases=['image', 'image_family']), - source_image_encryption_key=dict(type='dict', options=dict(raw_key=dict(type='str'), sha256=dict(type='str'))), + source_image_encryption_key=dict(type='dict', options=dict(raw_key=dict(type='str'))), ), ), interface=dict(type='str', choices=['SCSI', 'NVME']), @@ -936,7 +921,6 @@ def main(): options=dict(name=dict(required=True, type='str'), nat_ip=dict(), type=dict(required=True, type='str', choices=['ONE_TO_ONE_NAT'])), ), alias_ip_ranges=dict(type='list', elements='dict', options=dict(ip_cidr_range=dict(type='str'), subnetwork_range_name=dict(type='str'))), - name=dict(type='str'), network=dict(), network_ip=dict(type='str'), subnetwork=dict(), diff --git a/lib/ansible/modules/cloud/google/gcp_compute_instance_template.py b/lib/ansible/modules/cloud/google/gcp_compute_instance_template.py index ee90ace8439f54..eebdfa5540f943 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_instance_template.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_instance_template.py @@ -123,11 +123,6 @@ - Specifies an RFC 4648 base64 encoded, RSA-wrapped 2048-bit customer-supplied encryption key to either encrypt or decrypt this resource. required: false - sha256: - description: - - The RFC 4648 base64 encoded SHA-256 hash of the customer-supplied - encryption key that protects this resource. - required: false index: description: - Assigns a zero-based index to this disk, where 0 is reserved for the @@ -179,11 +174,6 @@ - Specifies a 256-bit customer-supplied encryption key, encoded in RFC 4648 base64 to either encrypt or decrypt this resource. required: false - sha256: - description: - - The RFC 4648 base64 encoded SHA-256 hash of the customer-supplied - encryption key that protects this resource. - required: false interface: description: - Specifies the disk interface to use for attaching this disk, which is @@ -315,11 +305,6 @@ range. If left unspecified, the primary range of the subnetwork will be used. required: false - name: - description: - - The name of the network interface, generated by the server. For network - devices, these are eth0, eth1, etc . - required: false network: description: - Specifies the title of an existing network. When creating an instance, @@ -878,9 +863,7 @@ def main(): auto_delete=dict(type='bool'), boot=dict(type='bool'), device_name=dict(type='str'), - disk_encryption_key=dict( - type='dict', options=dict(raw_key=dict(type='str'), rsa_encrypted_key=dict(type='str'), sha256=dict(type='str')) - ), + disk_encryption_key=dict(type='dict', options=dict(raw_key=dict(type='str'), rsa_encrypted_key=dict(type='str'))), index=dict(type='int'), initialize_params=dict( type='dict', @@ -889,7 +872,7 @@ def main(): disk_size_gb=dict(type='int'), disk_type=dict(type='str'), source_image=dict(type='str'), - source_image_encryption_key=dict(type='dict', options=dict(raw_key=dict(type='str'), sha256=dict(type='str'))), + source_image_encryption_key=dict(type='dict', options=dict(raw_key=dict(type='str'))), ), ), interface=dict(type='str', choices=['SCSI', 'NVME']), @@ -916,7 +899,6 @@ def main(): alias_ip_ranges=dict( type='list', elements='dict', options=dict(ip_cidr_range=dict(type='str'), subnetwork_range_name=dict(type='str')) ), - name=dict(type='str'), network=dict(), network_ip=dict(type='str'), subnetwork=dict(), diff --git a/lib/ansible/modules/cloud/google/gcp_compute_region_disk.py b/lib/ansible/modules/cloud/google/gcp_compute_region_disk.py index 627ce87ee4761c..416e85bced6167 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_region_disk.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_region_disk.py @@ -118,11 +118,6 @@ - Specifies a 256-bit customer-supplied encryption key, encoded in RFC 4648 base64 to either encrypt or decrypt this resource. required: false - sha256: - description: - - The RFC 4648 base64 encoded SHA-256 hash of the customer-supplied encryption - key that protects this resource. - required: false source_snapshot: description: - The source snapshot used to create this disk. You can provide this as a partial @@ -143,11 +138,6 @@ - Specifies a 256-bit customer-supplied encryption key, encoded in RFC 4648 base64 to either encrypt or decrypt this resource. required: false - sha256: - description: - - The RFC 4648 base64 encoded SHA-256 hash of the customer-supplied encryption - key that protects this resource. - required: false extends_documentation_fragment: gcp notes: - 'API Reference: U(https://cloud.google.com/compute/docs/reference/rest/beta/regionDisks)' @@ -345,9 +335,9 @@ def main(): replica_zones=dict(required=True, type='list', elements='str'), type=dict(type='str'), region=dict(required=True, type='str'), - disk_encryption_key=dict(type='dict', options=dict(raw_key=dict(type='str'), sha256=dict(type='str'))), + disk_encryption_key=dict(type='dict', options=dict(raw_key=dict(type='str'))), source_snapshot=dict(), - source_snapshot_encryption_key=dict(type='dict', options=dict(raw_key=dict(type='str'), sha256=dict(type='str'))), + source_snapshot_encryption_key=dict(type='dict', options=dict(raw_key=dict(type='str'))), ) ) diff --git a/lib/ansible/modules/cloud/google/gcp_container_cluster.py b/lib/ansible/modules/cloud/google/gcp_container_cluster.py index 6564d7a769e8d3..3f0edf6ede5108 100644 --- a/lib/ansible/modules/cloud/google/gcp_container_cluster.py +++ b/lib/ansible/modules/cloud/google/gcp_container_cluster.py @@ -170,20 +170,6 @@ Because the master endpoint is open to the Internet, you should create a strong password. required: false - cluster_ca_certificate: - description: - - Base64-encoded public certificate that is the root of trust for the cluster. - required: false - client_certificate: - description: - - Base64-encoded public certificate used by clients to authenticate to the - cluster endpoint. - required: false - client_key: - description: - - Base64-encoded private key used by clients to authenticate to the cluster - endpoint. - required: false logging_service: description: - 'The logging service the cluster should use to write logs. Currently available @@ -672,16 +658,7 @@ def main(): preemptible=dict(type='bool'), ), ), - master_auth=dict( - type='dict', - options=dict( - username=dict(type='str'), - password=dict(type='str'), - cluster_ca_certificate=dict(type='str'), - client_certificate=dict(type='str'), - client_key=dict(type='str'), - ), - ), + master_auth=dict(type='dict', options=dict(username=dict(type='str'), password=dict(type='str'))), logging_service=dict(type='str', choices=['logging.googleapis.com', 'none']), monitoring_service=dict(type='str', choices=['monitoring.googleapis.com', 'none']), network=dict(type='str'), diff --git a/lib/ansible/modules/cloud/google/gcp_container_node_pool.py b/lib/ansible/modules/cloud/google/gcp_container_node_pool.py index 32b1c04e24c9d2..59aa070654aa8f 100644 --- a/lib/ansible/modules/cloud/google/gcp_container_node_pool.py +++ b/lib/ansible/modules/cloud/google/gcp_container_node_pool.py @@ -188,17 +188,7 @@ description: - Specifies the Auto Upgrade knobs for the node pool. required: false - suboptions: - auto_upgrade_start_time: - description: - - This field is set when upgrades are about to commence with the approximate - start time for the upgrades, in RFC3339 text format. - required: false - description: - description: - - This field is set when upgrades are about to commence with the description - of the upgrade. - required: false + suboptions: {} cluster: description: - The cluster this node pool belongs to. @@ -464,12 +454,7 @@ def main(): initial_node_count=dict(required=True, type='int'), autoscaling=dict(type='dict', options=dict(enabled=dict(type='bool'), min_node_count=dict(type='int'), max_node_count=dict(type='int'))), management=dict( - type='dict', - options=dict( - auto_upgrade=dict(type='bool'), - auto_repair=dict(type='bool'), - upgrade_options=dict(type='dict', options=dict(auto_upgrade_start_time=dict(type='str'), description=dict(type='str'))), - ), + type='dict', options=dict(auto_upgrade=dict(type='bool'), auto_repair=dict(type='bool'), upgrade_options=dict(type='dict', options=dict())) ), cluster=dict(required=True), location=dict(required=True, type='str', aliases=['region', 'zone']), diff --git a/lib/ansible/modules/cloud/google/gcp_sql_instance.py b/lib/ansible/modules/cloud/google/gcp_sql_instance.py index f1fd075a59183d..9301b4f51587c6 100644 --- a/lib/ansible/modules/cloud/google/gcp_sql_instance.py +++ b/lib/ansible/modules/cloud/google/gcp_sql_instance.py @@ -82,13 +82,6 @@ to Second Generation instances. required: false suboptions: - available: - description: - - The availability status of the failover replica. A false status indicates - that the failover replica is out of sync. The master can only failover to - the failover replica when the status is true. - required: false - type: bool name: description: - The name of the failover replica. If specified at instance creation, a failover @@ -286,13 +279,6 @@ description: - Define the backup start time in UTC (HH:MM) . required: false - settings_version: - description: - - The version of instance settings. This is a required field for update method - to make sure concurrent updates are handled properly. During update, use - the most recent settingsVersion value for this instance and do not try to - update this value. - required: false extends_documentation_fragment: gcp ''' @@ -624,7 +610,7 @@ def main(): backend_type=dict(type='str', choices=['FIRST_GEN', 'SECOND_GEN', 'EXTERNAL']), connection_name=dict(type='str'), database_version=dict(type='str', choices=['MYSQL_5_5', 'MYSQL_5_6', 'MYSQL_5_7', 'POSTGRES_9_6']), - failover_replica=dict(type='dict', options=dict(available=dict(type='bool'), name=dict(type='str'))), + failover_replica=dict(type='dict', options=dict(name=dict(type='str'))), instance_type=dict(type='str', choices=['CLOUD_SQL_INSTANCE', 'ON_PREMISES_INSTANCE', 'READ_REPLICA_INSTANCE']), ipv6_address=dict(type='str'), master_instance_name=dict(type='str'), @@ -672,7 +658,6 @@ def main(): backup_configuration=dict( type='dict', options=dict(enabled=dict(type='bool'), binary_log_enabled=dict(type='bool'), start_time=dict(type='str')) ), - settings_version=dict(type='int'), ), ), ) diff --git a/lib/ansible/modules/cloud/google/gcp_storage_bucket.py b/lib/ansible/modules/cloud/google/gcp_storage_bucket.py index 0da5659e92edfd..2e738662857486 100644 --- a/lib/ansible/modules/cloud/google/gcp_storage_bucket.py +++ b/lib/ansible/modules/cloud/google/gcp_storage_bucket.py @@ -65,14 +65,6 @@ string Alternatively, you can add `register: name-of-resource` to a gcp_storage_bucket task and then set this bucket field to "{{ name-of-resource }}"' required: true - domain: - description: - - The domain associated with the entity. - required: false - email: - description: - - The email address associated with the entity. - required: false entity: description: - 'The entity holding the permission, in one of the following forms: user-userId @@ -87,10 +79,6 @@ description: - The ID for the entity. required: false - id: - description: - - The ID of the access-control entry. - required: false project_team: description: - The project team associated with the entity. @@ -156,14 +144,6 @@ string Alternatively, you can add `register: name-of-resource` to a gcp_storage_bucket task and then set this bucket field to "{{ name-of-resource }}"' required: true - domain: - description: - - The domain associated with the entity. - required: false - email: - description: - - The email address associated with the entity. - required: false entity: description: - 'The entity holding the permission, in one of the following forms: * user-{{userId}} @@ -172,39 +152,10 @@ (such as "domain-example.com") * project-team-{{projectId}} * allUsers * allAuthenticatedUsers .' required: true - entity_id: - description: - - The ID for the entity. - required: false - generation: - description: - - The content generation of the object, if applied to an object. - required: false - id: - description: - - The ID of the access-control entry. - required: false object: description: - The name of the object, if applied to an object. required: false - project_team: - description: - - The project team associated with the entity. - required: false - suboptions: - project_number: - description: - - The project team associated with the entity. - required: false - team: - description: - - The team. - required: false - choices: - - editors - - owners - - viewers role: description: - The access permission for the entity. @@ -313,10 +264,6 @@ description: - The entity, in the form project-owner-projectId. required: false - entity_id: - description: - - The ID for the entity. - required: false storage_class: description: - The bucket's default storage class, used whenever no storageClass is specified @@ -794,11 +741,8 @@ def main(): elements='dict', options=dict( bucket=dict(required=True), - domain=dict(type='str'), - email=dict(type='str'), entity=dict(required=True, type='str'), entity_id=dict(type='str'), - id=dict(type='str'), project_team=dict( type='dict', options=dict(project_number=dict(type='str'), team=dict(type='str', choices=['editors', 'owners', 'viewers'])) ), @@ -820,16 +764,8 @@ def main(): elements='dict', options=dict( bucket=dict(required=True), - domain=dict(type='str'), - email=dict(type='str'), entity=dict(required=True, type='str'), - entity_id=dict(type='str'), - generation=dict(type='int'), - id=dict(type='str'), object=dict(type='str'), - project_team=dict( - type='dict', options=dict(project_number=dict(type='str'), team=dict(type='str', choices=['editors', 'owners', 'viewers'])) - ), role=dict(required=True, type='str', choices=['OWNER', 'READER']), ), ), @@ -861,7 +797,7 @@ def main(): logging=dict(type='dict', options=dict(log_bucket=dict(type='str'), log_object_prefix=dict(type='str'))), metageneration=dict(type='int'), name=dict(type='str'), - owner=dict(type='dict', options=dict(entity=dict(type='str'), entity_id=dict(type='str'))), + owner=dict(type='dict', options=dict(entity=dict(type='str'))), storage_class=dict(type='str', choices=['MULTI_REGIONAL', 'REGIONAL', 'STANDARD', 'NEARLINE', 'COLDLINE', 'DURABLE_REDUCED_AVAILABILITY']), versioning=dict(type='dict', options=dict(enabled=dict(type='bool'))), website=dict(type='dict', options=dict(main_page_suffix=dict(type='str'), not_found_page=dict(type='str'))), From 6bdd379d47c244e2361f073799f416d0e12ee040 Mon Sep 17 00:00:00 2001 From: The Magician Date: Mon, 11 Mar 2019 14:20:07 -0700 Subject: [PATCH 124/144] Node Pool versioning (#206) Signed-off-by: Modular Magician --- .../cloud/google/gcp_container_cluster.py | 16 +--------------- .../cloud/google/gcp_container_node_pool.py | 9 ++++++++- 2 files changed, 9 insertions(+), 16 deletions(-) diff --git a/lib/ansible/modules/cloud/google/gcp_container_cluster.py b/lib/ansible/modules/cloud/google/gcp_container_cluster.py index 3f0edf6ede5108..d526d578aef434 100644 --- a/lib/ansible/modules/cloud/google/gcp_container_cluster.py +++ b/lib/ansible/modules/cloud/google/gcp_container_cluster.py @@ -221,14 +221,6 @@ set of masters, as well as the ILB VIP. This range must not overlap with any other ranges in use within the cluster's network. required: false - private_endpoint: - description: - - The internal IP address of this cluster's master endpoint. - required: false - public_endpoint: - description: - - The external IP address of this cluster's master endpoint. - required: false cluster_ipv4_cidr: description: - The IP address range of the container pods in this cluster, in CIDR notation @@ -664,13 +656,7 @@ def main(): network=dict(type='str'), private_cluster_config=dict( type='dict', - options=dict( - enable_private_nodes=dict(type='bool'), - enable_private_endpoint=dict(type='bool'), - master_ipv4_cidr_block=dict(type='str'), - private_endpoint=dict(type='str'), - public_endpoint=dict(type='str'), - ), + options=dict(enable_private_nodes=dict(type='bool'), enable_private_endpoint=dict(type='bool'), master_ipv4_cidr_block=dict(type='str')), ), cluster_ipv4_cidr=dict(type='str'), addons_config=dict( diff --git a/lib/ansible/modules/cloud/google/gcp_container_node_pool.py b/lib/ansible/modules/cloud/google/gcp_container_node_pool.py index 59aa070654aa8f..341d8311800951 100644 --- a/lib/ansible/modules/cloud/google/gcp_container_node_pool.py +++ b/lib/ansible/modules/cloud/google/gcp_container_node_pool.py @@ -144,6 +144,11 @@ resource quota is sufficient for this number of instances. You must also have available firewall and routes quota. required: true + version: + description: + - The version of the Kubernetes of this node. + required: false + version_added: 2.8 autoscaling: description: - Autoscaler configuration for this NodePool. Autoscaler is enabled only if a @@ -452,6 +457,7 @@ def main(): ), ), initial_node_count=dict(required=True, type='int'), + version=dict(type='str'), autoscaling=dict(type='dict', options=dict(enabled=dict(type='bool'), min_node_count=dict(type='int'), max_node_count=dict(type='int'))), management=dict( type='dict', options=dict(auto_upgrade=dict(type='bool'), auto_repair=dict(type='bool'), upgrade_options=dict(type='dict', options=dict())) @@ -511,6 +517,7 @@ def resource_to_request(module): u'name': module.params.get('name'), u'config': NodePoolConfig(module.params.get('config', {}), module).to_request(), u'initialNodeCount': module.params.get('initial_node_count'), + u'version': module.params.get('version'), u'autoscaling': NodePoolAutoscaling(module.params.get('autoscaling', {}), module).to_request(), u'management': NodePoolManagement(module.params.get('management', {}), module).to_request(), } @@ -589,7 +596,7 @@ def response_to_hash(module, response): u'name': response.get(u'name'), u'config': NodePoolConfig(response.get(u'config', {}), module).from_response(), u'initialNodeCount': module.params.get('initial_node_count'), - u'version': response.get(u'version'), + u'version': module.params.get('version'), u'autoscaling': NodePoolAutoscaling(response.get(u'autoscaling', {}), module).from_response(), u'management': NodePoolManagement(response.get(u'management', {}), module).from_response(), } From 5e0703959744e64af241ce8b4a85a2142b70ebca Mon Sep 17 00:00:00 2001 From: The Magician Date: Wed, 13 Mar 2019 14:28:51 -0700 Subject: [PATCH 125/144] Update URLs in api.yml (#208) Signed-off-by: Modular Magician --- lib/ansible/modules/cloud/google/gcp_compute_backend_bucket.py | 2 +- lib/ansible/modules/cloud/google/gcp_compute_disk.py | 2 +- lib/ansible/modules/cloud/google/gcp_compute_firewall.py | 2 +- lib/ansible/modules/cloud/google/gcp_compute_forwarding_rule.py | 2 +- lib/ansible/modules/cloud/google/gcp_compute_global_address.py | 2 +- lib/ansible/modules/cloud/google/gcp_compute_health_check.py | 2 +- .../modules/cloud/google/gcp_compute_http_health_check.py | 2 +- .../modules/cloud/google/gcp_compute_https_health_check.py | 2 +- lib/ansible/modules/cloud/google/gcp_compute_image.py | 2 +- .../modules/cloud/google/gcp_compute_target_http_proxy.py | 2 +- .../modules/cloud/google/gcp_compute_target_https_proxy.py | 2 +- .../modules/cloud/google/gcp_compute_target_ssl_proxy.py | 2 +- .../modules/cloud/google/gcp_compute_target_tcp_proxy.py | 2 +- 13 files changed, 13 insertions(+), 13 deletions(-) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_backend_bucket.py b/lib/ansible/modules/cloud/google/gcp_compute_backend_bucket.py index c04d0ae88304b4..d1bddb47c42d2a 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_backend_bucket.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_backend_bucket.py @@ -76,7 +76,7 @@ required: true extends_documentation_fragment: gcp notes: -- 'API Reference: U(https://cloud.google.com/compute/docs/reference/latest/backendBuckets)' +- 'API Reference: U(https://cloud.google.com/compute/docs/reference/v1/backendBuckets)' - 'Using a Cloud Storage bucket as a load balancer backend: U(https://cloud.google.com/compute/docs/load-balancing/http/backend-bucket)' ''' diff --git a/lib/ansible/modules/cloud/google/gcp_compute_disk.py b/lib/ansible/modules/cloud/google/gcp_compute_disk.py index a94b9c2dc07229..c9c53d66776be5 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_disk.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_disk.py @@ -175,7 +175,7 @@ required: false extends_documentation_fragment: gcp notes: -- 'API Reference: U(https://cloud.google.com/compute/docs/reference/latest/disks)' +- 'API Reference: U(https://cloud.google.com/compute/docs/reference/v1/disks)' - 'Adding a persistent disk: U(https://cloud.google.com/compute/docs/disks/add-persistent-disk)' ''' diff --git a/lib/ansible/modules/cloud/google/gcp_compute_firewall.py b/lib/ansible/modules/cloud/google/gcp_compute_firewall.py index 98e621e24f11f3..ab70325e2032ee 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_firewall.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_firewall.py @@ -214,7 +214,7 @@ required: false extends_documentation_fragment: gcp notes: -- 'API Reference: U(https://cloud.google.com/compute/docs/reference/latest/firewalls)' +- 'API Reference: U(https://cloud.google.com/compute/docs/reference/v1/firewalls)' - 'Official Documentation: U(https://cloud.google.com/vpc/docs/firewalls)' ''' diff --git a/lib/ansible/modules/cloud/google/gcp_compute_forwarding_rule.py b/lib/ansible/modules/cloud/google/gcp_compute_forwarding_rule.py index 0caa9bb26e9bf5..c9eef469c499a0 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_forwarding_rule.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_forwarding_rule.py @@ -205,7 +205,7 @@ required: true extends_documentation_fragment: gcp notes: -- 'API Reference: U(https://cloud.google.com/compute/docs/reference/latest/forwardingRule)' +- 'API Reference: U(https://cloud.google.com/compute/docs/reference/v1/forwardingRule)' - 'Official Documentation: U(https://cloud.google.com/compute/docs/load-balancing/network/forwarding-rules)' ''' diff --git a/lib/ansible/modules/cloud/google/gcp_compute_global_address.py b/lib/ansible/modules/cloud/google/gcp_compute_global_address.py index 9deaf15217d48c..8692981bd59046 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_global_address.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_global_address.py @@ -88,7 +88,7 @@ - INTERNAL extends_documentation_fragment: gcp notes: -- 'API Reference: U(https://cloud.google.com/compute/docs/reference/latest/globalAddresses)' +- 'API Reference: U(https://cloud.google.com/compute/docs/reference/v1/globalAddresses)' - 'Reserving a Static External IP Address: U(https://cloud.google.com/compute/docs/ip-addresses/reserve-static-external-ip-address)' ''' 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 f79e904bb917c1..1ecf29aa7579e0 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_health_check.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_health_check.py @@ -264,7 +264,7 @@ - PROXY_V1 extends_documentation_fragment: gcp notes: -- 'API Reference: U(https://cloud.google.com/compute/docs/reference/rest/latest/healthChecks)' +- 'API Reference: U(https://cloud.google.com/compute/docs/reference/rest/v1/healthChecks)' - 'Official Documentation: U(https://cloud.google.com/load-balancing/docs/health-checks)' ''' diff --git a/lib/ansible/modules/cloud/google/gcp_compute_http_health_check.py b/lib/ansible/modules/cloud/google/gcp_compute_http_health_check.py index 30cf9b3459abee..5379eebec06718 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_http_health_check.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_http_health_check.py @@ -105,7 +105,7 @@ required: false extends_documentation_fragment: gcp notes: -- 'API Reference: U(https://cloud.google.com/compute/docs/reference/latest/httpHealthChecks)' +- 'API Reference: U(https://cloud.google.com/compute/docs/reference/v1/httpHealthChecks)' - 'Adding Health Checks: U(https://cloud.google.com/compute/docs/load-balancing/health-checks#legacy_health_checks)' ''' diff --git a/lib/ansible/modules/cloud/google/gcp_compute_https_health_check.py b/lib/ansible/modules/cloud/google/gcp_compute_https_health_check.py index da0f37895c3823..41b496a4c44a79 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_https_health_check.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_https_health_check.py @@ -102,7 +102,7 @@ required: false extends_documentation_fragment: gcp notes: -- 'API Reference: U(https://cloud.google.com/compute/docs/reference/latest/httpsHealthChecks)' +- 'API Reference: U(https://cloud.google.com/compute/docs/reference/v1/httpsHealthChecks)' - 'Adding Health Checks: U(https://cloud.google.com/compute/docs/load-balancing/health-checks#legacy_health_checks)' ''' diff --git a/lib/ansible/modules/cloud/google/gcp_compute_image.py b/lib/ansible/modules/cloud/google/gcp_compute_image.py index f27231ee0e0230..4a8f9eb00a5d81 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_image.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_image.py @@ -183,7 +183,7 @@ - RAW extends_documentation_fragment: gcp notes: -- 'API Reference: U(https://cloud.google.com/compute/docs/reference/latest/images)' +- 'API Reference: U(https://cloud.google.com/compute/docs/reference/v1/images)' - 'Official Documentation: U(https://cloud.google.com/compute/docs/images)' ''' diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_http_proxy.py b/lib/ansible/modules/cloud/google/gcp_compute_target_http_proxy.py index 9bc3fbe00a0b58..3e69a973f521da 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_http_proxy.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_http_proxy.py @@ -72,7 +72,7 @@ required: true extends_documentation_fragment: gcp notes: -- 'API Reference: U(https://cloud.google.com/compute/docs/reference/latest/targetHttpProxies)' +- 'API Reference: U(https://cloud.google.com/compute/docs/reference/v1/targetHttpProxies)' - 'Official Documentation: U(https://cloud.google.com/compute/docs/load-balancing/http/target-proxies)' ''' diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_https_proxy.py b/lib/ansible/modules/cloud/google/gcp_compute_target_https_proxy.py index e849ca63349755..c9dd72cfe16ef9 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_https_proxy.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_https_proxy.py @@ -102,7 +102,7 @@ required: true extends_documentation_fragment: gcp notes: -- 'API Reference: U(https://cloud.google.com/compute/docs/reference/latest/targetHttpsProxies)' +- 'API Reference: U(https://cloud.google.com/compute/docs/reference/v1/targetHttpsProxies)' - 'Official Documentation: U(https://cloud.google.com/compute/docs/load-balancing/http/target-proxies)' ''' diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_ssl_proxy.py b/lib/ansible/modules/cloud/google/gcp_compute_target_ssl_proxy.py index 9ce3d1a9a61b1d..ec6f54ccc23555 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_ssl_proxy.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_ssl_proxy.py @@ -97,7 +97,7 @@ version_added: 2.8 extends_documentation_fragment: gcp notes: -- 'API Reference: U(https://cloud.google.com/compute/docs/reference/latest/targetSslProxies)' +- 'API Reference: U(https://cloud.google.com/compute/docs/reference/v1/targetSslProxies)' - 'Setting Up SSL proxy for Google Cloud Load Balancing: U(https://cloud.google.com/compute/docs/load-balancing/tcp-ssl/)' ''' diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_tcp_proxy.py b/lib/ansible/modules/cloud/google/gcp_compute_target_tcp_proxy.py index 02562eacb69aac..b10ace3174f2e2 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_tcp_proxy.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_tcp_proxy.py @@ -80,7 +80,7 @@ required: true extends_documentation_fragment: gcp notes: -- 'API Reference: U(https://cloud.google.com/compute/docs/reference/latest/targetTcpProxies)' +- 'API Reference: U(https://cloud.google.com/compute/docs/reference/v1/targetTcpProxies)' - 'Setting Up TCP proxy for Google Cloud Load Balancing: U(https://cloud.google.com/compute/docs/load-balancing/tcp-ssl/tcp-proxy)' ''' From 295a10a11105231f2b932eff3961f2ece2408ad7 Mon Sep 17 00:00:00 2001 From: The Magician Date: Wed, 13 Mar 2019 15:23:39 -0700 Subject: [PATCH 126/144] boolean checks on difference checker (#210) /cc @rambleraptor --- lib/ansible/module_utils/gcp_utils.py | 38 +++++++++++++++++++-------- 1 file changed, 27 insertions(+), 11 deletions(-) diff --git a/lib/ansible/module_utils/gcp_utils.py b/lib/ansible/module_utils/gcp_utils.py index 0a89db4100876a..0b4b48cde6d659 100644 --- a/lib/ansible/module_utils/gcp_utils.py +++ b/lib/ansible/module_utils/gcp_utils.py @@ -273,19 +273,11 @@ def _compare_dicts(self, dict1, dict2): # Takes in two lists and compares them. def _compare_lists(self, list1, list2): difference = [] - list1.sort() - list2.sort() for index in range(len(list1)): value1 = list1[index] - # If items are dicts or arrays, we're assuming the next value - # is the correct one. - if isinstance(value1, dict) or isinstance(value1, list): - if index < len(list2): - value2 = list2[index] - difference.append(self._compare_value(value1, value2)) - else: - if value1 not in list2: - difference.append(value1) + if index < len(list2): + value2 = list2[index] + difference.append(self._compare_value(value1, value2)) difference2 = [] for value in difference: @@ -307,6 +299,8 @@ def _compare_value(self, value1, value2): diff = self._compare_lists(value1, value2) elif isinstance(value2, dict): diff = self._compare_dicts(value1, value2) + elif isinstance(value1, bool): + diff = self._compare_boolean(value1, value2) # Always use to_text values to avoid unicode issues. elif to_text(value1) != to_text(value2): diff = value1 @@ -316,3 +310,25 @@ def _compare_value(self, value1, value2): pass return diff + + def _compare_boolean(self, value1, value2): + try: + # Both True + if value1 and value2 is True: + return None + # Value1 True, value2 'true' + elif value1 and to_text(value2) == 'true': + return None + # Both False + elif not value1 and not value2: + return None + # Value1 False, value2 'false' + elif not value1 and to_text(value2) == 'false': + return None + else: + return value2 + + # to_text may throw UnicodeErrors. + # These errors shouldn't crash Ansible and should be hidden. + except UnicodeError: + return None From e980df857814464846def4e1839b57ae56ae2824 Mon Sep 17 00:00:00 2001 From: Chris Stephens Date: Wed, 13 Mar 2019 22:42:22 +0000 Subject: [PATCH 127/144] Add import support for organization_policies Signed-off-by: Modular Magician --- lib/ansible/module_utils/gcp_utils.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/ansible/module_utils/gcp_utils.py b/lib/ansible/module_utils/gcp_utils.py index 0b4b48cde6d659..d3dce29ee68494 100644 --- a/lib/ansible/module_utils/gcp_utils.py +++ b/lib/ansible/module_utils/gcp_utils.py @@ -314,13 +314,13 @@ def _compare_value(self, value1, value2): def _compare_boolean(self, value1, value2): try: # Both True - if value1 and value2 is True: + if value1 and isinstance(value2, bool) and value2: return None # Value1 True, value2 'true' elif value1 and to_text(value2) == 'true': return None # Both False - elif not value1 and not value2: + elif not value1 and isinstance(value2, bool) and not value2: return None # Value1 False, value2 'false' elif not value1 and to_text(value2) == 'false': From 382b07a7942c1e96f41d89e42a28ddc046b8050b Mon Sep 17 00:00:00 2001 From: The Magician Date: Wed, 13 Mar 2019 15:52:54 -0700 Subject: [PATCH 128/144] Terraform: Support for (Regional)Disk physicalBlockSizeBytes (#211) /cc @drebes --- .../modules/cloud/google/gcp_compute_disk.py | 21 +++++++++++++++++++ .../cloud/google/gcp_compute_disk_facts.py | 9 ++++++++ .../cloud/google/gcp_compute_region_disk.py | 20 ++++++++++++++++++ .../google/gcp_compute_region_disk_facts.py | 9 ++++++++ 4 files changed, 59 insertions(+) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_disk.py b/lib/ansible/modules/cloud/google/gcp_compute_disk.py index c9c53d66776be5..4c2c197f4425db 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_disk.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_disk.py @@ -89,6 +89,15 @@ of sizeGb must not be less than the size of the sourceImage or the size of the snapshot. required: false + physical_block_size_bytes: + description: + - Physical block size of the persistent disk, in bytes. If not present in a request, + a default value is used. Currently supported sizes are 4096 and 16384, other + sizes may be added in the future. + - If an unsupported value is requested, the error message will list the supported + values for the caller's project. + required: false + version_added: 2.8 type: description: - URL of the disk type resource describing which disk type to use to create the @@ -262,6 +271,15 @@ .' returned: success type: list +physicalBlockSizeBytes: + description: + - Physical block size of the persistent disk, in bytes. If not present in a request, + a default value is used. Currently supported sizes are 4096 and 16384, other sizes + may be added in the future. + - If an unsupported value is requested, the error message will list the supported + values for the caller's project. + returned: success + type: int type: description: - URL of the disk type resource describing which disk type to use to create the @@ -417,6 +435,7 @@ def main(): licenses=dict(type='list', elements='str'), name=dict(required=True, type='str'), size_gb=dict(type='int'), + physical_block_size_bytes=dict(type='int'), type=dict(type='str'), source_image=dict(type='str'), zone=dict(required=True, type='str'), @@ -507,6 +526,7 @@ def resource_to_request(module): u'licenses': module.params.get('licenses'), u'name': module.params.get('name'), u'sizeGb': module.params.get('size_gb'), + u'physicalBlockSizeBytes': module.params.get('physical_block_size_bytes'), u'type': disk_type_selflink(module.params.get('type'), module.params), u'sourceImage': module.params.get('source_image'), } @@ -585,6 +605,7 @@ def response_to_hash(module, response): u'name': module.params.get('name'), u'sizeGb': response.get(u'sizeGb'), u'users': response.get(u'users'), + u'physicalBlockSizeBytes': response.get(u'physicalBlockSizeBytes'), u'type': response.get(u'type'), u'sourceImage': module.params.get('source_image'), } diff --git a/lib/ansible/modules/cloud/google/gcp_compute_disk_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_disk_facts.py index 4cd90eec417248..0eac0ae6d0a18e 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_disk_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_disk_facts.py @@ -138,6 +138,15 @@ .' returned: success type: list + physicalBlockSizeBytes: + description: + - Physical block size of the persistent disk, in bytes. If not present in a + request, a default value is used. Currently supported sizes are 4096 and 16384, + other sizes may be added in the future. + - If an unsupported value is requested, the error message will list the supported + values for the caller's project. + returned: success + type: int type: description: - URL of the disk type resource describing which disk type to use to create diff --git a/lib/ansible/modules/cloud/google/gcp_compute_region_disk.py b/lib/ansible/modules/cloud/google/gcp_compute_region_disk.py index 416e85bced6167..cd2500b12f8ff4 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_region_disk.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_region_disk.py @@ -88,6 +88,14 @@ of sizeGb must not be less than the size of the sourceImage or the size of the snapshot. required: false + physical_block_size_bytes: + description: + - Physical block size of the persistent disk, in bytes. If not present in a request, + a default value is used. Currently supported sizes are 4096 and 16384, other + sizes may be added in the future. + - If an unsupported value is requested, the error message will list the supported + values for the caller's project. + required: false replica_zones: description: - URLs of the zones where the disk should be replicated to. @@ -230,6 +238,15 @@ .' returned: success type: list +physicalBlockSizeBytes: + description: + - Physical block size of the persistent disk, in bytes. If not present in a request, + a default value is used. Currently supported sizes are 4096 and 16384, other sizes + may be added in the future. + - If an unsupported value is requested, the error message will list the supported + values for the caller's project. + returned: success + type: int replicaZones: description: - URLs of the zones where the disk should be replicated to. @@ -332,6 +349,7 @@ def main(): licenses=dict(type='list', elements='str'), name=dict(required=True, type='str'), size_gb=dict(type='int'), + physical_block_size_bytes=dict(type='int'), replica_zones=dict(required=True, type='list', elements='str'), type=dict(type='str'), region=dict(required=True, type='str'), @@ -420,6 +438,7 @@ def resource_to_request(module): u'licenses': module.params.get('licenses'), u'name': module.params.get('name'), u'sizeGb': module.params.get('size_gb'), + u'physicalBlockSizeBytes': module.params.get('physical_block_size_bytes'), u'replicaZones': module.params.get('replica_zones'), u'type': region_disk_type_selflink(module.params.get('type'), module.params), } @@ -498,6 +517,7 @@ def response_to_hash(module, response): u'name': module.params.get('name'), u'sizeGb': response.get(u'sizeGb'), u'users': response.get(u'users'), + u'physicalBlockSizeBytes': response.get(u'physicalBlockSizeBytes'), u'replicaZones': response.get(u'replicaZones'), u'type': response.get(u'type'), } diff --git a/lib/ansible/modules/cloud/google/gcp_compute_region_disk_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_region_disk_facts.py index d2f310d1cc20da..d571944e002b0f 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_region_disk_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_region_disk_facts.py @@ -138,6 +138,15 @@ .' returned: success type: list + physicalBlockSizeBytes: + description: + - Physical block size of the persistent disk, in bytes. If not present in a + request, a default value is used. Currently supported sizes are 4096 and 16384, + other sizes may be added in the future. + - If an unsupported value is requested, the error message will list the supported + values for the caller's project. + returned: success + type: int replicaZones: description: - URLs of the zones where the disk should be replicated to. From 37a086500825180e8d4b6a43484026e933b6b6d1 Mon Sep 17 00:00:00 2001 From: The Magician Date: Thu, 14 Mar 2019 11:26:31 -0700 Subject: [PATCH 129/144] Error in managed zone api (#213) /cc @rambleraptor --- lib/ansible/modules/cloud/google/gcp_dns_managed_zone.py | 4 ++-- .../modules/cloud/google/gcp_dns_managed_zone_facts.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/ansible/modules/cloud/google/gcp_dns_managed_zone.py b/lib/ansible/modules/cloud/google/gcp_dns_managed_zone.py index 4e0c58117ea430..07f4309702fae7 100644 --- a/lib/ansible/modules/cloud/google/gcp_dns_managed_zone.py +++ b/lib/ansible/modules/cloud/google/gcp_dns_managed_zone.py @@ -126,7 +126,7 @@ a set of DNS name servers that all host the same ManagedZones. Most users will leave this field unset. returned: success - type: list + type: str creationTime: description: - The time that this resource was created on the server. @@ -161,7 +161,7 @@ def main(): description=dict(required=True, type='str'), dns_name=dict(required=True, type='str'), name=dict(required=True, type='str'), - name_server_set=dict(type='list', elements='str'), + name_server_set=dict(type='str'), labels=dict(type='dict'), ) ) diff --git a/lib/ansible/modules/cloud/google/gcp_dns_managed_zone_facts.py b/lib/ansible/modules/cloud/google/gcp_dns_managed_zone_facts.py index 9a5f73a4b4d446..e5a8152f57ac2e 100644 --- a/lib/ansible/modules/cloud/google/gcp_dns_managed_zone_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_dns_managed_zone_facts.py @@ -96,7 +96,7 @@ is a set of DNS name servers that all host the same ManagedZones. Most users will leave this field unset. returned: success - type: list + type: str creationTime: description: - The time that this resource was created on the server. From 9bf0215f62a519f33acbab3b72a46f17ac0cd986 Mon Sep 17 00:00:00 2001 From: The Magician Date: Wed, 20 Mar 2019 10:39:27 -0700 Subject: [PATCH 130/144] Add post-create for VpnTunnels Labels (#218) /cc @emilymye --- .../cloud/google/gcp_compute_vpn_tunnel.py | 40 ++----------------- .../google/gcp_compute_vpn_tunnel_facts.py | 11 ----- 2 files changed, 3 insertions(+), 48 deletions(-) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_vpn_tunnel.py b/lib/ansible/modules/cloud/google/gcp_compute_vpn_tunnel.py index 18c651928add36..c88d31844cd049 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_vpn_tunnel.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_vpn_tunnel.py @@ -105,10 +105,6 @@ The ranges should be disjoint. - Only IPv4 is supported. required: false - labels: - description: - - Labels to apply to this VpnTunnel. - required: false region: description: - The region where the tunnel is located. @@ -241,17 +237,6 @@ - Only IPv4 is supported. returned: success type: list -labels: - description: - - Labels to apply to this VpnTunnel. - returned: success - type: dict -labelFingerprint: - description: - - The fingerprint used for optimistic locking of this resource. Used internally - during updates. - returned: success - type: str region: description: - The region where the tunnel is located. @@ -287,7 +272,6 @@ def main(): ike_version=dict(default=2, type='int'), local_traffic_selector=dict(type='list', elements='str'), remote_traffic_selector=dict(type='list', elements='str'), - labels=dict(type='dict'), region=dict(required=True, type='str'), ) ) @@ -304,7 +288,7 @@ def main(): if fetch: if state == 'present': if is_different(module, fetch): - update(module, self_link(module), kind, fetch) + update(module, self_link(module), kind) fetch = fetch_resource(module, self_link(module), kind) changed = True else: @@ -314,7 +298,6 @@ def main(): else: if state == 'present': fetch = create(module, collection(module), kind) - labels_update(module, module.params, fetch) changed = True else: fetch = {} @@ -329,22 +312,8 @@ def create(module, link, kind): return wait_for_operation(module, auth.post(link, resource_to_request(module))) -def update(module, link, kind, fetch): - update_fields(module, resource_to_request(module), response_to_hash(module, fetch)) - return fetch_resource(module, self_link(module), kind) - - -def update_fields(module, request, response): - if response.get('labels') != request.get('labels'): - labels_update(module, request, response) - - -def labels_update(module, request, response): - auth = GcpSession(module, 'compute') - auth.post( - ''.join(["https://www.googleapis.com/compute/v1/", "projects/{project}/regions/{region}/vpnTunnels/{name}/setLabels"]).format(**module.params), - {u'labels': module.params.get('labels'), u'labelFingerprint': response.get('labelFingerprint')}, - ) +def update(module, link, kind): + module.fail_json(msg="VpnTunnel cannot be edited") def delete(module, link, kind): @@ -364,7 +333,6 @@ def resource_to_request(module): u'ikeVersion': module.params.get('ike_version'), u'localTrafficSelector': module.params.get('local_traffic_selector'), u'remoteTrafficSelector': module.params.get('remote_traffic_selector'), - u'labels': module.params.get('labels'), } return_vals = {} for k, v in request.items(): @@ -441,8 +409,6 @@ def response_to_hash(module, response): u'ikeVersion': response.get(u'ikeVersion'), u'localTrafficSelector': response.get(u'localTrafficSelector'), u'remoteTrafficSelector': response.get(u'remoteTrafficSelector'), - u'labels': response.get(u'labels'), - u'labelFingerprint': response.get(u'labelFingerprint'), } diff --git a/lib/ansible/modules/cloud/google/gcp_compute_vpn_tunnel_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_vpn_tunnel_facts.py index da4b071b17509c..00d5645d1e01df 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_vpn_tunnel_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_vpn_tunnel_facts.py @@ -138,17 +138,6 @@ - Only IPv4 is supported. returned: success type: list - labels: - description: - - Labels to apply to this VpnTunnel. - returned: success - type: dict - labelFingerprint: - description: - - The fingerprint used for optimistic locking of this resource. Used internally - during updates. - returned: success - type: str region: description: - The region where the tunnel is located. From 4b3972b434af780a724ace4b6214959ee9b2666d Mon Sep 17 00:00:00 2001 From: The Magician Date: Wed, 20 Mar 2019 10:49:21 -0700 Subject: [PATCH 131/144] Ansible - Remove output only from response (#216) /cc @rambleraptor --- lib/ansible/module_utils/gcp_utils.py | 119 ++++++++++++------ .../cloud/google/gcp_bigquery_table.py | 16 +-- .../google/gcp_compute_backend_service.py | 2 - .../modules/cloud/google/gcp_compute_disk.py | 24 +--- .../modules/cloud/google/gcp_compute_image.py | 8 +- .../cloud/google/gcp_compute_instance.py | 14 +-- .../gcp_compute_instance_group_manager.py | 26 +--- .../google/gcp_compute_instance_template.py | 14 +-- .../gcp_compute_interconnect_attachment.py | 4 +- .../cloud/google/gcp_compute_region_disk.py | 8 +- .../cloud/google/gcp_compute_ssl_policy.py | 4 +- .../cloud/google/gcp_container_cluster.py | 24 +--- .../cloud/google/gcp_container_node_pool.py | 4 +- .../modules/cloud/google/gcp_sql_instance.py | 6 +- .../cloud/google/gcp_storage_bucket.py | 29 +---- test/units/module_utils/gcp/test_gcp_utils.py | 41 ++++++ 16 files changed, 160 insertions(+), 183 deletions(-) diff --git a/lib/ansible/module_utils/gcp_utils.py b/lib/ansible/module_utils/gcp_utils.py index d3dce29ee68494..ffa5b5c565bac4 100644 --- a/lib/ansible/module_utils/gcp_utils.py +++ b/lib/ansible/module_utils/gcp_utils.py @@ -237,12 +237,16 @@ def _merge_dictionaries(self, a, b): return new -# This class takes in two dictionaries `a` and `b`. -# These are dictionaries of arbitrary depth, but made up of standard Python -# types only. -# This differ will compare all values in `a` to those in `b`. -# Note: Only keys in `a` will be compared. Extra keys in `b` will be ignored. -# Note: On all lists, order does matter. +# This class does difference checking according to a set of GCP-specific rules. +# This will be primarily used for checking dictionaries. +# In an equivalence check, the left-hand dictionary will be the request and +# the right-hand side will be the response. + +# Rules: +# Extra keys in response will be ignored. +# Ordering of lists does not matter. +# - exception: lists of dictionaries are +# assumed to be in sorted order. class GcpRequest(object): def __init__(self, request): self.request = request @@ -253,31 +257,48 @@ def __eq__(self, other): def __ne__(self, other): return not self.__eq__(other) - # Returns the difference between `self.request` and `b` - def difference(self, b): - return self._compare_dicts(self.request, b.request) + # Returns the difference between a request + response. + # While this is used under the hood for __eq__ and __ne__, + # it is useful for debugging. + def difference(self, response): + return self._compare_value(self.request, response.request) - def _compare_dicts(self, dict1, dict2): + def _compare_dicts(self, req_dict, resp_dict): difference = {} - for key in dict1: - difference[key] = self._compare_value(dict1.get(key), dict2.get(key)) + for key in req_dict: + if resp_dict.get(key): + difference[key] = self._compare_value(req_dict.get(key), resp_dict.get(key)) # Remove all empty values from difference. - difference2 = {} + sanitized_difference = {} for key in difference: if difference[key]: - difference2[key] = difference[key] + sanitized_difference[key] = difference[key] - return difference2 + return sanitized_difference # Takes in two lists and compares them. - def _compare_lists(self, list1, list2): + # All things in the list should be identical (even if a dictionary) + def _compare_lists(self, req_list, resp_list): + # Have to convert each thing over to unicode. + # Python doesn't handle equality checks between unicode + non-unicode well. difference = [] - for index in range(len(list1)): - value1 = list1[index] - if index < len(list2): - value2 = list2[index] - difference.append(self._compare_value(value1, value2)) + new_req_list = self._convert_value(req_list) + new_resp_list = self._convert_value(resp_list) + + # We have to compare each thing in the request to every other thing + # in the response. + # This is because the request value will be a subset of the response value. + # The assumption is that these lists will be small enough that it won't + # be a performance burden. + for req_item in new_req_list: + found_item = False + for resp_item in new_resp_list: + # Looking for a None value here. + if not self._compare_value(req_item, resp_item): + found_item = True + if not found_item: + difference.append(req_item) difference2 = [] for value in difference: @@ -286,24 +307,25 @@ def _compare_lists(self, list1, list2): return difference2 - def _compare_value(self, value1, value2): + # Compare two values of arbitrary types. + def _compare_value(self, req_value, resp_value): diff = None # If a None is found, a difference does not exist. # Only differing values matter. - if not value2: + if not resp_value: return None # Can assume non-None types at this point. try: - if isinstance(value1, list): - diff = self._compare_lists(value1, value2) - elif isinstance(value2, dict): - diff = self._compare_dicts(value1, value2) - elif isinstance(value1, bool): - diff = self._compare_boolean(value1, value2) + if isinstance(req_value, list): + diff = self._compare_lists(req_value, resp_value) + elif isinstance(req_value, dict): + diff = self._compare_dicts(req_value, resp_value) + elif isinstance(req_value, bool): + diff = self._compare_boolean(req_value, resp_value) # Always use to_text values to avoid unicode issues. - elif to_text(value1) != to_text(value2): - diff = value1 + elif to_text(req_value) != to_text(resp_value): + diff = req_value # to_text may throw UnicodeErrors. # These errors shouldn't crash Ansible and should be hidden. except UnicodeError: @@ -311,24 +333,43 @@ def _compare_value(self, value1, value2): return diff - def _compare_boolean(self, value1, value2): + # Compare two boolean values. + def _compare_boolean(self, req_value, resp_value): try: # Both True - if value1 and isinstance(value2, bool) and value2: + if req_value and isinstance(resp_value, bool) and resp_value: return None - # Value1 True, value2 'true' - elif value1 and to_text(value2) == 'true': + # Value1 True, resp_value 'true' + elif req_value and to_text(resp_value) == 'true': return None # Both False - elif not value1 and isinstance(value2, bool) and not value2: + elif not req_value and isinstance(resp_value, bool) and not resp_value: return None - # Value1 False, value2 'false' - elif not value1 and to_text(value2) == 'false': + # Value1 False, resp_value 'false' + elif not req_value and to_text(resp_value) == 'false': return None else: - return value2 + return resp_value # to_text may throw UnicodeErrors. # These errors shouldn't crash Ansible and should be hidden. except UnicodeError: return None + + # Python (2 esp.) doesn't do comparisons between unicode + non-unicode well. + # This leads to a lot of false positives when diffing values. + # The Ansible to_text() function is meant to get all strings + # into a standard format. + def _convert_value(self, value): + if isinstance(value, list): + new_list = [] + for item in value: + new_list.append(self._convert_value(item)) + return new_list + elif isinstance(value, dict): + new_dict = {} + for key in value: + new_dict[key] = self._convert_value(value[key]) + return new_dict + else: + return to_text(value) diff --git a/lib/ansible/modules/cloud/google/gcp_bigquery_table.py b/lib/ansible/modules/cloud/google/gcp_bigquery_table.py index 502b0b3836e20b..69c90c89314910 100644 --- a/lib/ansible/modules/cloud/google/gcp_bigquery_table.py +++ b/lib/ansible/modules/cloud/google/gcp_bigquery_table.py @@ -1254,22 +1254,10 @@ def __init__(self, request, module): self.request = {} def to_request(self): - return remove_nones_from_dict( - { - u'estimatedBytes': self.request.get('estimated_bytes'), - u'estimatedRows': self.request.get('estimated_rows'), - u'oldestEntryTime': self.request.get('oldest_entry_time'), - } - ) + return remove_nones_from_dict({}) def from_response(self): - return remove_nones_from_dict( - { - u'estimatedBytes': self.request.get(u'estimatedBytes'), - u'estimatedRows': self.request.get(u'estimatedRows'), - u'oldestEntryTime': self.request.get(u'oldestEntryTime'), - } - ) + return remove_nones_from_dict({}) class TableSchema(object): diff --git a/lib/ansible/modules/cloud/google/gcp_compute_backend_service.py b/lib/ansible/modules/cloud/google/gcp_compute_backend_service.py index bab23b2994c05d..03d1a19338fba6 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_backend_service.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_backend_service.py @@ -981,7 +981,6 @@ def to_request(self): u'enabled': self.request.get('enabled'), u'oauth2ClientId': self.request.get('oauth2_client_id'), u'oauth2ClientSecret': self.request.get('oauth2_client_secret'), - u'oauth2ClientSecretSha256': self.request.get('oauth2_client_secret_sha256'), } ) @@ -991,7 +990,6 @@ def from_response(self): u'enabled': self.request.get(u'enabled'), u'oauth2ClientId': self.request.get(u'oauth2ClientId'), u'oauth2ClientSecret': self.request.get(u'oauth2ClientSecret'), - u'oauth2ClientSecretSha256': self.request.get(u'oauth2ClientSecretSha256'), } ) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_disk.py b/lib/ansible/modules/cloud/google/gcp_compute_disk.py index 4c2c197f4425db..a96ca008d18a34 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_disk.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_disk.py @@ -664,14 +664,10 @@ def __init__(self, request, module): self.request = {} def to_request(self): - return remove_nones_from_dict( - {u'rawKey': self.request.get('raw_key'), u'sha256': self.request.get('sha256'), u'kmsKeyName': self.request.get('kms_key_name')} - ) + return remove_nones_from_dict({u'rawKey': self.request.get('raw_key'), u'kmsKeyName': self.request.get('kms_key_name')}) def from_response(self): - return remove_nones_from_dict( - {u'rawKey': self.request.get(u'rawKey'), u'sha256': self.request.get(u'sha256'), u'kmsKeyName': self.request.get(u'kmsKeyName')} - ) + return remove_nones_from_dict({u'rawKey': self.request.get(u'rawKey'), u'kmsKeyName': self.request.get(u'kmsKeyName')}) class DiskDiskencryptionkey(object): @@ -683,14 +679,10 @@ def __init__(self, request, module): self.request = {} def to_request(self): - return remove_nones_from_dict( - {u'rawKey': self.request.get('raw_key'), u'sha256': self.request.get('sha256'), u'kmsKeyName': self.request.get('kms_key_name')} - ) + return remove_nones_from_dict({u'rawKey': self.request.get('raw_key'), u'kmsKeyName': self.request.get('kms_key_name')}) def from_response(self): - return remove_nones_from_dict( - {u'rawKey': self.request.get(u'rawKey'), u'sha256': self.request.get(u'sha256'), u'kmsKeyName': self.request.get(u'kmsKeyName')} - ) + return remove_nones_from_dict({u'rawKey': self.request.get(u'rawKey'), u'kmsKeyName': self.request.get(u'kmsKeyName')}) class DiskSourcesnapshotencryptionkey(object): @@ -702,14 +694,10 @@ def __init__(self, request, module): self.request = {} def to_request(self): - return remove_nones_from_dict( - {u'rawKey': self.request.get('raw_key'), u'kmsKeyName': self.request.get('kms_key_name'), u'sha256': self.request.get('sha256')} - ) + return remove_nones_from_dict({u'rawKey': self.request.get('raw_key'), u'kmsKeyName': self.request.get('kms_key_name')}) def from_response(self): - return remove_nones_from_dict( - {u'rawKey': self.request.get(u'rawKey'), u'kmsKeyName': self.request.get(u'kmsKeyName'), u'sha256': self.request.get(u'sha256')} - ) + return remove_nones_from_dict({u'rawKey': self.request.get(u'rawKey'), u'kmsKeyName': self.request.get(u'kmsKeyName')}) if __name__ == '__main__': diff --git a/lib/ansible/modules/cloud/google/gcp_compute_image.py b/lib/ansible/modules/cloud/google/gcp_compute_image.py index 4a8f9eb00a5d81..fc6baa19e2dc0b 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_image.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_image.py @@ -730,10 +730,10 @@ def __init__(self, request, module): self.request = {} def to_request(self): - return remove_nones_from_dict({u'rawKey': self.request.get('raw_key'), u'sha256': self.request.get('sha256')}) + return remove_nones_from_dict({u'rawKey': self.request.get('raw_key')}) def from_response(self): - return remove_nones_from_dict({u'rawKey': self.request.get(u'rawKey'), u'sha256': self.request.get(u'sha256')}) + return remove_nones_from_dict({u'rawKey': self.request.get(u'rawKey')}) class ImageRawdisk(object): @@ -764,10 +764,10 @@ def __init__(self, request, module): self.request = {} def to_request(self): - return remove_nones_from_dict({u'rawKey': self.request.get('raw_key'), u'sha256': self.request.get('sha256')}) + return remove_nones_from_dict({u'rawKey': self.request.get('raw_key')}) def from_response(self): - return remove_nones_from_dict({u'rawKey': self.request.get(u'rawKey'), u'sha256': self.request.get(u'sha256')}) + return remove_nones_from_dict({u'rawKey': self.request.get(u'rawKey')}) if __name__ == '__main__': diff --git a/lib/ansible/modules/cloud/google/gcp_compute_instance.py b/lib/ansible/modules/cloud/google/gcp_compute_instance.py index 1687eb9c85ef03..e5790c2d8d6c0f 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_instance.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_instance.py @@ -1298,14 +1298,10 @@ def __init__(self, request, module): self.request = {} def to_request(self): - return remove_nones_from_dict( - {u'rawKey': self.request.get('raw_key'), u'rsaEncryptedKey': self.request.get('rsa_encrypted_key'), u'sha256': self.request.get('sha256')} - ) + return remove_nones_from_dict({u'rawKey': self.request.get('raw_key'), u'rsaEncryptedKey': self.request.get('rsa_encrypted_key')}) def from_response(self): - return remove_nones_from_dict( - {u'rawKey': self.request.get(u'rawKey'), u'rsaEncryptedKey': self.request.get(u'rsaEncryptedKey'), u'sha256': self.request.get(u'sha256')} - ) + return remove_nones_from_dict({u'rawKey': self.request.get(u'rawKey'), u'rsaEncryptedKey': self.request.get(u'rsaEncryptedKey')}) class InstanceInitializeparams(object): @@ -1348,10 +1344,10 @@ def __init__(self, request, module): self.request = {} def to_request(self): - return remove_nones_from_dict({u'rawKey': self.request.get('raw_key'), u'sha256': self.request.get('sha256')}) + return remove_nones_from_dict({u'rawKey': self.request.get('raw_key')}) def from_response(self): - return remove_nones_from_dict({u'rawKey': self.request.get(u'rawKey'), u'sha256': self.request.get(u'sha256')}) + return remove_nones_from_dict({u'rawKey': self.request.get(u'rawKey')}) class InstanceGuestacceleratorsArray(object): @@ -1406,7 +1402,6 @@ def _request_for_item(self, item): { u'accessConfigs': InstanceAccessconfigsArray(item.get('access_configs', []), self.module).to_request(), u'aliasIpRanges': InstanceAliasiprangesArray(item.get('alias_ip_ranges', []), self.module).to_request(), - u'name': item.get('name'), u'network': replace_resource_dict(item.get(u'network', {}), 'selfLink'), u'networkIP': item.get('network_ip'), u'subnetwork': replace_resource_dict(item.get(u'subnetwork', {}), 'selfLink'), @@ -1418,7 +1413,6 @@ def _response_from_item(self, item): { u'accessConfigs': InstanceAccessconfigsArray(item.get(u'accessConfigs', []), self.module).from_response(), u'aliasIpRanges': InstanceAliasiprangesArray(item.get(u'aliasIpRanges', []), self.module).from_response(), - u'name': item.get(u'name'), u'network': item.get(u'network'), u'networkIP': item.get(u'networkIP'), u'subnetwork': item.get(u'subnetwork'), diff --git a/lib/ansible/modules/cloud/google/gcp_compute_instance_group_manager.py b/lib/ansible/modules/cloud/google/gcp_compute_instance_group_manager.py index 2c9ef402105f1d..6153fc3a1f67fc 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_instance_group_manager.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_instance_group_manager.py @@ -537,32 +537,10 @@ def __init__(self, request, module): self.request = {} def to_request(self): - return remove_nones_from_dict( - { - u'abandoning': self.request.get('abandoning'), - u'creating': self.request.get('creating'), - u'creatingWithoutRetries': self.request.get('creating_without_retries'), - u'deleting': self.request.get('deleting'), - u'none': self.request.get('none'), - u'recreating': self.request.get('recreating'), - u'refreshing': self.request.get('refreshing'), - u'restarting': self.request.get('restarting'), - } - ) + return remove_nones_from_dict({}) def from_response(self): - return remove_nones_from_dict( - { - u'abandoning': self.request.get(u'abandoning'), - u'creating': self.request.get(u'creating'), - u'creatingWithoutRetries': self.request.get(u'creatingWithoutRetries'), - u'deleting': self.request.get(u'deleting'), - u'none': self.request.get(u'none'), - u'recreating': self.request.get(u'recreating'), - u'refreshing': self.request.get(u'refreshing'), - u'restarting': self.request.get(u'restarting'), - } - ) + return remove_nones_from_dict({}) class InstanceGroupManagerNamedportsArray(object): diff --git a/lib/ansible/modules/cloud/google/gcp_compute_instance_template.py b/lib/ansible/modules/cloud/google/gcp_compute_instance_template.py index eebdfa5540f943..68ffdabbce2c87 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_instance_template.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_instance_template.py @@ -1237,14 +1237,10 @@ def __init__(self, request, module): self.request = {} def to_request(self): - return remove_nones_from_dict( - {u'rawKey': self.request.get('raw_key'), u'rsaEncryptedKey': self.request.get('rsa_encrypted_key'), u'sha256': self.request.get('sha256')} - ) + return remove_nones_from_dict({u'rawKey': self.request.get('raw_key'), u'rsaEncryptedKey': self.request.get('rsa_encrypted_key')}) def from_response(self): - return remove_nones_from_dict( - {u'rawKey': self.request.get(u'rawKey'), u'rsaEncryptedKey': self.request.get(u'rsaEncryptedKey'), u'sha256': self.request.get(u'sha256')} - ) + return remove_nones_from_dict({u'rawKey': self.request.get(u'rawKey'), u'rsaEncryptedKey': self.request.get(u'rsaEncryptedKey')}) class InstanceTemplateInitializeparams(object): @@ -1291,10 +1287,10 @@ def __init__(self, request, module): self.request = {} def to_request(self): - return remove_nones_from_dict({u'rawKey': self.request.get('raw_key'), u'sha256': self.request.get('sha256')}) + return remove_nones_from_dict({u'rawKey': self.request.get('raw_key')}) def from_response(self): - return remove_nones_from_dict({u'rawKey': self.request.get(u'rawKey'), u'sha256': self.request.get(u'sha256')}) + return remove_nones_from_dict({u'rawKey': self.request.get(u'rawKey')}) class InstanceTemplateGuestacceleratorsArray(object): @@ -1349,7 +1345,6 @@ def _request_for_item(self, item): { u'accessConfigs': InstanceTemplateAccessconfigsArray(item.get('access_configs', []), self.module).to_request(), u'aliasIpRanges': InstanceTemplateAliasiprangesArray(item.get('alias_ip_ranges', []), self.module).to_request(), - u'name': item.get('name'), u'network': replace_resource_dict(item.get(u'network', {}), 'selfLink'), u'networkIP': item.get('network_ip'), u'subnetwork': replace_resource_dict(item.get(u'subnetwork', {}), 'selfLink'), @@ -1361,7 +1356,6 @@ def _response_from_item(self, item): { u'accessConfigs': InstanceTemplateAccessconfigsArray(item.get(u'accessConfigs', []), self.module).from_response(), u'aliasIpRanges': InstanceTemplateAliasiprangesArray(item.get(u'aliasIpRanges', []), self.module).from_response(), - u'name': item.get(u'name'), u'network': item.get(u'network'), u'networkIP': item.get(u'networkIP'), u'subnetwork': item.get(u'subnetwork'), diff --git a/lib/ansible/modules/cloud/google/gcp_compute_interconnect_attachment.py b/lib/ansible/modules/cloud/google/gcp_compute_interconnect_attachment.py index 025755127bf7fc..3ce52d47075f43 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_interconnect_attachment.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_interconnect_attachment.py @@ -484,10 +484,10 @@ def __init__(self, request, module): self.request = {} def to_request(self): - return remove_nones_from_dict({u'tag8021q': self.request.get('tag8021q')}) + return remove_nones_from_dict({}) def from_response(self): - return remove_nones_from_dict({u'tag8021q': self.request.get(u'tag8021q')}) + return remove_nones_from_dict({}) if __name__ == '__main__': diff --git a/lib/ansible/modules/cloud/google/gcp_compute_region_disk.py b/lib/ansible/modules/cloud/google/gcp_compute_region_disk.py index cd2500b12f8ff4..f789eaca2994df 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_region_disk.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_region_disk.py @@ -585,10 +585,10 @@ def __init__(self, request, module): self.request = {} def to_request(self): - return remove_nones_from_dict({u'rawKey': self.request.get('raw_key'), u'sha256': self.request.get('sha256')}) + return remove_nones_from_dict({u'rawKey': self.request.get('raw_key')}) def from_response(self): - return remove_nones_from_dict({u'rawKey': self.request.get(u'rawKey'), u'sha256': self.request.get(u'sha256')}) + return remove_nones_from_dict({u'rawKey': self.request.get(u'rawKey')}) class RegionDiskSourcesnapshotencryptionkey(object): @@ -600,10 +600,10 @@ def __init__(self, request, module): self.request = {} def to_request(self): - return remove_nones_from_dict({u'rawKey': self.request.get('raw_key'), u'sha256': self.request.get('sha256')}) + return remove_nones_from_dict({u'rawKey': self.request.get('raw_key')}) def from_response(self): - return remove_nones_from_dict({u'rawKey': self.request.get(u'rawKey'), u'sha256': self.request.get(u'sha256')}) + return remove_nones_from_dict({u'rawKey': self.request.get(u'rawKey')}) if __name__ == '__main__': diff --git a/lib/ansible/modules/cloud/google/gcp_compute_ssl_policy.py b/lib/ansible/modules/cloud/google/gcp_compute_ssl_policy.py index 329ec37fa3a62c..3ae8d0f9684630 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_ssl_policy.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_ssl_policy.py @@ -403,10 +403,10 @@ def from_response(self): return items def _request_for_item(self, item): - return remove_nones_from_dict({u'code': item.get('code'), u'message': item.get('message')}) + return remove_nones_from_dict({}) def _response_from_item(self, item): - return remove_nones_from_dict({u'code': item.get(u'code'), u'message': item.get(u'message')}) + return remove_nones_from_dict({}) if __name__ == '__main__': diff --git a/lib/ansible/modules/cloud/google/gcp_container_cluster.py b/lib/ansible/modules/cloud/google/gcp_container_cluster.py index d526d578aef434..aca85eb58b9c3b 100644 --- a/lib/ansible/modules/cloud/google/gcp_container_cluster.py +++ b/lib/ansible/modules/cloud/google/gcp_container_cluster.py @@ -919,26 +919,10 @@ def __init__(self, request, module): self.request = {} def to_request(self): - return remove_nones_from_dict( - { - u'username': self.request.get('username'), - u'password': self.request.get('password'), - u'clusterCaCertificate': self.request.get('cluster_ca_certificate'), - u'clientCertificate': self.request.get('client_certificate'), - u'clientKey': self.request.get('client_key'), - } - ) + return remove_nones_from_dict({u'username': self.request.get('username'), u'password': self.request.get('password')}) def from_response(self): - return remove_nones_from_dict( - { - u'username': self.request.get(u'username'), - u'password': self.request.get(u'password'), - u'clusterCaCertificate': self.request.get(u'clusterCaCertificate'), - u'clientCertificate': self.request.get(u'clientCertificate'), - u'clientKey': self.request.get(u'clientKey'), - } - ) + return remove_nones_from_dict({u'username': self.request.get(u'username'), u'password': self.request.get(u'password')}) class ClusterPrivateclusterconfig(object): @@ -955,8 +939,6 @@ def to_request(self): u'enablePrivateNodes': self.request.get('enable_private_nodes'), u'enablePrivateEndpoint': self.request.get('enable_private_endpoint'), u'masterIpv4CidrBlock': self.request.get('master_ipv4_cidr_block'), - u'privateEndpoint': self.request.get('private_endpoint'), - u'publicEndpoint': self.request.get('public_endpoint'), } ) @@ -966,8 +948,6 @@ def from_response(self): u'enablePrivateNodes': self.request.get(u'enablePrivateNodes'), u'enablePrivateEndpoint': self.request.get(u'enablePrivateEndpoint'), u'masterIpv4CidrBlock': self.request.get(u'masterIpv4CidrBlock'), - u'privateEndpoint': self.request.get(u'privateEndpoint'), - u'publicEndpoint': self.request.get(u'publicEndpoint'), } ) diff --git a/lib/ansible/modules/cloud/google/gcp_container_node_pool.py b/lib/ansible/modules/cloud/google/gcp_container_node_pool.py index 341d8311800951..fc4acf092e14a6 100644 --- a/lib/ansible/modules/cloud/google/gcp_container_node_pool.py +++ b/lib/ansible/modules/cloud/google/gcp_container_node_pool.py @@ -747,10 +747,10 @@ def __init__(self, request, module): self.request = {} def to_request(self): - return remove_nones_from_dict({u'autoUpgradeStartTime': self.request.get('auto_upgrade_start_time'), u'description': self.request.get('description')}) + return remove_nones_from_dict({}) def from_response(self): - return remove_nones_from_dict({u'autoUpgradeStartTime': self.request.get(u'autoUpgradeStartTime'), u'description': self.request.get(u'description')}) + return remove_nones_from_dict({}) if __name__ == '__main__': diff --git a/lib/ansible/modules/cloud/google/gcp_sql_instance.py b/lib/ansible/modules/cloud/google/gcp_sql_instance.py index 9301b4f51587c6..9cfa57d2fb6beb 100644 --- a/lib/ansible/modules/cloud/google/gcp_sql_instance.py +++ b/lib/ansible/modules/cloud/google/gcp_sql_instance.py @@ -852,10 +852,10 @@ def __init__(self, request, module): self.request = {} def to_request(self): - return remove_nones_from_dict({u'available': self.request.get('available'), u'name': self.request.get('name')}) + return remove_nones_from_dict({u'name': self.request.get('name')}) def from_response(self): - return remove_nones_from_dict({u'available': self.request.get(u'available'), u'name': self.request.get(u'name')}) + return remove_nones_from_dict({u'name': self.request.get(u'name')}) class InstanceIpaddressesArray(object): @@ -972,7 +972,6 @@ def to_request(self): u'tier': self.request.get('tier'), u'availabilityType': self.request.get('availability_type'), u'backupConfiguration': InstanceBackupconfiguration(self.request.get('backup_configuration', {}), self.module).to_request(), - u'settingsVersion': self.request.get('settings_version'), } ) @@ -983,7 +982,6 @@ def from_response(self): u'tier': self.request.get(u'tier'), u'availabilityType': self.request.get(u'availabilityType'), u'backupConfiguration': InstanceBackupconfiguration(self.request.get(u'backupConfiguration', {}), self.module).from_response(), - u'settingsVersion': self.request.get(u'settingsVersion'), } ) diff --git a/lib/ansible/modules/cloud/google/gcp_storage_bucket.py b/lib/ansible/modules/cloud/google/gcp_storage_bucket.py index 2e738662857486..73b13f7363cc9d 100644 --- a/lib/ansible/modules/cloud/google/gcp_storage_bucket.py +++ b/lib/ansible/modules/cloud/google/gcp_storage_bucket.py @@ -979,11 +979,8 @@ def _request_for_item(self, item): return remove_nones_from_dict( { u'bucket': replace_resource_dict(item.get(u'bucket', {}), 'name'), - u'domain': item.get('domain'), - u'email': item.get('email'), u'entity': item.get('entity'), u'entityId': item.get('entity_id'), - u'id': item.get('id'), u'projectTeam': BucketProjectteam(item.get('project_team', {}), self.module).to_request(), u'role': item.get('role'), } @@ -993,11 +990,8 @@ def _response_from_item(self, item): return remove_nones_from_dict( { u'bucket': item.get(u'bucket'), - u'domain': item.get(u'domain'), - u'email': item.get(u'email'), u'entity': item.get(u'entity'), u'entityId': item.get(u'entityId'), - u'id': item.get(u'id'), u'projectTeam': BucketProjectteam(item.get(u'projectTeam', {}), self.module).from_response(), u'role': item.get(u'role'), } @@ -1084,32 +1078,15 @@ def _request_for_item(self, item): return remove_nones_from_dict( { u'bucket': replace_resource_dict(item.get(u'bucket', {}), 'name'), - u'domain': item.get('domain'), - u'email': item.get('email'), u'entity': item.get('entity'), - u'entityId': item.get('entity_id'), - u'generation': item.get('generation'), - u'id': item.get('id'), u'object': item.get('object'), - u'projectTeam': BucketProjectteam(item.get('project_team', {}), self.module).to_request(), u'role': item.get('role'), } ) def _response_from_item(self, item): return remove_nones_from_dict( - { - u'bucket': item.get(u'bucket'), - u'domain': item.get(u'domain'), - u'email': item.get(u'email'), - u'entity': item.get(u'entity'), - u'entityId': item.get(u'entityId'), - u'generation': item.get(u'generation'), - u'id': item.get(u'id'), - u'object': item.get(u'object'), - u'projectTeam': BucketProjectteam(item.get(u'projectTeam', {}), self.module).from_response(), - u'role': item.get(u'role'), - } + {u'bucket': item.get(u'bucket'), u'entity': item.get(u'entity'), u'object': item.get(u'object'), u'role': item.get(u'role')} ) @@ -1250,10 +1227,10 @@ def __init__(self, request, module): self.request = {} def to_request(self): - return remove_nones_from_dict({u'entity': self.request.get('entity'), u'entityId': self.request.get('entity_id')}) + return remove_nones_from_dict({u'entity': self.request.get('entity')}) def from_response(self): - return remove_nones_from_dict({u'entity': self.request.get(u'entity'), u'entityId': self.request.get(u'entityId')}) + return remove_nones_from_dict({u'entity': self.request.get(u'entity')}) class BucketVersioning(object): diff --git a/test/units/module_utils/gcp/test_gcp_utils.py b/test/units/module_utils/gcp/test_gcp_utils.py index 0f12efc3d6d229..580949557f0717 100644 --- a/test/units/module_utils/gcp/test_gcp_utils.py +++ b/test/units/module_utils/gcp/test_gcp_utils.py @@ -172,4 +172,45 @@ def test_arrays_dicts_with_difference(self): self.assertEquals(request1 == request2, False) self.assertEquals(request1.difference(request2), difference) + def test_unsorted_string_arrays(self): + value1 = { + 'foo': [ + 'aaa', + 'bbb' + ] + } + value2 = { + 'foo': [ + 'bbb', + 'aaa' + ] + } + request1 = GcpRequest(value1) + request2 = GcpRequest(value2) + self.assertEquals(request1 == request2, True) + def test_unsorted_dictionaries(self): + value1 = { + 'foo': [ + { + 'bar': 'foo' + }, + { + 'test': 'bar' + } + ] + } + value2 = { + 'foo': [ + { + 'test': 'bar' + }, + { + 'bar': 'foo', + 'baz': 'bar' + } + ] + } + request1 = GcpRequest(value1) + request2 = GcpRequest(value2) + self.assertEquals(request1 == request2, True) From 1d315b16022a5dfe44c0fcc83bdd18810065e744 Mon Sep 17 00:00:00 2001 From: The Magician Date: Mon, 25 Mar 2019 10:18:42 -0700 Subject: [PATCH 132/144] Mark Forwarding Rule allPorts as GA (#219) /cc @rileykarson --- .../google/gcp_compute_forwarding_rule.py | 18 ++++++++++++++++++ .../gcp_compute_forwarding_rule_facts.py | 7 +++++++ 2 files changed, 25 insertions(+) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_forwarding_rule.py b/lib/ansible/modules/cloud/google/gcp_compute_forwarding_rule.py index c9eef469c499a0..f7840a0990293f 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_forwarding_rule.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_forwarding_rule.py @@ -188,6 +188,14 @@ task and then set this target field to "{{ name-of-resource }}"' required: false version_added: 2.7 + all_ports: + description: + - When the load balancing scheme is INTERNAL and protocol is TCP/UDP, omit `port`/`port_range` + and specify this field as `true` to allow packets addressed to any ports to + be forwarded to the backends configured with this forwarding rule. + required: false + type: bool + version_added: 2.8 network_tier: description: - 'The networking tier used for configuring this address. This field can take @@ -374,6 +382,13 @@ - This field is not used for internal load balancing. returned: success type: str +allPorts: + description: + - When the load balancing scheme is INTERNAL and protocol is TCP/UDP, omit `port`/`port_range` + and specify this field as `true` to allow packets addressed to any ports to be + forwarded to the backends configured with this forwarding rule. + returned: success + type: bool networkTier: description: - 'The networking tier used for configuring this address. This field can take the @@ -420,6 +435,7 @@ def main(): ports=dict(type='list', elements='str'), subnetwork=dict(), target=dict(), + all_ports=dict(type='bool'), network_tier=dict(type='str', choices=['PREMIUM', 'STANDARD']), region=dict(required=True, type='str'), ) @@ -499,6 +515,7 @@ def resource_to_request(module): u'ports': module.params.get('ports'), u'subnetwork': replace_resource_dict(module.params.get(u'subnetwork', {}), 'selfLink'), u'target': replace_resource_dict(module.params.get(u'target', {}), 'selfLink'), + u'allPorts': module.params.get('all_ports'), u'networkTier': module.params.get('network_tier'), } return_vals = {} @@ -579,6 +596,7 @@ def response_to_hash(module, response): u'ports': response.get(u'ports'), u'subnetwork': response.get(u'subnetwork'), u'target': response.get(u'target'), + u'allPorts': response.get(u'allPorts'), u'networkTier': module.params.get('network_tier'), } diff --git a/lib/ansible/modules/cloud/google/gcp_compute_forwarding_rule_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_forwarding_rule_facts.py index 15cef1e1cea8ed..7481e517a4cb41 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_forwarding_rule_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_forwarding_rule_facts.py @@ -202,6 +202,13 @@ - This field is not used for internal load balancing. returned: success type: str + allPorts: + description: + - When the load balancing scheme is INTERNAL and protocol is TCP/UDP, omit `port`/`port_range` + and specify this field as `true` to allow packets addressed to any ports to + be forwarded to the backends configured with this forwarding rule. + returned: success + type: bool networkTier: description: - 'The networking tier used for configuring this address. This field can take From dc4593ddaac978ea6d70cfe75db1c4849e9aaf9c Mon Sep 17 00:00:00 2001 From: The Magician Date: Thu, 28 Mar 2019 10:06:42 -0700 Subject: [PATCH 133/144] Make forwarding rule service_label and service_name GA (#221) Signed-off-by: Modular Magician --- .../google/gcp_compute_forwarding_rule.py | 34 +++++++++++++++++++ .../gcp_compute_forwarding_rule_facts.py | 18 ++++++++++ 2 files changed, 52 insertions(+) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_forwarding_rule.py b/lib/ansible/modules/cloud/google/gcp_compute_forwarding_rule.py index f7840a0990293f..7813b2b8802584 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_forwarding_rule.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_forwarding_rule.py @@ -206,6 +206,18 @@ choices: - PREMIUM - STANDARD + service_label: + description: + - An optional prefix to the service name for this Forwarding Rule. + - If specified, will be the first label of the fully qualified service name. + - The label must be 1-63 characters long, and comply with RFC1035. + - Specifically, the label must be 1-63 characters long and match the regular expression + `[a-z]([-a-z0-9]*[a-z0-9])?` which means the first character must be a lowercase + letter, and all following characters must be a dash, lowercase letter, or digit, + except the last character, which cannot be a dash. + - This field is only used for internal load balancing. + required: false + version_added: 2.8 region: description: - A reference to the region where the regional forwarding rule resides. @@ -396,6 +408,24 @@ to be PREMIUM.' returned: success type: str +serviceLabel: + description: + - An optional prefix to the service name for this Forwarding Rule. + - If specified, will be the first label of the fully qualified service name. + - The label must be 1-63 characters long, and comply with RFC1035. + - Specifically, the label must be 1-63 characters long and match the regular expression + `[a-z]([-a-z0-9]*[a-z0-9])?` which means the first character must be a lowercase + letter, and all following characters must be a dash, lowercase letter, or digit, + except the last character, which cannot be a dash. + - This field is only used for internal load balancing. + returned: success + type: str +serviceName: + description: + - The internal fully qualified service name for this Forwarding Rule. + - This field is only used for internal load balancing. + returned: success + type: str region: description: - A reference to the region where the regional forwarding rule resides. @@ -437,6 +467,7 @@ def main(): target=dict(), all_ports=dict(type='bool'), network_tier=dict(type='str', choices=['PREMIUM', 'STANDARD']), + service_label=dict(type='str'), region=dict(required=True, type='str'), ) ) @@ -517,6 +548,7 @@ def resource_to_request(module): u'target': replace_resource_dict(module.params.get(u'target', {}), 'selfLink'), u'allPorts': module.params.get('all_ports'), u'networkTier': module.params.get('network_tier'), + u'serviceLabel': module.params.get('service_label'), } return_vals = {} for k, v in request.items(): @@ -598,6 +630,8 @@ def response_to_hash(module, response): u'target': response.get(u'target'), u'allPorts': response.get(u'allPorts'), u'networkTier': module.params.get('network_tier'), + u'serviceLabel': response.get(u'serviceLabel'), + u'serviceName': response.get(u'serviceName'), } diff --git a/lib/ansible/modules/cloud/google/gcp_compute_forwarding_rule_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_forwarding_rule_facts.py index 7481e517a4cb41..d0dce15b518a67 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_forwarding_rule_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_forwarding_rule_facts.py @@ -216,6 +216,24 @@ it is assumed to be PREMIUM.' returned: success type: str + serviceLabel: + description: + - An optional prefix to the service name for this Forwarding Rule. + - If specified, will be the first label of the fully qualified service name. + - The label must be 1-63 characters long, and comply with RFC1035. + - Specifically, the label must be 1-63 characters long and match the regular + expression `[a-z]([-a-z0-9]*[a-z0-9])?` which means the first character must + be a lowercase letter, and all following characters must be a dash, lowercase + letter, or digit, except the last character, which cannot be a dash. + - This field is only used for internal load balancing. + returned: success + type: str + serviceName: + description: + - The internal fully qualified service name for this Forwarding Rule. + - This field is only used for internal load balancing. + returned: success + type: str region: description: - A reference to the region where the regional forwarding rule resides. From da4dd458989c82f6113813583443060138a7347f Mon Sep 17 00:00:00 2001 From: The Magician Date: Mon, 1 Apr 2019 10:20:10 -0700 Subject: [PATCH 134/144] Add backend bucket signed URL key (for CDN) support (#209) Signed-off-by: Modular Magician --- .../google/gcp_compute_backend_bucket.py | 54 ++++++++++++++++++- .../gcp_compute_backend_bucket_facts.py | 17 ++++++ .../google/gcp_compute_backend_service.py | 40 ++++++++++++-- .../gcp_compute_backend_service_facts.py | 11 ++++ 4 files changed, 118 insertions(+), 4 deletions(-) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_backend_bucket.py b/lib/ansible/modules/cloud/google/gcp_compute_backend_bucket.py index d1bddb47c42d2a..2658387d8c7ed0 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_backend_bucket.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_backend_bucket.py @@ -55,6 +55,23 @@ description: - Cloud Storage bucket name. required: true + cdn_policy: + description: + - Cloud CDN configuration for this Backend Bucket. + required: false + version_added: 2.8 + suboptions: + signed_url_cache_max_age_sec: + description: + - Maximum number of seconds the response to a signed URL request will be considered + fresh. Defaults to 1hr (3600s). After this time period, the response will + be revalidated before being served. + - 'When serving responses to signed URL requests, Cloud CDN will internally + behave as though all responses from this backend had a "Cache-Control: public, + max-age=[TTL]" header, regardless of any existing Cache-Control header. + The actual headers served in responses will not be altered.' + required: false + default: '3600' description: description: - An optional textual description of the resource; provided by the client when @@ -108,6 +125,23 @@ - Cloud Storage bucket name. returned: success type: str +cdnPolicy: + description: + - Cloud CDN configuration for this Backend Bucket. + returned: success + type: complex + contains: + signedUrlCacheMaxAgeSec: + description: + - Maximum number of seconds the response to a signed URL request will be considered + fresh. Defaults to 1hr (3600s). After this time period, the response will + be revalidated before being served. + - 'When serving responses to signed URL requests, Cloud CDN will internally + behave as though all responses from this backend had a "Cache-Control: public, + max-age=[TTL]" header, regardless of any existing Cache-Control header. The + actual headers served in responses will not be altered.' + returned: success + type: int creationTimestamp: description: - Creation timestamp in RFC3339 text format. @@ -145,7 +179,7 @@ # Imports ################################################################################ -from ansible.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest, replace_resource_dict +from ansible.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest, remove_nones_from_dict, replace_resource_dict import json import time @@ -161,6 +195,7 @@ def main(): argument_spec=dict( state=dict(default='present', choices=['present', 'absent'], type='str'), bucket_name=dict(required=True, type='str'), + cdn_policy=dict(type='dict', options=dict(signed_url_cache_max_age_sec=dict(default=3600, type='int'))), description=dict(type='str'), enable_cdn=dict(type='bool'), name=dict(required=True, type='str'), @@ -217,6 +252,7 @@ def resource_to_request(module): request = { u'kind': 'compute#backendBucket', u'bucketName': module.params.get('bucket_name'), + u'cdnPolicy': BackendBucketCdnpolicy(module.params.get('cdn_policy', {}), module).to_request(), u'description': module.params.get('description'), u'enableCdn': module.params.get('enable_cdn'), u'name': module.params.get('name'), @@ -286,6 +322,7 @@ def is_different(module, response): def response_to_hash(module, response): return { u'bucketName': response.get(u'bucketName'), + u'cdnPolicy': BackendBucketCdnpolicy(response.get(u'cdnPolicy', {}), module).from_response(), u'creationTimestamp': response.get(u'creationTimestamp'), u'description': response.get(u'description'), u'enableCdn': response.get(u'enableCdn'), @@ -329,5 +366,20 @@ def raise_if_errors(response, err_path, module): module.fail_json(msg=errors) +class BackendBucketCdnpolicy(object): + def __init__(self, request, module): + self.module = module + if request: + self.request = request + else: + self.request = {} + + def to_request(self): + return remove_nones_from_dict({u'signedUrlCacheMaxAgeSec': self.request.get('signed_url_cache_max_age_sec')}) + + def from_response(self): + return remove_nones_from_dict({u'signedUrlCacheMaxAgeSec': self.request.get(u'signedUrlCacheMaxAgeSec')}) + + if __name__ == '__main__': main() diff --git a/lib/ansible/modules/cloud/google/gcp_compute_backend_bucket_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_backend_bucket_facts.py index fe21d60bdc082d..aa1dd499205ea5 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_backend_bucket_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_backend_bucket_facts.py @@ -70,6 +70,23 @@ - Cloud Storage bucket name. returned: success type: str + cdnPolicy: + description: + - Cloud CDN configuration for this Backend Bucket. + returned: success + type: complex + contains: + signedUrlCacheMaxAgeSec: + description: + - Maximum number of seconds the response to a signed URL request will be + considered fresh. Defaults to 1hr (3600s). After this time period, the + response will be revalidated before being served. + - 'When serving responses to signed URL requests, Cloud CDN will internally + behave as though all responses from this backend had a "Cache-Control: + public, max-age=[TTL]" header, regardless of any existing Cache-Control + header. The actual headers served in responses will not be altered.' + returned: success + type: int creationTimestamp: description: - Creation timestamp in RFC3339 text format. diff --git a/lib/ansible/modules/cloud/google/gcp_compute_backend_service.py b/lib/ansible/modules/cloud/google/gcp_compute_backend_service.py index 03d1a19338fba6..f528e06882b9f5 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_backend_service.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_backend_service.py @@ -182,6 +182,18 @@ or query_string_blacklist, not both. - "'&' and '=' will be percent encoded and not treated as delimiters." required: false + signed_url_cache_max_age_sec: + description: + - Maximum number of seconds the response to a signed URL request will be considered + fresh, defaults to 1hr (3600s). After this time period, the response will + be revalidated before being served. + - 'When serving responses to signed URL requests, Cloud CDN will internally + behave as though all responses from this backend had a "Cache-Control: public, + max-age=[TTL]" header, regardless of any existing Cache-Control header. + The actual headers served in responses will not be altered.' + required: false + default: '3600' + version_added: 2.8 connection_draining: description: - Settings for connection draining. @@ -473,6 +485,17 @@ - "'&' and '=' will be percent encoded and not treated as delimiters." returned: success type: list + signedUrlCacheMaxAgeSec: + description: + - Maximum number of seconds the response to a signed URL request will be considered + fresh, defaults to 1hr (3600s). After this time period, the response will + be revalidated before being served. + - 'When serving responses to signed URL requests, Cloud CDN will internally + behave as though all responses from this backend had a "Cache-Control: public, + max-age=[TTL]" header, regardless of any existing Cache-Control header. The + actual headers served in responses will not be altered.' + returned: success + type: int connectionDraining: description: - Settings for connection draining. @@ -644,7 +667,8 @@ def main(): query_string_blacklist=dict(type='list', elements='str'), query_string_whitelist=dict(type='list', elements='str'), ), - ) + ), + signed_url_cache_max_age_sec=dict(default=3600, type='int'), ), ), connection_draining=dict(type='dict', options=dict(draining_timeout_sec=dict(type='int'))), @@ -915,10 +939,20 @@ def __init__(self, request, module): self.request = {} def to_request(self): - return remove_nones_from_dict({u'cacheKeyPolicy': BackendServiceCachekeypolicy(self.request.get('cache_key_policy', {}), self.module).to_request()}) + return remove_nones_from_dict( + { + u'cacheKeyPolicy': BackendServiceCachekeypolicy(self.request.get('cache_key_policy', {}), self.module).to_request(), + u'signedUrlCacheMaxAgeSec': self.request.get('signed_url_cache_max_age_sec'), + } + ) def from_response(self): - return remove_nones_from_dict({u'cacheKeyPolicy': BackendServiceCachekeypolicy(self.request.get(u'cacheKeyPolicy', {}), self.module).from_response()}) + return remove_nones_from_dict( + { + u'cacheKeyPolicy': BackendServiceCachekeypolicy(self.request.get(u'cacheKeyPolicy', {}), self.module).from_response(), + u'signedUrlCacheMaxAgeSec': self.request.get(u'signedUrlCacheMaxAgeSec'), + } + ) class BackendServiceCachekeypolicy(object): diff --git a/lib/ansible/modules/cloud/google/gcp_compute_backend_service_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_backend_service_facts.py index e9bbb3e6c60507..e7339098bdfd37 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_backend_service_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_backend_service_facts.py @@ -206,6 +206,17 @@ - "'&' and '=' will be percent encoded and not treated as delimiters." returned: success type: list + signedUrlCacheMaxAgeSec: + description: + - Maximum number of seconds the response to a signed URL request will be + considered fresh, defaults to 1hr (3600s). After this time period, the + response will be revalidated before being served. + - 'When serving responses to signed URL requests, Cloud CDN will internally + behave as though all responses from this backend had a "Cache-Control: + public, max-age=[TTL]" header, regardless of any existing Cache-Control + header. The actual headers served in responses will not be altered.' + returned: success + type: int connectionDraining: description: - Settings for connection draining. From d16dd1337bfe87a651615fd25eb677a0f901b790 Mon Sep 17 00:00:00 2001 From: The Magician Date: Mon, 1 Apr 2019 10:53:31 -0700 Subject: [PATCH 135/144] Terraform: Make private Cloud DNS GA (#224) /cc @drebes --- .../cloud/google/gcp_dns_managed_zone.py | 118 +++++++++++++++++- .../google/gcp_dns_managed_zone_facts.py | 27 ++++ 2 files changed, 142 insertions(+), 3 deletions(-) diff --git a/lib/ansible/modules/cloud/google/gcp_dns_managed_zone.py b/lib/ansible/modules/cloud/google/gcp_dns_managed_zone.py index 07f4309702fae7..5a548124af4ac3 100644 --- a/lib/ansible/modules/cloud/google/gcp_dns_managed_zone.py +++ b/lib/ansible/modules/cloud/google/gcp_dns_managed_zone.py @@ -73,6 +73,35 @@ - A set of key/value label pairs to assign to this ManagedZone. required: false version_added: 2.8 + visibility: + description: + - 'The zone''s visibility: public zones are exposed to the Internet, while private + zones are visible only to Virtual Private Cloud resources.' + - 'Must be one of: `public`, `private`.' + required: false + default: public + version_added: 2.8 + choices: + - private + - public + private_visibility_config: + description: + - For privately visible zones, the set of Virtual Private Cloud resources that + the zone is visible from. + required: false + version_added: 2.8 + suboptions: + networks: + description: + - The list of VPC networks that can see this zone. + required: false + suboptions: + network_url: + description: + - The fully qualified URL of the VPC network to bind to. + - This should be formatted like `U(https://www.googleapis.com/compute/v1/projects/{project}/global/networks/{network}`) + . + required: false extends_documentation_fragment: gcp notes: - 'API Reference: U(https://cloud.google.com/dns/api/v1/managedZones)' @@ -138,13 +167,40 @@ - A set of key/value label pairs to assign to this ManagedZone. returned: success type: dict +visibility: + description: + - 'The zone''s visibility: public zones are exposed to the Internet, while private + zones are visible only to Virtual Private Cloud resources.' + - 'Must be one of: `public`, `private`.' + returned: success + type: str +privateVisibilityConfig: + description: + - For privately visible zones, the set of Virtual Private Cloud resources that the + zone is visible from. + returned: success + type: complex + contains: + networks: + description: + - The list of VPC networks that can see this zone. + returned: success + type: complex + contains: + networkUrl: + description: + - The fully qualified URL of the VPC network to bind to. + - This should be formatted like `U(https://www.googleapis.com/compute/v1/projects/{project}/global/networks/{network}`) + . + returned: success + type: str ''' ################################################################################ # Imports ################################################################################ -from ansible.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest, replace_resource_dict +from ansible.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest, remove_nones_from_dict, replace_resource_dict import json ################################################################################ @@ -163,6 +219,8 @@ def main(): name=dict(required=True, type='str'), name_server_set=dict(type='str'), labels=dict(type='dict'), + visibility=dict(default='public', type='str', choices=['private', 'public']), + private_visibility_config=dict(type='dict', options=dict(networks=dict(type='list', elements='dict', options=dict(network_url=dict(type='str'))))), ) ) @@ -208,7 +266,11 @@ def update(module, link, kind, fetch): def update_fields(module, request, response): - if response.get('description') != request.get('description') or response.get('labels') != request.get('labels'): + if ( + response.get('description') != request.get('description') + or response.get('labels') != request.get('labels') + or response.get('privateVisibilityConfig') != request.get('privateVisibilityConfig') + ): description_update(module, request, response) @@ -216,7 +278,11 @@ def description_update(module, request, response): auth = GcpSession(module, 'dns') auth.patch( ''.join(["https://www.googleapis.com/dns/v1/", "projects/{project}/managedZones/{name}"]).format(**module.params), - {u'description': module.params.get('description'), u'labels': module.params.get('labels')}, + { + u'description': module.params.get('description'), + u'labels': module.params.get('labels'), + u'privateVisibilityConfig': ManagedZonePrivatevisibilityconfig(module.params.get('private_visibility_config', {}), module).to_request(), + }, ) @@ -233,6 +299,8 @@ def resource_to_request(module): u'name': module.params.get('name'), u'nameServerSet': module.params.get('name_server_set'), u'labels': module.params.get('labels'), + u'visibility': module.params.get('visibility'), + u'privateVisibilityConfig': ManagedZonePrivatevisibilityconfig(module.params.get('private_visibility_config', {}), module).to_request(), } return_vals = {} for k, v in request.items(): @@ -306,8 +374,52 @@ def response_to_hash(module, response): u'nameServerSet': response.get(u'nameServerSet'), u'creationTime': response.get(u'creationTime'), u'labels': response.get(u'labels'), + u'visibility': response.get(u'visibility'), + u'privateVisibilityConfig': ManagedZonePrivatevisibilityconfig(response.get(u'privateVisibilityConfig', {}), module).from_response(), } +class ManagedZonePrivatevisibilityconfig(object): + def __init__(self, request, module): + self.module = module + if request: + self.request = request + else: + self.request = {} + + def to_request(self): + return remove_nones_from_dict({u'networks': ManagedZoneNetworksArray(self.request.get('networks', []), self.module).to_request()}) + + def from_response(self): + return remove_nones_from_dict({u'networks': ManagedZoneNetworksArray(self.request.get(u'networks', []), self.module).from_response()}) + + +class ManagedZoneNetworksArray(object): + def __init__(self, request, module): + self.module = module + if request: + self.request = request + else: + self.request = [] + + def to_request(self): + items = [] + for item in self.request: + items.append(self._request_for_item(item)) + return items + + def from_response(self): + items = [] + for item in self.request: + items.append(self._response_from_item(item)) + return items + + def _request_for_item(self, item): + return remove_nones_from_dict({u'networkUrl': item.get('network_url')}) + + def _response_from_item(self, item): + return remove_nones_from_dict({u'networkUrl': item.get(u'networkUrl')}) + + if __name__ == '__main__': main() diff --git a/lib/ansible/modules/cloud/google/gcp_dns_managed_zone_facts.py b/lib/ansible/modules/cloud/google/gcp_dns_managed_zone_facts.py index e5a8152f57ac2e..6e729dac73620f 100644 --- a/lib/ansible/modules/cloud/google/gcp_dns_managed_zone_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_dns_managed_zone_facts.py @@ -108,6 +108,33 @@ - A set of key/value label pairs to assign to this ManagedZone. returned: success type: dict + visibility: + description: + - 'The zone''s visibility: public zones are exposed to the Internet, while private + zones are visible only to Virtual Private Cloud resources.' + - 'Must be one of: `public`, `private`.' + returned: success + type: str + privateVisibilityConfig: + description: + - For privately visible zones, the set of Virtual Private Cloud resources that + the zone is visible from. + returned: success + type: complex + contains: + networks: + description: + - The list of VPC networks that can see this zone. + returned: success + type: complex + contains: + networkUrl: + description: + - The fully qualified URL of the VPC network to bind to. + - This should be formatted like `U(https://www.googleapis.com/compute/v1/projects/{project}/global/networks/{network}`) + . + returned: success + type: str ''' ################################################################################ From e7b1ec4ce21b889782e4499377f0031c275de89c Mon Sep 17 00:00:00 2001 From: The Magician Date: Mon, 1 Apr 2019 18:14:34 -0700 Subject: [PATCH 136/144] More Cloudbuild Trigger Step support (#223) /cc @chrisst --- .../cloud/google/gcp_cloudbuild_trigger.py | 237 +++++++++++++++++- .../google/gcp_cloudbuild_trigger_facts.py | 87 +++++++ 2 files changed, 321 insertions(+), 3 deletions(-) diff --git a/lib/ansible/modules/cloud/google/gcp_cloudbuild_trigger.py b/lib/ansible/modules/cloud/google/gcp_cloudbuild_trigger.py index f37e6b67bb5394..13759a8401427a 100644 --- a/lib/ansible/modules/cloud/google/gcp_cloudbuild_trigger.py +++ b/lib/ansible/modules/cloud/google/gcp_cloudbuild_trigger.py @@ -176,6 +176,82 @@ define an entrypoint, the first element in args is used as the entrypoint, and the remainder will be used as arguments. required: false + env: + description: + - A list of environment variable definitions to be used when running a + step. + - The elements are of the form "KEY=VALUE" for the environment variable + "KEY" being given the value "VALUE". + required: false + id: + description: + - Unique identifier for this build step, used in `wait_for` to reference + this build step as a dependency. + required: false + entrypoint: + description: + - Entrypoint to be used instead of the build step image's default entrypoint. + - If unset, the image's default entrypoint is used . + required: false + dir: + description: + - Working directory to use when running this step's container. + - If this value is a relative path, it is relative to the build's working + directory. If this value is absolute, it may be outside the build's + working directory, in which case the contents of the path may not be + persisted across build step executions, unless a `volume` for that path + is specified. + - If the build specifies a `RepoSource` with `dir` and a step with a `dir`, + which specifies an absolute path, the `RepoSource` `dir` is ignored + for the step's execution. + required: false + secret_env: + description: + - A list of environment variables which are encrypted using a Cloud Key + Management Service crypto key. These values must be specified in the + build's `Secret`. + required: false + timeout: + description: + - Time limit for executing this build step. If not defined, the step has + no time limit and will be allowed to continue to run until either it + completes or the build itself times out. + required: false + timing: + description: + - Output only. Stores timing information for executing this build step. + required: false + volumes: + description: + - List of volumes to mount into the build step. + - Each volume is created as an empty volume prior to execution of the + build step. Upon completion of the build, volumes and their contents + are discarded. + - Using a named volume in only one step is not valid as it is indicative + of a build request with an incorrect configuration. + required: false + suboptions: + name: + description: + - Name of the volume to mount. + - Volume names must be unique per build step and must be valid names + for Docker volumes. Each named volume must be used by at least two + build steps. + required: false + path: + description: + - Path at which to mount the volume. + - Paths must be absolute and cannot conflict with other volume paths + on the same build step or with certain reserved volume paths. + required: false + wait_for: + description: + - The ID(s) of the step(s) that this build step depends on. + - This build step will not start until all the build steps in `wait_for` + have completed successfully. If `wait_for` is empty, this build step + will start when all previous build steps in the `Build.Steps` list have + completed successfully. + required: false extends_documentation_fragment: gcp notes: - 'API Reference: U(https://cloud.google.com/cloud-build/docs/api/reference/rest/)' @@ -359,6 +435,90 @@ the remainder will be used as arguments. returned: success type: list + env: + description: + - A list of environment variable definitions to be used when running a step. + - The elements are of the form "KEY=VALUE" for the environment variable + "KEY" being given the value "VALUE". + returned: success + type: list + id: + description: + - Unique identifier for this build step, used in `wait_for` to reference + this build step as a dependency. + returned: success + type: str + entrypoint: + description: + - Entrypoint to be used instead of the build step image's default entrypoint. + - If unset, the image's default entrypoint is used . + returned: success + type: str + dir: + description: + - Working directory to use when running this step's container. + - If this value is a relative path, it is relative to the build's working + directory. If this value is absolute, it may be outside the build's working + directory, in which case the contents of the path may not be persisted + across build step executions, unless a `volume` for that path is specified. + - If the build specifies a `RepoSource` with `dir` and a step with a `dir`, + which specifies an absolute path, the `RepoSource` `dir` is ignored for + the step's execution. + returned: success + type: str + secretEnv: + description: + - A list of environment variables which are encrypted using a Cloud Key + Management Service crypto key. These values must be specified in the build's + `Secret`. + returned: success + type: list + timeout: + description: + - Time limit for executing this build step. If not defined, the step has + no time limit and will be allowed to continue to run until either it completes + or the build itself times out. + returned: success + type: str + timing: + description: + - Output only. Stores timing information for executing this build step. + returned: success + type: str + volumes: + description: + - List of volumes to mount into the build step. + - Each volume is created as an empty volume prior to execution of the build + step. Upon completion of the build, volumes and their contents are discarded. + - Using a named volume in only one step is not valid as it is indicative + of a build request with an incorrect configuration. + returned: success + type: complex + contains: + name: + description: + - Name of the volume to mount. + - Volume names must be unique per build step and must be valid names + for Docker volumes. Each named volume must be used by at least two + build steps. + returned: success + type: str + path: + description: + - Path at which to mount the volume. + - Paths must be absolute and cannot conflict with other volume paths + on the same build step or with certain reserved volume paths. + returned: success + type: str + waitFor: + description: + - The ID(s) of the step(s) that this build step depends on. + - This build step will not start until all the build steps in `wait_for` + have completed successfully. If `wait_for` is empty, this build step will + start when all previous build steps in the `Build.Steps` list have completed + successfully. + returned: success + type: list ''' ################################################################################ @@ -402,7 +562,23 @@ def main(): options=dict( tags=dict(type='list', elements='str'), images=dict(type='list', elements='str'), - steps=dict(type='list', elements='dict', options=dict(name=dict(type='str'), args=dict(type='list', elements='str'))), + steps=dict( + type='list', + elements='dict', + options=dict( + name=dict(type='str'), + args=dict(type='list', elements='str'), + env=dict(type='list', elements='str'), + id=dict(type='str'), + entrypoint=dict(type='str'), + dir=dict(type='str'), + secret_env=dict(type='list', elements='str'), + timeout=dict(type='str'), + timing=dict(type='str'), + volumes=dict(type='list', elements='dict', options=dict(name=dict(type='str'), path=dict(type='str'))), + wait_for=dict(type='list', elements='str'), + ), + ), ), ), ), @@ -627,10 +803,65 @@ def from_response(self): return items def _request_for_item(self, item): - return remove_nones_from_dict({u'name': item.get('name'), u'args': item.get('args')}) + return remove_nones_from_dict( + { + u'name': item.get('name'), + u'args': item.get('args'), + u'env': item.get('env'), + u'id': item.get('id'), + u'entrypoint': item.get('entrypoint'), + u'dir': item.get('dir'), + u'secretEnv': item.get('secret_env'), + u'timeout': item.get('timeout'), + u'timing': item.get('timing'), + u'volumes': TriggerVolumesArray(item.get('volumes', []), self.module).to_request(), + u'waitFor': item.get('wait_for'), + } + ) + + def _response_from_item(self, item): + return remove_nones_from_dict( + { + u'name': item.get(u'name'), + u'args': item.get(u'args'), + u'env': item.get(u'env'), + u'id': item.get(u'id'), + u'entrypoint': item.get(u'entrypoint'), + u'dir': item.get(u'dir'), + u'secretEnv': item.get(u'secretEnv'), + u'timeout': item.get(u'timeout'), + u'timing': item.get(u'timing'), + u'volumes': TriggerVolumesArray(item.get(u'volumes', []), self.module).from_response(), + u'waitFor': item.get(u'waitFor'), + } + ) + + +class TriggerVolumesArray(object): + def __init__(self, request, module): + self.module = module + if request: + self.request = request + else: + self.request = [] + + def to_request(self): + items = [] + for item in self.request: + items.append(self._request_for_item(item)) + return items + + def from_response(self): + items = [] + for item in self.request: + items.append(self._response_from_item(item)) + return items + + def _request_for_item(self, item): + return remove_nones_from_dict({u'name': item.get('name'), u'path': item.get('path')}) def _response_from_item(self, item): - return remove_nones_from_dict({u'name': item.get(u'name'), u'args': item.get(u'args')}) + return remove_nones_from_dict({u'name': item.get(u'name'), u'path': item.get(u'path')}) if __name__ == '__main__': diff --git a/lib/ansible/modules/cloud/google/gcp_cloudbuild_trigger_facts.py b/lib/ansible/modules/cloud/google/gcp_cloudbuild_trigger_facts.py index ac40c6e7e7efef..05faee00714a3e 100644 --- a/lib/ansible/modules/cloud/google/gcp_cloudbuild_trigger_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_cloudbuild_trigger_facts.py @@ -214,6 +214,93 @@ and the remainder will be used as arguments. returned: success type: list + env: + description: + - A list of environment variable definitions to be used when running + a step. + - The elements are of the form "KEY=VALUE" for the environment variable + "KEY" being given the value "VALUE". + returned: success + type: list + id: + description: + - Unique identifier for this build step, used in `wait_for` to reference + this build step as a dependency. + returned: success + type: str + entrypoint: + description: + - Entrypoint to be used instead of the build step image's default entrypoint. + - If unset, the image's default entrypoint is used . + returned: success + type: str + dir: + description: + - Working directory to use when running this step's container. + - If this value is a relative path, it is relative to the build's working + directory. If this value is absolute, it may be outside the build's + working directory, in which case the contents of the path may not + be persisted across build step executions, unless a `volume` for that + path is specified. + - If the build specifies a `RepoSource` with `dir` and a step with a + `dir`, which specifies an absolute path, the `RepoSource` `dir` is + ignored for the step's execution. + returned: success + type: str + secretEnv: + description: + - A list of environment variables which are encrypted using a Cloud + Key Management Service crypto key. These values must be specified + in the build's `Secret`. + returned: success + type: list + timeout: + description: + - Time limit for executing this build step. If not defined, the step + has no time limit and will be allowed to continue to run until either + it completes or the build itself times out. + returned: success + type: str + timing: + description: + - Output only. Stores timing information for executing this build step. + returned: success + type: str + volumes: + description: + - List of volumes to mount into the build step. + - Each volume is created as an empty volume prior to execution of the + build step. Upon completion of the build, volumes and their contents + are discarded. + - Using a named volume in only one step is not valid as it is indicative + of a build request with an incorrect configuration. + returned: success + type: complex + contains: + name: + description: + - Name of the volume to mount. + - Volume names must be unique per build step and must be valid names + for Docker volumes. Each named volume must be used by at least + two build steps. + returned: success + type: str + path: + description: + - Path at which to mount the volume. + - Paths must be absolute and cannot conflict with other volume paths + on the same build step or with certain reserved volume paths. + returned: success + type: str + waitFor: + description: + - The ID(s) of the step(s) that this build step depends on. + - This build step will not start until all the build steps in `wait_for` + have completed successfully. If `wait_for` is empty, this build step + will start when all previous build steps in the `Build.Steps` list + have completed successfully. + returned: success + type: list ''' ################################################################################ From b5d8af07a32a64bcd1d4fe485335a3ff66e0f1d8 Mon Sep 17 00:00:00 2001 From: The Magician Date: Tue, 2 Apr 2019 14:32:02 -0700 Subject: [PATCH 137/144] Add fingerprint, securityPolicy to BackendService (#222) + increase validation Signed-off-by: Modular Magician --- .../google/gcp_compute_backend_service.py | 97 +++++++++++-------- .../gcp_compute_backend_service_facts.py | 19 ++-- 2 files changed, 69 insertions(+), 47 deletions(-) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_backend_service.py b/lib/ansible/modules/cloud/google/gcp_compute_backend_service.py index f528e06882b9f5..b8a1b323b2af85 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_backend_service.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_backend_service.py @@ -67,6 +67,7 @@ Valid values are UTILIZATION, RATE (for HTTP(S)) and CONNECTION (for TCP/SSL). - This cannot be used for internal load balancing. required: false + default: UTILIZATION choices: - UTILIZATION - RATE @@ -81,6 +82,7 @@ [0.0,1.0]. - This cannot be used for internal load balancing. required: false + default: '1.0' description: description: - An optional description of this resource. @@ -140,6 +142,7 @@ target for the group. The default is 0.8. Valid range is [0.0, 1.0]. - This cannot be used for internal load balancing. required: false + default: '0.8' cdn_policy: description: - Cloud CDN configuration for this BackendService. @@ -196,7 +199,7 @@ version_added: 2.8 connection_draining: description: - - Settings for connection draining. + - Settings for connection draining . required: false suboptions: draining_timeout_sec: @@ -204,6 +207,7 @@ - Time for which instance will be drained (not accept new connections, but still work to finish started). required: false + default: '300' description: description: - An optional description of this resource. @@ -221,7 +225,7 @@ and a health check is required. - For internal load balancing, a URL to a HealthCheck resource must be specified instead. - required: false + required: true iap: description: - Settings for enabling Cloud Identity Aware Proxy. @@ -235,12 +239,12 @@ type: bool oauth2_client_id: description: - - OAuth2 Client ID for IAP. - required: false + - OAuth2 Client ID for IAP . + required: true oauth2_client_secret: description: - - OAuth2 Client Secret for IAP. - required: false + - OAuth2 Client Secret for IAP . + required: true load_balancing_scheme: description: - Indicates whether the backend service will be used with internal or external @@ -259,7 +263,7 @@ which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash. - required: false + required: true port_name: description: - Name of backend port. The same name should appear in the instance groups referenced @@ -278,11 +282,11 @@ - HTTPS - TCP - SSL - region: + security_policy: description: - - The region where the regional backend service resides. - - This field is not applicable to global backend services. + - The security policy associated with this backend service. required: false + version_added: 2.8 session_affinity: description: - Type of session affinity to use. The default is NONE. @@ -498,7 +502,7 @@ type: int connectionDraining: description: - - Settings for connection draining. + - Settings for connection draining . returned: success type: complex contains: @@ -513,6 +517,12 @@ - Creation timestamp in RFC3339 text format. returned: success type: str +fingerprint: + description: + - Fingerprint of this resource. A hash of the contents stored in this object. This + field is used in optimistic locking. + returned: success + type: str description: description: - An optional description of this resource. @@ -551,17 +561,17 @@ type: bool oauth2ClientId: description: - - OAuth2 Client ID for IAP. + - OAuth2 Client ID for IAP . returned: success type: str oauth2ClientSecret: description: - - OAuth2 Client Secret for IAP. + - OAuth2 Client Secret for IAP . returned: success type: str oauth2ClientSecretSha256: description: - - OAuth2 Client Secret SHA-256 for IAP. + - OAuth2 Client Secret SHA-256 for IAP . returned: success type: str loadBalancingScheme: @@ -596,10 +606,9 @@ is TCP. returned: success type: str -region: +securityPolicy: description: - - The region where the regional backend service resides. - - This field is not applicable to global backend services. + - The security policy associated with this backend service. returned: success type: str sessionAffinity: @@ -625,7 +634,6 @@ from ansible.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest, remove_nones_from_dict, replace_resource_dict import json -import re import time ################################################################################ @@ -644,15 +652,15 @@ def main(): type='list', elements='dict', options=dict( - balancing_mode=dict(type='str', choices=['UTILIZATION', 'RATE', 'CONNECTION']), - capacity_scaler=dict(type='str'), + balancing_mode=dict(default='UTILIZATION', type='str', choices=['UTILIZATION', 'RATE', 'CONNECTION']), + capacity_scaler=dict(default=1.0, type='str'), description=dict(type='str'), group=dict(), max_connections=dict(type='int'), max_connections_per_instance=dict(type='int'), max_rate=dict(type='int'), max_rate_per_instance=dict(type='str'), - max_utilization=dict(type='str'), + max_utilization=dict(default=0.8, type='str'), ), ), cdn_policy=dict( @@ -671,16 +679,19 @@ def main(): signed_url_cache_max_age_sec=dict(default=3600, type='int'), ), ), - connection_draining=dict(type='dict', options=dict(draining_timeout_sec=dict(type='int'))), + connection_draining=dict(type='dict', options=dict(draining_timeout_sec=dict(default=300, type='int'))), description=dict(type='str'), enable_cdn=dict(type='bool'), - health_checks=dict(type='list', elements='str'), - iap=dict(type='dict', options=dict(enabled=dict(type='bool'), oauth2_client_id=dict(type='str'), oauth2_client_secret=dict(type='str'))), + health_checks=dict(required=True, type='list', elements='str'), + iap=dict( + type='dict', + options=dict(enabled=dict(type='bool'), oauth2_client_id=dict(required=True, type='str'), oauth2_client_secret=dict(required=True, type='str')), + ), load_balancing_scheme=dict(type='str', choices=['INTERNAL', 'EXTERNAL']), - name=dict(type='str'), + name=dict(required=True, type='str'), port_name=dict(type='str'), protocol=dict(type='str', choices=['HTTP', 'HTTPS', 'TCP', 'SSL']), - region=dict(type='str'), + security_policy=dict(type='str'), session_affinity=dict(type='str', choices=['NONE', 'CLIENT_IP', 'GENERATED_COOKIE', 'CLIENT_IP_PROTO', 'CLIENT_IP_PORT_PROTO']), timeout_sec=dict(type='int', aliases=['timeout_seconds']), ) @@ -698,7 +709,7 @@ def main(): if fetch: if state == 'present': if is_different(module, fetch): - update(module, self_link(module), kind) + update(module, self_link(module), kind, fetch) fetch = fetch_resource(module, self_link(module), kind) changed = True else: @@ -722,11 +733,25 @@ def create(module, link, kind): return wait_for_operation(module, auth.post(link, resource_to_request(module))) -def update(module, link, kind): +def update(module, link, kind, fetch): + update_fields(module, resource_to_request(module), response_to_hash(module, fetch)) auth = GcpSession(module, 'compute') return wait_for_operation(module, auth.put(link, resource_to_request(module))) +def update_fields(module, request, response): + if response.get('securityPolicy') != request.get('securityPolicy'): + security_policy_update(module, request, response) + + +def security_policy_update(module, request, response): + auth = GcpSession(module, 'compute') + auth.post( + ''.join(["https://www.googleapis.com/compute/v1/", "projects/{project}/global/backendServices/{name}/setSecurityPolicy"]).format(**module.params), + {u'securityPolicy': module.params.get('security_policy')}, + ) + + def delete(module, link, kind): auth = GcpSession(module, 'compute') return wait_for_operation(module, auth.delete(link)) @@ -747,7 +772,7 @@ def resource_to_request(module): u'name': module.params.get('name'), u'portName': module.params.get('port_name'), u'protocol': module.params.get('protocol'), - u'region': region_selflink(module.params.get('region'), module.params), + u'securityPolicy': module.params.get('security_policy'), u'sessionAffinity': module.params.get('session_affinity'), u'timeoutSec': module.params.get('timeout_sec'), } @@ -820,30 +845,22 @@ def response_to_hash(module, response): u'cdnPolicy': BackendServiceCdnpolicy(response.get(u'cdnPolicy', {}), module).from_response(), u'connectionDraining': BackendServiceConnectiondraining(response.get(u'connectionDraining', {}), module).from_response(), u'creationTimestamp': response.get(u'creationTimestamp'), + u'fingerprint': response.get(u'fingerprint'), u'description': response.get(u'description'), u'enableCDN': response.get(u'enableCDN'), u'healthChecks': response.get(u'healthChecks'), u'id': response.get(u'id'), u'iap': BackendServiceIap(response.get(u'iap', {}), module).from_response(), u'loadBalancingScheme': response.get(u'loadBalancingScheme'), - u'name': response.get(u'name'), + u'name': module.params.get('name'), u'portName': response.get(u'portName'), u'protocol': response.get(u'protocol'), - u'region': response.get(u'region'), + u'securityPolicy': response.get(u'securityPolicy'), u'sessionAffinity': response.get(u'sessionAffinity'), u'timeoutSec': response.get(u'timeoutSec'), } -def region_selflink(name, params): - if name is None: - return - url = r"https://www.googleapis.com/compute/v1/projects/.*/regions/[a-z1-9\-]*" - if not re.match(url, name): - name = "https://www.googleapis.com/compute/v1/projects/{project}/regions/%s".format(**params) % name - return name - - def async_op_url(module, extra_data=None): if extra_data is None: extra_data = {} diff --git a/lib/ansible/modules/cloud/google/gcp_compute_backend_service_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_backend_service_facts.py index e7339098bdfd37..3a23e0cff0ecf5 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_backend_service_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_backend_service_facts.py @@ -219,7 +219,7 @@ type: int connectionDraining: description: - - Settings for connection draining. + - Settings for connection draining . returned: success type: complex contains: @@ -234,6 +234,12 @@ - Creation timestamp in RFC3339 text format. returned: success type: str + fingerprint: + description: + - Fingerprint of this resource. A hash of the contents stored in this object. + This field is used in optimistic locking. + returned: success + type: str description: description: - An optional description of this resource. @@ -272,17 +278,17 @@ type: bool oauth2ClientId: description: - - OAuth2 Client ID for IAP. + - OAuth2 Client ID for IAP . returned: success type: str oauth2ClientSecret: description: - - OAuth2 Client Secret for IAP. + - OAuth2 Client Secret for IAP . returned: success type: str oauth2ClientSecretSha256: description: - - OAuth2 Client Secret SHA-256 for IAP. + - OAuth2 Client Secret SHA-256 for IAP . returned: success type: str loadBalancingScheme: @@ -317,10 +323,9 @@ default is TCP. returned: success type: str - region: + securityPolicy: description: - - The region where the regional backend service resides. - - This field is not applicable to global backend services. + - The security policy associated with this backend service. returned: success type: str sessionAffinity: From ee1bd6398c8c1f0cd9fc8c5e68db5f1c4612a54e Mon Sep 17 00:00:00 2001 From: The Magician Date: Tue, 2 Apr 2019 21:03:30 -0700 Subject: [PATCH 138/144] Reverting some ResourceRef changes (#226) Signed-off-by: Modular Magician --- lib/ansible/module_utils/gcp_utils.py | 9 +--- .../cloud/google/gcp_compute_address.py | 11 ++-- .../cloud/google/gcp_compute_address_facts.py | 2 +- .../google/gcp_compute_backend_service.py | 12 ++--- .../gcp_compute_backend_service_facts.py | 2 +- .../modules/cloud/google/gcp_compute_disk.py | 11 ++-- .../cloud/google/gcp_compute_disk_facts.py | 2 +- .../cloud/google/gcp_compute_firewall.py | 11 ++-- .../google/gcp_compute_firewall_facts.py | 2 +- .../google/gcp_compute_forwarding_rule.py | 45 ++++++++-------- .../gcp_compute_forwarding_rule_facts.py | 8 +-- .../gcp_compute_global_forwarding_rule.py | 34 ++++++------ ...cp_compute_global_forwarding_rule_facts.py | 6 +-- .../modules/cloud/google/gcp_compute_image.py | 11 ++-- .../cloud/google/gcp_compute_image_facts.py | 2 +- .../cloud/google/gcp_compute_instance.py | 48 +++++++++-------- .../google/gcp_compute_instance_facts.py | 8 +-- .../google/gcp_compute_instance_group.py | 24 +++++---- .../gcp_compute_instance_group_facts.py | 4 +- .../gcp_compute_instance_group_manager.py | 16 +++--- ...cp_compute_instance_group_manager_facts.py | 4 +- .../google/gcp_compute_instance_template.py | 50 ++++++++--------- .../gcp_compute_instance_template_facts.py | 8 +-- .../gcp_compute_interconnect_attachment.py | 11 ++-- ...p_compute_interconnect_attachment_facts.py | 2 +- .../cloud/google/gcp_compute_region_disk.py | 11 ++-- .../google/gcp_compute_region_disk_facts.py | 2 +- .../modules/cloud/google/gcp_compute_route.py | 33 ++++++------ .../cloud/google/gcp_compute_route_facts.py | 6 +-- .../cloud/google/gcp_compute_router.py | 11 ++-- .../cloud/google/gcp_compute_router_facts.py | 2 +- .../cloud/google/gcp_compute_subnetwork.py | 11 ++-- .../google/gcp_compute_subnetwork_facts.py | 2 +- .../google/gcp_compute_target_http_proxy.py | 11 ++-- .../gcp_compute_target_http_proxy_facts.py | 2 +- .../google/gcp_compute_target_https_proxy.py | 24 +++++---- .../gcp_compute_target_https_proxy_facts.py | 4 +- .../cloud/google/gcp_compute_target_pool.py | 25 ++++----- .../google/gcp_compute_target_pool_facts.py | 4 +- .../google/gcp_compute_target_ssl_proxy.py | 25 ++++----- .../gcp_compute_target_ssl_proxy_facts.py | 4 +- .../google/gcp_compute_target_tcp_proxy.py | 12 ++--- .../gcp_compute_target_tcp_proxy_facts.py | 2 +- .../google/gcp_compute_target_vpn_gateway.py | 11 ++-- .../gcp_compute_target_vpn_gateway_facts.py | 2 +- .../cloud/google/gcp_compute_url_map.py | 53 ++++++++++--------- .../cloud/google/gcp_compute_url_map_facts.py | 8 +-- .../cloud/google/gcp_compute_vpn_tunnel.py | 23 ++++---- .../google/gcp_compute_vpn_tunnel_facts.py | 4 +- .../cloud/google/gcp_container_node_pool.py | 11 ++-- .../google/gcp_container_node_pool_facts.py | 11 ++-- .../google/gcp_dns_resource_record_set.py | 11 ++-- .../gcp_dns_resource_record_set_facts.py | 11 ++-- .../google/gcp_iam_service_account_key.py | 11 ++-- .../cloud/google/gcp_pubsub_subscription.py | 11 ++-- .../google/gcp_pubsub_subscription_facts.py | 2 +- .../cloud/google/gcp_spanner_database.py | 11 ++-- .../google/gcp_spanner_database_facts.py | 11 ++-- .../modules/cloud/google/gcp_sql_database.py | 11 ++-- .../cloud/google/gcp_sql_database_facts.py | 11 ++-- .../modules/cloud/google/gcp_sql_user.py | 11 ++-- .../cloud/google/gcp_sql_user_facts.py | 11 ++-- .../cloud/google/gcp_storage_bucket.py | 22 ++++---- .../gcp_storage_bucket_access_control.py | 11 ++-- 64 files changed, 423 insertions(+), 379 deletions(-) diff --git a/lib/ansible/module_utils/gcp_utils.py b/lib/ansible/module_utils/gcp_utils.py index ffa5b5c565bac4..ae4f88582b7a64 100644 --- a/lib/ansible/module_utils/gcp_utils.py +++ b/lib/ansible/module_utils/gcp_utils.py @@ -62,16 +62,9 @@ def replace_resource_dict(item, value): else: if not item: return item - if isinstance(item, dict): + else: return item.get(value) - # Item could be a string or a string representing a dictionary. - try: - new_item = ast.literal_eval(item) - return replace_resource_dict(new_item, value) - except ValueError: - return item - # Handles all authentication and HTTP sessions for GCP API calls. class GcpSession(object): diff --git a/lib/ansible/modules/cloud/google/gcp_compute_address.py b/lib/ansible/modules/cloud/google/gcp_compute_address.py index 1c2054a1b6e627..df536ed69198bb 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_address.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_address.py @@ -101,9 +101,10 @@ - This field can only be used with INTERNAL type with GCE_ENDPOINT/DNS_RESOLVER purposes. - 'This field represents a link to a Subnetwork resource in GCP. It can be specified - in two ways. First, you can place in the selfLink of the resource here as a - string Alternatively, you can add `register: name-of-resource` to a gcp_compute_subnetwork - task and then set this subnetwork field to "{{ name-of-resource }}"' + in two ways. First, you can place a dictionary with key ''selfLink'' and value + of your resource''s selfLink Alternatively, you can add `register: name-of-resource` + to a gcp_compute_subnetwork task and then set this subnetwork field to "{{ name-of-resource + }}"' required: false version_added: 2.7 region: @@ -181,7 +182,7 @@ - This field can only be used with INTERNAL type with GCE_ENDPOINT/DNS_RESOLVER purposes. returned: success - type: str + type: dict users: description: - The URLs of the resources that are using this address. @@ -219,7 +220,7 @@ def main(): description=dict(type='str'), name=dict(required=True, type='str'), network_tier=dict(type='str', choices=['PREMIUM', 'STANDARD']), - subnetwork=dict(), + subnetwork=dict(type='dict'), region=dict(required=True, type='str'), ) ) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_address_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_address_facts.py index a6a3d67f1bf306..4ad4457577c878 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_address_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_address_facts.py @@ -122,7 +122,7 @@ - This field can only be used with INTERNAL type with GCE_ENDPOINT/DNS_RESOLVER purposes. returned: success - type: str + type: dict users: description: - The URLs of the resources that are using this address. diff --git a/lib/ansible/modules/cloud/google/gcp_compute_backend_service.py b/lib/ansible/modules/cloud/google/gcp_compute_backend_service.py index b8a1b323b2af85..efb31664a56814 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_backend_service.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_backend_service.py @@ -98,10 +98,10 @@ - When the BackendService has load balancing scheme INTERNAL, the instance group must be in a zone within the same region as the BackendService. - 'This field represents a link to a InstanceGroup resource in GCP. It can - be specified in two ways. First, you can place in the selfLink of the resource - here as a string Alternatively, you can add `register: name-of-resource` - to a gcp_compute_instance_group task and then set this group field to "{{ - name-of-resource }}"' + be specified in two ways. First, you can place a dictionary with key ''selfLink'' + and value of your resource''s selfLink Alternatively, you can add `register: + name-of-resource` to a gcp_compute_instance_group task and then set this + group field to "{{ name-of-resource }}"' required: false max_connections: description: @@ -398,7 +398,7 @@ - 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 - type: str + type: dict maxConnections: description: - The max number of simultaneous connections for the group. Can be used with @@ -655,7 +655,7 @@ def main(): balancing_mode=dict(default='UTILIZATION', type='str', choices=['UTILIZATION', 'RATE', 'CONNECTION']), capacity_scaler=dict(default=1.0, type='str'), description=dict(type='str'), - group=dict(), + group=dict(type='dict'), max_connections=dict(type='int'), max_connections_per_instance=dict(type='int'), max_rate=dict(type='int'), diff --git a/lib/ansible/modules/cloud/google/gcp_compute_backend_service_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_backend_service_facts.py index 3a23e0cff0ecf5..aa8713d91f8de9 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_backend_service_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_backend_service_facts.py @@ -115,7 +115,7 @@ - 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 - type: str + type: dict maxConnections: description: - The max number of simultaneous connections for the group. Can be used diff --git a/lib/ansible/modules/cloud/google/gcp_compute_disk.py b/lib/ansible/modules/cloud/google/gcp_compute_disk.py index a96ca008d18a34..051683ff4d95cf 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_disk.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_disk.py @@ -163,9 +163,10 @@ - The source snapshot used to create this disk. You can provide this as a partial or full URL to the resource. - 'This field represents a link to a Snapshot resource in GCP. It can be specified - in two ways. First, you can place in the selfLink of the resource here as a - string Alternatively, you can add `register: name-of-resource` to a gcp_compute_snapshot - task and then set this source_snapshot field to "{{ name-of-resource }}"' + in two ways. First, you can place a dictionary with key ''selfLink'' and value + of your resource''s selfLink Alternatively, you can add `register: name-of-resource` + to a gcp_compute_snapshot task and then set this source_snapshot field to "{{ + name-of-resource }}"' required: false source_snapshot_encryption_key: description: @@ -374,7 +375,7 @@ - The source snapshot used to create this disk. You can provide this as a partial or full URL to the resource. returned: success - type: str + type: dict sourceSnapshotEncryptionKey: description: - The customer-supplied encryption key of the source snapshot. Required if the source @@ -441,7 +442,7 @@ def main(): zone=dict(required=True, type='str'), source_image_encryption_key=dict(type='dict', options=dict(raw_key=dict(type='str'), kms_key_name=dict(type='str'))), disk_encryption_key=dict(type='dict', options=dict(raw_key=dict(type='str'), kms_key_name=dict(type='str'))), - source_snapshot=dict(), + source_snapshot=dict(type='dict'), source_snapshot_encryption_key=dict(type='dict', options=dict(raw_key=dict(type='str'), kms_key_name=dict(type='str'))), ) ) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_disk_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_disk_facts.py index 0eac0ae6d0a18e..7d727de17ae6f6 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_disk_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_disk_facts.py @@ -243,7 +243,7 @@ - The source snapshot used to create this disk. You can provide this as a partial or full URL to the resource. returned: success - type: str + type: dict sourceSnapshotEncryptionKey: description: - The customer-supplied encryption key of the source snapshot. Required if the diff --git a/lib/ansible/modules/cloud/google/gcp_compute_firewall.py b/lib/ansible/modules/cloud/google/gcp_compute_firewall.py index ab70325e2032ee..082d6972fde887 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_firewall.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_firewall.py @@ -146,9 +146,10 @@ networks/my-network projects/myproject/global/networks/my-network global/networks/default .' - 'This field represents a link to a Network resource in GCP. It can be specified - in two ways. First, you can place in the selfLink of the resource here as a - string Alternatively, you can add `register: name-of-resource` to a gcp_compute_network - task and then set this network field to "{{ name-of-resource }}"' + in two ways. First, you can place a dictionary with key ''selfLink'' and value + of your resource''s selfLink Alternatively, you can add `register: name-of-resource` + to a gcp_compute_network task and then set this network field to "{{ name-of-resource + }}"' required: false default: selfLink: global/networks/default @@ -341,7 +342,7 @@ networks/my-network projects/myproject/global/networks/my-network global/networks/default .' returned: success - type: str + type: dict priority: description: - Priority for this rule. This is an integer between 0 and 65535, both inclusive. @@ -433,7 +434,7 @@ def main(): direction=dict(type='str', choices=['INGRESS', 'EGRESS']), disabled=dict(type='bool'), name=dict(required=True, type='str'), - network=dict(default=dict(selfLink='global/networks/default')), + network=dict(default=dict(selfLink='global/networks/default'), type='dict'), priority=dict(default=1000, type='int'), source_ranges=dict(type='list', elements='str'), source_service_accounts=dict(type='list', elements='str'), diff --git a/lib/ansible/modules/cloud/google/gcp_compute_firewall_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_firewall_facts.py index ecc39b5aac9613..6c266d3d00f8d7 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_firewall_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_firewall_facts.py @@ -170,7 +170,7 @@ networks/my-network projects/myproject/global/networks/my-network global/networks/default .' returned: success - type: str + type: dict priority: description: - Priority for this rule. This is an integer between 0 and 65535, both inclusive. diff --git a/lib/ansible/modules/cloud/google/gcp_compute_forwarding_rule.py b/lib/ansible/modules/cloud/google/gcp_compute_forwarding_rule.py index 7813b2b8802584..d00485470fcc76 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_forwarding_rule.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_forwarding_rule.py @@ -95,10 +95,10 @@ - This is used for internal load balancing. - "(not used for external load balancing) ." - 'This field represents a link to a BackendService resource in GCP. It can be - specified in two ways. First, you can place in the selfLink of the resource - here as a string Alternatively, you can add `register: name-of-resource` to - a gcp_compute_backend_service task and then set this backend_service field to - "{{ name-of-resource }}"' + specified in two ways. First, you can place a dictionary with key ''selfLink'' + and value of your resource''s selfLink Alternatively, you can add `register: + name-of-resource` to a gcp_compute_backend_service task and then set this backend_service + field to "{{ name-of-resource }}"' required: false ip_version: description: @@ -135,9 +135,10 @@ specified, the default network will be used. - This field is not used for external load balancing. - 'This field represents a link to a Network resource in GCP. It can be specified - in two ways. First, you can place in the selfLink of the resource here as a - string Alternatively, you can add `register: name-of-resource` to a gcp_compute_network - task and then set this network field to "{{ name-of-resource }}"' + in two ways. First, you can place a dictionary with key ''selfLink'' and value + of your resource''s selfLink Alternatively, you can add `register: name-of-resource` + to a gcp_compute_network task and then set this network field to "{{ name-of-resource + }}"' required: false port_range: description: @@ -170,9 +171,10 @@ if the network is in custom subnet mode, a subnetwork must be specified. - This field is not used for external load balancing. - 'This field represents a link to a Subnetwork resource in GCP. It can be specified - in two ways. First, you can place in the selfLink of the resource here as a - string Alternatively, you can add `register: name-of-resource` to a gcp_compute_subnetwork - task and then set this subnetwork field to "{{ name-of-resource }}"' + in two ways. First, you can place a dictionary with key ''selfLink'' and value + of your resource''s selfLink Alternatively, you can add `register: name-of-resource` + to a gcp_compute_subnetwork task and then set this subnetwork field to "{{ name-of-resource + }}"' required: false target: description: @@ -183,9 +185,10 @@ target object. - This field is not used for internal load balancing. - 'This field represents a link to a TargetPool resource in GCP. It can be specified - in two ways. First, you can place in the selfLink of the resource here as a - string Alternatively, you can add `register: name-of-resource` to a gcp_compute_target_pool - task and then set this target field to "{{ name-of-resource }}"' + in two ways. First, you can place a dictionary with key ''selfLink'' and value + of your resource''s selfLink Alternatively, you can add `register: name-of-resource` + to a gcp_compute_target_pool task and then set this target field to "{{ name-of-resource + }}"' required: false version_added: 2.7 all_ports: @@ -317,7 +320,7 @@ - This is used for internal load balancing. - "(not used for external load balancing) ." returned: success - type: str + type: dict ipVersion: description: - The IP Version that will be used by this forwarding rule. Valid options are IPV4 @@ -350,7 +353,7 @@ the default network will be used. - This field is not used for external load balancing. returned: success - type: str + type: dict portRange: description: - This field is used along with the target field for TargetHttpProxy, TargetHttpsProxy, @@ -383,7 +386,7 @@ if the network is in custom subnet mode, a subnetwork must be specified. - This field is not used for external load balancing. returned: success - type: str + type: dict target: description: - A reference to a TargetPool resource to receive the matched traffic. @@ -393,7 +396,7 @@ target object. - This field is not used for internal load balancing. returned: success - type: str + type: dict allPorts: description: - When the load balancing scheme is INTERNAL and protocol is TCP/UDP, omit `port`/`port_range` @@ -456,15 +459,15 @@ def main(): description=dict(type='str'), ip_address=dict(type='str'), ip_protocol=dict(type='str', choices=['TCP', 'UDP', 'ESP', 'AH', 'SCTP', 'ICMP']), - backend_service=dict(), + backend_service=dict(type='dict'), ip_version=dict(type='str', choices=['IPV4', 'IPV6']), load_balancing_scheme=dict(type='str', choices=['INTERNAL', 'EXTERNAL']), name=dict(required=True, type='str'), - network=dict(), + network=dict(type='dict'), port_range=dict(type='str'), ports=dict(type='list', elements='str'), - subnetwork=dict(), - target=dict(), + subnetwork=dict(type='dict'), + target=dict(type='dict'), all_ports=dict(type='bool'), network_tier=dict(type='str', choices=['PREMIUM', 'STANDARD']), service_label=dict(type='str'), diff --git a/lib/ansible/modules/cloud/google/gcp_compute_forwarding_rule_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_forwarding_rule_facts.py index d0dce15b518a67..99f2e16c8df214 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_forwarding_rule_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_forwarding_rule_facts.py @@ -123,7 +123,7 @@ - This is used for internal load balancing. - "(not used for external load balancing) ." returned: success - type: str + type: dict ipVersion: description: - The IP Version that will be used by this forwarding rule. Valid options are @@ -156,7 +156,7 @@ specified, the default network will be used. - This field is not used for external load balancing. returned: success - type: str + type: dict portRange: description: - This field is used along with the target field for TargetHttpProxy, TargetHttpsProxy, @@ -191,7 +191,7 @@ if the network is in custom subnet mode, a subnetwork must be specified. - This field is not used for external load balancing. returned: success - type: str + type: dict target: description: - A reference to a TargetPool resource to receive the matched traffic. @@ -201,7 +201,7 @@ to the target object. - This field is not used for internal load balancing. returned: success - type: str + type: dict allPorts: description: - When the load balancing scheme is INTERNAL and protocol is TCP/UDP, omit `port`/`port_range` diff --git a/lib/ansible/modules/cloud/google/gcp_compute_global_forwarding_rule.py b/lib/ansible/modules/cloud/google/gcp_compute_global_forwarding_rule.py index 2f4749a7f6c7e6..e2f6e658849ba3 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_global_forwarding_rule.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_global_forwarding_rule.py @@ -97,10 +97,10 @@ - This is used for internal load balancing. - "(not used for external load balancing) ." - 'This field represents a link to a BackendService resource in GCP. It can be - specified in two ways. First, you can place in the selfLink of the resource - here as a string Alternatively, you can add `register: name-of-resource` to - a gcp_compute_backend_service task and then set this backend_service field to - "{{ name-of-resource }}"' + specified in two ways. First, you can place a dictionary with key ''selfLink'' + and value of your resource''s selfLink Alternatively, you can add `register: + name-of-resource` to a gcp_compute_backend_service task and then set this backend_service + field to "{{ name-of-resource }}"' required: false ip_version: description: @@ -137,9 +137,10 @@ specified, the default network will be used. - This field is not used for external load balancing. - 'This field represents a link to a Network resource in GCP. It can be specified - in two ways. First, you can place in the selfLink of the resource here as a - string Alternatively, you can add `register: name-of-resource` to a gcp_compute_network - task and then set this network field to "{{ name-of-resource }}"' + in two ways. First, you can place a dictionary with key ''selfLink'' and value + of your resource''s selfLink Alternatively, you can add `register: name-of-resource` + to a gcp_compute_network task and then set this network field to "{{ name-of-resource + }}"' required: false port_range: description: @@ -172,9 +173,10 @@ if the network is in custom subnet mode, a subnetwork must be specified. - This field is not used for external load balancing. - 'This field represents a link to a Subnetwork resource in GCP. It can be specified - in two ways. First, you can place in the selfLink of the resource here as a - string Alternatively, you can add `register: name-of-resource` to a gcp_compute_subnetwork - task and then set this subnetwork field to "{{ name-of-resource }}"' + in two ways. First, you can place a dictionary with key ''selfLink'' and value + of your resource''s selfLink Alternatively, you can add `register: name-of-resource` + to a gcp_compute_subnetwork task and then set this subnetwork field to "{{ name-of-resource + }}"' required: false target: description: @@ -318,7 +320,7 @@ - This is used for internal load balancing. - "(not used for external load balancing) ." returned: success - type: str + type: dict ipVersion: description: - The IP Version that will be used by this forwarding rule. Valid options are IPV4 @@ -351,7 +353,7 @@ the default network will be used. - This field is not used for external load balancing. returned: success - type: str + type: dict portRange: description: - This field is used along with the target field for TargetHttpProxy, TargetHttpsProxy, @@ -384,7 +386,7 @@ if the network is in custom subnet mode, a subnetwork must be specified. - This field is not used for external load balancing. returned: success - type: str + type: dict region: description: - A reference to the region where the regional forwarding rule resides. @@ -422,14 +424,14 @@ def main(): description=dict(type='str'), ip_address=dict(type='str'), ip_protocol=dict(type='str', choices=['TCP', 'UDP', 'ESP', 'AH', 'SCTP', 'ICMP']), - backend_service=dict(), + backend_service=dict(type='dict'), ip_version=dict(type='str', choices=['IPV4', 'IPV6']), load_balancing_scheme=dict(type='str', choices=['INTERNAL', 'EXTERNAL']), name=dict(required=True, type='str'), - network=dict(), + network=dict(type='dict'), port_range=dict(type='str'), ports=dict(type='list', elements='str'), - subnetwork=dict(), + subnetwork=dict(type='dict'), target=dict(type='str'), ) ) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_global_forwarding_rule_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_global_forwarding_rule_facts.py index a9bc1652bb1e10..c41904100e51bf 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_global_forwarding_rule_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_global_forwarding_rule_facts.py @@ -117,7 +117,7 @@ - This is used for internal load balancing. - "(not used for external load balancing) ." returned: success - type: str + type: dict ipVersion: description: - The IP Version that will be used by this forwarding rule. Valid options are @@ -150,7 +150,7 @@ specified, the default network will be used. - This field is not used for external load balancing. returned: success - type: str + type: dict portRange: description: - This field is used along with the target field for TargetHttpProxy, TargetHttpsProxy, @@ -185,7 +185,7 @@ if the network is in custom subnet mode, a subnetwork must be specified. - This field is not used for external load balancing. returned: success - type: str + type: dict region: description: - A reference to the region where the regional forwarding rule resides. diff --git a/lib/ansible/modules/cloud/google/gcp_compute_image.py b/lib/ansible/modules/cloud/google/gcp_compute_image.py index fc6baa19e2dc0b..f8db6b4308482a 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_image.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_image.py @@ -153,9 +153,10 @@ - You must provide either this property or the rawDisk.source property but not both to create an image. - 'This field represents a link to a Disk resource in GCP. It can be specified - in two ways. First, you can place in the selfLink of the resource here as a - string Alternatively, you can add `register: name-of-resource` to a gcp_compute_disk - task and then set this source_disk field to "{{ name-of-resource }}"' + in two ways. First, you can place a dictionary with key ''selfLink'' and value + of your resource''s selfLink Alternatively, you can add `register: name-of-resource` + to a gcp_compute_disk task and then set this source_disk field to "{{ name-of-resource + }}"' required: false source_disk_encryption_key: description: @@ -384,7 +385,7 @@ - You must provide either this property or the rawDisk.source property but not both to create an image. returned: success - type: str + type: dict sourceDiskEncryptionKey: description: - The customer-supplied encryption key of the source disk. Required if the source @@ -451,7 +452,7 @@ def main(): type='dict', options=dict(container_type=dict(type='str', choices=['TAR']), sha1_checksum=dict(type='str'), source=dict(required=True, type='str')), ), - source_disk=dict(), + source_disk=dict(type='dict'), source_disk_encryption_key=dict(type='dict', options=dict(raw_key=dict(type='str'))), source_disk_id=dict(type='str'), source_type=dict(type='str', choices=['RAW']), diff --git a/lib/ansible/modules/cloud/google/gcp_compute_image_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_image_facts.py index bcf494a7b8e43b..e6f19b09e26109 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_image_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_image_facts.py @@ -244,7 +244,7 @@ - You must provide either this property or the rawDisk.source property but not both to create an image. returned: success - type: str + type: dict sourceDiskEncryptionKey: description: - The customer-supplied encryption key of the source disk. Required if the source diff --git a/lib/ansible/modules/cloud/google/gcp_compute_instance.py b/lib/ansible/modules/cloud/google/gcp_compute_instance.py index e5790c2d8d6c0f..2b922c69baf28d 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_instance.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_instance.py @@ -176,9 +176,10 @@ - If desired, you can also attach existing non-root persistent disks using this property. This field is only applicable for persistent disks. - 'This field represents a link to a Disk resource in GCP. It can be specified - in two ways. First, you can place in the selfLink of the resource here as - a string Alternatively, you can add `register: name-of-resource` to a gcp_compute_disk - task and then set this source field to "{{ name-of-resource }}"' + in two ways. First, you can place a dictionary with key ''selfLink'' and + value of your resource''s selfLink Alternatively, you can add `register: + name-of-resource` to a gcp_compute_disk task and then set this source field + to "{{ name-of-resource }}"' required: false type: description: @@ -261,10 +262,10 @@ address pool. If you specify a static external IP address, it must live in the same region as the zone of the instance. - 'This field represents a link to a Address resource in GCP. It can be - specified in two ways. First, you can place in the address of the resource - here as a string Alternatively, you can add `register: name-of-resource` - to a gcp_compute_address task and then set this nat_ip field to "{{ - name-of-resource }}"' + specified in two ways. First, you can place a dictionary with key ''address'' + and value of your resource''s address Alternatively, you can add `register: + name-of-resource` to a gcp_compute_address task and then set this nat_ip + field to "{{ name-of-resource }}"' required: false type: description: @@ -299,9 +300,10 @@ global/networks/default is used; if the network is not specified but the subnetwork is specified, the network is inferred. - 'This field represents a link to a Network resource in GCP. It can be specified - in two ways. First, you can place in the selfLink of the resource here as - a string Alternatively, you can add `register: name-of-resource` to a gcp_compute_network - task and then set this network field to "{{ name-of-resource }}"' + in two ways. First, you can place a dictionary with key ''selfLink'' and + value of your resource''s selfLink Alternatively, you can add `register: + name-of-resource` to a gcp_compute_network task and then set this network + field to "{{ name-of-resource }}"' required: false network_ip: description: @@ -316,10 +318,10 @@ If the network is in auto subnet mode, providing the subnetwork is optional. If the network is in custom subnet mode, then this field should be specified. - 'This field represents a link to a Subnetwork resource in GCP. It can be - specified in two ways. First, you can place in the selfLink of the resource - here as a string Alternatively, you can add `register: name-of-resource` - to a gcp_compute_subnetwork task and then set this subnetwork field to "{{ - name-of-resource }}"' + specified in two ways. First, you can place a dictionary with key ''selfLink'' + and value of your resource''s selfLink Alternatively, you can add `register: + name-of-resource` to a gcp_compute_subnetwork task and then set this subnetwork + field to "{{ name-of-resource }}"' required: false scheduling: description: @@ -617,7 +619,7 @@ - If desired, you can also attach existing non-root persistent disks using this property. This field is only applicable for persistent disks. returned: success - type: str + type: dict type: description: - Specifies the type of the disk, either SCRATCH or PERSISTENT. If not specified, @@ -713,7 +715,7 @@ address pool. If you specify a static external IP address, it must live in the same region as the zone of the instance. returned: success - type: str + type: dict type: description: - The type of configuration. The default and only option is ONE_TO_ONE_NAT. @@ -755,7 +757,7 @@ is used; if the network is not specified but the subnetwork is specified, the network is inferred. returned: success - type: str + type: dict networkIP: description: - An IPv4 internal network address to assign to the instance for this network @@ -770,7 +772,7 @@ the network is in auto subnet mode, providing the subnetwork is optional. If the network is in custom subnet mode, then this field should be specified. returned: success - type: str + type: dict scheduling: description: - Sets the scheduling options for this instance. @@ -901,7 +903,7 @@ def main(): ), interface=dict(type='str', choices=['SCSI', 'NVME']), mode=dict(type='str', choices=['READ_WRITE', 'READ_ONLY']), - source=dict(), + source=dict(type='dict'), type=dict(type='str', choices=['SCRATCH', 'PERSISTENT']), ), ), @@ -918,12 +920,14 @@ def main(): access_configs=dict( type='list', elements='dict', - options=dict(name=dict(required=True, type='str'), nat_ip=dict(), type=dict(required=True, type='str', choices=['ONE_TO_ONE_NAT'])), + options=dict( + name=dict(required=True, type='str'), nat_ip=dict(type='dict'), type=dict(required=True, type='str', choices=['ONE_TO_ONE_NAT']) + ), ), alias_ip_ranges=dict(type='list', elements='dict', options=dict(ip_cidr_range=dict(type='str'), subnetwork_range_name=dict(type='str'))), - network=dict(), + network=dict(type='dict'), network_ip=dict(type='str'), - subnetwork=dict(), + subnetwork=dict(type='dict'), ), ), scheduling=dict( diff --git a/lib/ansible/modules/cloud/google/gcp_compute_instance_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_instance_facts.py index dbc0431292506f..950d95a4883e28 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_instance_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_instance_facts.py @@ -226,7 +226,7 @@ - If desired, you can also attach existing non-root persistent disks using this property. This field is only applicable for persistent disks. returned: success - type: str + type: dict type: description: - Specifies the type of the disk, either SCRATCH or PERSISTENT. If not specified, @@ -324,7 +324,7 @@ IP address pool. If you specify a static external IP address, it must live in the same region as the zone of the instance. returned: success - type: str + type: dict type: description: - The type of configuration. The default and only option is ONE_TO_ONE_NAT. @@ -366,7 +366,7 @@ global/networks/default is used; if the network is not specified but the subnetwork is specified, the network is inferred. returned: success - type: str + type: dict networkIP: description: - An IPv4 internal network address to assign to the instance for this network @@ -381,7 +381,7 @@ If the network is in auto subnet mode, providing the subnetwork is optional. If the network is in custom subnet mode, then this field should be specified. returned: success - type: str + type: dict scheduling: description: - Sets the scheduling options for this instance. diff --git a/lib/ansible/modules/cloud/google/gcp_compute_instance_group.py b/lib/ansible/modules/cloud/google/gcp_compute_instance_group.py index 7c7b9d73497fff..228cd8de38a2d3 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_instance_group.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_instance_group.py @@ -83,9 +83,10 @@ description: - The network to which all instances in the instance group belong. - 'This field represents a link to a Network resource in GCP. It can be specified - in two ways. First, you can place in the selfLink of the resource here as a - string Alternatively, you can add `register: name-of-resource` to a gcp_compute_network - task and then set this network field to "{{ name-of-resource }}"' + in two ways. First, you can place a dictionary with key ''selfLink'' and value + of your resource''s selfLink Alternatively, you can add `register: name-of-resource` + to a gcp_compute_network task and then set this network field to "{{ name-of-resource + }}"' required: false region: description: @@ -95,9 +96,10 @@ description: - The subnetwork to which all instances in the instance group belong. - 'This field represents a link to a Subnetwork resource in GCP. It can be specified - in two ways. First, you can place in the selfLink of the resource here as a - string Alternatively, you can add `register: name-of-resource` to a gcp_compute_subnetwork - task and then set this subnetwork field to "{{ name-of-resource }}"' + in two ways. First, you can place a dictionary with key ''selfLink'' and value + of your resource''s selfLink Alternatively, you can add `register: name-of-resource` + to a gcp_compute_subnetwork task and then set this subnetwork field to "{{ name-of-resource + }}"' required: false zone: description: @@ -188,7 +190,7 @@ description: - The network to which all instances in the instance group belong. returned: success - type: str + type: dict region: description: - The region where the instance group is located (for regional resources). @@ -198,7 +200,7 @@ description: - The subnetwork to which all instances in the instance group belong. returned: success - type: str + type: dict zone: description: - A reference to the zone where the instance group resides. @@ -238,11 +240,11 @@ def main(): description=dict(type='str'), name=dict(type='str'), named_ports=dict(type='list', elements='dict', options=dict(name=dict(type='str'), port=dict(type='int'))), - network=dict(), + network=dict(type='dict'), region=dict(type='str'), - subnetwork=dict(), + subnetwork=dict(type='dict'), zone=dict(required=True, type='str'), - instances=dict(type='list'), + instances=dict(type='list', elements='dict'), ) ) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_instance_group_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_instance_group_facts.py index a875420c5dadb5..890758f2d38182 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_instance_group_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_instance_group_facts.py @@ -118,7 +118,7 @@ description: - The network to which all instances in the instance group belong. returned: success - type: str + type: dict region: description: - The region where the instance group is located (for regional resources). @@ -128,7 +128,7 @@ description: - The subnetwork to which all instances in the instance group belong. returned: success - type: str + type: dict zone: description: - A reference to the zone where the instance group resides. diff --git a/lib/ansible/modules/cloud/google/gcp_compute_instance_group_manager.py b/lib/ansible/modules/cloud/google/gcp_compute_instance_group_manager.py index 6153fc3a1f67fc..cca5ee042e202b 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_instance_group_manager.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_instance_group_manager.py @@ -70,10 +70,10 @@ group uses this template to create all new instances in the managed instance group. - 'This field represents a link to a InstanceTemplate resource in GCP. It can - be specified in two ways. First, you can place in the selfLink of the resource - here as a string Alternatively, you can add `register: name-of-resource` to - a gcp_compute_instance_template task and then set this instance_template field - to "{{ name-of-resource }}"' + be specified in two ways. First, you can place a dictionary with key ''selfLink'' + and value of your resource''s selfLink Alternatively, you can add `register: + name-of-resource` to a gcp_compute_instance_template task and then set this + instance_template field to "{{ name-of-resource }}"' required: true name: description: @@ -261,13 +261,13 @@ description: - The instance group being managed. returned: success - type: str + type: dict instanceTemplate: description: - The instance template that is specified for this managed instance group. The group uses this template to create all new instances in the managed instance group. returned: success - type: str + type: dict name: description: - The name of the managed instance group. The name must be 1-63 characters long, @@ -339,10 +339,10 @@ def main(): state=dict(default='present', choices=['present', 'absent'], type='str'), base_instance_name=dict(required=True, type='str'), description=dict(type='str'), - instance_template=dict(required=True), + instance_template=dict(required=True, type='dict'), name=dict(required=True, type='str'), named_ports=dict(type='list', elements='dict', options=dict(name=dict(type='str'), port=dict(type='int'))), - target_pools=dict(type='list'), + target_pools=dict(type='list', elements='dict'), target_size=dict(type='int'), zone=dict(required=True, type='str'), ) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_instance_group_manager_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_instance_group_manager_facts.py index 0d13073cfbca78..4f0d703ce1fcff 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_instance_group_manager_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_instance_group_manager_facts.py @@ -162,14 +162,14 @@ description: - The instance group being managed. returned: success - type: str + type: dict instanceTemplate: description: - The instance template that is specified for this managed instance group. The group uses this template to create all new instances in the managed instance group. returned: success - type: str + type: dict name: description: - The name of the managed instance group. The name must be 1-63 characters long, diff --git a/lib/ansible/modules/cloud/google/gcp_compute_instance_template.py b/lib/ansible/modules/cloud/google/gcp_compute_instance_template.py index 68ffdabbce2c87..566efea58dec67 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_instance_template.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_instance_template.py @@ -201,10 +201,10 @@ - Note that for InstanceTemplate, specify the disk name, not the URL for the disk. - 'This field represents a link to a Disk resource in GCP. It can be specified - in two ways. First, you can place in the name of the resource here as - a string Alternatively, you can add `register: name-of-resource` to - a gcp_compute_disk task and then set this source field to "{{ name-of-resource - }}"' + in two ways. First, you can place a dictionary with key ''name'' and + value of your resource''s name Alternatively, you can add `register: + name-of-resource` to a gcp_compute_disk task and then set this source + field to "{{ name-of-resource }}"' required: false type: description: @@ -273,10 +273,10 @@ IP address pool. If you specify a static external IP address, it must live in the same region as the zone of the instance. - 'This field represents a link to a Address resource in GCP. It can - be specified in two ways. First, you can place in the address of - the resource here as a string Alternatively, you can add `register: - name-of-resource` to a gcp_compute_address task and then set this - nat_ip field to "{{ name-of-resource }}"' + be specified in two ways. First, you can place a dictionary with + key ''address'' and value of your resource''s address Alternatively, + you can add `register: name-of-resource` to a gcp_compute_address + task and then set this nat_ip field to "{{ name-of-resource }}"' required: false type: description: @@ -312,10 +312,10 @@ network global/networks/default is used; if the network is not specified but the subnetwork is specified, the network is inferred. - 'This field represents a link to a Network resource in GCP. It can be - specified in two ways. First, you can place in the selfLink of the resource - here as a string Alternatively, you can add `register: name-of-resource` - to a gcp_compute_network task and then set this network field to "{{ - name-of-resource }}"' + specified in two ways. First, you can place a dictionary with key ''selfLink'' + and value of your resource''s selfLink Alternatively, you can add `register: + name-of-resource` to a gcp_compute_network task and then set this network + field to "{{ name-of-resource }}"' required: false network_ip: description: @@ -330,10 +330,10 @@ If the network is in auto subnet mode, providing the subnetwork is optional. If the network is in custom subnet mode, then this field should be specified. - 'This field represents a link to a Subnetwork resource in GCP. It can - be specified in two ways. First, you can place in the selfLink of the - resource here as a string Alternatively, you can add `register: name-of-resource` - to a gcp_compute_subnetwork task and then set this subnetwork field - to "{{ name-of-resource }}"' + be specified in two ways. First, you can place a dictionary with key + ''selfLink'' and value of your resource''s selfLink Alternatively, you + can add `register: name-of-resource` to a gcp_compute_subnetwork task + and then set this subnetwork field to "{{ name-of-resource }}"' required: false scheduling: description: @@ -626,7 +626,7 @@ - Note that for InstanceTemplate, specify the disk name, not the URL for the disk. returned: success - type: str + type: dict type: description: - Specifies the type of the disk, either SCRATCH or PERSISTENT. If not specified, @@ -699,7 +699,7 @@ IP address pool. If you specify a static external IP address, it must live in the same region as the zone of the instance. returned: success - type: str + type: dict type: description: - The type of configuration. The default and only option is ONE_TO_ONE_NAT. @@ -741,7 +741,7 @@ global/networks/default is used; if the network is not specified but the subnetwork is specified, the network is inferred. returned: success - type: str + type: dict networkIP: description: - An IPv4 internal network address to assign to the instance for this network @@ -756,7 +756,7 @@ If the network is in auto subnet mode, providing the subnetwork is optional. If the network is in custom subnet mode, then this field should be specified. returned: success - type: str + type: dict scheduling: description: - Sets the scheduling options for this instance. @@ -877,7 +877,7 @@ def main(): ), interface=dict(type='str', choices=['SCSI', 'NVME']), mode=dict(type='str', choices=['READ_WRITE', 'READ_ONLY']), - source=dict(), + source=dict(type='dict'), type=dict(type='str', choices=['SCRATCH', 'PERSISTENT']), ), ), @@ -893,15 +893,17 @@ def main(): type='list', elements='dict', options=dict( - name=dict(required=True, type='str'), nat_ip=dict(), type=dict(required=True, type='str', choices=['ONE_TO_ONE_NAT']) + name=dict(required=True, type='str'), + nat_ip=dict(type='dict'), + type=dict(required=True, type='str', choices=['ONE_TO_ONE_NAT']), ), ), alias_ip_ranges=dict( type='list', elements='dict', options=dict(ip_cidr_range=dict(type='str'), subnetwork_range_name=dict(type='str')) ), - network=dict(), + network=dict(type='dict'), network_ip=dict(type='str'), - subnetwork=dict(), + subnetwork=dict(type='dict'), ), ), scheduling=dict( diff --git a/lib/ansible/modules/cloud/google/gcp_compute_instance_template_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_instance_template_facts.py index b6f57d9aca69fb..612027490f20db 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_instance_template_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_instance_template_facts.py @@ -251,7 +251,7 @@ - Note that for InstanceTemplate, specify the disk name, not the URL for the disk. returned: success - type: str + type: dict type: description: - Specifies the type of the disk, either SCRATCH or PERSISTENT. If not @@ -327,7 +327,7 @@ ephemeral IP address pool. If you specify a static external IP address, it must live in the same region as the zone of the instance. returned: success - type: str + type: dict type: description: - The type of configuration. The default and only option is ONE_TO_ONE_NAT. @@ -371,7 +371,7 @@ network global/networks/default is used; if the network is not specified but the subnetwork is specified, the network is inferred. returned: success - type: str + type: dict networkIP: description: - An IPv4 internal network address to assign to the instance for this @@ -387,7 +387,7 @@ optional. If the network is in custom subnet mode, then this field should be specified. returned: success - type: str + type: dict scheduling: description: - Sets the scheduling options for this instance. diff --git a/lib/ansible/modules/cloud/google/gcp_compute_interconnect_attachment.py b/lib/ansible/modules/cloud/google/gcp_compute_interconnect_attachment.py index 3ce52d47075f43..92b951e35f2a23 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_interconnect_attachment.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_interconnect_attachment.py @@ -82,9 +82,10 @@ will automatically connect the Interconnect to the network & region within which the Cloud Router is configured. - 'This field represents a link to a Router resource in GCP. It can be specified - in two ways. First, you can place in the selfLink of the resource here as a - string Alternatively, you can add `register: name-of-resource` to a gcp_compute_router - task and then set this router field to "{{ name-of-resource }}"' + in two ways. First, you can place a dictionary with key ''selfLink'' and value + of your resource''s selfLink Alternatively, you can add `register: name-of-resource` + to a gcp_compute_router task and then set this router field to "{{ name-of-resource + }}"' required: true name: description: @@ -214,7 +215,7 @@ automatically connect the Interconnect to the network & region within which the Cloud Router is configured. returned: success - type: str + type: dict creationTimestamp: description: - Creation timestamp in RFC3339 text format. @@ -282,7 +283,7 @@ def main(): description=dict(type='str'), edge_availability_domain=dict(type='str'), type=dict(type='str', choices=['DEDICATED', 'PARTNER', 'PARTNER_PROVIDER']), - router=dict(required=True), + router=dict(required=True, type='dict'), name=dict(required=True, type='str'), candidate_subnets=dict(type='list', elements='str'), vlan_tag8021q=dict(type='int'), diff --git a/lib/ansible/modules/cloud/google/gcp_compute_interconnect_attachment_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_interconnect_attachment_facts.py index 2d43ab07dd87cf..b374f4f0e86286 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_interconnect_attachment_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_interconnect_attachment_facts.py @@ -154,7 +154,7 @@ will automatically connect the Interconnect to the network & region within which the Cloud Router is configured. returned: success - type: str + type: dict creationTimestamp: description: - Creation timestamp in RFC3339 text format. diff --git a/lib/ansible/modules/cloud/google/gcp_compute_region_disk.py b/lib/ansible/modules/cloud/google/gcp_compute_region_disk.py index f789eaca2994df..12beabc75032fe 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_region_disk.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_region_disk.py @@ -131,9 +131,10 @@ - The source snapshot used to create this disk. You can provide this as a partial or full URL to the resource. - 'This field represents a link to a Snapshot resource in GCP. It can be specified - in two ways. First, you can place in the selfLink of the resource here as a - string Alternatively, you can add `register: name-of-resource` to a gcp_compute_snapshot - task and then set this source_snapshot field to "{{ name-of-resource }}"' + in two ways. First, you can place a dictionary with key ''selfLink'' and value + of your resource''s selfLink Alternatively, you can add `register: name-of-resource` + to a gcp_compute_snapshot task and then set this source_snapshot field to "{{ + name-of-resource }}"' required: false source_snapshot_encryption_key: description: @@ -293,7 +294,7 @@ - The source snapshot used to create this disk. You can provide this as a partial or full URL to the resource. returned: success - type: str + type: dict sourceSnapshotEncryptionKey: description: - The customer-supplied encryption key of the source snapshot. Required if the source @@ -354,7 +355,7 @@ def main(): type=dict(type='str'), region=dict(required=True, type='str'), disk_encryption_key=dict(type='dict', options=dict(raw_key=dict(type='str'))), - source_snapshot=dict(), + source_snapshot=dict(type='dict'), source_snapshot_encryption_key=dict(type='dict', options=dict(raw_key=dict(type='str'))), ) ) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_region_disk_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_region_disk_facts.py index d571944e002b0f..4ce0dfe5b80734 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_region_disk_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_region_disk_facts.py @@ -194,7 +194,7 @@ - The source snapshot used to create this disk. You can provide this as a partial or full URL to the resource. returned: success - type: str + type: dict sourceSnapshotEncryptionKey: description: - The customer-supplied encryption key of the source snapshot. Required if the diff --git a/lib/ansible/modules/cloud/google/gcp_compute_route.py b/lib/ansible/modules/cloud/google/gcp_compute_route.py index e0b47593de22e5..8f62a2fe9eb433 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_route.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_route.py @@ -86,9 +86,10 @@ description: - The network that this route applies to. - 'This field represents a link to a Network resource in GCP. It can be specified - in two ways. First, you can place in the selfLink of the resource here as a - string Alternatively, you can add `register: name-of-resource` to a gcp_compute_network - task and then set this network field to "{{ name-of-resource }}"' + in two ways. First, you can place a dictionary with key ''selfLink'' and value + of your resource''s selfLink Alternatively, you can add `register: name-of-resource` + to a gcp_compute_network task and then set this network field to "{{ name-of-resource + }}"' required: true priority: description: @@ -117,9 +118,10 @@ instances/instance * projects/project/zones/zone/instances/instance * zones/zone/instances/instance .' - 'This field represents a link to a Instance resource in GCP. It can be specified - in two ways. First, you can place in the selfLink of the resource here as a - string Alternatively, you can add `register: name-of-resource` to a gcp_compute_instance - task and then set this next_hop_instance field to "{{ name-of-resource }}"' + in two ways. First, you can place a dictionary with key ''selfLink'' and value + of your resource''s selfLink Alternatively, you can add `register: name-of-resource` + to a gcp_compute_instance task and then set this next_hop_instance field to + "{{ name-of-resource }}"' required: false next_hop_ip: description: @@ -129,9 +131,10 @@ description: - URL to a VpnTunnel that should handle matching packets. - 'This field represents a link to a VpnTunnel resource in GCP. It can be specified - in two ways. First, you can place in the selfLink of the resource here as a - string Alternatively, you can add `register: name-of-resource` to a gcp_compute_vpn_tunnel - task and then set this next_hop_vpn_tunnel field to "{{ name-of-resource }}"' + in two ways. First, you can place a dictionary with key ''selfLink'' and value + of your resource''s selfLink Alternatively, you can add `register: name-of-resource` + to a gcp_compute_vpn_tunnel task and then set this next_hop_vpn_tunnel field + to "{{ name-of-resource }}"' required: false extends_documentation_fragment: gcp notes: @@ -191,7 +194,7 @@ description: - The network that this route applies to. returned: success - type: str + type: dict priority: description: - The priority of this route. Priority is used to break ties in cases where there @@ -222,7 +225,7 @@ instances/instance * projects/project/zones/zone/instances/instance * zones/zone/instances/instance .' returned: success - type: str + type: dict nextHopIp: description: - Network IP address of an instance that should handle matching packets. @@ -232,7 +235,7 @@ description: - URL to a VpnTunnel that should handle matching packets. returned: success - type: str + type: dict nextHopNetwork: description: - URL to a Network that should handle matching packets. @@ -262,13 +265,13 @@ def main(): dest_range=dict(required=True, type='str'), description=dict(type='str'), name=dict(required=True, type='str'), - network=dict(required=True), + network=dict(required=True, type='dict'), priority=dict(type='int'), tags=dict(type='list', elements='str'), next_hop_gateway=dict(type='str'), - next_hop_instance=dict(), + next_hop_instance=dict(type='dict'), next_hop_ip=dict(type='str'), - next_hop_vpn_tunnel=dict(), + next_hop_vpn_tunnel=dict(type='dict'), ) ) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_route_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_route_facts.py index 34de7c0e6eaf4d..9e3fc2bb19b8e8 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_route_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_route_facts.py @@ -91,7 +91,7 @@ description: - The network that this route applies to. returned: success - type: str + type: dict priority: description: - The priority of this route. Priority is used to break ties in cases where @@ -122,7 +122,7 @@ instances/instance * projects/project/zones/zone/instances/instance * zones/zone/instances/instance .' returned: success - type: str + type: dict nextHopIp: description: - Network IP address of an instance that should handle matching packets. @@ -132,7 +132,7 @@ description: - URL to a VpnTunnel that should handle matching packets. returned: success - type: str + type: dict nextHopNetwork: description: - URL to a Network that should handle matching packets. diff --git a/lib/ansible/modules/cloud/google/gcp_compute_router.py b/lib/ansible/modules/cloud/google/gcp_compute_router.py index 83ecca83de7bed..d15a4b11ef5578 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_router.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_router.py @@ -63,9 +63,10 @@ description: - A reference to the network to which this router belongs. - 'This field represents a link to a Network resource in GCP. It can be specified - in two ways. First, you can place in the selfLink of the resource here as a - string Alternatively, you can add `register: name-of-resource` to a gcp_compute_network - task and then set this network field to "{{ name-of-resource }}"' + in two ways. First, you can place a dictionary with key ''selfLink'' and value + of your resource''s selfLink Alternatively, you can add `register: name-of-resource` + to a gcp_compute_network task and then set this network field to "{{ name-of-resource + }}"' required: true bgp: description: @@ -181,7 +182,7 @@ description: - A reference to the network to which this router belongs. returned: success - type: str + type: dict bgp: description: - BGP information specific to this router. @@ -258,7 +259,7 @@ def main(): state=dict(default='present', choices=['present', 'absent'], type='str'), name=dict(required=True, type='str'), description=dict(type='str'), - network=dict(required=True), + network=dict(required=True, type='dict'), bgp=dict( type='dict', options=dict( diff --git a/lib/ansible/modules/cloud/google/gcp_compute_router_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_router_facts.py index 45c00d8af7cb05..fd454ea5bd53d3 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_router_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_router_facts.py @@ -98,7 +98,7 @@ description: - A reference to the network to which this router belongs. returned: success - type: str + type: dict bgp: description: - BGP information specific to this router. diff --git a/lib/ansible/modules/cloud/google/gcp_compute_subnetwork.py b/lib/ansible/modules/cloud/google/gcp_compute_subnetwork.py index 5f4762a2b1bbf4..22a045b4cf809c 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_subnetwork.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_subnetwork.py @@ -89,9 +89,10 @@ - The network this subnet belongs to. - Only networks that are in the distributed mode can have subnetworks. - 'This field represents a link to a Network resource in GCP. It can be specified - in two ways. First, you can place in the selfLink of the resource here as a - string Alternatively, you can add `register: name-of-resource` to a gcp_compute_network - task and then set this network field to "{{ name-of-resource }}"' + in two ways. First, you can place a dictionary with key ''selfLink'' and value + of your resource''s selfLink Alternatively, you can add `register: name-of-resource` + to a gcp_compute_network task and then set this network field to "{{ name-of-resource + }}"' required: true enable_flow_logs: description: @@ -206,7 +207,7 @@ - The network this subnet belongs to. - Only networks that are in the distributed mode can have subnetworks. returned: success - type: str + type: dict enableFlowLogs: description: - Whether to enable flow logging for this subnetwork. @@ -276,7 +277,7 @@ def main(): description=dict(type='str'), ip_cidr_range=dict(required=True, type='str'), name=dict(required=True, type='str'), - network=dict(required=True), + network=dict(required=True, type='dict'), enable_flow_logs=dict(type='bool'), secondary_ip_ranges=dict( type='list', elements='dict', options=dict(range_name=dict(required=True, type='str'), ip_cidr_range=dict(required=True, type='str')) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_subnetwork_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_subnetwork_facts.py index 9d24ddd967da2e..58d67c35ccd3c6 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_subnetwork_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_subnetwork_facts.py @@ -115,7 +115,7 @@ - The network this subnet belongs to. - Only networks that are in the distributed mode can have subnetworks. returned: success - type: str + type: dict enableFlowLogs: description: - Whether to enable flow logging for this subnetwork. diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_http_proxy.py b/lib/ansible/modules/cloud/google/gcp_compute_target_http_proxy.py index 3e69a973f521da..77ac93c525d872 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_http_proxy.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_http_proxy.py @@ -66,9 +66,10 @@ - A reference to the UrlMap resource that defines the mapping from URL to the BackendService. - 'This field represents a link to a UrlMap resource in GCP. It can be specified - in two ways. First, you can place in the selfLink of the resource here as a - string Alternatively, you can add `register: name-of-resource` to a gcp_compute_url_map - task and then set this url_map field to "{{ name-of-resource }}"' + in two ways. First, you can place a dictionary with key ''selfLink'' and value + of your resource''s selfLink Alternatively, you can add `register: name-of-resource` + to a gcp_compute_url_map task and then set this url_map field to "{{ name-of-resource + }}"' required: true extends_documentation_fragment: gcp notes: @@ -164,7 +165,7 @@ description: - A reference to the UrlMap resource that defines the mapping from URL to the BackendService. returned: success - type: str + type: dict ''' ################################################################################ @@ -188,7 +189,7 @@ def main(): state=dict(default='present', choices=['present', 'absent'], type='str'), description=dict(type='str'), name=dict(required=True, type='str'), - url_map=dict(required=True), + url_map=dict(required=True, type='dict'), ) ) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_http_proxy_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_target_http_proxy_facts.py index 1a6e68af68839c..0ae4f891c64b45 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_http_proxy_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_http_proxy_facts.py @@ -95,7 +95,7 @@ - A reference to the UrlMap resource that defines the mapping from URL to the BackendService. returned: success - type: str + type: dict ''' ################################################################################ diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_https_proxy.py b/lib/ansible/modules/cloud/google/gcp_compute_target_https_proxy.py index c9dd72cfe16ef9..e32c47c5dd40cf 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_https_proxy.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_https_proxy.py @@ -86,9 +86,10 @@ resource. If not set, the TargetHttpsProxy resource will not have any SSL policy configured. - 'This field represents a link to a SslPolicy resource in GCP. It can be specified - in two ways. First, you can place in the selfLink of the resource here as a - string Alternatively, you can add `register: name-of-resource` to a gcp_compute_ssl_policy - task and then set this ssl_policy field to "{{ name-of-resource }}"' + in two ways. First, you can place a dictionary with key ''selfLink'' and value + of your resource''s selfLink Alternatively, you can add `register: name-of-resource` + to a gcp_compute_ssl_policy task and then set this ssl_policy field to "{{ name-of-resource + }}"' required: false version_added: 2.8 url_map: @@ -96,9 +97,10 @@ - A reference to the UrlMap resource that defines the mapping from URL to the BackendService. - 'This field represents a link to a UrlMap resource in GCP. It can be specified - in two ways. First, you can place in the selfLink of the resource here as a - string Alternatively, you can add `register: name-of-resource` to a gcp_compute_url_map - task and then set this url_map field to "{{ name-of-resource }}"' + in two ways. First, you can place a dictionary with key ''selfLink'' and value + of your resource''s selfLink Alternatively, you can add `register: name-of-resource` + to a gcp_compute_url_map task and then set this url_map field to "{{ name-of-resource + }}"' required: true extends_documentation_fragment: gcp notes: @@ -235,12 +237,12 @@ resource. If not set, the TargetHttpsProxy resource will not have any SSL policy configured. returned: success - type: str + type: dict urlMap: description: - A reference to the UrlMap resource that defines the mapping from URL to the BackendService. returned: success - type: str + type: dict ''' ################################################################################ @@ -265,9 +267,9 @@ def main(): description=dict(type='str'), name=dict(required=True, type='str'), quic_override=dict(type='str', choices=['NONE', 'ENABLE', 'DISABLE']), - ssl_certificates=dict(required=True, type='list'), - ssl_policy=dict(), - url_map=dict(required=True), + ssl_certificates=dict(required=True, type='list', elements='dict'), + ssl_policy=dict(type='dict'), + url_map=dict(required=True, type='dict'), ) ) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_https_proxy_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_target_https_proxy_facts.py index bd79ec0d85a155..423fe90e879fc7 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_https_proxy_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_https_proxy_facts.py @@ -112,13 +112,13 @@ resource. If not set, the TargetHttpsProxy resource will not have any SSL policy configured. returned: success - type: str + type: dict urlMap: description: - A reference to the UrlMap resource that defines the mapping from URL to the BackendService. returned: success - type: str + type: dict ''' ################################################################################ diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_pool.py b/lib/ansible/modules/cloud/google/gcp_compute_target_pool.py index 270e1a03edb0be..4d9e693c2bf608 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_pool.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_pool.py @@ -61,9 +61,10 @@ pool in the "force" mode, where traffic will be spread to the healthy instances with the best effort, or to all instances when no instance is healthy. - 'This field represents a link to a TargetPool resource in GCP. It can be specified - in two ways. First, you can place in the selfLink of the resource here as a - string Alternatively, you can add `register: name-of-resource` to a gcp_compute_target_pool - task and then set this backup_pool field to "{{ name-of-resource }}"' + in two ways. First, you can place a dictionary with key ''selfLink'' and value + of your resource''s selfLink Alternatively, you can add `register: name-of-resource` + to a gcp_compute_target_pool task and then set this backup_pool field to "{{ + name-of-resource }}"' required: false description: description: @@ -90,10 +91,10 @@ checks pass. If not specified it means all member instances will be considered healthy at all times. - 'This field represents a link to a HttpHealthCheck resource in GCP. It can be - specified in two ways. First, you can place in the selfLink of the resource - here as a string Alternatively, you can add `register: name-of-resource` to - a gcp_compute_http_health_check task and then set this health_check field to - "{{ name-of-resource }}"' + specified in two ways. First, you can place a dictionary with key ''selfLink'' + and value of your resource''s selfLink Alternatively, you can add `register: + name-of-resource` to a gcp_compute_http_health_check task and then set this + health_check field to "{{ name-of-resource }}"' required: false instances: description: @@ -158,7 +159,7 @@ pool in the "force" mode, where traffic will be spread to the healthy instances with the best effort, or to all instances when no instance is healthy. returned: success - type: str + type: dict creationTimestamp: description: - Creation timestamp in RFC3339 text format. @@ -191,7 +192,7 @@ checks pass. If not specified it means all member instances will be considered healthy at all times. returned: success - type: str + type: dict id: description: - The unique identifier for the resource. @@ -249,11 +250,11 @@ def main(): module = GcpModule( argument_spec=dict( state=dict(default='present', choices=['present', 'absent'], type='str'), - backup_pool=dict(), + backup_pool=dict(type='dict'), description=dict(type='str'), failover_ratio=dict(type='str'), - health_check=dict(), - instances=dict(type='list'), + health_check=dict(type='dict'), + instances=dict(type='list', elements='dict'), name=dict(required=True, type='str'), session_affinity=dict(type='str', choices=['NONE', 'CLIENT_IP', 'CLIENT_IP_PROTO']), region=dict(required=True, type='str'), diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_pool_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_target_pool_facts.py index 48923e140719a2..884cc6dcf095ea 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_pool_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_pool_facts.py @@ -84,7 +84,7 @@ primary pool in the "force" mode, where traffic will be spread to the healthy instances with the best effort, or to all instances when no instance is healthy. returned: success - type: str + type: dict creationTimestamp: description: - Creation timestamp in RFC3339 text format. @@ -117,7 +117,7 @@ checks pass. If not specified it means all member instances will be considered healthy at all times. returned: success - type: str + type: dict id: description: - The unique identifier for the resource. diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_ssl_proxy.py b/lib/ansible/modules/cloud/google/gcp_compute_target_ssl_proxy.py index ec6f54ccc23555..108d2718de2b0e 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_ssl_proxy.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_ssl_proxy.py @@ -73,10 +73,10 @@ description: - A reference to the BackendService resource. - 'This field represents a link to a BackendService resource in GCP. It can be - specified in two ways. First, you can place in the selfLink of the resource - here as a string Alternatively, you can add `register: name-of-resource` to - a gcp_compute_backend_service task and then set this service field to "{{ name-of-resource - }}"' + specified in two ways. First, you can place a dictionary with key ''selfLink'' + and value of your resource''s selfLink Alternatively, you can add `register: + name-of-resource` to a gcp_compute_backend_service task and then set this service + field to "{{ name-of-resource }}"' required: true ssl_certificates: description: @@ -90,9 +90,10 @@ resource. If not set, the TargetSslProxy resource will not have any SSL policy configured. - 'This field represents a link to a SslPolicy resource in GCP. It can be specified - in two ways. First, you can place in the selfLink of the resource here as a - string Alternatively, you can add `register: name-of-resource` to a gcp_compute_ssl_policy - task and then set this ssl_policy field to "{{ name-of-resource }}"' + in two ways. First, you can place a dictionary with key ''selfLink'' and value + of your resource''s selfLink Alternatively, you can add `register: name-of-resource` + to a gcp_compute_ssl_policy task and then set this ssl_policy field to "{{ name-of-resource + }}"' required: false version_added: 2.8 extends_documentation_fragment: gcp @@ -213,7 +214,7 @@ description: - A reference to the BackendService resource. returned: success - type: str + type: dict sslCertificates: description: - A list of SslCertificate resources that are used to authenticate connections between @@ -226,7 +227,7 @@ resource. If not set, the TargetSslProxy resource will not have any SSL policy configured. returned: success - type: str + type: dict ''' ################################################################################ @@ -251,9 +252,9 @@ def main(): description=dict(type='str'), name=dict(required=True, type='str'), proxy_header=dict(type='str', choices=['NONE', 'PROXY_V1']), - service=dict(required=True), - ssl_certificates=dict(required=True, type='list'), - ssl_policy=dict(), + service=dict(required=True, type='dict'), + ssl_certificates=dict(required=True, type='list', elements='dict'), + ssl_policy=dict(type='dict'), ) ) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_ssl_proxy_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_target_ssl_proxy_facts.py index fe582bfccf3408..a1937543072798 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_ssl_proxy_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_ssl_proxy_facts.py @@ -100,7 +100,7 @@ description: - A reference to the BackendService resource. returned: success - type: str + type: dict sslCertificates: description: - A list of SslCertificate resources that are used to authenticate connections @@ -114,7 +114,7 @@ resource. If not set, the TargetSslProxy resource will not have any SSL policy configured. returned: success - type: str + type: dict ''' ################################################################################ diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_tcp_proxy.py b/lib/ansible/modules/cloud/google/gcp_compute_target_tcp_proxy.py index b10ace3174f2e2..06acbc343c36f7 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_tcp_proxy.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_tcp_proxy.py @@ -73,10 +73,10 @@ description: - A reference to the BackendService resource. - 'This field represents a link to a BackendService resource in GCP. It can be - specified in two ways. First, you can place in the selfLink of the resource - here as a string Alternatively, you can add `register: name-of-resource` to - a gcp_compute_backend_service task and then set this service field to "{{ name-of-resource - }}"' + specified in two ways. First, you can place a dictionary with key ''selfLink'' + and value of your resource''s selfLink Alternatively, you can add `register: + name-of-resource` to a gcp_compute_backend_service task and then set this service + field to "{{ name-of-resource }}"' required: true extends_documentation_fragment: gcp notes: @@ -173,7 +173,7 @@ description: - A reference to the BackendService resource. returned: success - type: str + type: dict ''' ################################################################################ @@ -198,7 +198,7 @@ def main(): description=dict(type='str'), name=dict(required=True, type='str'), proxy_header=dict(type='str', choices=['NONE', 'PROXY_V1']), - service=dict(required=True), + service=dict(required=True, type='dict'), ) ) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_tcp_proxy_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_target_tcp_proxy_facts.py index f563a0b8bf4c8a..ab0e0da3008fb2 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_tcp_proxy_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_tcp_proxy_facts.py @@ -100,7 +100,7 @@ description: - A reference to the BackendService resource. returned: success - type: str + type: dict ''' ################################################################################ diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_vpn_gateway.py b/lib/ansible/modules/cloud/google/gcp_compute_target_vpn_gateway.py index 9bf4d8c2149e08..3e26ef4634d065 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_vpn_gateway.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_vpn_gateway.py @@ -65,9 +65,10 @@ description: - The network this VPN gateway is accepting traffic for. - 'This field represents a link to a Network resource in GCP. It can be specified - in two ways. First, you can place in the selfLink of the resource here as a - string Alternatively, you can add `register: name-of-resource` to a gcp_compute_network - task and then set this network field to "{{ name-of-resource }}"' + in two ways. First, you can place a dictionary with key ''selfLink'' and value + of your resource''s selfLink Alternatively, you can add `register: name-of-resource` + to a gcp_compute_network task and then set this network field to "{{ name-of-resource + }}"' required: true region: description: @@ -139,7 +140,7 @@ description: - The network this VPN gateway is accepting traffic for. returned: success - type: str + type: dict tunnels: description: - A list of references to VpnTunnel resources associated with this VPN gateway. @@ -179,7 +180,7 @@ def main(): state=dict(default='present', choices=['present', 'absent'], type='str'), description=dict(type='str'), name=dict(required=True, type='str'), - network=dict(required=True), + network=dict(required=True, type='dict'), region=dict(required=True, type='str'), ) ) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_vpn_gateway_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_target_vpn_gateway_facts.py index 09c6913ee6bec0..91c2a47ac6fa2a 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_vpn_gateway_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_vpn_gateway_facts.py @@ -99,7 +99,7 @@ description: - The network this VPN gateway is accepting traffic for. returned: success - type: str + type: dict tunnels: description: - A list of references to VpnTunnel resources associated with this VPN gateway. diff --git a/lib/ansible/modules/cloud/google/gcp_compute_url_map.py b/lib/ansible/modules/cloud/google/gcp_compute_url_map.py index 5d0c6bd1935d91..74ed45aa0b0f4c 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_url_map.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_url_map.py @@ -52,10 +52,10 @@ description: - A reference to BackendService resource if none of the hostRules match. - 'This field represents a link to a BackendService resource in GCP. It can be - specified in two ways. First, you can place in the selfLink of the resource - here as a string Alternatively, you can add `register: name-of-resource` to - a gcp_compute_backend_service task and then set this default_service field to - "{{ name-of-resource }}"' + specified in two ways. First, you can place a dictionary with key ''selfLink'' + and value of your resource''s selfLink Alternatively, you can add `register: + name-of-resource` to a gcp_compute_backend_service task and then set this default_service + field to "{{ name-of-resource }}"' required: true description: description: @@ -102,10 +102,10 @@ - A reference to a BackendService resource. This will be used if none of the pathRules defined by this PathMatcher is matched by the URL's path portion. - 'This field represents a link to a BackendService resource in GCP. It can - be specified in two ways. First, you can place in the selfLink of the resource - here as a string Alternatively, you can add `register: name-of-resource` - to a gcp_compute_backend_service task and then set this default_service - field to "{{ name-of-resource }}"' + be specified in two ways. First, you can place a dictionary with key ''selfLink'' + and value of your resource''s selfLink Alternatively, you can add `register: + name-of-resource` to a gcp_compute_backend_service task and then set this + default_service field to "{{ name-of-resource }}"' required: true description: description: @@ -131,10 +131,10 @@ description: - A reference to the BackendService resource if this rule is matched. - 'This field represents a link to a BackendService resource in GCP. It - can be specified in two ways. First, you can place in the selfLink of - the resource here as a string Alternatively, you can add `register: - name-of-resource` to a gcp_compute_backend_service task and then set - this service field to "{{ name-of-resource }}"' + can be specified in two ways. First, you can place a dictionary with + key ''selfLink'' and value of your resource''s selfLink Alternatively, + you can add `register: name-of-resource` to a gcp_compute_backend_service + task and then set this service field to "{{ name-of-resource }}"' required: true tests: description: @@ -159,10 +159,10 @@ - A reference to expected BackendService resource the given URL should be mapped to. - 'This field represents a link to a BackendService resource in GCP. It can - be specified in two ways. First, you can place in the selfLink of the resource - here as a string Alternatively, you can add `register: name-of-resource` - to a gcp_compute_backend_service task and then set this service field to - "{{ name-of-resource }}"' + be specified in two ways. First, you can place a dictionary with key ''selfLink'' + and value of your resource''s selfLink Alternatively, you can add `register: + name-of-resource` to a gcp_compute_backend_service task and then set this + service field to "{{ name-of-resource }}"' required: true extends_documentation_fragment: gcp ''' @@ -225,7 +225,7 @@ description: - A reference to BackendService resource if none of the hostRules match. returned: success - type: str + type: dict description: description: - An optional description of this resource. Provide this property when you create @@ -289,7 +289,7 @@ - A reference to a BackendService resource. This will be used if none of the pathRules defined by this PathMatcher is matched by the URL's path portion. returned: success - type: str + type: dict description: description: - An optional description of this resource. @@ -318,7 +318,7 @@ description: - A reference to the BackendService resource if this rule is matched. returned: success - type: str + type: dict tests: description: - The list of expected URL mappings. Requests to update this UrlMap will succeed @@ -346,7 +346,7 @@ - A reference to expected BackendService resource the given URL should be mapped to. returned: success - type: str + type: dict ''' ################################################################################ @@ -368,7 +368,7 @@ def main(): module = GcpModule( argument_spec=dict( state=dict(default='present', choices=['present', 'absent'], type='str'), - default_service=dict(required=True), + default_service=dict(required=True, type='dict'), description=dict(type='str'), host_rules=dict( type='list', @@ -382,11 +382,13 @@ def main(): type='list', elements='dict', options=dict( - default_service=dict(required=True), + default_service=dict(required=True, type='dict'), description=dict(type='str'), name=dict(required=True, type='str'), path_rules=dict( - type='list', elements='dict', options=dict(paths=dict(required=True, type='list', elements='str'), service=dict(required=True)) + type='list', + elements='dict', + options=dict(paths=dict(required=True, type='list', elements='str'), service=dict(required=True, type='dict')), ), ), ), @@ -394,7 +396,10 @@ def main(): type='list', elements='dict', options=dict( - description=dict(type='str'), host=dict(required=True, type='str'), path=dict(required=True, type='str'), service=dict(required=True) + description=dict(type='str'), + host=dict(required=True, type='str'), + path=dict(required=True, type='str'), + service=dict(required=True, type='dict'), ), ), ) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_url_map_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_url_map_facts.py index 2fd5175a96fd52..99ed600a31f144 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_url_map_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_url_map_facts.py @@ -74,7 +74,7 @@ description: - A reference to BackendService resource if none of the hostRules match. returned: success - type: str + type: dict description: description: - An optional description of this resource. Provide this property when you create @@ -139,7 +139,7 @@ the pathRules defined by this PathMatcher is matched by the URL's path portion. returned: success - type: str + type: dict description: description: - An optional description of this resource. @@ -168,7 +168,7 @@ description: - A reference to the BackendService resource if this rule is matched. returned: success - type: str + type: dict tests: description: - The list of expected URL mappings. Requests to update this UrlMap will succeed @@ -196,7 +196,7 @@ - A reference to expected BackendService resource the given URL should be mapped to. returned: success - type: str + type: dict ''' ################################################################################ diff --git a/lib/ansible/modules/cloud/google/gcp_compute_vpn_tunnel.py b/lib/ansible/modules/cloud/google/gcp_compute_vpn_tunnel.py index c88d31844cd049..ec7be3db0500e5 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_vpn_tunnel.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_vpn_tunnel.py @@ -63,18 +63,19 @@ description: - URL of the Target VPN gateway with which this VPN tunnel is associated. - 'This field represents a link to a TargetVpnGateway resource in GCP. It can - be specified in two ways. First, you can place in the selfLink of the resource - here as a string Alternatively, you can add `register: name-of-resource` to - a gcp_compute_target_vpn_gateway task and then set this target_vpn_gateway field - to "{{ name-of-resource }}"' + be specified in two ways. First, you can place a dictionary with key ''selfLink'' + and value of your resource''s selfLink Alternatively, you can add `register: + name-of-resource` to a gcp_compute_target_vpn_gateway task and then set this + target_vpn_gateway field to "{{ name-of-resource }}"' required: true router: description: - URL of router resource to be used for dynamic routing. - 'This field represents a link to a Router resource in GCP. It can be specified - in two ways. First, you can place in the selfLink of the resource here as a - string Alternatively, you can add `register: name-of-resource` to a gcp_compute_router - task and then set this router field to "{{ name-of-resource }}"' + in two ways. First, you can place a dictionary with key ''selfLink'' and value + of your resource''s selfLink Alternatively, you can add `register: name-of-resource` + to a gcp_compute_router task and then set this router field to "{{ name-of-resource + }}"' required: false peer_ip: description: @@ -193,12 +194,12 @@ description: - URL of the Target VPN gateway with which this VPN tunnel is associated. returned: success - type: str + type: dict router: description: - URL of router resource to be used for dynamic routing. returned: success - type: str + type: dict peerIp: description: - IP address of the peer VPN gateway. Only IPv4 is supported. @@ -265,8 +266,8 @@ def main(): state=dict(default='present', choices=['present', 'absent'], type='str'), name=dict(required=True, type='str'), description=dict(type='str'), - target_vpn_gateway=dict(required=True), - router=dict(), + target_vpn_gateway=dict(required=True, type='dict'), + router=dict(type='dict'), peer_ip=dict(required=True, type='str'), shared_secret=dict(required=True, type='str'), ike_version=dict(default=2, type='int'), diff --git a/lib/ansible/modules/cloud/google/gcp_compute_vpn_tunnel_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_vpn_tunnel_facts.py index 00d5645d1e01df..e67c1b4e0402f6 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_vpn_tunnel_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_vpn_tunnel_facts.py @@ -93,12 +93,12 @@ description: - URL of the Target VPN gateway with which this VPN tunnel is associated. returned: success - type: str + type: dict router: description: - URL of router resource to be used for dynamic routing. returned: success - type: str + type: dict peerIp: description: - IP address of the peer VPN gateway. Only IPv4 is supported. diff --git a/lib/ansible/modules/cloud/google/gcp_container_node_pool.py b/lib/ansible/modules/cloud/google/gcp_container_node_pool.py index fc4acf092e14a6..79b4e36663d36b 100644 --- a/lib/ansible/modules/cloud/google/gcp_container_node_pool.py +++ b/lib/ansible/modules/cloud/google/gcp_container_node_pool.py @@ -198,9 +198,10 @@ description: - The cluster this node pool belongs to. - 'This field represents a link to a Cluster resource in GCP. It can be specified - in two ways. First, you can place in the name of the resource here as a string - Alternatively, you can add `register: name-of-resource` to a gcp_container_cluster - task and then set this cluster field to "{{ name-of-resource }}"' + in two ways. First, you can place a dictionary with key ''name'' and value of + your resource''s name Alternatively, you can add `register: name-of-resource` + to a gcp_container_cluster task and then set this cluster field to "{{ name-of-resource + }}"' required: true location: description: @@ -413,7 +414,7 @@ description: - The cluster this node pool belongs to. returned: success - type: str + type: dict location: description: - The location where the node pool is deployed. @@ -462,7 +463,7 @@ def main(): management=dict( type='dict', options=dict(auto_upgrade=dict(type='bool'), auto_repair=dict(type='bool'), upgrade_options=dict(type='dict', options=dict())) ), - cluster=dict(required=True), + cluster=dict(required=True, type='dict'), location=dict(required=True, type='str', aliases=['region', 'zone']), ) ) diff --git a/lib/ansible/modules/cloud/google/gcp_container_node_pool_facts.py b/lib/ansible/modules/cloud/google/gcp_container_node_pool_facts.py index a95501ed8dabd3..aae03244997318 100644 --- a/lib/ansible/modules/cloud/google/gcp_container_node_pool_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_container_node_pool_facts.py @@ -52,9 +52,10 @@ description: - The cluster this node pool belongs to. - 'This field represents a link to a Cluster resource in GCP. It can be specified - in two ways. First, you can place in the name of the resource here as a string - Alternatively, you can add `register: name-of-resource` to a gcp_container_cluster - task and then set this cluster field to "{{ name-of-resource }}"' + in two ways. First, you can place a dictionary with key ''name'' and value of + your resource''s name Alternatively, you can add `register: name-of-resource` + to a gcp_container_cluster task and then set this cluster field to "{{ name-of-resource + }}"' required: true extends_documentation_fragment: gcp ''' @@ -252,7 +253,7 @@ description: - The cluster this node pool belongs to. returned: success - type: str + type: dict location: description: - The location where the node pool is deployed. @@ -272,7 +273,7 @@ def main(): - module = GcpModule(argument_spec=dict(location=dict(required=True, type='str', aliases=['region', 'zone']), cluster=dict(required=True))) + module = GcpModule(argument_spec=dict(location=dict(required=True, type='str', aliases=['region', 'zone']), cluster=dict(required=True, type='dict'))) if not module.params['scopes']: module.params['scopes'] = ['https://www.googleapis.com/auth/cloud-platform'] diff --git a/lib/ansible/modules/cloud/google/gcp_dns_resource_record_set.py b/lib/ansible/modules/cloud/google/gcp_dns_resource_record_set.py index d9a97252e4b1a7..6acd1957a71eb8 100644 --- a/lib/ansible/modules/cloud/google/gcp_dns_resource_record_set.py +++ b/lib/ansible/modules/cloud/google/gcp_dns_resource_record_set.py @@ -85,9 +85,10 @@ description: - Identifies the managed zone addressed by this request. - 'This field represents a link to a ManagedZone resource in GCP. It can be specified - in two ways. First, you can place in the name of the resource here as a string - Alternatively, you can add `register: name-of-resource` to a gcp_dns_managed_zone - task and then set this managed_zone field to "{{ name-of-resource }}"' + in two ways. First, you can place a dictionary with key ''name'' and value of + your resource''s name Alternatively, you can add `register: name-of-resource` + to a gcp_dns_managed_zone task and then set this managed_zone field to "{{ name-of-resource + }}"' required: true extends_documentation_fragment: gcp ''' @@ -144,7 +145,7 @@ description: - Identifies the managed zone addressed by this request. returned: success - type: str + type: dict ''' ################################################################################ @@ -172,7 +173,7 @@ def main(): type=dict(required=True, type='str', choices=['A', 'AAAA', 'CAA', 'CNAME', 'MX', 'NAPTR', 'NS', 'PTR', 'SOA', 'SPF', 'SRV', 'TLSA', 'TXT']), ttl=dict(type='int'), target=dict(type='list', elements='str'), - managed_zone=dict(required=True), + managed_zone=dict(required=True, type='dict'), ) ) diff --git a/lib/ansible/modules/cloud/google/gcp_dns_resource_record_set_facts.py b/lib/ansible/modules/cloud/google/gcp_dns_resource_record_set_facts.py index 402cc4db53ce1b..1e3e6917703397 100644 --- a/lib/ansible/modules/cloud/google/gcp_dns_resource_record_set_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_dns_resource_record_set_facts.py @@ -44,9 +44,10 @@ description: - Identifies the managed zone addressed by this request. - 'This field represents a link to a ManagedZone resource in GCP. It can be specified - in two ways. First, you can place in the name of the resource here as a string - Alternatively, you can add `register: name-of-resource` to a gcp_dns_managed_zone - task and then set this managed_zone field to "{{ name-of-resource }}"' + in two ways. First, you can place a dictionary with key ''name'' and value of + your resource''s name Alternatively, you can add `register: name-of-resource` + to a gcp_dns_managed_zone task and then set this managed_zone field to "{{ name-of-resource + }}"' required: true extends_documentation_fragment: gcp ''' @@ -91,7 +92,7 @@ description: - Identifies the managed zone addressed by this request. returned: success - type: str + type: dict ''' ################################################################################ @@ -106,7 +107,7 @@ def main(): - module = GcpModule(argument_spec=dict(managed_zone=dict(required=True))) + module = GcpModule(argument_spec=dict(managed_zone=dict(required=True, type='dict'))) if not module.params['scopes']: module.params['scopes'] = ['https://www.googleapis.com/auth/ndev.clouddns.readwrite'] diff --git a/lib/ansible/modules/cloud/google/gcp_iam_service_account_key.py b/lib/ansible/modules/cloud/google/gcp_iam_service_account_key.py index 50d8ee02ebcb1e..a994c23ac2da2c 100644 --- a/lib/ansible/modules/cloud/google/gcp_iam_service_account_key.py +++ b/lib/ansible/modules/cloud/google/gcp_iam_service_account_key.py @@ -67,9 +67,10 @@ description: - The name of the serviceAccount. - 'This field represents a link to a ServiceAccount resource in GCP. It can be - specified in two ways. First, you can place in the name of the resource here - as a string Alternatively, you can add `register: name-of-resource` to a gcp_iam_service_account - task and then set this service_account field to "{{ name-of-resource }}"' + specified in two ways. First, you can place a dictionary with key ''name'' and + value of your resource''s name Alternatively, you can add `register: name-of-resource` + to a gcp_iam_service_account task and then set this service_account field to + "{{ name-of-resource }}"' required: false path: description: @@ -142,7 +143,7 @@ description: - The name of the serviceAccount. returned: success - type: str + type: dict path: description: - The full name of the file that will hold the service account private key. The @@ -176,7 +177,7 @@ def main(): state=dict(default='present', choices=['present', 'absent'], type='str'), private_key_type=dict(type='str', choices=['TYPE_UNSPECIFIED', 'TYPE_PKCS12_FILE', 'TYPE_GOOGLE_CREDENTIALS_FILE']), key_algorithm=dict(type='str', choices=['KEY_ALG_UNSPECIFIED', 'KEY_ALG_RSA_1024', 'KEY_ALG_RSA_2048']), - service_account=dict(), + service_account=dict(type='dict'), path=dict(type='path'), ) ) diff --git a/lib/ansible/modules/cloud/google/gcp_pubsub_subscription.py b/lib/ansible/modules/cloud/google/gcp_pubsub_subscription.py index a71b2a62381db5..503edbd7099af1 100644 --- a/lib/ansible/modules/cloud/google/gcp_pubsub_subscription.py +++ b/lib/ansible/modules/cloud/google/gcp_pubsub_subscription.py @@ -56,9 +56,10 @@ description: - A reference to a Topic resource. - 'This field represents a link to a Topic resource in GCP. It can be specified - in two ways. First, you can place in the name of the resource here as a string - Alternatively, you can add `register: name-of-resource` to a gcp_pubsub_topic - task and then set this topic field to "{{ name-of-resource }}"' + in two ways. First, you can place a dictionary with key ''name'' and value of + your resource''s name Alternatively, you can add `register: name-of-resource` + to a gcp_pubsub_topic task and then set this topic field to "{{ name-of-resource + }}"' required: true labels: description: @@ -170,7 +171,7 @@ description: - A reference to a Topic resource. returned: success - type: str + type: dict labels: description: - A set of key/value label pairs to assign to this Subscription. @@ -266,7 +267,7 @@ def main(): argument_spec=dict( state=dict(default='present', choices=['present', 'absent'], type='str'), name=dict(required=True, type='str'), - topic=dict(required=True), + topic=dict(required=True, type='dict'), labels=dict(type='dict'), push_config=dict(type='dict', options=dict(push_endpoint=dict(required=True, type='str'), attributes=dict(type='dict'))), ack_deadline_seconds=dict(type='int'), diff --git a/lib/ansible/modules/cloud/google/gcp_pubsub_subscription_facts.py b/lib/ansible/modules/cloud/google/gcp_pubsub_subscription_facts.py index 52f2ed9c940644..30e39be3b2cf80 100644 --- a/lib/ansible/modules/cloud/google/gcp_pubsub_subscription_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_pubsub_subscription_facts.py @@ -67,7 +67,7 @@ description: - A reference to a Topic resource. returned: success - type: str + type: dict labels: description: - A set of key/value label pairs to assign to this Subscription. diff --git a/lib/ansible/modules/cloud/google/gcp_spanner_database.py b/lib/ansible/modules/cloud/google/gcp_spanner_database.py index e9d852ed249ade..19306cdd6bb902 100644 --- a/lib/ansible/modules/cloud/google/gcp_spanner_database.py +++ b/lib/ansible/modules/cloud/google/gcp_spanner_database.py @@ -63,9 +63,10 @@ description: - The instance to create the database on. - 'This field represents a link to a Instance resource in GCP. It can be specified - in two ways. First, you can place in the name of the resource here as a string - Alternatively, you can add `register: name-of-resource` to a gcp_spanner_instance - task and then set this instance field to "{{ name-of-resource }}"' + in two ways. First, you can place a dictionary with key ''name'' and value of + your resource''s name Alternatively, you can add `register: name-of-resource` + to a gcp_spanner_instance task and then set this instance field to "{{ name-of-resource + }}"' required: true extends_documentation_fragment: gcp notes: @@ -117,7 +118,7 @@ description: - The instance to create the database on. returned: success - type: str + type: dict ''' ################################################################################ @@ -140,7 +141,7 @@ def main(): state=dict(default='present', choices=['present', 'absent'], type='str'), name=dict(required=True, type='str'), extra_statements=dict(type='list', elements='str'), - instance=dict(required=True), + instance=dict(required=True, type='dict'), ) ) diff --git a/lib/ansible/modules/cloud/google/gcp_spanner_database_facts.py b/lib/ansible/modules/cloud/google/gcp_spanner_database_facts.py index 23d4f296bd8fec..e5d02ce5acc71e 100644 --- a/lib/ansible/modules/cloud/google/gcp_spanner_database_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_spanner_database_facts.py @@ -44,9 +44,10 @@ description: - The instance to create the database on. - 'This field represents a link to a Instance resource in GCP. It can be specified - in two ways. First, you can place in the name of the resource here as a string - Alternatively, you can add `register: name-of-resource` to a gcp_spanner_instance - task and then set this instance field to "{{ name-of-resource }}"' + in two ways. First, you can place a dictionary with key ''name'' and value of + your resource''s name Alternatively, you can add `register: name-of-resource` + to a gcp_spanner_instance task and then set this instance field to "{{ name-of-resource + }}"' required: true extends_documentation_fragment: gcp ''' @@ -85,7 +86,7 @@ description: - The instance to create the database on. returned: success - type: str + type: dict ''' ################################################################################ @@ -100,7 +101,7 @@ def main(): - module = GcpModule(argument_spec=dict(instance=dict(required=True))) + module = GcpModule(argument_spec=dict(instance=dict(required=True, type='dict'))) if not module.params['scopes']: module.params['scopes'] = ['https://www.googleapis.com/auth/spanner.admin'] diff --git a/lib/ansible/modules/cloud/google/gcp_sql_database.py b/lib/ansible/modules/cloud/google/gcp_sql_database.py index 94a65adf448bc2..c13402a1ed8500 100644 --- a/lib/ansible/modules/cloud/google/gcp_sql_database.py +++ b/lib/ansible/modules/cloud/google/gcp_sql_database.py @@ -64,9 +64,10 @@ description: - The name of the Cloud SQL instance. This does not include the project ID. - 'This field represents a link to a Instance resource in GCP. It can be specified - in two ways. First, you can place in the name of the resource here as a string - Alternatively, you can add `register: name-of-resource` to a gcp_sql_instance - task and then set this instance field to "{{ name-of-resource }}"' + in two ways. First, you can place a dictionary with key ''name'' and value of + your resource''s name Alternatively, you can add `register: name-of-resource` + to a gcp_sql_instance task and then set this instance field to "{{ name-of-resource + }}"' required: true extends_documentation_fragment: gcp ''' @@ -120,7 +121,7 @@ description: - The name of the Cloud SQL instance. This does not include the project ID. returned: success - type: str + type: dict ''' ################################################################################ @@ -145,7 +146,7 @@ def main(): charset=dict(type='str'), collation=dict(type='str'), name=dict(type='str'), - instance=dict(required=True), + instance=dict(required=True, type='dict'), ) ) diff --git a/lib/ansible/modules/cloud/google/gcp_sql_database_facts.py b/lib/ansible/modules/cloud/google/gcp_sql_database_facts.py index df677e04694292..215fef21881ad6 100644 --- a/lib/ansible/modules/cloud/google/gcp_sql_database_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_sql_database_facts.py @@ -44,9 +44,10 @@ description: - The name of the Cloud SQL instance. This does not include the project ID. - 'This field represents a link to a Instance resource in GCP. It can be specified - in two ways. First, you can place in the name of the resource here as a string - Alternatively, you can add `register: name-of-resource` to a gcp_sql_instance - task and then set this instance field to "{{ name-of-resource }}"' + in two ways. First, you can place a dictionary with key ''name'' and value of + your resource''s name Alternatively, you can add `register: name-of-resource` + to a gcp_sql_instance task and then set this instance field to "{{ name-of-resource + }}"' required: true extends_documentation_fragment: gcp ''' @@ -87,7 +88,7 @@ description: - The name of the Cloud SQL instance. This does not include the project ID. returned: success - type: str + type: dict ''' ################################################################################ @@ -102,7 +103,7 @@ def main(): - module = GcpModule(argument_spec=dict(instance=dict(required=True))) + module = GcpModule(argument_spec=dict(instance=dict(required=True, type='dict'))) if not module.params['scopes']: module.params['scopes'] = ['https://www.googleapis.com/auth/sqlservice.admin'] diff --git a/lib/ansible/modules/cloud/google/gcp_sql_user.py b/lib/ansible/modules/cloud/google/gcp_sql_user.py index 9699a4ea8c1e12..6428e7f3416e1c 100644 --- a/lib/ansible/modules/cloud/google/gcp_sql_user.py +++ b/lib/ansible/modules/cloud/google/gcp_sql_user.py @@ -61,9 +61,10 @@ description: - The name of the Cloud SQL instance. This does not include the project ID. - 'This field represents a link to a Instance resource in GCP. It can be specified - in two ways. First, you can place in the name of the resource here as a string - Alternatively, you can add `register: name-of-resource` to a gcp_sql_instance - task and then set this instance field to "{{ name-of-resource }}"' + in two ways. First, you can place a dictionary with key ''name'' and value of + your resource''s name Alternatively, you can add `register: name-of-resource` + to a gcp_sql_instance task and then set this instance field to "{{ name-of-resource + }}"' required: true password: description: @@ -118,7 +119,7 @@ description: - The name of the Cloud SQL instance. This does not include the project ID. returned: success - type: str + type: dict password: description: - The password for the user. @@ -147,7 +148,7 @@ def main(): state=dict(default='present', choices=['present', 'absent'], type='str'), host=dict(required=True, type='str'), name=dict(required=True, type='str'), - instance=dict(required=True), + instance=dict(required=True, type='dict'), password=dict(type='str'), ) ) diff --git a/lib/ansible/modules/cloud/google/gcp_sql_user_facts.py b/lib/ansible/modules/cloud/google/gcp_sql_user_facts.py index 9511a872f10396..3cfe6326594200 100644 --- a/lib/ansible/modules/cloud/google/gcp_sql_user_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_sql_user_facts.py @@ -44,9 +44,10 @@ description: - The name of the Cloud SQL instance. This does not include the project ID. - 'This field represents a link to a Instance resource in GCP. It can be specified - in two ways. First, you can place in the name of the resource here as a string - Alternatively, you can add `register: name-of-resource` to a gcp_sql_instance - task and then set this instance field to "{{ name-of-resource }}"' + in two ways. First, you can place a dictionary with key ''name'' and value of + your resource''s name Alternatively, you can add `register: name-of-resource` + to a gcp_sql_instance task and then set this instance field to "{{ name-of-resource + }}"' required: true extends_documentation_fragment: gcp ''' @@ -83,7 +84,7 @@ description: - The name of the Cloud SQL instance. This does not include the project ID. returned: success - type: str + type: dict password: description: - The password for the user. @@ -103,7 +104,7 @@ def main(): - module = GcpModule(argument_spec=dict(instance=dict(required=True))) + module = GcpModule(argument_spec=dict(instance=dict(required=True, type='dict'))) if not module.params['scopes']: module.params['scopes'] = ['https://www.googleapis.com/auth/sqlservice.admin'] diff --git a/lib/ansible/modules/cloud/google/gcp_storage_bucket.py b/lib/ansible/modules/cloud/google/gcp_storage_bucket.py index 73b13f7363cc9d..e33cbed23028a2 100644 --- a/lib/ansible/modules/cloud/google/gcp_storage_bucket.py +++ b/lib/ansible/modules/cloud/google/gcp_storage_bucket.py @@ -61,9 +61,10 @@ description: - The name of the bucket. - 'This field represents a link to a Bucket resource in GCP. It can be specified - in two ways. First, you can place in the name of the resource here as a - string Alternatively, you can add `register: name-of-resource` to a gcp_storage_bucket - task and then set this bucket field to "{{ name-of-resource }}"' + in two ways. First, you can place a dictionary with key ''name'' and value + of your resource''s name Alternatively, you can add `register: name-of-resource` + to a gcp_storage_bucket task and then set this bucket field to "{{ name-of-resource + }}"' required: true entity: description: @@ -140,9 +141,10 @@ description: - The name of the bucket. - 'This field represents a link to a Bucket resource in GCP. It can be specified - in two ways. First, you can place in the name of the resource here as a - string Alternatively, you can add `register: name-of-resource` to a gcp_storage_bucket - task and then set this bucket field to "{{ name-of-resource }}"' + in two ways. First, you can place a dictionary with key ''name'' and value + of your resource''s name Alternatively, you can add `register: name-of-resource` + to a gcp_storage_bucket task and then set this bucket field to "{{ name-of-resource + }}"' required: true entity: description: @@ -359,7 +361,7 @@ description: - The name of the bucket. returned: success - type: str + type: dict domain: description: - The domain associated with the entity. @@ -453,7 +455,7 @@ description: - The name of the bucket. returned: success - type: str + type: dict domain: description: - The domain associated with the entity. @@ -740,7 +742,7 @@ def main(): type='list', elements='dict', options=dict( - bucket=dict(required=True), + bucket=dict(required=True, type='dict'), entity=dict(required=True, type='str'), entity_id=dict(type='str'), project_team=dict( @@ -763,7 +765,7 @@ def main(): type='list', elements='dict', options=dict( - bucket=dict(required=True), + bucket=dict(required=True, type='dict'), entity=dict(required=True, type='str'), object=dict(type='str'), role=dict(required=True, type='str', choices=['OWNER', 'READER']), diff --git a/lib/ansible/modules/cloud/google/gcp_storage_bucket_access_control.py b/lib/ansible/modules/cloud/google/gcp_storage_bucket_access_control.py index 8e25f11418a49e..49c9dc76e79c8f 100644 --- a/lib/ansible/modules/cloud/google/gcp_storage_bucket_access_control.py +++ b/lib/ansible/modules/cloud/google/gcp_storage_bucket_access_control.py @@ -60,9 +60,10 @@ description: - The name of the bucket. - 'This field represents a link to a Bucket resource in GCP. It can be specified - in two ways. First, you can place in the name of the resource here as a string - Alternatively, you can add `register: name-of-resource` to a gcp_storage_bucket - task and then set this bucket field to "{{ name-of-resource }}"' + in two ways. First, you can place a dictionary with key ''name'' and value of + your resource''s name Alternatively, you can add `register: name-of-resource` + to a gcp_storage_bucket task and then set this bucket field to "{{ name-of-resource + }}"' required: true entity: description: @@ -131,7 +132,7 @@ description: - The name of the bucket. returned: success - type: str + type: dict domain: description: - The domain associated with the entity. @@ -203,7 +204,7 @@ def main(): module = GcpModule( argument_spec=dict( state=dict(default='present', choices=['present', 'absent'], type='str'), - bucket=dict(required=True), + bucket=dict(required=True, type='dict'), entity=dict(required=True, type='str'), entity_id=dict(type='str'), project_team=dict(type='dict', options=dict(project_number=dict(type='str'), team=dict(type='str', choices=['editors', 'owners', 'viewers']))), From aaf3bca4d1105be79502e3df40a84fa59e76e5fb Mon Sep 17 00:00:00 2001 From: The Magician Date: Thu, 4 Apr 2019 11:21:28 -0700 Subject: [PATCH 139/144] Update global address docs now that they are settable + ip ranges sometimes (#228) /cc @rileykarson --- .../modules/cloud/google/gcp_compute_global_address.py | 10 ++++------ .../cloud/google/gcp_compute_global_address_facts.py | 5 ++--- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_global_address.py b/lib/ansible/modules/cloud/google/gcp_compute_global_address.py index 8692981bd59046..00bc1af38511d1 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_global_address.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_global_address.py @@ -56,7 +56,6 @@ description: description: - An optional description of this resource. - - Provide this property when you create the resource. required: false name: description: @@ -69,8 +68,8 @@ required: true ip_version: description: - - The IP Version that will be used by this address. Valid options are IPV4 or - IPV6. The default value is IPV4. + - The IP Version that will be used by this address. Valid options are `IPV4` or + `IPV6`. The default value is `IPV4`. required: false choices: - IPV4 @@ -116,7 +115,6 @@ description: description: - An optional description of this resource. - - Provide this property when you create the resource. returned: success type: str id: @@ -136,8 +134,8 @@ type: str ipVersion: description: - - The IP Version that will be used by this address. Valid options are IPV4 or IPV6. - The default value is IPV4. + - The IP Version that will be used by this address. Valid options are `IPV4` or + `IPV6`. The default value is `IPV4`. returned: success type: str region: diff --git a/lib/ansible/modules/cloud/google/gcp_compute_global_address_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_global_address_facts.py index 11682fee960761..9344e8b7f7c7f3 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_global_address_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_global_address_facts.py @@ -78,7 +78,6 @@ description: description: - An optional description of this resource. - - Provide this property when you create the resource. returned: success type: str id: @@ -99,8 +98,8 @@ type: str ipVersion: description: - - The IP Version that will be used by this address. Valid options are IPV4 or - IPV6. The default value is IPV4. + - The IP Version that will be used by this address. Valid options are `IPV4` + or `IPV6`. The default value is `IPV4`. returned: success type: str region: From 40dd93cad5795f2dee6e8fe173020b153b87e761 Mon Sep 17 00:00:00 2001 From: The Magician Date: Thu, 4 Apr 2019 13:50:34 -0700 Subject: [PATCH 140/144] Cleanup BackendService after generation, add omitted fields. (#227) /cc @rileykarson --- .../modules/cloud/google/gcp_compute_backend_service.py | 7 ++++--- .../cloud/google/gcp_compute_backend_service_facts.py | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_backend_service.py b/lib/ansible/modules/cloud/google/gcp_compute_backend_service.py index efb31664a56814..869b4aedff08ea 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_backend_service.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_backend_service.py @@ -249,8 +249,9 @@ description: - Indicates whether the backend service will be used with internal or external load balancing. A backend service created for one type of load balancing cannot - be used with the other. + be used with the other. One of `INTERNAL` or `EXTERNAL`. Defaults to `EXTERNAL`. required: false + default: EXTERNAL version_added: 2.7 choices: - INTERNAL @@ -578,7 +579,7 @@ description: - Indicates whether the backend service will be used with internal or external load balancing. A backend service created for one type of load balancing cannot be - used with the other. + used with the other. One of `INTERNAL` or `EXTERNAL`. Defaults to `EXTERNAL`. returned: success type: str name: @@ -687,7 +688,7 @@ def main(): type='dict', options=dict(enabled=dict(type='bool'), oauth2_client_id=dict(required=True, type='str'), oauth2_client_secret=dict(required=True, type='str')), ), - load_balancing_scheme=dict(type='str', choices=['INTERNAL', 'EXTERNAL']), + load_balancing_scheme=dict(default='EXTERNAL', type='str', choices=['INTERNAL', 'EXTERNAL']), name=dict(required=True, type='str'), port_name=dict(type='str'), protocol=dict(type='str', choices=['HTTP', 'HTTPS', 'TCP', 'SSL']), diff --git a/lib/ansible/modules/cloud/google/gcp_compute_backend_service_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_backend_service_facts.py index aa8713d91f8de9..3851ed00a09269 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_backend_service_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_backend_service_facts.py @@ -295,7 +295,7 @@ description: - Indicates whether the backend service will be used with internal or external load balancing. A backend service created for one type of load balancing cannot - be used with the other. + be used with the other. One of `INTERNAL` or `EXTERNAL`. Defaults to `EXTERNAL`. returned: success type: str name: From 6e67c9affc7f3ebeeea65a74860f5f4ed0db3d76 Mon Sep 17 00:00:00 2001 From: The Magician Date: Mon, 8 Apr 2019 13:35:41 -0700 Subject: [PATCH 141/144] Make cloudbuild trigger disabled field a bool (#230) Signed-off-by: Modular Magician --- lib/ansible/modules/cloud/google/gcp_cloudbuild_trigger.py | 5 +++-- .../modules/cloud/google/gcp_cloudbuild_trigger_facts.py | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/ansible/modules/cloud/google/gcp_cloudbuild_trigger.py b/lib/ansible/modules/cloud/google/gcp_cloudbuild_trigger.py index 13759a8401427a..4e472b0fb3cce8 100644 --- a/lib/ansible/modules/cloud/google/gcp_cloudbuild_trigger.py +++ b/lib/ansible/modules/cloud/google/gcp_cloudbuild_trigger.py @@ -60,6 +60,7 @@ - Whether the trigger is disabled or not. If true, the trigger will never result in a build. required: false + type: bool substitutions: description: - Substitutions data for Build resource. @@ -300,7 +301,7 @@ - Whether the trigger is disabled or not. If true, the trigger will never result in a build. returned: success - type: str + type: bool createTime: description: - Time when the trigger was created. @@ -541,7 +542,7 @@ def main(): state=dict(default='present', choices=['present', 'absent'], type='str'), id=dict(type='str'), description=dict(type='str'), - disabled=dict(type='str'), + disabled=dict(type='bool'), substitutions=dict(type='dict'), filename=dict(type='str'), ignored_files=dict(type='list', elements='str'), diff --git a/lib/ansible/modules/cloud/google/gcp_cloudbuild_trigger_facts.py b/lib/ansible/modules/cloud/google/gcp_cloudbuild_trigger_facts.py index 05faee00714a3e..42c4dc6417ec90 100644 --- a/lib/ansible/modules/cloud/google/gcp_cloudbuild_trigger_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_cloudbuild_trigger_facts.py @@ -73,7 +73,7 @@ - Whether the trigger is disabled or not. If true, the trigger will never result in a build. returned: success - type: str + type: bool createTime: description: - Time when the trigger was created. From 4b488dc5b7d47751a3967838365e2ad7c152f96e Mon Sep 17 00:00:00 2001 From: The Magician Date: Mon, 15 Apr 2019 12:41:18 -0700 Subject: [PATCH 142/144] Adding proper vars to tests (#225) Signed-off-by: Modular Magician --- .../modules/cloud/google/gcp_iam_service_account.py | 2 +- .../targets/gcp_bigquery_dataset/defaults/main.yml | 3 +-- .../targets/gcp_bigquery_table/defaults/main.yml | 3 +-- .../targets/gcp_compute_address/defaults/main.yml | 3 +-- .../gcp_compute_backend_bucket/defaults/main.yml | 3 +-- .../gcp_compute_backend_service/defaults/main.yml | 3 +-- .../targets/gcp_compute_disk/defaults/main.yml | 3 +-- .../targets/gcp_compute_firewall/defaults/main.yml | 3 +-- .../gcp_compute_forwarding_rule/defaults/main.yml | 3 +-- .../gcp_compute_global_address/defaults/main.yml | 3 +-- .../defaults/main.yml | 3 +-- .../targets/gcp_compute_health_check/defaults/main.yml | 3 +-- .../gcp_compute_http_health_check/defaults/main.yml | 3 +-- .../gcp_compute_https_health_check/defaults/main.yml | 3 +-- .../targets/gcp_compute_image/defaults/main.yml | 3 +-- .../targets/gcp_compute_instance/defaults/main.yml | 3 +-- .../gcp_compute_instance_group/defaults/main.yml | 3 +-- .../defaults/main.yml | 3 +-- .../gcp_compute_instance_template/defaults/main.yml | 3 +-- .../targets/gcp_compute_network/defaults/main.yml | 3 +-- .../targets/gcp_compute_region_disk/defaults/main.yml | 3 +-- .../targets/gcp_compute_route/defaults/main.yml | 3 +-- .../targets/gcp_compute_router/defaults/main.yml | 3 +-- .../gcp_compute_ssl_certificate/defaults/main.yml | 3 +-- .../targets/gcp_compute_ssl_policy/defaults/main.yml | 3 +-- .../targets/gcp_compute_subnetwork/defaults/main.yml | 3 +-- .../gcp_compute_target_http_proxy/defaults/main.yml | 3 +-- .../gcp_compute_target_https_proxy/defaults/main.yml | 3 +-- .../targets/gcp_compute_target_pool/defaults/main.yml | 3 +-- .../gcp_compute_target_ssl_proxy/defaults/main.yml | 3 +-- .../gcp_compute_target_tcp_proxy/defaults/main.yml | 3 +-- .../gcp_compute_target_vpn_gateway/defaults/main.yml | 3 +-- .../targets/gcp_compute_url_map/defaults/main.yml | 3 +-- .../targets/gcp_compute_vpn_tunnel/defaults/main.yml | 3 +-- .../targets/gcp_container_cluster/defaults/main.yml | 3 +-- .../targets/gcp_container_node_pool/defaults/main.yml | 3 +-- .../targets/gcp_dns_managed_zone/defaults/main.yml | 3 +-- .../gcp_dns_resource_record_set/defaults/main.yml | 3 +-- .../integration/targets/gcp_iam_role/defaults/main.yml | 3 +-- .../targets/gcp_iam_service_account/defaults/main.yml | 4 ++-- .../targets/gcp_iam_service_account/tasks/main.yml | 10 +++++----- .../targets/gcp_pubsub_subscription/defaults/main.yml | 3 +-- .../targets/gcp_pubsub_topic/defaults/main.yml | 3 +-- .../targets/gcp_redis_instance/defaults/main.yml | 3 +-- .../gcp_resourcemanager_project/defaults/main.yml | 3 +-- .../gcp_sourcerepo_repository/defaults/main.yml | 3 +-- .../targets/gcp_spanner_database/defaults/main.yml | 3 +-- .../targets/gcp_spanner_instance/defaults/main.yml | 3 +-- .../targets/gcp_sql_database/defaults/main.yml | 3 +-- .../targets/gcp_sql_instance/defaults/main.yml | 3 +-- .../integration/targets/gcp_sql_user/defaults/main.yml | 3 +-- .../targets/gcp_storage_bucket/defaults/main.yml | 3 +-- .../defaults/main.yml | 3 +-- 53 files changed, 58 insertions(+), 108 deletions(-) diff --git a/lib/ansible/modules/cloud/google/gcp_iam_service_account.py b/lib/ansible/modules/cloud/google/gcp_iam_service_account.py index 041171994b8aa3..47a0587f2f5c20 100644 --- a/lib/ansible/modules/cloud/google/gcp_iam_service_account.py +++ b/lib/ansible/modules/cloud/google/gcp_iam_service_account.py @@ -61,7 +61,7 @@ EXAMPLES = ''' - name: create a service account gcp_iam_service_account: - name: '"{{resource_name}}@{{gcp_project}}.google.com.iam.gserviceaccount.com"' + name: "{{ sa_name }}" display_name: My Ansible test key project: test_project auth_kind: serviceaccount diff --git a/test/integration/targets/gcp_bigquery_dataset/defaults/main.yml b/test/integration/targets/gcp_bigquery_dataset/defaults/main.yml index aa87a2a8e0e0e0..ba66644fc1cb3d 100644 --- a/test/integration/targets/gcp_bigquery_dataset/defaults/main.yml +++ b/test/integration/targets/gcp_bigquery_dataset/defaults/main.yml @@ -1,3 +1,2 @@ --- -# defaults file -resource_name: '{{resource_prefix}}' +resource_name: "{{ resource_prefix }}" diff --git a/test/integration/targets/gcp_bigquery_table/defaults/main.yml b/test/integration/targets/gcp_bigquery_table/defaults/main.yml index aa87a2a8e0e0e0..ba66644fc1cb3d 100644 --- a/test/integration/targets/gcp_bigquery_table/defaults/main.yml +++ b/test/integration/targets/gcp_bigquery_table/defaults/main.yml @@ -1,3 +1,2 @@ --- -# defaults file -resource_name: '{{resource_prefix}}' +resource_name: "{{ resource_prefix }}" diff --git a/test/integration/targets/gcp_compute_address/defaults/main.yml b/test/integration/targets/gcp_compute_address/defaults/main.yml index aa87a2a8e0e0e0..ba66644fc1cb3d 100644 --- a/test/integration/targets/gcp_compute_address/defaults/main.yml +++ b/test/integration/targets/gcp_compute_address/defaults/main.yml @@ -1,3 +1,2 @@ --- -# defaults file -resource_name: '{{resource_prefix}}' +resource_name: "{{ resource_prefix }}" diff --git a/test/integration/targets/gcp_compute_backend_bucket/defaults/main.yml b/test/integration/targets/gcp_compute_backend_bucket/defaults/main.yml index aa87a2a8e0e0e0..ba66644fc1cb3d 100644 --- a/test/integration/targets/gcp_compute_backend_bucket/defaults/main.yml +++ b/test/integration/targets/gcp_compute_backend_bucket/defaults/main.yml @@ -1,3 +1,2 @@ --- -# defaults file -resource_name: '{{resource_prefix}}' +resource_name: "{{ resource_prefix }}" diff --git a/test/integration/targets/gcp_compute_backend_service/defaults/main.yml b/test/integration/targets/gcp_compute_backend_service/defaults/main.yml index aa87a2a8e0e0e0..ba66644fc1cb3d 100644 --- a/test/integration/targets/gcp_compute_backend_service/defaults/main.yml +++ b/test/integration/targets/gcp_compute_backend_service/defaults/main.yml @@ -1,3 +1,2 @@ --- -# defaults file -resource_name: '{{resource_prefix}}' +resource_name: "{{ resource_prefix }}" diff --git a/test/integration/targets/gcp_compute_disk/defaults/main.yml b/test/integration/targets/gcp_compute_disk/defaults/main.yml index aa87a2a8e0e0e0..ba66644fc1cb3d 100644 --- a/test/integration/targets/gcp_compute_disk/defaults/main.yml +++ b/test/integration/targets/gcp_compute_disk/defaults/main.yml @@ -1,3 +1,2 @@ --- -# defaults file -resource_name: '{{resource_prefix}}' +resource_name: "{{ resource_prefix }}" diff --git a/test/integration/targets/gcp_compute_firewall/defaults/main.yml b/test/integration/targets/gcp_compute_firewall/defaults/main.yml index aa87a2a8e0e0e0..ba66644fc1cb3d 100644 --- a/test/integration/targets/gcp_compute_firewall/defaults/main.yml +++ b/test/integration/targets/gcp_compute_firewall/defaults/main.yml @@ -1,3 +1,2 @@ --- -# defaults file -resource_name: '{{resource_prefix}}' +resource_name: "{{ resource_prefix }}" diff --git a/test/integration/targets/gcp_compute_forwarding_rule/defaults/main.yml b/test/integration/targets/gcp_compute_forwarding_rule/defaults/main.yml index aa87a2a8e0e0e0..ba66644fc1cb3d 100644 --- a/test/integration/targets/gcp_compute_forwarding_rule/defaults/main.yml +++ b/test/integration/targets/gcp_compute_forwarding_rule/defaults/main.yml @@ -1,3 +1,2 @@ --- -# defaults file -resource_name: '{{resource_prefix}}' +resource_name: "{{ resource_prefix }}" diff --git a/test/integration/targets/gcp_compute_global_address/defaults/main.yml b/test/integration/targets/gcp_compute_global_address/defaults/main.yml index aa87a2a8e0e0e0..ba66644fc1cb3d 100644 --- a/test/integration/targets/gcp_compute_global_address/defaults/main.yml +++ b/test/integration/targets/gcp_compute_global_address/defaults/main.yml @@ -1,3 +1,2 @@ --- -# defaults file -resource_name: '{{resource_prefix}}' +resource_name: "{{ resource_prefix }}" diff --git a/test/integration/targets/gcp_compute_global_forwarding_rule/defaults/main.yml b/test/integration/targets/gcp_compute_global_forwarding_rule/defaults/main.yml index aa87a2a8e0e0e0..ba66644fc1cb3d 100644 --- a/test/integration/targets/gcp_compute_global_forwarding_rule/defaults/main.yml +++ b/test/integration/targets/gcp_compute_global_forwarding_rule/defaults/main.yml @@ -1,3 +1,2 @@ --- -# defaults file -resource_name: '{{resource_prefix}}' +resource_name: "{{ resource_prefix }}" diff --git a/test/integration/targets/gcp_compute_health_check/defaults/main.yml b/test/integration/targets/gcp_compute_health_check/defaults/main.yml index aa87a2a8e0e0e0..ba66644fc1cb3d 100644 --- a/test/integration/targets/gcp_compute_health_check/defaults/main.yml +++ b/test/integration/targets/gcp_compute_health_check/defaults/main.yml @@ -1,3 +1,2 @@ --- -# defaults file -resource_name: '{{resource_prefix}}' +resource_name: "{{ resource_prefix }}" diff --git a/test/integration/targets/gcp_compute_http_health_check/defaults/main.yml b/test/integration/targets/gcp_compute_http_health_check/defaults/main.yml index aa87a2a8e0e0e0..ba66644fc1cb3d 100644 --- a/test/integration/targets/gcp_compute_http_health_check/defaults/main.yml +++ b/test/integration/targets/gcp_compute_http_health_check/defaults/main.yml @@ -1,3 +1,2 @@ --- -# defaults file -resource_name: '{{resource_prefix}}' +resource_name: "{{ resource_prefix }}" diff --git a/test/integration/targets/gcp_compute_https_health_check/defaults/main.yml b/test/integration/targets/gcp_compute_https_health_check/defaults/main.yml index aa87a2a8e0e0e0..ba66644fc1cb3d 100644 --- a/test/integration/targets/gcp_compute_https_health_check/defaults/main.yml +++ b/test/integration/targets/gcp_compute_https_health_check/defaults/main.yml @@ -1,3 +1,2 @@ --- -# defaults file -resource_name: '{{resource_prefix}}' +resource_name: "{{ resource_prefix }}" diff --git a/test/integration/targets/gcp_compute_image/defaults/main.yml b/test/integration/targets/gcp_compute_image/defaults/main.yml index aa87a2a8e0e0e0..ba66644fc1cb3d 100644 --- a/test/integration/targets/gcp_compute_image/defaults/main.yml +++ b/test/integration/targets/gcp_compute_image/defaults/main.yml @@ -1,3 +1,2 @@ --- -# defaults file -resource_name: '{{resource_prefix}}' +resource_name: "{{ resource_prefix }}" diff --git a/test/integration/targets/gcp_compute_instance/defaults/main.yml b/test/integration/targets/gcp_compute_instance/defaults/main.yml index aa87a2a8e0e0e0..ba66644fc1cb3d 100644 --- a/test/integration/targets/gcp_compute_instance/defaults/main.yml +++ b/test/integration/targets/gcp_compute_instance/defaults/main.yml @@ -1,3 +1,2 @@ --- -# defaults file -resource_name: '{{resource_prefix}}' +resource_name: "{{ resource_prefix }}" diff --git a/test/integration/targets/gcp_compute_instance_group/defaults/main.yml b/test/integration/targets/gcp_compute_instance_group/defaults/main.yml index aa87a2a8e0e0e0..ba66644fc1cb3d 100644 --- a/test/integration/targets/gcp_compute_instance_group/defaults/main.yml +++ b/test/integration/targets/gcp_compute_instance_group/defaults/main.yml @@ -1,3 +1,2 @@ --- -# defaults file -resource_name: '{{resource_prefix}}' +resource_name: "{{ resource_prefix }}" diff --git a/test/integration/targets/gcp_compute_instance_group_manager/defaults/main.yml b/test/integration/targets/gcp_compute_instance_group_manager/defaults/main.yml index aa87a2a8e0e0e0..ba66644fc1cb3d 100644 --- a/test/integration/targets/gcp_compute_instance_group_manager/defaults/main.yml +++ b/test/integration/targets/gcp_compute_instance_group_manager/defaults/main.yml @@ -1,3 +1,2 @@ --- -# defaults file -resource_name: '{{resource_prefix}}' +resource_name: "{{ resource_prefix }}" diff --git a/test/integration/targets/gcp_compute_instance_template/defaults/main.yml b/test/integration/targets/gcp_compute_instance_template/defaults/main.yml index aa87a2a8e0e0e0..ba66644fc1cb3d 100644 --- a/test/integration/targets/gcp_compute_instance_template/defaults/main.yml +++ b/test/integration/targets/gcp_compute_instance_template/defaults/main.yml @@ -1,3 +1,2 @@ --- -# defaults file -resource_name: '{{resource_prefix}}' +resource_name: "{{ resource_prefix }}" diff --git a/test/integration/targets/gcp_compute_network/defaults/main.yml b/test/integration/targets/gcp_compute_network/defaults/main.yml index aa87a2a8e0e0e0..ba66644fc1cb3d 100644 --- a/test/integration/targets/gcp_compute_network/defaults/main.yml +++ b/test/integration/targets/gcp_compute_network/defaults/main.yml @@ -1,3 +1,2 @@ --- -# defaults file -resource_name: '{{resource_prefix}}' +resource_name: "{{ resource_prefix }}" diff --git a/test/integration/targets/gcp_compute_region_disk/defaults/main.yml b/test/integration/targets/gcp_compute_region_disk/defaults/main.yml index aa87a2a8e0e0e0..ba66644fc1cb3d 100644 --- a/test/integration/targets/gcp_compute_region_disk/defaults/main.yml +++ b/test/integration/targets/gcp_compute_region_disk/defaults/main.yml @@ -1,3 +1,2 @@ --- -# defaults file -resource_name: '{{resource_prefix}}' +resource_name: "{{ resource_prefix }}" diff --git a/test/integration/targets/gcp_compute_route/defaults/main.yml b/test/integration/targets/gcp_compute_route/defaults/main.yml index aa87a2a8e0e0e0..ba66644fc1cb3d 100644 --- a/test/integration/targets/gcp_compute_route/defaults/main.yml +++ b/test/integration/targets/gcp_compute_route/defaults/main.yml @@ -1,3 +1,2 @@ --- -# defaults file -resource_name: '{{resource_prefix}}' +resource_name: "{{ resource_prefix }}" diff --git a/test/integration/targets/gcp_compute_router/defaults/main.yml b/test/integration/targets/gcp_compute_router/defaults/main.yml index aa87a2a8e0e0e0..ba66644fc1cb3d 100644 --- a/test/integration/targets/gcp_compute_router/defaults/main.yml +++ b/test/integration/targets/gcp_compute_router/defaults/main.yml @@ -1,3 +1,2 @@ --- -# defaults file -resource_name: '{{resource_prefix}}' +resource_name: "{{ resource_prefix }}" diff --git a/test/integration/targets/gcp_compute_ssl_certificate/defaults/main.yml b/test/integration/targets/gcp_compute_ssl_certificate/defaults/main.yml index aa87a2a8e0e0e0..ba66644fc1cb3d 100644 --- a/test/integration/targets/gcp_compute_ssl_certificate/defaults/main.yml +++ b/test/integration/targets/gcp_compute_ssl_certificate/defaults/main.yml @@ -1,3 +1,2 @@ --- -# defaults file -resource_name: '{{resource_prefix}}' +resource_name: "{{ resource_prefix }}" diff --git a/test/integration/targets/gcp_compute_ssl_policy/defaults/main.yml b/test/integration/targets/gcp_compute_ssl_policy/defaults/main.yml index aa87a2a8e0e0e0..ba66644fc1cb3d 100644 --- a/test/integration/targets/gcp_compute_ssl_policy/defaults/main.yml +++ b/test/integration/targets/gcp_compute_ssl_policy/defaults/main.yml @@ -1,3 +1,2 @@ --- -# defaults file -resource_name: '{{resource_prefix}}' +resource_name: "{{ resource_prefix }}" diff --git a/test/integration/targets/gcp_compute_subnetwork/defaults/main.yml b/test/integration/targets/gcp_compute_subnetwork/defaults/main.yml index aa87a2a8e0e0e0..ba66644fc1cb3d 100644 --- a/test/integration/targets/gcp_compute_subnetwork/defaults/main.yml +++ b/test/integration/targets/gcp_compute_subnetwork/defaults/main.yml @@ -1,3 +1,2 @@ --- -# defaults file -resource_name: '{{resource_prefix}}' +resource_name: "{{ resource_prefix }}" diff --git a/test/integration/targets/gcp_compute_target_http_proxy/defaults/main.yml b/test/integration/targets/gcp_compute_target_http_proxy/defaults/main.yml index aa87a2a8e0e0e0..ba66644fc1cb3d 100644 --- a/test/integration/targets/gcp_compute_target_http_proxy/defaults/main.yml +++ b/test/integration/targets/gcp_compute_target_http_proxy/defaults/main.yml @@ -1,3 +1,2 @@ --- -# defaults file -resource_name: '{{resource_prefix}}' +resource_name: "{{ resource_prefix }}" diff --git a/test/integration/targets/gcp_compute_target_https_proxy/defaults/main.yml b/test/integration/targets/gcp_compute_target_https_proxy/defaults/main.yml index aa87a2a8e0e0e0..ba66644fc1cb3d 100644 --- a/test/integration/targets/gcp_compute_target_https_proxy/defaults/main.yml +++ b/test/integration/targets/gcp_compute_target_https_proxy/defaults/main.yml @@ -1,3 +1,2 @@ --- -# defaults file -resource_name: '{{resource_prefix}}' +resource_name: "{{ resource_prefix }}" diff --git a/test/integration/targets/gcp_compute_target_pool/defaults/main.yml b/test/integration/targets/gcp_compute_target_pool/defaults/main.yml index aa87a2a8e0e0e0..ba66644fc1cb3d 100644 --- a/test/integration/targets/gcp_compute_target_pool/defaults/main.yml +++ b/test/integration/targets/gcp_compute_target_pool/defaults/main.yml @@ -1,3 +1,2 @@ --- -# defaults file -resource_name: '{{resource_prefix}}' +resource_name: "{{ resource_prefix }}" diff --git a/test/integration/targets/gcp_compute_target_ssl_proxy/defaults/main.yml b/test/integration/targets/gcp_compute_target_ssl_proxy/defaults/main.yml index aa87a2a8e0e0e0..ba66644fc1cb3d 100644 --- a/test/integration/targets/gcp_compute_target_ssl_proxy/defaults/main.yml +++ b/test/integration/targets/gcp_compute_target_ssl_proxy/defaults/main.yml @@ -1,3 +1,2 @@ --- -# defaults file -resource_name: '{{resource_prefix}}' +resource_name: "{{ resource_prefix }}" diff --git a/test/integration/targets/gcp_compute_target_tcp_proxy/defaults/main.yml b/test/integration/targets/gcp_compute_target_tcp_proxy/defaults/main.yml index aa87a2a8e0e0e0..ba66644fc1cb3d 100644 --- a/test/integration/targets/gcp_compute_target_tcp_proxy/defaults/main.yml +++ b/test/integration/targets/gcp_compute_target_tcp_proxy/defaults/main.yml @@ -1,3 +1,2 @@ --- -# defaults file -resource_name: '{{resource_prefix}}' +resource_name: "{{ resource_prefix }}" diff --git a/test/integration/targets/gcp_compute_target_vpn_gateway/defaults/main.yml b/test/integration/targets/gcp_compute_target_vpn_gateway/defaults/main.yml index aa87a2a8e0e0e0..ba66644fc1cb3d 100644 --- a/test/integration/targets/gcp_compute_target_vpn_gateway/defaults/main.yml +++ b/test/integration/targets/gcp_compute_target_vpn_gateway/defaults/main.yml @@ -1,3 +1,2 @@ --- -# defaults file -resource_name: '{{resource_prefix}}' +resource_name: "{{ resource_prefix }}" diff --git a/test/integration/targets/gcp_compute_url_map/defaults/main.yml b/test/integration/targets/gcp_compute_url_map/defaults/main.yml index aa87a2a8e0e0e0..ba66644fc1cb3d 100644 --- a/test/integration/targets/gcp_compute_url_map/defaults/main.yml +++ b/test/integration/targets/gcp_compute_url_map/defaults/main.yml @@ -1,3 +1,2 @@ --- -# defaults file -resource_name: '{{resource_prefix}}' +resource_name: "{{ resource_prefix }}" diff --git a/test/integration/targets/gcp_compute_vpn_tunnel/defaults/main.yml b/test/integration/targets/gcp_compute_vpn_tunnel/defaults/main.yml index aa87a2a8e0e0e0..ba66644fc1cb3d 100644 --- a/test/integration/targets/gcp_compute_vpn_tunnel/defaults/main.yml +++ b/test/integration/targets/gcp_compute_vpn_tunnel/defaults/main.yml @@ -1,3 +1,2 @@ --- -# defaults file -resource_name: '{{resource_prefix}}' +resource_name: "{{ resource_prefix }}" diff --git a/test/integration/targets/gcp_container_cluster/defaults/main.yml b/test/integration/targets/gcp_container_cluster/defaults/main.yml index aa87a2a8e0e0e0..ba66644fc1cb3d 100644 --- a/test/integration/targets/gcp_container_cluster/defaults/main.yml +++ b/test/integration/targets/gcp_container_cluster/defaults/main.yml @@ -1,3 +1,2 @@ --- -# defaults file -resource_name: '{{resource_prefix}}' +resource_name: "{{ resource_prefix }}" diff --git a/test/integration/targets/gcp_container_node_pool/defaults/main.yml b/test/integration/targets/gcp_container_node_pool/defaults/main.yml index aa87a2a8e0e0e0..ba66644fc1cb3d 100644 --- a/test/integration/targets/gcp_container_node_pool/defaults/main.yml +++ b/test/integration/targets/gcp_container_node_pool/defaults/main.yml @@ -1,3 +1,2 @@ --- -# defaults file -resource_name: '{{resource_prefix}}' +resource_name: "{{ resource_prefix }}" diff --git a/test/integration/targets/gcp_dns_managed_zone/defaults/main.yml b/test/integration/targets/gcp_dns_managed_zone/defaults/main.yml index aa87a2a8e0e0e0..ba66644fc1cb3d 100644 --- a/test/integration/targets/gcp_dns_managed_zone/defaults/main.yml +++ b/test/integration/targets/gcp_dns_managed_zone/defaults/main.yml @@ -1,3 +1,2 @@ --- -# defaults file -resource_name: '{{resource_prefix}}' +resource_name: "{{ resource_prefix }}" diff --git a/test/integration/targets/gcp_dns_resource_record_set/defaults/main.yml b/test/integration/targets/gcp_dns_resource_record_set/defaults/main.yml index aa87a2a8e0e0e0..ba66644fc1cb3d 100644 --- a/test/integration/targets/gcp_dns_resource_record_set/defaults/main.yml +++ b/test/integration/targets/gcp_dns_resource_record_set/defaults/main.yml @@ -1,3 +1,2 @@ --- -# defaults file -resource_name: '{{resource_prefix}}' +resource_name: "{{ resource_prefix }}" diff --git a/test/integration/targets/gcp_iam_role/defaults/main.yml b/test/integration/targets/gcp_iam_role/defaults/main.yml index aa87a2a8e0e0e0..ba66644fc1cb3d 100644 --- a/test/integration/targets/gcp_iam_role/defaults/main.yml +++ b/test/integration/targets/gcp_iam_role/defaults/main.yml @@ -1,3 +1,2 @@ --- -# defaults file -resource_name: '{{resource_prefix}}' +resource_name: "{{ resource_prefix }}" diff --git a/test/integration/targets/gcp_iam_service_account/defaults/main.yml b/test/integration/targets/gcp_iam_service_account/defaults/main.yml index aa87a2a8e0e0e0..5595dfb48eccb4 100644 --- a/test/integration/targets/gcp_iam_service_account/defaults/main.yml +++ b/test/integration/targets/gcp_iam_service_account/defaults/main.yml @@ -1,3 +1,3 @@ --- -# defaults file -resource_name: '{{resource_prefix}}' +resource_name: "{{ resource_prefix }}" +sa_name: sa-{{ 100000 | random }}@graphite-playground.google.com.iam.gserviceaccount.com diff --git a/test/integration/targets/gcp_iam_service_account/tasks/main.yml b/test/integration/targets/gcp_iam_service_account/tasks/main.yml index 496b31b15ba133..f302e82e9766ea 100644 --- a/test/integration/targets/gcp_iam_service_account/tasks/main.yml +++ b/test/integration/targets/gcp_iam_service_account/tasks/main.yml @@ -15,7 +15,7 @@ # Pre-test setup - name: delete a service account gcp_iam_service_account: - name: '"{{resource_name}}@{{gcp_project}}.google.com.iam.gserviceaccount.com"' + name: "{{ sa_name }}" display_name: My Ansible test key project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" @@ -24,7 +24,7 @@ #---------------------------------------------------------- - name: create a service account gcp_iam_service_account: - name: '"{{resource_name}}@{{gcp_project}}.google.com.iam.gserviceaccount.com"' + name: "{{ sa_name }}" display_name: My Ansible test key project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" @@ -50,7 +50,7 @@ # ---------------------------------------------------------------------------- - name: create a service account that already exists gcp_iam_service_account: - name: '"{{resource_name}}@{{gcp_project}}.google.com.iam.gserviceaccount.com"' + name: "{{ sa_name }}" display_name: My Ansible test key project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" @@ -64,7 +64,7 @@ #---------------------------------------------------------- - name: delete a service account gcp_iam_service_account: - name: '"{{resource_name}}@{{gcp_project}}.google.com.iam.gserviceaccount.com"' + name: "{{ sa_name }}" display_name: My Ansible test key project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" @@ -90,7 +90,7 @@ # ---------------------------------------------------------------------------- - name: delete a service account that does not exist gcp_iam_service_account: - name: '"{{resource_name}}@{{gcp_project}}.google.com.iam.gserviceaccount.com"' + name: "{{ sa_name }}" display_name: My Ansible test key project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" diff --git a/test/integration/targets/gcp_pubsub_subscription/defaults/main.yml b/test/integration/targets/gcp_pubsub_subscription/defaults/main.yml index aa87a2a8e0e0e0..ba66644fc1cb3d 100644 --- a/test/integration/targets/gcp_pubsub_subscription/defaults/main.yml +++ b/test/integration/targets/gcp_pubsub_subscription/defaults/main.yml @@ -1,3 +1,2 @@ --- -# defaults file -resource_name: '{{resource_prefix}}' +resource_name: "{{ resource_prefix }}" diff --git a/test/integration/targets/gcp_pubsub_topic/defaults/main.yml b/test/integration/targets/gcp_pubsub_topic/defaults/main.yml index aa87a2a8e0e0e0..ba66644fc1cb3d 100644 --- a/test/integration/targets/gcp_pubsub_topic/defaults/main.yml +++ b/test/integration/targets/gcp_pubsub_topic/defaults/main.yml @@ -1,3 +1,2 @@ --- -# defaults file -resource_name: '{{resource_prefix}}' +resource_name: "{{ resource_prefix }}" diff --git a/test/integration/targets/gcp_redis_instance/defaults/main.yml b/test/integration/targets/gcp_redis_instance/defaults/main.yml index aa87a2a8e0e0e0..ba66644fc1cb3d 100644 --- a/test/integration/targets/gcp_redis_instance/defaults/main.yml +++ b/test/integration/targets/gcp_redis_instance/defaults/main.yml @@ -1,3 +1,2 @@ --- -# defaults file -resource_name: '{{resource_prefix}}' +resource_name: "{{ resource_prefix }}" diff --git a/test/integration/targets/gcp_resourcemanager_project/defaults/main.yml b/test/integration/targets/gcp_resourcemanager_project/defaults/main.yml index aa87a2a8e0e0e0..ba66644fc1cb3d 100644 --- a/test/integration/targets/gcp_resourcemanager_project/defaults/main.yml +++ b/test/integration/targets/gcp_resourcemanager_project/defaults/main.yml @@ -1,3 +1,2 @@ --- -# defaults file -resource_name: '{{resource_prefix}}' +resource_name: "{{ resource_prefix }}" diff --git a/test/integration/targets/gcp_sourcerepo_repository/defaults/main.yml b/test/integration/targets/gcp_sourcerepo_repository/defaults/main.yml index aa87a2a8e0e0e0..ba66644fc1cb3d 100644 --- a/test/integration/targets/gcp_sourcerepo_repository/defaults/main.yml +++ b/test/integration/targets/gcp_sourcerepo_repository/defaults/main.yml @@ -1,3 +1,2 @@ --- -# defaults file -resource_name: '{{resource_prefix}}' +resource_name: "{{ resource_prefix }}" diff --git a/test/integration/targets/gcp_spanner_database/defaults/main.yml b/test/integration/targets/gcp_spanner_database/defaults/main.yml index aa87a2a8e0e0e0..ba66644fc1cb3d 100644 --- a/test/integration/targets/gcp_spanner_database/defaults/main.yml +++ b/test/integration/targets/gcp_spanner_database/defaults/main.yml @@ -1,3 +1,2 @@ --- -# defaults file -resource_name: '{{resource_prefix}}' +resource_name: "{{ resource_prefix }}" diff --git a/test/integration/targets/gcp_spanner_instance/defaults/main.yml b/test/integration/targets/gcp_spanner_instance/defaults/main.yml index aa87a2a8e0e0e0..ba66644fc1cb3d 100644 --- a/test/integration/targets/gcp_spanner_instance/defaults/main.yml +++ b/test/integration/targets/gcp_spanner_instance/defaults/main.yml @@ -1,3 +1,2 @@ --- -# defaults file -resource_name: '{{resource_prefix}}' +resource_name: "{{ resource_prefix }}" diff --git a/test/integration/targets/gcp_sql_database/defaults/main.yml b/test/integration/targets/gcp_sql_database/defaults/main.yml index aa87a2a8e0e0e0..ba66644fc1cb3d 100644 --- a/test/integration/targets/gcp_sql_database/defaults/main.yml +++ b/test/integration/targets/gcp_sql_database/defaults/main.yml @@ -1,3 +1,2 @@ --- -# defaults file -resource_name: '{{resource_prefix}}' +resource_name: "{{ resource_prefix }}" diff --git a/test/integration/targets/gcp_sql_instance/defaults/main.yml b/test/integration/targets/gcp_sql_instance/defaults/main.yml index aa87a2a8e0e0e0..ba66644fc1cb3d 100644 --- a/test/integration/targets/gcp_sql_instance/defaults/main.yml +++ b/test/integration/targets/gcp_sql_instance/defaults/main.yml @@ -1,3 +1,2 @@ --- -# defaults file -resource_name: '{{resource_prefix}}' +resource_name: "{{ resource_prefix }}" diff --git a/test/integration/targets/gcp_sql_user/defaults/main.yml b/test/integration/targets/gcp_sql_user/defaults/main.yml index aa87a2a8e0e0e0..ba66644fc1cb3d 100644 --- a/test/integration/targets/gcp_sql_user/defaults/main.yml +++ b/test/integration/targets/gcp_sql_user/defaults/main.yml @@ -1,3 +1,2 @@ --- -# defaults file -resource_name: '{{resource_prefix}}' +resource_name: "{{ resource_prefix }}" diff --git a/test/integration/targets/gcp_storage_bucket/defaults/main.yml b/test/integration/targets/gcp_storage_bucket/defaults/main.yml index aa87a2a8e0e0e0..ba66644fc1cb3d 100644 --- a/test/integration/targets/gcp_storage_bucket/defaults/main.yml +++ b/test/integration/targets/gcp_storage_bucket/defaults/main.yml @@ -1,3 +1,2 @@ --- -# defaults file -resource_name: '{{resource_prefix}}' +resource_name: "{{ resource_prefix }}" diff --git a/test/integration/targets/gcp_storage_bucket_access_control/defaults/main.yml b/test/integration/targets/gcp_storage_bucket_access_control/defaults/main.yml index aa87a2a8e0e0e0..ba66644fc1cb3d 100644 --- a/test/integration/targets/gcp_storage_bucket_access_control/defaults/main.yml +++ b/test/integration/targets/gcp_storage_bucket_access_control/defaults/main.yml @@ -1,3 +1,2 @@ --- -# defaults file -resource_name: '{{resource_prefix}}' +resource_name: "{{ resource_prefix }}" From 5efccb635040ae9354ab4b28cb4fb5b5a2b3fa0b Mon Sep 17 00:00:00 2001 From: The Magician Date: Mon, 15 Apr 2019 13:27:50 -0700 Subject: [PATCH 143/144] Ansible - non-updatable resources should be deleted/created (#231) /cc @rambleraptor --- lib/ansible/modules/cloud/google/gcp_compute_address.py | 3 ++- lib/ansible/modules/cloud/google/gcp_compute_global_address.py | 3 ++- .../modules/cloud/google/gcp_compute_instance_template.py | 3 ++- .../cloud/google/gcp_compute_interconnect_attachment.py | 3 ++- lib/ansible/modules/cloud/google/gcp_compute_route.py | 3 ++- .../modules/cloud/google/gcp_compute_ssl_certificate.py | 3 ++- .../modules/cloud/google/gcp_compute_target_vpn_gateway.py | 3 ++- lib/ansible/modules/cloud/google/gcp_compute_vpn_tunnel.py | 3 ++- lib/ansible/modules/cloud/google/gcp_pubsub_topic.py | 3 ++- lib/ansible/modules/cloud/google/gcp_sourcerepo_repository.py | 3 ++- lib/ansible/modules/cloud/google/gcp_spanner_database.py | 3 ++- 11 files changed, 22 insertions(+), 11 deletions(-) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_address.py b/lib/ansible/modules/cloud/google/gcp_compute_address.py index df536ed69198bb..9a05e01744c667 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_address.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_address.py @@ -262,7 +262,8 @@ def create(module, link, kind): def update(module, link, kind): - module.fail_json(msg="Address cannot be edited") + delete(module, self_link(module), kind) + create(module, collection(module), kind) def delete(module, link, kind): diff --git a/lib/ansible/modules/cloud/google/gcp_compute_global_address.py b/lib/ansible/modules/cloud/google/gcp_compute_global_address.py index 00bc1af38511d1..fff05fb85c921a 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_global_address.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_global_address.py @@ -217,7 +217,8 @@ def create(module, link, kind): def update(module, link, kind): - module.fail_json(msg="GlobalAddress cannot be edited") + delete(module, self_link(module), kind) + create(module, collection(module), kind) def delete(module, link, kind): diff --git a/lib/ansible/modules/cloud/google/gcp_compute_instance_template.py b/lib/ansible/modules/cloud/google/gcp_compute_instance_template.py index 566efea58dec67..71b7ab3d76acfb 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_instance_template.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_instance_template.py @@ -953,7 +953,8 @@ def create(module, link, kind): def update(module, link, kind): - module.fail_json(msg="InstanceTemplate cannot be edited") + delete(module, self_link(module), kind) + create(module, collection(module), kind) def delete(module, link, kind): diff --git a/lib/ansible/modules/cloud/google/gcp_compute_interconnect_attachment.py b/lib/ansible/modules/cloud/google/gcp_compute_interconnect_attachment.py index 92b951e35f2a23..b977a7a9c7df7d 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_interconnect_attachment.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_interconnect_attachment.py @@ -328,7 +328,8 @@ def create(module, link, kind): def update(module, link, kind): - module.fail_json(msg="InterconnectAttachment cannot be edited") + delete(module, self_link(module), kind) + create(module, collection(module), kind) def delete(module, link, kind): diff --git a/lib/ansible/modules/cloud/google/gcp_compute_route.py b/lib/ansible/modules/cloud/google/gcp_compute_route.py index 8f62a2fe9eb433..cd80b35335d67c 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_route.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_route.py @@ -312,7 +312,8 @@ def create(module, link, kind): def update(module, link, kind): - module.fail_json(msg="Route cannot be edited") + delete(module, self_link(module), kind) + create(module, collection(module), kind) def delete(module, link, kind): diff --git a/lib/ansible/modules/cloud/google/gcp_compute_ssl_certificate.py b/lib/ansible/modules/cloud/google/gcp_compute_ssl_certificate.py index 8a4e6ae79c0486..3bb5f0abeb6787 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_ssl_certificate.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_ssl_certificate.py @@ -204,7 +204,8 @@ def create(module, link, kind): def update(module, link, kind): - module.fail_json(msg="SslCertificate cannot be edited") + delete(module, self_link(module), kind) + create(module, collection(module), kind) def delete(module, link, kind): diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_vpn_gateway.py b/lib/ansible/modules/cloud/google/gcp_compute_target_vpn_gateway.py index 3e26ef4634d065..9b7a9805444ba0 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_vpn_gateway.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_vpn_gateway.py @@ -222,7 +222,8 @@ def create(module, link, kind): def update(module, link, kind): - module.fail_json(msg="TargetVpnGateway cannot be edited") + delete(module, self_link(module), kind) + create(module, collection(module), kind) def delete(module, link, kind): diff --git a/lib/ansible/modules/cloud/google/gcp_compute_vpn_tunnel.py b/lib/ansible/modules/cloud/google/gcp_compute_vpn_tunnel.py index ec7be3db0500e5..1302affb83b008 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_vpn_tunnel.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_vpn_tunnel.py @@ -314,7 +314,8 @@ def create(module, link, kind): def update(module, link, kind): - module.fail_json(msg="VpnTunnel cannot be edited") + delete(module, self_link(module), kind) + create(module, collection(module), kind) def delete(module, link, kind): diff --git a/lib/ansible/modules/cloud/google/gcp_pubsub_topic.py b/lib/ansible/modules/cloud/google/gcp_pubsub_topic.py index 5982ed0a79c070..728fc60080f3d2 100644 --- a/lib/ansible/modules/cloud/google/gcp_pubsub_topic.py +++ b/lib/ansible/modules/cloud/google/gcp_pubsub_topic.py @@ -142,7 +142,8 @@ def create(module, link): def update(module, link): - module.fail_json(msg="Topic cannot be edited") + delete(module, self_link(module)) + create(module, self_link(module)) def delete(module, link): diff --git a/lib/ansible/modules/cloud/google/gcp_sourcerepo_repository.py b/lib/ansible/modules/cloud/google/gcp_sourcerepo_repository.py index d1e1a06be437f0..8bfa22e7065772 100644 --- a/lib/ansible/modules/cloud/google/gcp_sourcerepo_repository.py +++ b/lib/ansible/modules/cloud/google/gcp_sourcerepo_repository.py @@ -142,7 +142,8 @@ def create(module, link): def update(module, link): - module.fail_json(msg="Repository cannot be edited") + delete(module, self_link(module)) + create(module, collection(module)) def delete(module, link): diff --git a/lib/ansible/modules/cloud/google/gcp_spanner_database.py b/lib/ansible/modules/cloud/google/gcp_spanner_database.py index 19306cdd6bb902..fe585a05e82acd 100644 --- a/lib/ansible/modules/cloud/google/gcp_spanner_database.py +++ b/lib/ansible/modules/cloud/google/gcp_spanner_database.py @@ -181,7 +181,8 @@ def create(module, link): def update(module, link): - module.fail_json(msg="Database cannot be edited") + delete(module, self_link(module)) + create(module, collection(module)) def delete(module, link): From 9fa4661bdedae5c4a753c46b0e9d6add4b8f4d63 Mon Sep 17 00:00:00 2001 From: Alex Stephen Date: Fri, 19 Apr 2019 19:38:36 +0000 Subject: [PATCH 144/144] block/always on ansible tests Signed-off-by: Modular Magician --- .../gcp_bigquery_dataset/tasks/main.yml | 185 +++---- .../targets/gcp_bigquery_table/tasks/main.yml | 264 +++++----- .../gcp_compute_address/tasks/main.yml | 183 +++---- .../gcp_compute_backend_bucket/tasks/main.yml | 244 ++++----- .../tasks/main.yml | 318 ++++++------ .../targets/gcp_compute_disk/tasks/main.yml | 213 ++++---- .../gcp_compute_firewall/tasks/main.yml | 263 +++++----- .../tasks/main.yml | 306 +++++------ .../gcp_compute_global_address/tasks/main.yml | 173 +++---- .../tasks/main.yml | 484 +++++++++--------- .../gcp_compute_health_check/tasks/main.yml | 253 ++++----- .../tasks/main.yml | 213 ++++---- .../tasks/main.yml | 213 ++++---- .../targets/gcp_compute_image/tasks/main.yml | 228 +++++---- .../gcp_compute_instance/tasks/main.yml | 448 ++++++++-------- .../gcp_compute_instance_group/tasks/main.yml | 264 +++++----- .../tasks/main.yml | 378 +++++++------- .../tasks/main.yml | 382 +++++++------- .../gcp_compute_network/tasks/main.yml | 183 +++---- .../gcp_compute_region_disk/tasks/main.yml | 243 ++++----- .../targets/gcp_compute_route/tasks/main.yml | 274 +++++----- .../targets/gcp_compute_router/tasks/main.yml | 314 ++++++------ .../tasks/main.yml | 303 +++++------ .../gcp_compute_ssl_policy/tasks/main.yml | 223 ++++---- .../gcp_compute_subnetwork/tasks/main.yml | 248 ++++----- .../tasks/main.yml | 370 ++++++------- .../tasks/main.yml | 476 ++++++++--------- .../gcp_compute_target_pool/tasks/main.yml | 183 +++---- .../tasks/main.yml | 454 ++++++++-------- .../tasks/main.yml | 358 ++++++------- .../tasks/main.yml | 272 +++++----- .../gcp_compute_url_map/tasks/main.yml | 332 ++++++------ .../gcp_compute_vpn_tunnel/tasks/main.yml | 370 ++++++------- .../gcp_container_cluster/tasks/main.yml | 237 ++++----- .../gcp_container_node_pool/tasks/main.yml | 236 ++++----- .../gcp_dns_managed_zone/tasks/main.yml | 185 +++---- .../tasks/main.yml | 274 +++++----- .../targets/gcp_iam_role/tasks/main.yml | 217 ++++---- .../gcp_iam_service_account/tasks/main.yml | 167 +++--- .../gcp_pubsub_subscription/tasks/main.yml | 218 ++++---- .../targets/gcp_pubsub_topic/tasks/main.yml | 157 +++--- .../targets/gcp_redis_instance/tasks/main.yml | 298 +++++------ .../tasks/main.yml | 191 +++---- .../gcp_sourcerepo_repository/tasks/main.yml | 157 +++--- .../gcp_spanner_database/tasks/main.yml | 228 +++++---- .../gcp_spanner_instance/tasks/main.yml | 207 ++++---- .../targets/gcp_sql_database/tasks/main.yml | 254 ++++----- .../targets/gcp_sql_instance/tasks/main.yml | 235 ++++----- .../targets/gcp_sql_user/tasks/main.yml | 264 +++++----- .../targets/gcp_storage_bucket/tasks/main.yml | 129 ++--- .../tasks/main.yml | 190 +++---- 51 files changed, 6769 insertions(+), 6690 deletions(-) diff --git a/test/integration/targets/gcp_bigquery_dataset/tasks/main.yml b/test/integration/targets/gcp_bigquery_dataset/tasks/main.yml index 98421640d30619..fb17ab72b4ead6 100644 --- a/test/integration/targets/gcp_bigquery_dataset/tasks/main.yml +++ b/test/integration/targets/gcp_bigquery_dataset/tasks/main.yml @@ -12,101 +12,102 @@ # https://www.github.com/GoogleCloudPlatform/magic-modules # # ---------------------------------------------------------------------------- -# Pre-test setup -- name: delete a dataset - gcp_bigquery_dataset: - name: my_example_dataset - dataset_reference: - dataset_id: my_example_dataset - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent -#---------------------------------------------------------- -- name: create a dataset - gcp_bigquery_dataset: - name: my_example_dataset - dataset_reference: - dataset_id: my_example_dataset - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present - register: result -- name: assert changed is true - assert: - that: - - result.changed == true - - "result.kind == 'bigquery#dataset'" -- name: verify that dataset was created - gcp_bigquery_dataset_facts: +- block: + # Pre-test setup + - name: delete a dataset + gcp_bigquery_dataset: + name: my_example_dataset + dataset_reference: + dataset_id: my_example_dataset project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" - scopes: - - https://www.googleapis.com/auth/bigquery - register: results -- name: verify that command succeeded - assert: - that: - - results['items'] | length >= 1 -# ---------------------------------------------------------------------------- -- name: create a dataset that already exists - gcp_bigquery_dataset: - name: my_example_dataset - dataset_reference: - dataset_id: my_example_dataset - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present - register: result -- name: assert changed is false - assert: - that: - - result.changed == false - - "result.kind == 'bigquery#dataset'" -#---------------------------------------------------------- -- name: delete a dataset - gcp_bigquery_dataset: - name: my_example_dataset - dataset_reference: - dataset_id: my_example_dataset - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent - register: result -- name: assert changed is true - assert: - that: - - result.changed == true - - result.has_key('kind') == False -- name: verify that dataset was deleted - gcp_bigquery_dataset_facts: + state: absent + #---------------------------------------------------------- + - name: create a dataset + gcp_bigquery_dataset: + name: my_example_dataset + dataset_reference: + dataset_id: my_example_dataset project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" - scopes: - - https://www.googleapis.com/auth/bigquery - register: results -- name: verify that command succeeded - assert: - that: - - results['items'] | length == 0 -# ---------------------------------------------------------------------------- -- name: delete a dataset that does not exist - gcp_bigquery_dataset: - name: my_example_dataset - dataset_reference: - dataset_id: my_example_dataset - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent - register: result -- name: assert changed is false - assert: - that: - - result.changed == false - - result.has_key('kind') == False + state: present + register: result + - name: assert changed is true + assert: + that: + - result.changed == true + - "result.kind == 'bigquery#dataset'" + - name: verify that dataset was created + gcp_bigquery_dataset_facts: + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + scopes: + - https://www.googleapis.com/auth/bigquery + register: results + - name: verify that command succeeded + assert: + that: + - results['items'] | length >= 1 + # ---------------------------------------------------------------------------- + - name: create a dataset that already exists + gcp_bigquery_dataset: + name: my_example_dataset + dataset_reference: + dataset_id: my_example_dataset + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present + register: result + - name: assert changed is false + assert: + that: + - result.changed == false + - "result.kind == 'bigquery#dataset'" + #---------------------------------------------------------- + - name: delete a dataset + gcp_bigquery_dataset: + name: my_example_dataset + dataset_reference: + dataset_id: my_example_dataset + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: result + - name: assert changed is true + assert: + that: + - result.changed == true + - result.has_key('kind') == False + - name: verify that dataset was deleted + gcp_bigquery_dataset_facts: + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + scopes: + - https://www.googleapis.com/auth/bigquery + register: results + - name: verify that command succeeded + assert: + that: + - results['items'] | length == 0 + # ---------------------------------------------------------------------------- + - name: delete a dataset that does not exist + gcp_bigquery_dataset: + name: my_example_dataset + dataset_reference: + dataset_id: my_example_dataset + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: result + - name: assert changed is false + assert: + that: + - result.changed == false + - result.has_key('kind') == False diff --git a/test/integration/targets/gcp_bigquery_table/tasks/main.yml b/test/integration/targets/gcp_bigquery_table/tasks/main.yml index 3a1fda0ea5a190..683b6a8ab033a5 100644 --- a/test/integration/targets/gcp_bigquery_table/tasks/main.yml +++ b/test/integration/targets/gcp_bigquery_table/tasks/main.yml @@ -12,142 +12,144 @@ # https://www.github.com/GoogleCloudPlatform/magic-modules # # ---------------------------------------------------------------------------- -# Pre-test setup -- name: create a dataset - gcp_bigquery_dataset: - name: example_dataset - dataset_reference: - dataset_id: example_dataset - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present - register: dataset -- name: delete a table - gcp_bigquery_table: - name: example_table - dataset: example_dataset - table_reference: - dataset_id: example_dataset - project_id: "{{ gcp_project }}" - table_id: example_table - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent -#---------------------------------------------------------- -- name: create a table - gcp_bigquery_table: - name: example_table - dataset: example_dataset - table_reference: - dataset_id: example_dataset - project_id: "{{ gcp_project }}" - table_id: example_table - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present - register: result -- name: assert changed is true - assert: - that: - - result.changed == true - - "result.kind == 'bigquery#table'" -- name: verify that table was created - gcp_bigquery_table_facts: +- block: + # Pre-test setup + - name: create a dataset + gcp_bigquery_dataset: + name: example_dataset + dataset_reference: + dataset_id: example_dataset + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present + register: dataset + - name: delete a table + gcp_bigquery_table: + name: example_table dataset: example_dataset + table_reference: + dataset_id: example_dataset + project_id: "{{ gcp_project }}" + table_id: example_table project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" - scopes: - - https://www.googleapis.com/auth/bigquery - register: results -- name: verify that command succeeded - assert: - that: - - results['items'] | length >= 1 -# ---------------------------------------------------------------------------- -- name: create a table that already exists - gcp_bigquery_table: - name: example_table - dataset: example_dataset - table_reference: - dataset_id: example_dataset - project_id: "{{ gcp_project }}" - table_id: example_table - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present - register: result -- name: assert changed is false - assert: - that: - - result.changed == false - - "result.kind == 'bigquery#table'" -#---------------------------------------------------------- -- name: delete a table - gcp_bigquery_table: - name: example_table - dataset: example_dataset - table_reference: - dataset_id: example_dataset - project_id: "{{ gcp_project }}" - table_id: example_table - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent - register: result -- name: assert changed is true - assert: - that: - - result.changed == true - - result.has_key('kind') == False -- name: verify that table was deleted - gcp_bigquery_table_facts: + state: absent + #---------------------------------------------------------- + - name: create a table + gcp_bigquery_table: + name: example_table dataset: example_dataset + table_reference: + dataset_id: example_dataset + project_id: "{{ gcp_project }}" + table_id: example_table project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" - scopes: - - https://www.googleapis.com/auth/bigquery - register: results -- name: verify that command succeeded - assert: - that: - - results['items'] | length == 0 -# ---------------------------------------------------------------------------- -- name: delete a table that does not exist - gcp_bigquery_table: - name: example_table - dataset: example_dataset - table_reference: - dataset_id: example_dataset - project_id: "{{ gcp_project }}" - table_id: example_table - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent - register: result -- name: assert changed is false - assert: - that: - - result.changed == false - - result.has_key('kind') == False -#--------------------------------------------------------- -# Post-test teardown -# If errors happen, don't crash the playbook! -- name: delete a dataset - gcp_bigquery_dataset: - name: example_dataset - dataset_reference: - dataset_id: example_dataset - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent - register: dataset - ignore_errors: true + state: present + register: result + - name: assert changed is true + assert: + that: + - result.changed == true + - "result.kind == 'bigquery#table'" + - name: verify that table was created + gcp_bigquery_table_facts: + dataset: example_dataset + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + scopes: + - https://www.googleapis.com/auth/bigquery + register: results + - name: verify that command succeeded + assert: + that: + - results['items'] | length >= 1 + # ---------------------------------------------------------------------------- + - name: create a table that already exists + gcp_bigquery_table: + name: example_table + dataset: example_dataset + table_reference: + dataset_id: example_dataset + project_id: "{{ gcp_project }}" + table_id: example_table + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present + register: result + - name: assert changed is false + assert: + that: + - result.changed == false + - "result.kind == 'bigquery#table'" + #---------------------------------------------------------- + - name: delete a table + gcp_bigquery_table: + name: example_table + dataset: example_dataset + table_reference: + dataset_id: example_dataset + project_id: "{{ gcp_project }}" + table_id: example_table + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: result + - name: assert changed is true + assert: + that: + - result.changed == true + - result.has_key('kind') == False + - name: verify that table was deleted + gcp_bigquery_table_facts: + dataset: example_dataset + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + scopes: + - https://www.googleapis.com/auth/bigquery + register: results + - name: verify that command succeeded + assert: + that: + - results['items'] | length == 0 + # ---------------------------------------------------------------------------- + - name: delete a table that does not exist + gcp_bigquery_table: + name: example_table + dataset: example_dataset + table_reference: + dataset_id: example_dataset + project_id: "{{ gcp_project }}" + table_id: example_table + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: result + - name: assert changed is false + assert: + that: + - result.changed == false + - result.has_key('kind') == False + always: + #--------------------------------------------------------- + # Post-test teardown + # If errors happen, don't crash the playbook! + - name: delete a dataset + gcp_bigquery_dataset: + name: example_dataset + dataset_reference: + dataset_id: example_dataset + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: dataset + ignore_errors: true diff --git a/test/integration/targets/gcp_compute_address/tasks/main.yml b/test/integration/targets/gcp_compute_address/tasks/main.yml index 52b7c2357ef221..36eeb1b963fd0e 100644 --- a/test/integration/targets/gcp_compute_address/tasks/main.yml +++ b/test/integration/targets/gcp_compute_address/tasks/main.yml @@ -12,102 +12,103 @@ # https://www.github.com/GoogleCloudPlatform/magic-modules # # ---------------------------------------------------------------------------- -# Pre-test setup -- name: delete a address - gcp_compute_address: - name: test-address1 - region: us-west1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent -#---------------------------------------------------------- -- name: create a address - gcp_compute_address: - name: test-address1 - region: us-west1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present - register: result -- name: assert changed is true - assert: - that: - - result.changed == true - - "result.kind == 'compute#address'" -- name: verify that address was created - gcp_compute_address_facts: - filters: - - name = test-address1 +- block: + # Pre-test setup + - name: delete a address + gcp_compute_address: + name: test-address1 region: us-west1 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" - scopes: - - https://www.googleapis.com/auth/compute - register: results -- name: verify that command succeeded - assert: - that: - - results['items'] | length == 1 -# ---------------------------------------------------------------------------- -- name: create a address that already exists - gcp_compute_address: - name: test-address1 - region: us-west1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present - register: result -- name: assert changed is false - assert: - that: - - result.changed == false - - "result.kind == 'compute#address'" -#---------------------------------------------------------- -- name: delete a address - gcp_compute_address: - name: test-address1 - region: us-west1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent - register: result -- name: assert changed is true - assert: - that: - - result.changed == true - - result.has_key('kind') == False -- name: verify that address was deleted - gcp_compute_address_facts: - filters: - - name = test-address1 + state: absent + #---------------------------------------------------------- + - name: create a address + gcp_compute_address: + name: test-address1 region: us-west1 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" - scopes: - - https://www.googleapis.com/auth/compute - register: results -- name: verify that command succeeded - assert: - that: - - results['items'] | length == 0 -# ---------------------------------------------------------------------------- -- name: delete a address that does not exist - gcp_compute_address: - name: test-address1 - region: us-west1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent - register: result -- name: assert changed is false - assert: - that: - - result.changed == false - - result.has_key('kind') == False + state: present + register: result + - name: assert changed is true + assert: + that: + - result.changed == true + - "result.kind == 'compute#address'" + - name: verify that address was created + gcp_compute_address_facts: + filters: + - name = test-address1 + region: us-west1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + scopes: + - https://www.googleapis.com/auth/compute + register: results + - name: verify that command succeeded + assert: + that: + - results['items'] | length == 1 + # ---------------------------------------------------------------------------- + - name: create a address that already exists + gcp_compute_address: + name: test-address1 + region: us-west1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present + register: result + - name: assert changed is false + assert: + that: + - result.changed == false + - "result.kind == 'compute#address'" + #---------------------------------------------------------- + - name: delete a address + gcp_compute_address: + name: test-address1 + region: us-west1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: result + - name: assert changed is true + assert: + that: + - result.changed == true + - result.has_key('kind') == False + - name: verify that address was deleted + gcp_compute_address_facts: + filters: + - name = test-address1 + region: us-west1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + scopes: + - https://www.googleapis.com/auth/compute + register: results + - name: verify that command succeeded + assert: + that: + - results['items'] | length == 0 + # ---------------------------------------------------------------------------- + - name: delete a address that does not exist + gcp_compute_address: + name: test-address1 + region: us-west1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: result + - name: assert changed is false + assert: + that: + - result.changed == false + - result.has_key('kind') == False diff --git a/test/integration/targets/gcp_compute_backend_bucket/tasks/main.yml b/test/integration/targets/gcp_compute_backend_bucket/tasks/main.yml index 1074135754f17b..c67e532c957256 100644 --- a/test/integration/targets/gcp_compute_backend_bucket/tasks/main.yml +++ b/test/integration/targets/gcp_compute_backend_bucket/tasks/main.yml @@ -12,130 +12,132 @@ # https://www.github.com/GoogleCloudPlatform/magic-modules # # ---------------------------------------------------------------------------- -# Pre-test setup -- name: create a bucket - gcp_storage_bucket: - name: bucket-backendbucket - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present - register: bucket -- name: delete a backend bucket - gcp_compute_backend_bucket: - name: "{{ resource_name }}" - bucket_name: "{{ bucket.name }}" - description: A BackendBucket to connect LNB w/ Storage Bucket - enable_cdn: 'true' - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent -#---------------------------------------------------------- -- name: create a backend bucket - gcp_compute_backend_bucket: - name: "{{ resource_name }}" - bucket_name: "{{ bucket.name }}" - description: A BackendBucket to connect LNB w/ Storage Bucket - enable_cdn: 'true' - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present - register: result -- name: assert changed is true - assert: - that: - - result.changed == true - - "result.kind == 'compute#backendBucket'" -- name: verify that backend_bucket was created - gcp_compute_backend_bucket_facts: - filters: - - name = {{ resource_name }} +- block: + # Pre-test setup + - name: create a bucket + gcp_storage_bucket: + name: bucket-backendbucket project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" - scopes: - - https://www.googleapis.com/auth/compute - register: results -- name: verify that command succeeded - assert: - that: - - results['items'] | length == 1 -# ---------------------------------------------------------------------------- -- name: create a backend bucket that already exists - gcp_compute_backend_bucket: - name: "{{ resource_name }}" - bucket_name: "{{ bucket.name }}" - description: A BackendBucket to connect LNB w/ Storage Bucket - enable_cdn: 'true' - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present - register: result -- name: assert changed is false - assert: - that: - - result.changed == false - - "result.kind == 'compute#backendBucket'" -#---------------------------------------------------------- -- name: delete a backend bucket - gcp_compute_backend_bucket: - name: "{{ resource_name }}" - bucket_name: "{{ bucket.name }}" - description: A BackendBucket to connect LNB w/ Storage Bucket - enable_cdn: 'true' - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent - register: result -- name: assert changed is true - assert: - that: - - result.changed == true - - result.has_key('kind') == False -- name: verify that backend_bucket was deleted - gcp_compute_backend_bucket_facts: - filters: - - name = {{ resource_name }} + state: present + register: bucket + - name: delete a backend bucket + gcp_compute_backend_bucket: + name: "{{ resource_name }}" + bucket_name: "{{ bucket.name }}" + description: A BackendBucket to connect LNB w/ Storage Bucket + enable_cdn: 'true' project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" - scopes: - - https://www.googleapis.com/auth/compute - register: results -- name: verify that command succeeded - assert: - that: - - results['items'] | length == 0 -# ---------------------------------------------------------------------------- -- name: delete a backend bucket that does not exist - gcp_compute_backend_bucket: - name: "{{ resource_name }}" - bucket_name: "{{ bucket.name }}" - description: A BackendBucket to connect LNB w/ Storage Bucket - enable_cdn: 'true' - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent - register: result -- name: assert changed is false - assert: - that: - - result.changed == false - - result.has_key('kind') == False -#--------------------------------------------------------- -# Post-test teardown -# If errors happen, don't crash the playbook! -- name: delete a bucket - gcp_storage_bucket: - name: bucket-backendbucket - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent - register: bucket - ignore_errors: true + state: absent + #---------------------------------------------------------- + - name: create a backend bucket + gcp_compute_backend_bucket: + name: "{{ resource_name }}" + bucket_name: "{{ bucket.name }}" + description: A BackendBucket to connect LNB w/ Storage Bucket + enable_cdn: 'true' + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present + register: result + - name: assert changed is true + assert: + that: + - result.changed == true + - "result.kind == 'compute#backendBucket'" + - name: verify that backend_bucket was created + gcp_compute_backend_bucket_facts: + filters: + - name = {{ resource_name }} + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + scopes: + - https://www.googleapis.com/auth/compute + register: results + - name: verify that command succeeded + assert: + that: + - results['items'] | length == 1 + # ---------------------------------------------------------------------------- + - name: create a backend bucket that already exists + gcp_compute_backend_bucket: + name: "{{ resource_name }}" + bucket_name: "{{ bucket.name }}" + description: A BackendBucket to connect LNB w/ Storage Bucket + enable_cdn: 'true' + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present + register: result + - name: assert changed is false + assert: + that: + - result.changed == false + - "result.kind == 'compute#backendBucket'" + #---------------------------------------------------------- + - name: delete a backend bucket + gcp_compute_backend_bucket: + name: "{{ resource_name }}" + bucket_name: "{{ bucket.name }}" + description: A BackendBucket to connect LNB w/ Storage Bucket + enable_cdn: 'true' + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: result + - name: assert changed is true + assert: + that: + - result.changed == true + - result.has_key('kind') == False + - name: verify that backend_bucket was deleted + gcp_compute_backend_bucket_facts: + filters: + - name = {{ resource_name }} + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + scopes: + - https://www.googleapis.com/auth/compute + register: results + - name: verify that command succeeded + assert: + that: + - results['items'] | length == 0 + # ---------------------------------------------------------------------------- + - name: delete a backend bucket that does not exist + gcp_compute_backend_bucket: + name: "{{ resource_name }}" + bucket_name: "{{ bucket.name }}" + description: A BackendBucket to connect LNB w/ Storage Bucket + enable_cdn: 'true' + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: result + - name: assert changed is false + assert: + that: + - result.changed == false + - result.has_key('kind') == False + always: + #--------------------------------------------------------- + # Post-test teardown + # If errors happen, don't crash the playbook! + - name: delete a bucket + gcp_storage_bucket: + name: bucket-backendbucket + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: bucket + ignore_errors: true diff --git a/test/integration/targets/gcp_compute_backend_service/tasks/main.yml b/test/integration/targets/gcp_compute_backend_service/tasks/main.yml index 3bdf590fdd796e..8db065419a9c15 100644 --- a/test/integration/targets/gcp_compute_backend_service/tasks/main.yml +++ b/test/integration/targets/gcp_compute_backend_service/tasks/main.yml @@ -12,167 +12,169 @@ # https://www.github.com/GoogleCloudPlatform/magic-modules # # ---------------------------------------------------------------------------- -# Pre-test setup -- name: create a instance group - gcp_compute_instance_group: - name: instancegroup-backendservice - zone: us-central1-a - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present - register: instancegroup -- name: create a http health check - gcp_compute_http_health_check: - name: httphealthcheck-backendservice - healthy_threshold: 10 - port: 8080 - timeout_sec: 2 - unhealthy_threshold: 5 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present - register: healthcheck -- name: delete a backend service - 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 -#---------------------------------------------------------- -- name: create a backend service - 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 - register: result -- name: assert changed is true - assert: - that: - - result.changed == true - - "result.kind == 'compute#backendService'" -- name: verify that backend_service was created - gcp_compute_backend_service_facts: - filters: - - name = {{ resource_name }} +- block: + # Pre-test setup + - name: create a instance group + gcp_compute_instance_group: + name: instancegroup-backendservice + zone: us-central1-a project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" - scopes: - - 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 - register: result -- name: assert changed is false - assert: - that: - - result.changed == false - - "result.kind == 'compute#backendService'" -#---------------------------------------------------------- -- name: delete a backend service - 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 - register: result -- name: assert changed is true - assert: - that: - - result.changed == true - - result.has_key('kind') == False -- name: verify that backend_service was deleted - gcp_compute_backend_service_facts: - filters: - - name = {{ resource_name }} + state: present + register: instancegroup + - name: create a http health check + gcp_compute_http_health_check: + name: httphealthcheck-backendservice + healthy_threshold: 10 + port: 8080 + timeout_sec: 2 + unhealthy_threshold: 5 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" - scopes: - - 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 - register: result -- name: assert changed is false - assert: - that: - - result.changed == false - - result.has_key('kind') == False -#--------------------------------------------------------- -# Post-test teardown -# If errors happen, don't crash the playbook! -- name: delete a http health check - gcp_compute_http_health_check: - name: httphealthcheck-backendservice - healthy_threshold: 10 - port: 8080 - timeout_sec: 2 - unhealthy_threshold: 5 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent - register: healthcheck - ignore_errors: true -- name: delete a instance group - gcp_compute_instance_group: - name: instancegroup-backendservice - zone: us-central1-a - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent - register: instancegroup - ignore_errors: true + state: present + register: healthcheck + - name: delete a backend service + 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 + #---------------------------------------------------------- + - name: create a backend service + 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 + register: result + - name: assert changed is true + assert: + that: + - result.changed == true + - "result.kind == 'compute#backendService'" + - name: verify that backend_service was created + gcp_compute_backend_service_facts: + filters: + - name = {{ resource_name }} + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + scopes: + - 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 + register: result + - name: assert changed is false + assert: + that: + - result.changed == false + - "result.kind == 'compute#backendService'" + #---------------------------------------------------------- + - name: delete a backend service + 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 + register: result + - name: assert changed is true + assert: + that: + - result.changed == true + - result.has_key('kind') == False + - name: verify that backend_service was deleted + gcp_compute_backend_service_facts: + filters: + - name = {{ resource_name }} + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + scopes: + - 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 + register: result + - name: assert changed is false + assert: + that: + - result.changed == false + - result.has_key('kind') == False + always: + #--------------------------------------------------------- + # Post-test teardown + # If errors happen, don't crash the playbook! + - name: delete a http health check + gcp_compute_http_health_check: + name: httphealthcheck-backendservice + healthy_threshold: 10 + port: 8080 + timeout_sec: 2 + unhealthy_threshold: 5 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: healthcheck + ignore_errors: true + - name: delete a instance group + gcp_compute_instance_group: + name: instancegroup-backendservice + zone: us-central1-a + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: instancegroup + ignore_errors: true diff --git a/test/integration/targets/gcp_compute_disk/tasks/main.yml b/test/integration/targets/gcp_compute_disk/tasks/main.yml index fc9e4dd6a076eb..4a9b279a10d418 100644 --- a/test/integration/targets/gcp_compute_disk/tasks/main.yml +++ b/test/integration/targets/gcp_compute_disk/tasks/main.yml @@ -12,117 +12,118 @@ # https://www.github.com/GoogleCloudPlatform/magic-modules # # ---------------------------------------------------------------------------- -# Pre-test setup -- name: delete a disk - gcp_compute_disk: - name: "{{ resource_name }}" - size_gb: 50 - disk_encryption_key: - raw_key: SGVsbG8gZnJvbSBHb29nbGUgQ2xvdWQgUGxhdGZvcm0= - zone: us-central1-a - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent -#---------------------------------------------------------- -- name: create a disk - gcp_compute_disk: - name: "{{ resource_name }}" - size_gb: 50 - disk_encryption_key: - raw_key: SGVsbG8gZnJvbSBHb29nbGUgQ2xvdWQgUGxhdGZvcm0= - zone: us-central1-a - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present - register: result -- name: assert changed is true - assert: - that: - - result.changed == true - - "result.kind == 'compute#disk'" -- name: verify that disk was created - gcp_compute_disk_facts: - filters: - - name = {{ resource_name }} +- block: + # Pre-test setup + - name: delete a disk + gcp_compute_disk: + name: "{{ resource_name }}" + size_gb: 50 + disk_encryption_key: + raw_key: SGVsbG8gZnJvbSBHb29nbGUgQ2xvdWQgUGxhdGZvcm0= zone: us-central1-a project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" - scopes: - - https://www.googleapis.com/auth/compute - register: results -- name: verify that command succeeded - assert: - that: - - results['items'] | length == 1 -# ---------------------------------------------------------------------------- -- name: create a disk that already exists - gcp_compute_disk: - name: "{{ resource_name }}" - size_gb: 50 - disk_encryption_key: - raw_key: SGVsbG8gZnJvbSBHb29nbGUgQ2xvdWQgUGxhdGZvcm0= - zone: us-central1-a - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present - register: result -- name: assert changed is false - assert: - that: - - result.changed == false - - "result.kind == 'compute#disk'" -#---------------------------------------------------------- -- name: delete a disk - gcp_compute_disk: - name: "{{ resource_name }}" - size_gb: 50 - disk_encryption_key: - raw_key: SGVsbG8gZnJvbSBHb29nbGUgQ2xvdWQgUGxhdGZvcm0= - zone: us-central1-a - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent - register: result -- name: assert changed is true - assert: - that: - - result.changed == true - - result.has_key('kind') == False -- name: verify that disk was deleted - gcp_compute_disk_facts: - filters: - - name = {{ resource_name }} + state: absent + #---------------------------------------------------------- + - name: create a disk + gcp_compute_disk: + name: "{{ resource_name }}" + size_gb: 50 + disk_encryption_key: + raw_key: SGVsbG8gZnJvbSBHb29nbGUgQ2xvdWQgUGxhdGZvcm0= zone: us-central1-a project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" - scopes: - - https://www.googleapis.com/auth/compute - register: results -- name: verify that command succeeded - assert: - that: - - results['items'] | length == 0 -# ---------------------------------------------------------------------------- -- name: delete a disk that does not exist - gcp_compute_disk: - name: "{{ resource_name }}" - size_gb: 50 - disk_encryption_key: - raw_key: SGVsbG8gZnJvbSBHb29nbGUgQ2xvdWQgUGxhdGZvcm0= - zone: us-central1-a - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent - register: result -- name: assert changed is false - assert: - that: - - result.changed == false - - result.has_key('kind') == False + state: present + register: result + - name: assert changed is true + assert: + that: + - result.changed == true + - "result.kind == 'compute#disk'" + - name: verify that disk was created + gcp_compute_disk_facts: + filters: + - name = {{ resource_name }} + zone: us-central1-a + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + scopes: + - https://www.googleapis.com/auth/compute + register: results + - name: verify that command succeeded + assert: + that: + - results['items'] | length == 1 + # ---------------------------------------------------------------------------- + - name: create a disk that already exists + gcp_compute_disk: + name: "{{ resource_name }}" + size_gb: 50 + disk_encryption_key: + raw_key: SGVsbG8gZnJvbSBHb29nbGUgQ2xvdWQgUGxhdGZvcm0= + zone: us-central1-a + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present + register: result + - name: assert changed is false + assert: + that: + - result.changed == false + - "result.kind == 'compute#disk'" + #---------------------------------------------------------- + - name: delete a disk + gcp_compute_disk: + name: "{{ resource_name }}" + size_gb: 50 + disk_encryption_key: + raw_key: SGVsbG8gZnJvbSBHb29nbGUgQ2xvdWQgUGxhdGZvcm0= + zone: us-central1-a + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: result + - name: assert changed is true + assert: + that: + - result.changed == true + - result.has_key('kind') == False + - name: verify that disk was deleted + gcp_compute_disk_facts: + filters: + - name = {{ resource_name }} + zone: us-central1-a + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + scopes: + - https://www.googleapis.com/auth/compute + register: results + - name: verify that command succeeded + assert: + that: + - results['items'] | length == 0 + # ---------------------------------------------------------------------------- + - name: delete a disk that does not exist + gcp_compute_disk: + name: "{{ resource_name }}" + size_gb: 50 + disk_encryption_key: + raw_key: SGVsbG8gZnJvbSBHb29nbGUgQ2xvdWQgUGxhdGZvcm0= + zone: us-central1-a + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: result + - name: assert changed is false + assert: + that: + - result.changed == false + - result.has_key('kind') == False diff --git a/test/integration/targets/gcp_compute_firewall/tasks/main.yml b/test/integration/targets/gcp_compute_firewall/tasks/main.yml index e88ffd7c6fd323..9c1e31918a6900 100644 --- a/test/integration/targets/gcp_compute_firewall/tasks/main.yml +++ b/test/integration/targets/gcp_compute_firewall/tasks/main.yml @@ -12,140 +12,141 @@ # https://www.github.com/GoogleCloudPlatform/magic-modules # # ---------------------------------------------------------------------------- -# Pre-test setup -- name: delete a firewall - gcp_compute_firewall: - name: "{{ resource_name }}" - allowed: - - ip_protocol: tcp - ports: - - '22' - target_tags: - - test-ssh-server - - staging-ssh-server - source_tags: - - test-ssh-clients - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent -#---------------------------------------------------------- -- name: create a firewall - gcp_compute_firewall: - name: "{{ resource_name }}" - allowed: - - ip_protocol: tcp - ports: - - '22' - target_tags: - - test-ssh-server - - staging-ssh-server - source_tags: - - test-ssh-clients - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present - register: result -- name: assert changed is true - assert: - that: - - result.changed == true - - "result.kind == 'compute#firewall'" -- name: verify that firewall was created - gcp_compute_firewall_facts: - filters: - - name = {{ resource_name }} +- block: + # Pre-test setup + - name: delete a firewall + gcp_compute_firewall: + name: "{{ resource_name }}" + allowed: + - ip_protocol: tcp + ports: + - '22' + target_tags: + - test-ssh-server + - staging-ssh-server + source_tags: + - test-ssh-clients project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" - scopes: - - https://www.googleapis.com/auth/compute - register: results -- name: verify that command succeeded - assert: - that: - - results['items'] | length == 1 -# ---------------------------------------------------------------------------- -- name: create a firewall that already exists - gcp_compute_firewall: - name: "{{ resource_name }}" - allowed: - - ip_protocol: tcp - ports: - - '22' - target_tags: - - test-ssh-server - - staging-ssh-server - source_tags: - - test-ssh-clients - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present - register: result -- name: assert changed is false - assert: - that: - - result.changed == false - - "result.kind == 'compute#firewall'" -#---------------------------------------------------------- -- name: delete a firewall - gcp_compute_firewall: - name: "{{ resource_name }}" - allowed: - - ip_protocol: tcp - ports: - - '22' - target_tags: - - test-ssh-server - - staging-ssh-server - source_tags: - - test-ssh-clients - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent - register: result -- name: assert changed is true - assert: - that: - - result.changed == true - - result.has_key('kind') == False -- name: verify that firewall was deleted - gcp_compute_firewall_facts: - filters: - - name = {{ resource_name }} + state: absent + #---------------------------------------------------------- + - name: create a firewall + gcp_compute_firewall: + name: "{{ resource_name }}" + allowed: + - ip_protocol: tcp + ports: + - '22' + target_tags: + - test-ssh-server + - staging-ssh-server + source_tags: + - test-ssh-clients project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" - scopes: - - https://www.googleapis.com/auth/compute - register: results -- name: verify that command succeeded - assert: - that: - - results['items'] | length == 0 -# ---------------------------------------------------------------------------- -- name: delete a firewall that does not exist - gcp_compute_firewall: - name: "{{ resource_name }}" - allowed: - - ip_protocol: tcp - ports: - - '22' - target_tags: - - test-ssh-server - - staging-ssh-server - source_tags: - - test-ssh-clients - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent - register: result -- name: assert changed is false - assert: - that: - - result.changed == false - - result.has_key('kind') == False + state: present + register: result + - name: assert changed is true + assert: + that: + - result.changed == true + - "result.kind == 'compute#firewall'" + - name: verify that firewall was created + gcp_compute_firewall_facts: + filters: + - name = {{ resource_name }} + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + scopes: + - https://www.googleapis.com/auth/compute + register: results + - name: verify that command succeeded + assert: + that: + - results['items'] | length == 1 + # ---------------------------------------------------------------------------- + - name: create a firewall that already exists + gcp_compute_firewall: + name: "{{ resource_name }}" + allowed: + - ip_protocol: tcp + ports: + - '22' + target_tags: + - test-ssh-server + - staging-ssh-server + source_tags: + - test-ssh-clients + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present + register: result + - name: assert changed is false + assert: + that: + - result.changed == false + - "result.kind == 'compute#firewall'" + #---------------------------------------------------------- + - name: delete a firewall + gcp_compute_firewall: + name: "{{ resource_name }}" + allowed: + - ip_protocol: tcp + ports: + - '22' + target_tags: + - test-ssh-server + - staging-ssh-server + source_tags: + - test-ssh-clients + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: result + - name: assert changed is true + assert: + that: + - result.changed == true + - result.has_key('kind') == False + - name: verify that firewall was deleted + gcp_compute_firewall_facts: + filters: + - name = {{ resource_name }} + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + scopes: + - https://www.googleapis.com/auth/compute + register: results + - name: verify that command succeeded + assert: + that: + - results['items'] | length == 0 + # ---------------------------------------------------------------------------- + - name: delete a firewall that does not exist + gcp_compute_firewall: + name: "{{ resource_name }}" + allowed: + - ip_protocol: tcp + ports: + - '22' + target_tags: + - test-ssh-server + - staging-ssh-server + source_tags: + - test-ssh-clients + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: result + - name: assert changed is false + assert: + that: + - result.changed == false + - result.has_key('kind') == False diff --git a/test/integration/targets/gcp_compute_forwarding_rule/tasks/main.yml b/test/integration/targets/gcp_compute_forwarding_rule/tasks/main.yml index 58f6da401130be..ed6ac0785105d5 100644 --- a/test/integration/targets/gcp_compute_forwarding_rule/tasks/main.yml +++ b/test/integration/targets/gcp_compute_forwarding_rule/tasks/main.yml @@ -12,163 +12,165 @@ # https://www.github.com/GoogleCloudPlatform/magic-modules # # ---------------------------------------------------------------------------- -# Pre-test setup -- name: create a address - gcp_compute_address: - name: address-forwardingrule - region: us-west1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present - register: address -- name: create a target pool - gcp_compute_target_pool: - name: targetpool-forwardingrule - region: us-west1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present - register: targetpool -- name: delete a forwarding rule - gcp_compute_forwarding_rule: - name: "{{ resource_name }}" - region: us-west1 - target: "{{ targetpool }}" - ip_protocol: TCP - port_range: 80-80 - ip_address: "{{ address.address }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent -#---------------------------------------------------------- -- name: create a forwarding rule - gcp_compute_forwarding_rule: - name: "{{ resource_name }}" - region: us-west1 - target: "{{ targetpool }}" - ip_protocol: TCP - port_range: 80-80 - ip_address: "{{ address.address }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present - register: result -- name: assert changed is true - assert: - that: - - result.changed == true - - "result.kind == 'compute#forwardingRule'" -- name: verify that forwarding_rule was created - gcp_compute_forwarding_rule_facts: - filters: - - name = {{ resource_name }} +- block: + # Pre-test setup + - name: create a address + gcp_compute_address: + name: address-forwardingrule region: us-west1 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" - scopes: - - https://www.googleapis.com/auth/compute - register: results -- name: verify that command succeeded - assert: - that: - - results['items'] | length == 1 -# ---------------------------------------------------------------------------- -- name: create a forwarding rule that already exists - gcp_compute_forwarding_rule: - name: "{{ resource_name }}" - region: us-west1 - target: "{{ targetpool }}" - ip_protocol: TCP - port_range: 80-80 - ip_address: "{{ address.address }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present - register: result -- name: assert changed is false - assert: - that: - - result.changed == false - - "result.kind == 'compute#forwardingRule'" -#---------------------------------------------------------- -- name: delete a forwarding rule - gcp_compute_forwarding_rule: - name: "{{ resource_name }}" - region: us-west1 - target: "{{ targetpool }}" - ip_protocol: TCP - port_range: 80-80 - ip_address: "{{ address.address }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent - register: result -- name: assert changed is true - assert: - that: - - result.changed == true - - result.has_key('kind') == False -- name: verify that forwarding_rule was deleted - gcp_compute_forwarding_rule_facts: - filters: - - name = {{ resource_name }} + state: present + register: address + - name: create a target pool + gcp_compute_target_pool: + name: targetpool-forwardingrule region: us-west1 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" - scopes: - - https://www.googleapis.com/auth/compute - register: results -- name: verify that command succeeded - assert: - that: - - results['items'] | length == 0 -# ---------------------------------------------------------------------------- -- name: delete a forwarding rule that does not exist - gcp_compute_forwarding_rule: - name: "{{ resource_name }}" - region: us-west1 - target: "{{ targetpool }}" - ip_protocol: TCP - port_range: 80-80 - ip_address: "{{ address.address }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent - register: result -- name: assert changed is false - assert: - that: - - result.changed == false - - result.has_key('kind') == False -#--------------------------------------------------------- -# Post-test teardown -# If errors happen, don't crash the playbook! -- name: delete a target pool - gcp_compute_target_pool: - name: targetpool-forwardingrule - region: us-west1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent - register: targetpool - ignore_errors: true -- name: delete a address - gcp_compute_address: - name: address-forwardingrule - region: us-west1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent - register: address - ignore_errors: true + state: present + register: targetpool + - name: delete a forwarding rule + gcp_compute_forwarding_rule: + name: "{{ resource_name }}" + region: us-west1 + target: "{{ targetpool }}" + ip_protocol: TCP + port_range: 80-80 + ip_address: "{{ address.address }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + #---------------------------------------------------------- + - name: create a forwarding rule + gcp_compute_forwarding_rule: + name: "{{ resource_name }}" + region: us-west1 + target: "{{ targetpool }}" + ip_protocol: TCP + port_range: 80-80 + ip_address: "{{ address.address }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present + register: result + - name: assert changed is true + assert: + that: + - result.changed == true + - "result.kind == 'compute#forwardingRule'" + - name: verify that forwarding_rule was created + gcp_compute_forwarding_rule_facts: + filters: + - name = {{ resource_name }} + region: us-west1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + scopes: + - https://www.googleapis.com/auth/compute + register: results + - name: verify that command succeeded + assert: + that: + - results['items'] | length == 1 + # ---------------------------------------------------------------------------- + - name: create a forwarding rule that already exists + gcp_compute_forwarding_rule: + name: "{{ resource_name }}" + region: us-west1 + target: "{{ targetpool }}" + ip_protocol: TCP + port_range: 80-80 + ip_address: "{{ address.address }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present + register: result + - name: assert changed is false + assert: + that: + - result.changed == false + - "result.kind == 'compute#forwardingRule'" + #---------------------------------------------------------- + - name: delete a forwarding rule + gcp_compute_forwarding_rule: + name: "{{ resource_name }}" + region: us-west1 + target: "{{ targetpool }}" + ip_protocol: TCP + port_range: 80-80 + ip_address: "{{ address.address }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: result + - name: assert changed is true + assert: + that: + - result.changed == true + - result.has_key('kind') == False + - name: verify that forwarding_rule was deleted + gcp_compute_forwarding_rule_facts: + filters: + - name = {{ resource_name }} + region: us-west1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + scopes: + - https://www.googleapis.com/auth/compute + register: results + - name: verify that command succeeded + assert: + that: + - results['items'] | length == 0 + # ---------------------------------------------------------------------------- + - name: delete a forwarding rule that does not exist + gcp_compute_forwarding_rule: + name: "{{ resource_name }}" + region: us-west1 + target: "{{ targetpool }}" + ip_protocol: TCP + port_range: 80-80 + ip_address: "{{ address.address }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: result + - name: assert changed is false + assert: + that: + - result.changed == false + - result.has_key('kind') == False + always: + #--------------------------------------------------------- + # Post-test teardown + # If errors happen, don't crash the playbook! + - name: delete a target pool + gcp_compute_target_pool: + name: targetpool-forwardingrule + region: us-west1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: targetpool + ignore_errors: true + - name: delete a address + gcp_compute_address: + name: address-forwardingrule + region: us-west1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: address + ignore_errors: true diff --git a/test/integration/targets/gcp_compute_global_address/tasks/main.yml b/test/integration/targets/gcp_compute_global_address/tasks/main.yml index 65940d4e181743..f51e2de3ba999f 100644 --- a/test/integration/targets/gcp_compute_global_address/tasks/main.yml +++ b/test/integration/targets/gcp_compute_global_address/tasks/main.yml @@ -12,95 +12,96 @@ # https://www.github.com/GoogleCloudPlatform/magic-modules # # ---------------------------------------------------------------------------- -# Pre-test setup -- name: delete a global address - gcp_compute_global_address: - name: "{{ resource_name }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent -#---------------------------------------------------------- -- name: create a global address - gcp_compute_global_address: - name: "{{ resource_name }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present - register: result -- name: assert changed is true - assert: - that: - - result.changed == true - - "result.kind == 'compute#address'" -- name: verify that global_address was created - gcp_compute_global_address_facts: - filters: - - name = {{ resource_name }} +- block: + # Pre-test setup + - name: delete a global address + gcp_compute_global_address: + name: "{{ resource_name }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" - scopes: - - https://www.googleapis.com/auth/compute - register: results -- name: verify that command succeeded - assert: - that: - - results['items'] | length == 1 -# ---------------------------------------------------------------------------- -- name: create a global address that already exists - gcp_compute_global_address: - name: "{{ resource_name }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present - register: result -- name: assert changed is false - assert: - that: - - result.changed == false - - "result.kind == 'compute#address'" -#---------------------------------------------------------- -- name: delete a global address - gcp_compute_global_address: - name: "{{ resource_name }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent - register: result -- name: assert changed is true - assert: - that: - - result.changed == true - - result.has_key('kind') == False -- name: verify that global_address was deleted - gcp_compute_global_address_facts: - filters: - - name = {{ resource_name }} + state: absent + #---------------------------------------------------------- + - name: create a global address + gcp_compute_global_address: + name: "{{ resource_name }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" - scopes: - - https://www.googleapis.com/auth/compute - register: results -- name: verify that command succeeded - assert: - that: - - results['items'] | length == 0 -# ---------------------------------------------------------------------------- -- name: delete a global address that does not exist - gcp_compute_global_address: - name: "{{ resource_name }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent - register: result -- name: assert changed is false - assert: - that: - - result.changed == false - - result.has_key('kind') == False + state: present + register: result + - name: assert changed is true + assert: + that: + - result.changed == true + - "result.kind == 'compute#address'" + - name: verify that global_address was created + gcp_compute_global_address_facts: + filters: + - name = {{ resource_name }} + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + scopes: + - https://www.googleapis.com/auth/compute + register: results + - name: verify that command succeeded + assert: + that: + - results['items'] | length == 1 + # ---------------------------------------------------------------------------- + - name: create a global address that already exists + gcp_compute_global_address: + name: "{{ resource_name }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present + register: result + - name: assert changed is false + assert: + that: + - result.changed == false + - "result.kind == 'compute#address'" + #---------------------------------------------------------- + - name: delete a global address + gcp_compute_global_address: + name: "{{ resource_name }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: result + - name: assert changed is true + assert: + that: + - result.changed == true + - result.has_key('kind') == False + - name: verify that global_address was deleted + gcp_compute_global_address_facts: + filters: + - name = {{ resource_name }} + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + scopes: + - https://www.googleapis.com/auth/compute + register: results + - name: verify that command succeeded + assert: + that: + - results['items'] | length == 0 + # ---------------------------------------------------------------------------- + - name: delete a global address that does not exist + gcp_compute_global_address: + name: "{{ resource_name }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: result + - name: assert changed is false + assert: + that: + - result.changed == false + - result.has_key('kind') == False diff --git a/test/integration/targets/gcp_compute_global_forwarding_rule/tasks/main.yml b/test/integration/targets/gcp_compute_global_forwarding_rule/tasks/main.yml index ca636248437d1e..aecdb81802e535 100644 --- a/test/integration/targets/gcp_compute_global_forwarding_rule/tasks/main.yml +++ b/test/integration/targets/gcp_compute_global_forwarding_rule/tasks/main.yml @@ -12,244 +12,246 @@ # https://www.github.com/GoogleCloudPlatform/magic-modules # # ---------------------------------------------------------------------------- -# Pre-test setup -- name: create a global address - gcp_compute_global_address: - name: globaladdress-globalforwardingrule - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present - register: globaladdress -- name: create a instance group - gcp_compute_instance_group: - name: instancegroup-globalforwardingrule - zone: us-central1-a - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present - register: instancegroup -- name: create a http health check - gcp_compute_http_health_check: - name: httphealthcheck-globalforwardingrule - healthy_threshold: 10 - port: 8080 - timeout_sec: 2 - unhealthy_threshold: 5 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present - register: healthcheck -- name: create a backend service - gcp_compute_backend_service: - name: backendservice-globalforwardingrule - 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 - register: backendservice -- name: create a url map - gcp_compute_url_map: - name: urlmap-globalforwardingrule - default_service: "{{ backendservice }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present - register: urlmap -- name: create a target http proxy - gcp_compute_target_http_proxy: - name: targethttpproxy-globalforwardingrule - url_map: "{{ urlmap }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present - register: httpproxy -- name: delete a global forwarding rule - gcp_compute_global_forwarding_rule: - name: "{{ resource_name }}" - ip_address: "{{ globaladdress.address }}" - ip_protocol: TCP - port_range: 80-80 - target: "{{ httpproxy.selfLink }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent -#---------------------------------------------------------- -- name: create a global forwarding rule - gcp_compute_global_forwarding_rule: - name: "{{ resource_name }}" - ip_address: "{{ globaladdress.address }}" - ip_protocol: TCP - port_range: 80-80 - target: "{{ httpproxy.selfLink }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present - register: result -- name: assert changed is true - assert: - that: - - result.changed == true - - "result.kind == 'compute#forwardingRule'" -- name: verify that global_forwarding_rule was created - gcp_compute_global_forwarding_rule_facts: - filters: - - name = {{ resource_name }} - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - scopes: - - https://www.googleapis.com/auth/compute - register: results -- name: verify that command succeeded - assert: - that: - - results['items'] | length == 1 -# ---------------------------------------------------------------------------- -- name: create a global forwarding rule that already exists - gcp_compute_global_forwarding_rule: - name: "{{ resource_name }}" - ip_address: "{{ globaladdress.address }}" - ip_protocol: TCP - port_range: 80-80 - target: "{{ httpproxy.selfLink }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present - register: result -- name: assert changed is false - assert: - that: - - result.changed == false - - "result.kind == 'compute#forwardingRule'" -#---------------------------------------------------------- -- name: delete a global forwarding rule - gcp_compute_global_forwarding_rule: - name: "{{ resource_name }}" - ip_address: "{{ globaladdress.address }}" - ip_protocol: TCP - port_range: 80-80 - target: "{{ httpproxy.selfLink }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent - register: result -- name: assert changed is true - assert: - that: - - result.changed == true - - result.has_key('kind') == False -- name: verify that global_forwarding_rule was deleted - gcp_compute_global_forwarding_rule_facts: - filters: - - name = {{ resource_name }} - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - scopes: - - https://www.googleapis.com/auth/compute - register: results -- name: verify that command succeeded - assert: - that: - - results['items'] | length == 0 -# ---------------------------------------------------------------------------- -- name: delete a global forwarding rule that does not exist - gcp_compute_global_forwarding_rule: - name: "{{ resource_name }}" - ip_address: "{{ globaladdress.address }}" - ip_protocol: TCP - port_range: 80-80 - target: "{{ httpproxy.selfLink }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent - register: result -- name: assert changed is false - assert: - that: - - result.changed == false - - result.has_key('kind') == False -#--------------------------------------------------------- -# Post-test teardown -# If errors happen, don't crash the playbook! -- name: delete a target http proxy - gcp_compute_target_http_proxy: - name: targethttpproxy-globalforwardingrule - url_map: "{{ urlmap }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent - register: httpproxy - ignore_errors: true -- name: delete a url map - gcp_compute_url_map: - name: urlmap-globalforwardingrule - default_service: "{{ backendservice }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent - register: urlmap - ignore_errors: true -- name: delete a backend service - gcp_compute_backend_service: - name: backendservice-globalforwardingrule - 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 - register: backendservice - ignore_errors: true -- name: delete a http health check - gcp_compute_http_health_check: - name: httphealthcheck-globalforwardingrule - healthy_threshold: 10 - port: 8080 - timeout_sec: 2 - unhealthy_threshold: 5 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent - register: healthcheck - ignore_errors: true -- name: delete a instance group - gcp_compute_instance_group: - name: instancegroup-globalforwardingrule - zone: us-central1-a - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent - register: instancegroup - ignore_errors: true -- name: delete a global address - gcp_compute_global_address: - name: globaladdress-globalforwardingrule - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent - register: globaladdress - ignore_errors: true +- block: + # Pre-test setup + - name: create a global address + gcp_compute_global_address: + name: globaladdress-globalforwardingrule + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present + register: globaladdress + - name: create a instance group + gcp_compute_instance_group: + name: instancegroup-globalforwardingrule + zone: us-central1-a + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present + register: instancegroup + - name: create a http health check + gcp_compute_http_health_check: + name: httphealthcheck-globalforwardingrule + healthy_threshold: 10 + port: 8080 + timeout_sec: 2 + unhealthy_threshold: 5 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present + register: healthcheck + - name: create a backend service + gcp_compute_backend_service: + name: backendservice-globalforwardingrule + 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 + register: backendservice + - name: create a url map + gcp_compute_url_map: + name: urlmap-globalforwardingrule + default_service: "{{ backendservice }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present + register: urlmap + - name: create a target http proxy + gcp_compute_target_http_proxy: + name: targethttpproxy-globalforwardingrule + url_map: "{{ urlmap }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present + register: httpproxy + - name: delete a global forwarding rule + gcp_compute_global_forwarding_rule: + name: "{{ resource_name }}" + ip_address: "{{ globaladdress.address }}" + ip_protocol: TCP + port_range: 80-80 + target: "{{ httpproxy.selfLink }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + #---------------------------------------------------------- + - name: create a global forwarding rule + gcp_compute_global_forwarding_rule: + name: "{{ resource_name }}" + ip_address: "{{ globaladdress.address }}" + ip_protocol: TCP + port_range: 80-80 + target: "{{ httpproxy.selfLink }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present + register: result + - name: assert changed is true + assert: + that: + - result.changed == true + - "result.kind == 'compute#forwardingRule'" + - name: verify that global_forwarding_rule was created + gcp_compute_global_forwarding_rule_facts: + filters: + - name = {{ resource_name }} + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + scopes: + - https://www.googleapis.com/auth/compute + register: results + - name: verify that command succeeded + assert: + that: + - results['items'] | length == 1 + # ---------------------------------------------------------------------------- + - name: create a global forwarding rule that already exists + gcp_compute_global_forwarding_rule: + name: "{{ resource_name }}" + ip_address: "{{ globaladdress.address }}" + ip_protocol: TCP + port_range: 80-80 + target: "{{ httpproxy.selfLink }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present + register: result + - name: assert changed is false + assert: + that: + - result.changed == false + - "result.kind == 'compute#forwardingRule'" + #---------------------------------------------------------- + - name: delete a global forwarding rule + gcp_compute_global_forwarding_rule: + name: "{{ resource_name }}" + ip_address: "{{ globaladdress.address }}" + ip_protocol: TCP + port_range: 80-80 + target: "{{ httpproxy.selfLink }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: result + - name: assert changed is true + assert: + that: + - result.changed == true + - result.has_key('kind') == False + - name: verify that global_forwarding_rule was deleted + gcp_compute_global_forwarding_rule_facts: + filters: + - name = {{ resource_name }} + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + scopes: + - https://www.googleapis.com/auth/compute + register: results + - name: verify that command succeeded + assert: + that: + - results['items'] | length == 0 + # ---------------------------------------------------------------------------- + - name: delete a global forwarding rule that does not exist + gcp_compute_global_forwarding_rule: + name: "{{ resource_name }}" + ip_address: "{{ globaladdress.address }}" + ip_protocol: TCP + port_range: 80-80 + target: "{{ httpproxy.selfLink }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: result + - name: assert changed is false + assert: + that: + - result.changed == false + - result.has_key('kind') == False + always: + #--------------------------------------------------------- + # Post-test teardown + # If errors happen, don't crash the playbook! + - name: delete a target http proxy + gcp_compute_target_http_proxy: + name: targethttpproxy-globalforwardingrule + url_map: "{{ urlmap }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: httpproxy + ignore_errors: true + - name: delete a url map + gcp_compute_url_map: + name: urlmap-globalforwardingrule + default_service: "{{ backendservice }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: urlmap + ignore_errors: true + - name: delete a backend service + gcp_compute_backend_service: + name: backendservice-globalforwardingrule + 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 + register: backendservice + ignore_errors: true + - name: delete a http health check + gcp_compute_http_health_check: + name: httphealthcheck-globalforwardingrule + healthy_threshold: 10 + port: 8080 + timeout_sec: 2 + unhealthy_threshold: 5 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: healthcheck + ignore_errors: true + - name: delete a instance group + gcp_compute_instance_group: + name: instancegroup-globalforwardingrule + zone: us-central1-a + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: instancegroup + ignore_errors: true + - name: delete a global address + gcp_compute_global_address: + name: globaladdress-globalforwardingrule + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: globaladdress + ignore_errors: true diff --git a/test/integration/targets/gcp_compute_health_check/tasks/main.yml b/test/integration/targets/gcp_compute_health_check/tasks/main.yml index 833a2288ebca66..9fb991d6ffeb06 100644 --- a/test/integration/targets/gcp_compute_health_check/tasks/main.yml +++ b/test/integration/targets/gcp_compute_health_check/tasks/main.yml @@ -12,135 +12,136 @@ # https://www.github.com/GoogleCloudPlatform/magic-modules # # ---------------------------------------------------------------------------- -# Pre-test setup -- name: delete a health check - gcp_compute_health_check: - name: "{{ resource_name }}" - type: TCP - tcp_health_check: - port_name: service-health - request: ping - response: pong - healthy_threshold: 10 - timeout_sec: 2 - unhealthy_threshold: 5 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent -#---------------------------------------------------------- -- name: create a health check - gcp_compute_health_check: - name: "{{ resource_name }}" - type: TCP - tcp_health_check: - port_name: service-health - request: ping - response: pong - healthy_threshold: 10 - timeout_sec: 2 - unhealthy_threshold: 5 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present - register: result -- name: assert changed is true - assert: - that: - - result.changed == true - - "result.kind == 'compute#healthCheck'" -- name: verify that health_check was created - gcp_compute_health_check_facts: - filters: - - name = {{ resource_name }} +- block: + # Pre-test setup + - name: delete a health check + gcp_compute_health_check: + name: "{{ resource_name }}" + type: TCP + tcp_health_check: + port_name: service-health + request: ping + response: pong + healthy_threshold: 10 + timeout_sec: 2 + unhealthy_threshold: 5 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" - scopes: - - https://www.googleapis.com/auth/compute - register: results -- name: verify that command succeeded - assert: - that: - - results['items'] | length == 1 -# ---------------------------------------------------------------------------- -- name: create a health check that already exists - gcp_compute_health_check: - name: "{{ resource_name }}" - type: TCP - tcp_health_check: - port_name: service-health - request: ping - response: pong - healthy_threshold: 10 - timeout_sec: 2 - unhealthy_threshold: 5 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present - register: result -- name: assert changed is false - assert: - that: - - result.changed == false - - "result.kind == 'compute#healthCheck'" -#---------------------------------------------------------- -- name: delete a health check - gcp_compute_health_check: - name: "{{ resource_name }}" - type: TCP - tcp_health_check: - port_name: service-health - request: ping - response: pong - healthy_threshold: 10 - timeout_sec: 2 - unhealthy_threshold: 5 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent - register: result -- name: assert changed is true - assert: - that: - - result.changed == true - - result.has_key('kind') == False -- name: verify that health_check was deleted - gcp_compute_health_check_facts: - filters: - - name = {{ resource_name }} + state: absent + #---------------------------------------------------------- + - name: create a health check + gcp_compute_health_check: + name: "{{ resource_name }}" + type: TCP + tcp_health_check: + port_name: service-health + request: ping + response: pong + healthy_threshold: 10 + timeout_sec: 2 + unhealthy_threshold: 5 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" - scopes: - - https://www.googleapis.com/auth/compute - register: results -- name: verify that command succeeded - assert: - that: - - results['items'] | length == 0 -# ---------------------------------------------------------------------------- -- name: delete a health check that does not exist - gcp_compute_health_check: - name: "{{ resource_name }}" - type: TCP - tcp_health_check: - port_name: service-health - request: ping - response: pong - healthy_threshold: 10 - timeout_sec: 2 - unhealthy_threshold: 5 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent - register: result -- name: assert changed is false - assert: - that: - - result.changed == false - - result.has_key('kind') == False + state: present + register: result + - name: assert changed is true + assert: + that: + - result.changed == true + - "result.kind == 'compute#healthCheck'" + - name: verify that health_check was created + gcp_compute_health_check_facts: + filters: + - name = {{ resource_name }} + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + scopes: + - https://www.googleapis.com/auth/compute + register: results + - name: verify that command succeeded + assert: + that: + - results['items'] | length == 1 + # ---------------------------------------------------------------------------- + - name: create a health check that already exists + gcp_compute_health_check: + name: "{{ resource_name }}" + type: TCP + tcp_health_check: + port_name: service-health + request: ping + response: pong + healthy_threshold: 10 + timeout_sec: 2 + unhealthy_threshold: 5 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present + register: result + - name: assert changed is false + assert: + that: + - result.changed == false + - "result.kind == 'compute#healthCheck'" + #---------------------------------------------------------- + - name: delete a health check + gcp_compute_health_check: + name: "{{ resource_name }}" + type: TCP + tcp_health_check: + port_name: service-health + request: ping + response: pong + healthy_threshold: 10 + timeout_sec: 2 + unhealthy_threshold: 5 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: result + - name: assert changed is true + assert: + that: + - result.changed == true + - result.has_key('kind') == False + - name: verify that health_check was deleted + gcp_compute_health_check_facts: + filters: + - name = {{ resource_name }} + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + scopes: + - https://www.googleapis.com/auth/compute + register: results + - name: verify that command succeeded + assert: + that: + - results['items'] | length == 0 + # ---------------------------------------------------------------------------- + - name: delete a health check that does not exist + gcp_compute_health_check: + name: "{{ resource_name }}" + type: TCP + tcp_health_check: + port_name: service-health + request: ping + response: pong + healthy_threshold: 10 + timeout_sec: 2 + unhealthy_threshold: 5 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: result + - name: assert changed is false + assert: + that: + - result.changed == false + - result.has_key('kind') == False diff --git a/test/integration/targets/gcp_compute_http_health_check/tasks/main.yml b/test/integration/targets/gcp_compute_http_health_check/tasks/main.yml index 9d424e3ff0cde1..87956744d43fff 100644 --- a/test/integration/targets/gcp_compute_http_health_check/tasks/main.yml +++ b/test/integration/targets/gcp_compute_http_health_check/tasks/main.yml @@ -12,115 +12,116 @@ # https://www.github.com/GoogleCloudPlatform/magic-modules # # ---------------------------------------------------------------------------- -# Pre-test setup -- name: delete a http health check - gcp_compute_http_health_check: - name: "{{ resource_name }}" - healthy_threshold: 10 - port: 8080 - timeout_sec: 2 - unhealthy_threshold: 5 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent -#---------------------------------------------------------- -- name: create a http health check - gcp_compute_http_health_check: - name: "{{ resource_name }}" - healthy_threshold: 10 - port: 8080 - timeout_sec: 2 - unhealthy_threshold: 5 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present - register: result -- name: assert changed is true - assert: - that: - - result.changed == true - - "result.kind == 'compute#httpHealthCheck'" -- name: verify that http_health_check was created - gcp_compute_http_health_check_facts: - filters: - - name = {{ resource_name }} +- block: + # Pre-test setup + - name: delete a http health check + gcp_compute_http_health_check: + name: "{{ resource_name }}" + healthy_threshold: 10 + port: 8080 + timeout_sec: 2 + unhealthy_threshold: 5 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" - scopes: - - https://www.googleapis.com/auth/compute - register: results -- name: verify that command succeeded - assert: - that: - - results['items'] | length == 1 -# ---------------------------------------------------------------------------- -- name: create a http health check that already exists - gcp_compute_http_health_check: - name: "{{ resource_name }}" - healthy_threshold: 10 - port: 8080 - timeout_sec: 2 - unhealthy_threshold: 5 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present - register: result -- name: assert changed is false - assert: - that: - - result.changed == false - - "result.kind == 'compute#httpHealthCheck'" -#---------------------------------------------------------- -- name: delete a http health check - gcp_compute_http_health_check: - name: "{{ resource_name }}" - healthy_threshold: 10 - port: 8080 - timeout_sec: 2 - unhealthy_threshold: 5 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent - register: result -- name: assert changed is true - assert: - that: - - result.changed == true - - result.has_key('kind') == False -- name: verify that http_health_check was deleted - gcp_compute_http_health_check_facts: - filters: - - name = {{ resource_name }} + state: absent + #---------------------------------------------------------- + - name: create a http health check + gcp_compute_http_health_check: + name: "{{ resource_name }}" + healthy_threshold: 10 + port: 8080 + timeout_sec: 2 + unhealthy_threshold: 5 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" - scopes: - - https://www.googleapis.com/auth/compute - register: results -- name: verify that command succeeded - assert: - that: - - results['items'] | length == 0 -# ---------------------------------------------------------------------------- -- name: delete a http health check that does not exist - gcp_compute_http_health_check: - name: "{{ resource_name }}" - healthy_threshold: 10 - port: 8080 - timeout_sec: 2 - unhealthy_threshold: 5 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent - register: result -- name: assert changed is false - assert: - that: - - result.changed == false - - result.has_key('kind') == False + state: present + register: result + - name: assert changed is true + assert: + that: + - result.changed == true + - "result.kind == 'compute#httpHealthCheck'" + - name: verify that http_health_check was created + gcp_compute_http_health_check_facts: + filters: + - name = {{ resource_name }} + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + scopes: + - https://www.googleapis.com/auth/compute + register: results + - name: verify that command succeeded + assert: + that: + - results['items'] | length == 1 + # ---------------------------------------------------------------------------- + - name: create a http health check that already exists + gcp_compute_http_health_check: + name: "{{ resource_name }}" + healthy_threshold: 10 + port: 8080 + timeout_sec: 2 + unhealthy_threshold: 5 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present + register: result + - name: assert changed is false + assert: + that: + - result.changed == false + - "result.kind == 'compute#httpHealthCheck'" + #---------------------------------------------------------- + - name: delete a http health check + gcp_compute_http_health_check: + name: "{{ resource_name }}" + healthy_threshold: 10 + port: 8080 + timeout_sec: 2 + unhealthy_threshold: 5 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: result + - name: assert changed is true + assert: + that: + - result.changed == true + - result.has_key('kind') == False + - name: verify that http_health_check was deleted + gcp_compute_http_health_check_facts: + filters: + - name = {{ resource_name }} + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + scopes: + - https://www.googleapis.com/auth/compute + register: results + - name: verify that command succeeded + assert: + that: + - results['items'] | length == 0 + # ---------------------------------------------------------------------------- + - name: delete a http health check that does not exist + gcp_compute_http_health_check: + name: "{{ resource_name }}" + healthy_threshold: 10 + port: 8080 + timeout_sec: 2 + unhealthy_threshold: 5 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: result + - name: assert changed is false + assert: + that: + - result.changed == false + - result.has_key('kind') == False diff --git a/test/integration/targets/gcp_compute_https_health_check/tasks/main.yml b/test/integration/targets/gcp_compute_https_health_check/tasks/main.yml index ca205e01b2d5e5..b1c56f10e25720 100644 --- a/test/integration/targets/gcp_compute_https_health_check/tasks/main.yml +++ b/test/integration/targets/gcp_compute_https_health_check/tasks/main.yml @@ -12,115 +12,116 @@ # https://www.github.com/GoogleCloudPlatform/magic-modules # # ---------------------------------------------------------------------------- -# Pre-test setup -- name: delete a https health check - gcp_compute_https_health_check: - name: "{{ resource_name }}" - healthy_threshold: 10 - port: 8080 - timeout_sec: 2 - unhealthy_threshold: 5 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent -#---------------------------------------------------------- -- name: create a https health check - gcp_compute_https_health_check: - name: "{{ resource_name }}" - healthy_threshold: 10 - port: 8080 - timeout_sec: 2 - unhealthy_threshold: 5 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present - register: result -- name: assert changed is true - assert: - that: - - result.changed == true - - "result.kind == 'compute#httpsHealthCheck'" -- name: verify that https_health_check was created - gcp_compute_https_health_check_facts: - filters: - - name = {{ resource_name }} +- block: + # Pre-test setup + - name: delete a https health check + gcp_compute_https_health_check: + name: "{{ resource_name }}" + healthy_threshold: 10 + port: 8080 + timeout_sec: 2 + unhealthy_threshold: 5 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" - scopes: - - https://www.googleapis.com/auth/compute - register: results -- name: verify that command succeeded - assert: - that: - - results['items'] | length == 1 -# ---------------------------------------------------------------------------- -- name: create a https health check that already exists - gcp_compute_https_health_check: - name: "{{ resource_name }}" - healthy_threshold: 10 - port: 8080 - timeout_sec: 2 - unhealthy_threshold: 5 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present - register: result -- name: assert changed is false - assert: - that: - - result.changed == false - - "result.kind == 'compute#httpsHealthCheck'" -#---------------------------------------------------------- -- name: delete a https health check - gcp_compute_https_health_check: - name: "{{ resource_name }}" - healthy_threshold: 10 - port: 8080 - timeout_sec: 2 - unhealthy_threshold: 5 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent - register: result -- name: assert changed is true - assert: - that: - - result.changed == true - - result.has_key('kind') == False -- name: verify that https_health_check was deleted - gcp_compute_https_health_check_facts: - filters: - - name = {{ resource_name }} + state: absent + #---------------------------------------------------------- + - name: create a https health check + gcp_compute_https_health_check: + name: "{{ resource_name }}" + healthy_threshold: 10 + port: 8080 + timeout_sec: 2 + unhealthy_threshold: 5 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" - scopes: - - https://www.googleapis.com/auth/compute - register: results -- name: verify that command succeeded - assert: - that: - - results['items'] | length == 0 -# ---------------------------------------------------------------------------- -- name: delete a https health check that does not exist - gcp_compute_https_health_check: - name: "{{ resource_name }}" - healthy_threshold: 10 - port: 8080 - timeout_sec: 2 - unhealthy_threshold: 5 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent - register: result -- name: assert changed is false - assert: - that: - - result.changed == false - - result.has_key('kind') == False + state: present + register: result + - name: assert changed is true + assert: + that: + - result.changed == true + - "result.kind == 'compute#httpsHealthCheck'" + - name: verify that https_health_check was created + gcp_compute_https_health_check_facts: + filters: + - name = {{ resource_name }} + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + scopes: + - https://www.googleapis.com/auth/compute + register: results + - name: verify that command succeeded + assert: + that: + - results['items'] | length == 1 + # ---------------------------------------------------------------------------- + - name: create a https health check that already exists + gcp_compute_https_health_check: + name: "{{ resource_name }}" + healthy_threshold: 10 + port: 8080 + timeout_sec: 2 + unhealthy_threshold: 5 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present + register: result + - name: assert changed is false + assert: + that: + - result.changed == false + - "result.kind == 'compute#httpsHealthCheck'" + #---------------------------------------------------------- + - name: delete a https health check + gcp_compute_https_health_check: + name: "{{ resource_name }}" + healthy_threshold: 10 + port: 8080 + timeout_sec: 2 + unhealthy_threshold: 5 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: result + - name: assert changed is true + assert: + that: + - result.changed == true + - result.has_key('kind') == False + - name: verify that https_health_check was deleted + gcp_compute_https_health_check_facts: + filters: + - name = {{ resource_name }} + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + scopes: + - https://www.googleapis.com/auth/compute + register: results + - name: verify that command succeeded + assert: + that: + - results['items'] | length == 0 + # ---------------------------------------------------------------------------- + - name: delete a https health check that does not exist + gcp_compute_https_health_check: + name: "{{ resource_name }}" + healthy_threshold: 10 + port: 8080 + timeout_sec: 2 + unhealthy_threshold: 5 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: result + - name: assert changed is false + assert: + that: + - result.changed == false + - result.has_key('kind') == False diff --git a/test/integration/targets/gcp_compute_image/tasks/main.yml b/test/integration/targets/gcp_compute_image/tasks/main.yml index fae58eac1d2002..dd41655fc38bf0 100644 --- a/test/integration/targets/gcp_compute_image/tasks/main.yml +++ b/test/integration/targets/gcp_compute_image/tasks/main.yml @@ -12,122 +12,124 @@ # https://www.github.com/GoogleCloudPlatform/magic-modules # # ---------------------------------------------------------------------------- -# Pre-test setup -- name: create a disk - gcp_compute_disk: - name: disk-image - zone: us-central1-a - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present - register: disk -- name: delete a image - gcp_compute_image: - name: "{{ resource_name }}" - source_disk: "{{ disk }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent -#---------------------------------------------------------- -- name: create a image - gcp_compute_image: - name: "{{ resource_name }}" - source_disk: "{{ disk }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present - register: result -- name: assert changed is true - assert: - that: - - result.changed == true - - "result.kind == 'compute#image'" -- name: verify that image was created - gcp_compute_image_facts: - filters: - - name = {{ resource_name }} +- block: + # Pre-test setup + - name: create a disk + gcp_compute_disk: + name: disk-image + zone: us-central1-a project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" - scopes: - - https://www.googleapis.com/auth/compute - register: results -- name: verify that command succeeded - assert: - that: - - results['items'] | length == 1 -# ---------------------------------------------------------------------------- -- name: create a image that already exists - gcp_compute_image: - name: "{{ resource_name }}" - source_disk: "{{ disk }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present - register: result -- name: assert changed is false - assert: - that: - - result.changed == false - - "result.kind == 'compute#image'" -#---------------------------------------------------------- -- name: delete a image - gcp_compute_image: - name: "{{ resource_name }}" - source_disk: "{{ disk }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent - register: result -- name: assert changed is true - assert: - that: - - result.changed == true - - result.has_key('kind') == False -- name: verify that image was deleted - gcp_compute_image_facts: - filters: - - name = {{ resource_name }} + state: present + register: disk + - name: delete a image + gcp_compute_image: + name: "{{ resource_name }}" + source_disk: "{{ disk }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" - scopes: - - https://www.googleapis.com/auth/compute - register: results -- name: verify that command succeeded - assert: - that: - - results['items'] | length == 0 -# ---------------------------------------------------------------------------- -- name: delete a image that does not exist - gcp_compute_image: - name: "{{ resource_name }}" - source_disk: "{{ disk }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent - register: result -- name: assert changed is false - assert: - that: - - result.changed == false - - result.has_key('kind') == False -#--------------------------------------------------------- -# Post-test teardown -# If errors happen, don't crash the playbook! -- name: delete a disk - gcp_compute_disk: - name: disk-image - zone: us-central1-a - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent - register: disk - ignore_errors: true + state: absent + #---------------------------------------------------------- + - name: create a image + gcp_compute_image: + name: "{{ resource_name }}" + source_disk: "{{ disk }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present + register: result + - name: assert changed is true + assert: + that: + - result.changed == true + - "result.kind == 'compute#image'" + - name: verify that image was created + gcp_compute_image_facts: + filters: + - name = {{ resource_name }} + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + scopes: + - https://www.googleapis.com/auth/compute + register: results + - name: verify that command succeeded + assert: + that: + - results['items'] | length == 1 + # ---------------------------------------------------------------------------- + - name: create a image that already exists + gcp_compute_image: + name: "{{ resource_name }}" + source_disk: "{{ disk }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present + register: result + - name: assert changed is false + assert: + that: + - result.changed == false + - "result.kind == 'compute#image'" + #---------------------------------------------------------- + - name: delete a image + gcp_compute_image: + name: "{{ resource_name }}" + source_disk: "{{ disk }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: result + - name: assert changed is true + assert: + that: + - result.changed == true + - result.has_key('kind') == False + - name: verify that image was deleted + gcp_compute_image_facts: + filters: + - name = {{ resource_name }} + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + scopes: + - https://www.googleapis.com/auth/compute + register: results + - name: verify that command succeeded + assert: + that: + - results['items'] | length == 0 + # ---------------------------------------------------------------------------- + - name: delete a image that does not exist + gcp_compute_image: + name: "{{ resource_name }}" + source_disk: "{{ disk }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: result + - name: assert changed is false + assert: + that: + - result.changed == false + - result.has_key('kind') == False + always: + #--------------------------------------------------------- + # Post-test teardown + # If errors happen, don't crash the playbook! + - name: delete a disk + gcp_compute_disk: + name: disk-image + zone: us-central1-a + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: disk + ignore_errors: true diff --git a/test/integration/targets/gcp_compute_instance/tasks/main.yml b/test/integration/targets/gcp_compute_instance/tasks/main.yml index 1bb8d670d28367..90b4b35a3d6a85 100644 --- a/test/integration/targets/gcp_compute_instance/tasks/main.yml +++ b/test/integration/targets/gcp_compute_instance/tasks/main.yml @@ -12,234 +12,236 @@ # https://www.github.com/GoogleCloudPlatform/magic-modules # # ---------------------------------------------------------------------------- -# Pre-test setup -- name: create a disk - gcp_compute_disk: - name: disk-instance - size_gb: 50 - source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-1604-lts - zone: us-central1-a - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present - register: disk -- name: create a network - gcp_compute_network: - name: network-instance - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present - register: network -- name: create a address - gcp_compute_address: - name: address-instance - region: us-central1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present - register: address -- name: delete a instance - gcp_compute_instance: - name: "{{ resource_name }}" - machine_type: n1-standard-1 - disks: - - auto_delete: 'true' - boot: 'true' - source: "{{ disk }}" - metadata: - startup-script-url: gs:://graphite-playground/bootstrap.sh - cost-center: '12345' - network_interfaces: - - network: "{{ network }}" - access_configs: - - name: External NAT - nat_ip: "{{ address }}" - type: ONE_TO_ONE_NAT - zone: us-central1-a - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent -#---------------------------------------------------------- -- name: create a instance - gcp_compute_instance: - name: "{{ resource_name }}" - machine_type: n1-standard-1 - disks: - - auto_delete: 'true' - boot: 'true' - source: "{{ disk }}" - metadata: - startup-script-url: gs:://graphite-playground/bootstrap.sh - cost-center: '12345' - network_interfaces: - - network: "{{ network }}" - access_configs: - - name: External NAT - nat_ip: "{{ address }}" - type: ONE_TO_ONE_NAT - zone: us-central1-a - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present - register: result -- name: assert changed is true - assert: - that: - - result.changed == true - - "result.kind == 'compute#instance'" -- name: verify that instance was created - gcp_compute_instance_facts: - filters: - - name = {{ resource_name }} +- block: + # Pre-test setup + - name: create a disk + gcp_compute_disk: + name: disk-instance + size_gb: 50 + source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-1604-lts zone: us-central1-a project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" - scopes: - - https://www.googleapis.com/auth/compute - register: results -- name: verify that command succeeded - assert: - that: - - results['items'] | length == 1 -# ---------------------------------------------------------------------------- -- name: create a instance that already exists - gcp_compute_instance: - name: "{{ resource_name }}" - machine_type: n1-standard-1 - disks: - - auto_delete: 'true' - boot: 'true' - source: "{{ disk }}" - metadata: - startup-script-url: gs:://graphite-playground/bootstrap.sh - cost-center: '12345' - network_interfaces: - - network: "{{ network }}" - access_configs: - - name: External NAT - nat_ip: "{{ address }}" - type: ONE_TO_ONE_NAT - zone: us-central1-a - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present - register: result -- name: assert changed is false - assert: - that: - - result.changed == false - - "result.kind == 'compute#instance'" -#---------------------------------------------------------- -- name: delete a instance - gcp_compute_instance: - name: "{{ resource_name }}" - machine_type: n1-standard-1 - disks: - - auto_delete: 'true' - boot: 'true' - source: "{{ disk }}" - metadata: - startup-script-url: gs:://graphite-playground/bootstrap.sh - cost-center: '12345' - network_interfaces: - - network: "{{ network }}" - access_configs: - - name: External NAT - nat_ip: "{{ address }}" - type: ONE_TO_ONE_NAT - zone: us-central1-a - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent - register: result -- name: assert changed is true - assert: - that: - - result.changed == true - - result.has_key('kind') == False -- name: verify that instance was deleted - gcp_compute_instance_facts: - filters: - - name = {{ resource_name }} + state: present + register: disk + - name: create a network + gcp_compute_network: + name: network-instance + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present + register: network + - name: create a address + gcp_compute_address: + name: address-instance + region: us-central1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present + register: address + - name: delete a instance + gcp_compute_instance: + name: "{{ resource_name }}" + machine_type: n1-standard-1 + disks: + - auto_delete: 'true' + boot: 'true' + source: "{{ disk }}" + metadata: + startup-script-url: gs:://graphite-playground/bootstrap.sh + cost-center: '12345' + network_interfaces: + - network: "{{ network }}" + access_configs: + - name: External NAT + nat_ip: "{{ address }}" + type: ONE_TO_ONE_NAT zone: us-central1-a project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" - scopes: - - https://www.googleapis.com/auth/compute - register: results -- name: verify that command succeeded - assert: - that: - - results['items'] | length == 0 -# ---------------------------------------------------------------------------- -- name: delete a instance that does not exist - gcp_compute_instance: - name: "{{ resource_name }}" - machine_type: n1-standard-1 - disks: - - auto_delete: 'true' - boot: 'true' - source: "{{ disk }}" - metadata: - startup-script-url: gs:://graphite-playground/bootstrap.sh - cost-center: '12345' - network_interfaces: - - network: "{{ network }}" - access_configs: - - name: External NAT - nat_ip: "{{ address }}" - type: ONE_TO_ONE_NAT - zone: us-central1-a - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent - register: result -- name: assert changed is false - assert: - that: - - result.changed == false - - result.has_key('kind') == False -#--------------------------------------------------------- -# Post-test teardown -# If errors happen, don't crash the playbook! -- name: delete a address - gcp_compute_address: - name: address-instance - region: us-central1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent - register: address - ignore_errors: true -- name: delete a network - gcp_compute_network: - name: network-instance - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent - register: network - ignore_errors: true -- name: delete a disk - gcp_compute_disk: - name: disk-instance - size_gb: 50 - source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-1604-lts - zone: us-central1-a - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent - register: disk - ignore_errors: true + state: absent + #---------------------------------------------------------- + - name: create a instance + gcp_compute_instance: + name: "{{ resource_name }}" + machine_type: n1-standard-1 + disks: + - auto_delete: 'true' + boot: 'true' + source: "{{ disk }}" + metadata: + startup-script-url: gs:://graphite-playground/bootstrap.sh + cost-center: '12345' + network_interfaces: + - network: "{{ network }}" + access_configs: + - name: External NAT + nat_ip: "{{ address }}" + type: ONE_TO_ONE_NAT + zone: us-central1-a + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present + register: result + - name: assert changed is true + assert: + that: + - result.changed == true + - "result.kind == 'compute#instance'" + - name: verify that instance was created + gcp_compute_instance_facts: + filters: + - name = {{ resource_name }} + zone: us-central1-a + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + scopes: + - https://www.googleapis.com/auth/compute + register: results + - name: verify that command succeeded + assert: + that: + - results['items'] | length == 1 + # ---------------------------------------------------------------------------- + - name: create a instance that already exists + gcp_compute_instance: + name: "{{ resource_name }}" + machine_type: n1-standard-1 + disks: + - auto_delete: 'true' + boot: 'true' + source: "{{ disk }}" + metadata: + startup-script-url: gs:://graphite-playground/bootstrap.sh + cost-center: '12345' + network_interfaces: + - network: "{{ network }}" + access_configs: + - name: External NAT + nat_ip: "{{ address }}" + type: ONE_TO_ONE_NAT + zone: us-central1-a + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present + register: result + - name: assert changed is false + assert: + that: + - result.changed == false + - "result.kind == 'compute#instance'" + #---------------------------------------------------------- + - name: delete a instance + gcp_compute_instance: + name: "{{ resource_name }}" + machine_type: n1-standard-1 + disks: + - auto_delete: 'true' + boot: 'true' + source: "{{ disk }}" + metadata: + startup-script-url: gs:://graphite-playground/bootstrap.sh + cost-center: '12345' + network_interfaces: + - network: "{{ network }}" + access_configs: + - name: External NAT + nat_ip: "{{ address }}" + type: ONE_TO_ONE_NAT + zone: us-central1-a + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: result + - name: assert changed is true + assert: + that: + - result.changed == true + - result.has_key('kind') == False + - name: verify that instance was deleted + gcp_compute_instance_facts: + filters: + - name = {{ resource_name }} + zone: us-central1-a + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + scopes: + - https://www.googleapis.com/auth/compute + register: results + - name: verify that command succeeded + assert: + that: + - results['items'] | length == 0 + # ---------------------------------------------------------------------------- + - name: delete a instance that does not exist + gcp_compute_instance: + name: "{{ resource_name }}" + machine_type: n1-standard-1 + disks: + - auto_delete: 'true' + boot: 'true' + source: "{{ disk }}" + metadata: + startup-script-url: gs:://graphite-playground/bootstrap.sh + cost-center: '12345' + network_interfaces: + - network: "{{ network }}" + access_configs: + - name: External NAT + nat_ip: "{{ address }}" + type: ONE_TO_ONE_NAT + zone: us-central1-a + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: result + - name: assert changed is false + assert: + that: + - result.changed == false + - result.has_key('kind') == False + always: + #--------------------------------------------------------- + # Post-test teardown + # If errors happen, don't crash the playbook! + - name: delete a address + gcp_compute_address: + name: address-instance + region: us-central1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: address + ignore_errors: true + - name: delete a network + gcp_compute_network: + name: network-instance + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: network + ignore_errors: true + - name: delete a disk + gcp_compute_disk: + name: disk-instance + size_gb: 50 + source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-1604-lts + zone: us-central1-a + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: disk + ignore_errors: true diff --git a/test/integration/targets/gcp_compute_instance_group/tasks/main.yml b/test/integration/targets/gcp_compute_instance_group/tasks/main.yml index 51d404dabf1eb0..91431a3f75d26f 100644 --- a/test/integration/targets/gcp_compute_instance_group/tasks/main.yml +++ b/test/integration/targets/gcp_compute_instance_group/tasks/main.yml @@ -12,142 +12,144 @@ # https://www.github.com/GoogleCloudPlatform/magic-modules # # ---------------------------------------------------------------------------- -# Pre-test setup -- name: create a network - gcp_compute_network: - name: network-instancegroup - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present - register: network -- name: delete a instance group - gcp_compute_instance_group: - name: "{{ resource_name }}" - named_ports: - - name: ansible - port: 1234 - network: "{{ network }}" - zone: us-central1-a - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent -#---------------------------------------------------------- -- name: create a instance group - gcp_compute_instance_group: - name: "{{ resource_name }}" - named_ports: - - name: ansible - port: 1234 - network: "{{ network }}" - zone: us-central1-a - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present - register: result -- name: assert changed is true - assert: - that: - - result.changed == true - - "result.kind == 'compute#instanceGroup'" -- name: verify that instance_group was created - gcp_compute_instance_group_facts: - filters: - - name = {{ resource_name }} +- block: + # Pre-test setup + - name: create a network + gcp_compute_network: + name: network-instancegroup + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present + register: network + - name: delete a instance group + gcp_compute_instance_group: + name: "{{ resource_name }}" + named_ports: + - name: ansible + port: 1234 + network: "{{ network }}" zone: us-central1-a project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" - scopes: - - https://www.googleapis.com/auth/compute - register: results -- name: verify that command succeeded - assert: - that: - - results['items'] | length == 1 -# ---------------------------------------------------------------------------- -- name: create a instance group that already exists - gcp_compute_instance_group: - name: "{{ resource_name }}" - named_ports: - - name: ansible - port: 1234 - network: "{{ network }}" - zone: us-central1-a - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present - register: result -- name: assert changed is false - assert: - that: - - result.changed == false - - "result.kind == 'compute#instanceGroup'" -#---------------------------------------------------------- -- name: delete a instance group - gcp_compute_instance_group: - name: "{{ resource_name }}" - named_ports: - - name: ansible - port: 1234 - network: "{{ network }}" - zone: us-central1-a - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent - register: result -- name: assert changed is true - assert: - that: - - result.changed == true - - result.has_key('kind') == False -- name: verify that instance_group was deleted - gcp_compute_instance_group_facts: - filters: - - name = {{ resource_name }} + state: absent + #---------------------------------------------------------- + - name: create a instance group + gcp_compute_instance_group: + name: "{{ resource_name }}" + named_ports: + - name: ansible + port: 1234 + network: "{{ network }}" zone: us-central1-a project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" - scopes: - - https://www.googleapis.com/auth/compute - register: results -- name: verify that command succeeded - assert: - that: - - results['items'] | length == 0 -# ---------------------------------------------------------------------------- -- name: delete a instance group that does not exist - gcp_compute_instance_group: - name: "{{ resource_name }}" - named_ports: - - name: ansible - port: 1234 - network: "{{ network }}" - zone: us-central1-a - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent - register: result -- name: assert changed is false - assert: - that: - - result.changed == false - - result.has_key('kind') == False -#--------------------------------------------------------- -# Post-test teardown -# If errors happen, don't crash the playbook! -- name: delete a network - gcp_compute_network: - name: network-instancegroup - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent - register: network - ignore_errors: true + state: present + register: result + - name: assert changed is true + assert: + that: + - result.changed == true + - "result.kind == 'compute#instanceGroup'" + - name: verify that instance_group was created + gcp_compute_instance_group_facts: + filters: + - name = {{ resource_name }} + zone: us-central1-a + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + scopes: + - https://www.googleapis.com/auth/compute + register: results + - name: verify that command succeeded + assert: + that: + - results['items'] | length == 1 + # ---------------------------------------------------------------------------- + - name: create a instance group that already exists + gcp_compute_instance_group: + name: "{{ resource_name }}" + named_ports: + - name: ansible + port: 1234 + network: "{{ network }}" + zone: us-central1-a + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present + register: result + - name: assert changed is false + assert: + that: + - result.changed == false + - "result.kind == 'compute#instanceGroup'" + #---------------------------------------------------------- + - name: delete a instance group + gcp_compute_instance_group: + name: "{{ resource_name }}" + named_ports: + - name: ansible + port: 1234 + network: "{{ network }}" + zone: us-central1-a + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: result + - name: assert changed is true + assert: + that: + - result.changed == true + - result.has_key('kind') == False + - name: verify that instance_group was deleted + gcp_compute_instance_group_facts: + filters: + - name = {{ resource_name }} + zone: us-central1-a + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + scopes: + - https://www.googleapis.com/auth/compute + register: results + - name: verify that command succeeded + assert: + that: + - results['items'] | length == 0 + # ---------------------------------------------------------------------------- + - name: delete a instance group that does not exist + gcp_compute_instance_group: + name: "{{ resource_name }}" + named_ports: + - name: ansible + port: 1234 + network: "{{ network }}" + zone: us-central1-a + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: result + - name: assert changed is false + assert: + that: + - result.changed == false + - result.has_key('kind') == False + always: + #--------------------------------------------------------- + # Post-test teardown + # If errors happen, don't crash the playbook! + - name: delete a network + gcp_compute_network: + name: network-instancegroup + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: network + ignore_errors: true diff --git a/test/integration/targets/gcp_compute_instance_group_manager/tasks/main.yml b/test/integration/targets/gcp_compute_instance_group_manager/tasks/main.yml index 616344f6214a90..1352f7742ee2e1 100644 --- a/test/integration/targets/gcp_compute_instance_group_manager/tasks/main.yml +++ b/test/integration/targets/gcp_compute_instance_group_manager/tasks/main.yml @@ -12,199 +12,201 @@ # https://www.github.com/GoogleCloudPlatform/magic-modules # # ---------------------------------------------------------------------------- -# Pre-test setup -- name: create a network - gcp_compute_network: - name: network-instancetemplate - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present - register: network -- name: create a address - gcp_compute_address: - name: address-instancetemplate - region: us-west1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present - register: address -- name: create a instance template - gcp_compute_instance_template: - name: "{{ resource_name }}" - properties: - disks: - - auto_delete: 'true' - boot: 'true' - initialize_params: - source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-1604-lts - machine_type: n1-standard-1 - network_interfaces: - - network: "{{ network }}" - access_configs: - - name: test-config - type: ONE_TO_ONE_NAT - nat_ip: "{{ address }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present - register: instancetemplate -- name: delete a instance group manager - gcp_compute_instance_group_manager: - name: "{{ resource_name }}" - base_instance_name: test1-child - instance_template: "{{ instancetemplate }}" - target_size: 3 - zone: us-west1-a - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent -#---------------------------------------------------------- -- name: create a instance group manager - gcp_compute_instance_group_manager: - name: "{{ resource_name }}" - base_instance_name: test1-child - instance_template: "{{ instancetemplate }}" - target_size: 3 - zone: us-west1-a - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present - register: result -- name: assert changed is true - assert: - that: - - result.changed == true - - "result.kind == 'compute#instanceGroupManager'" -- name: verify that instance_group_manager was created - gcp_compute_instance_group_manager_facts: - filters: - - name = {{ resource_name }} +- block: + # Pre-test setup + - name: create a network + gcp_compute_network: + name: network-instancetemplate + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present + register: network + - name: create a address + gcp_compute_address: + name: address-instancetemplate + region: us-west1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present + register: address + - name: create a instance template + gcp_compute_instance_template: + name: "{{ resource_name }}" + properties: + disks: + - auto_delete: 'true' + boot: 'true' + initialize_params: + source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-1604-lts + machine_type: n1-standard-1 + network_interfaces: + - network: "{{ network }}" + access_configs: + - name: test-config + type: ONE_TO_ONE_NAT + nat_ip: "{{ address }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present + register: instancetemplate + - name: delete a instance group manager + gcp_compute_instance_group_manager: + name: "{{ resource_name }}" + base_instance_name: test1-child + instance_template: "{{ instancetemplate }}" + target_size: 3 zone: us-west1-a project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" - scopes: - - https://www.googleapis.com/auth/compute - register: results -- name: verify that command succeeded - assert: - that: - - results['items'] | length == 1 -# ---------------------------------------------------------------------------- -- name: create a instance group manager that already exists - gcp_compute_instance_group_manager: - name: "{{ resource_name }}" - base_instance_name: test1-child - instance_template: "{{ instancetemplate }}" - target_size: 3 - zone: us-west1-a - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present - register: result -- name: assert changed is false - assert: - that: - - result.changed == false - - "result.kind == 'compute#instanceGroupManager'" -#---------------------------------------------------------- -- name: delete a instance group manager - gcp_compute_instance_group_manager: - name: "{{ resource_name }}" - base_instance_name: test1-child - instance_template: "{{ instancetemplate }}" - target_size: 3 - zone: us-west1-a - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent - register: result -- name: assert changed is true - assert: - that: - - result.changed == true - - result.has_key('kind') == False -- name: verify that instance_group_manager was deleted - gcp_compute_instance_group_manager_facts: - filters: - - name = {{ resource_name }} + state: absent + #---------------------------------------------------------- + - name: create a instance group manager + gcp_compute_instance_group_manager: + name: "{{ resource_name }}" + base_instance_name: test1-child + instance_template: "{{ instancetemplate }}" + target_size: 3 zone: us-west1-a project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" - scopes: - - https://www.googleapis.com/auth/compute - register: results -- name: verify that command succeeded - assert: - that: - - results['items'] | length == 0 -# ---------------------------------------------------------------------------- -- name: delete a instance group manager that does not exist - gcp_compute_instance_group_manager: - name: "{{ resource_name }}" - base_instance_name: test1-child - instance_template: "{{ instancetemplate }}" - target_size: 3 - zone: us-west1-a - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent - register: result -- name: assert changed is false - assert: - that: - - result.changed == false - - result.has_key('kind') == False -#--------------------------------------------------------- -# Post-test teardown -# If errors happen, don't crash the playbook! -- name: delete a instance template - gcp_compute_instance_template: - name: "{{ resource_name }}" - properties: - disks: - - auto_delete: 'true' - boot: 'true' - initialize_params: - source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-1604-lts - machine_type: n1-standard-1 - network_interfaces: - - network: "{{ network }}" - access_configs: - - name: test-config - type: ONE_TO_ONE_NAT - nat_ip: "{{ address }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent - register: instancetemplate - ignore_errors: true -- name: delete a address - gcp_compute_address: - name: address-instancetemplate - region: us-west1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent - register: address - ignore_errors: true -- name: delete a network - gcp_compute_network: - name: network-instancetemplate - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent - register: network - ignore_errors: true + state: present + register: result + - name: assert changed is true + assert: + that: + - result.changed == true + - "result.kind == 'compute#instanceGroupManager'" + - name: verify that instance_group_manager was created + gcp_compute_instance_group_manager_facts: + filters: + - name = {{ resource_name }} + zone: us-west1-a + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + scopes: + - https://www.googleapis.com/auth/compute + register: results + - name: verify that command succeeded + assert: + that: + - results['items'] | length == 1 + # ---------------------------------------------------------------------------- + - name: create a instance group manager that already exists + gcp_compute_instance_group_manager: + name: "{{ resource_name }}" + base_instance_name: test1-child + instance_template: "{{ instancetemplate }}" + target_size: 3 + zone: us-west1-a + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present + register: result + - name: assert changed is false + assert: + that: + - result.changed == false + - "result.kind == 'compute#instanceGroupManager'" + #---------------------------------------------------------- + - name: delete a instance group manager + gcp_compute_instance_group_manager: + name: "{{ resource_name }}" + base_instance_name: test1-child + instance_template: "{{ instancetemplate }}" + target_size: 3 + zone: us-west1-a + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: result + - name: assert changed is true + assert: + that: + - result.changed == true + - result.has_key('kind') == False + - name: verify that instance_group_manager was deleted + gcp_compute_instance_group_manager_facts: + filters: + - name = {{ resource_name }} + zone: us-west1-a + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + scopes: + - https://www.googleapis.com/auth/compute + register: results + - name: verify that command succeeded + assert: + that: + - results['items'] | length == 0 + # ---------------------------------------------------------------------------- + - name: delete a instance group manager that does not exist + gcp_compute_instance_group_manager: + name: "{{ resource_name }}" + base_instance_name: test1-child + instance_template: "{{ instancetemplate }}" + target_size: 3 + zone: us-west1-a + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: result + - name: assert changed is false + assert: + that: + - result.changed == false + - result.has_key('kind') == False + always: + #--------------------------------------------------------- + # Post-test teardown + # If errors happen, don't crash the playbook! + - name: delete a instance template + gcp_compute_instance_template: + name: "{{ resource_name }}" + properties: + disks: + - auto_delete: 'true' + boot: 'true' + initialize_params: + source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-1604-lts + machine_type: n1-standard-1 + network_interfaces: + - network: "{{ network }}" + access_configs: + - name: test-config + type: ONE_TO_ONE_NAT + nat_ip: "{{ address }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: instancetemplate + ignore_errors: true + - name: delete a address + gcp_compute_address: + name: address-instancetemplate + region: us-west1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: address + ignore_errors: true + - name: delete a network + gcp_compute_network: + name: network-instancetemplate + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: network + ignore_errors: true diff --git a/test/integration/targets/gcp_compute_instance_template/tasks/main.yml b/test/integration/targets/gcp_compute_instance_template/tasks/main.yml index 772baab1f8be7e..324bff0c272029 100644 --- a/test/integration/targets/gcp_compute_instance_template/tasks/main.yml +++ b/test/integration/targets/gcp_compute_instance_template/tasks/main.yml @@ -12,199 +12,201 @@ # https://www.github.com/GoogleCloudPlatform/magic-modules # # ---------------------------------------------------------------------------- -# Pre-test setup -- name: create a network - gcp_compute_network: - name: network-instancetemplate - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present - register: network -- name: create a address - gcp_compute_address: - name: address-instancetemplate - region: us-west1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present - register: address -- name: delete a instance template - gcp_compute_instance_template: - name: "{{ resource_name }}" - properties: - disks: - - auto_delete: 'true' - boot: 'true' - initialize_params: - source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-1604-lts - machine_type: n1-standard-1 - network_interfaces: - - network: "{{ network }}" - access_configs: - - name: test-config - type: ONE_TO_ONE_NAT - nat_ip: "{{ address }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent -#---------------------------------------------------------- -- name: create a instance template - gcp_compute_instance_template: - name: "{{ resource_name }}" - properties: - disks: - - auto_delete: 'true' - boot: 'true' - initialize_params: - source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-1604-lts - machine_type: n1-standard-1 - network_interfaces: - - network: "{{ network }}" - access_configs: - - name: test-config - type: ONE_TO_ONE_NAT - nat_ip: "{{ address }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present - register: result -- name: assert changed is true - assert: - that: - - result.changed == true - - "result.kind == 'compute#instanceTemplate'" -- name: verify that instance_template was created - gcp_compute_instance_template_facts: - filters: - - name = {{ resource_name }} +- block: + # Pre-test setup + - name: create a network + gcp_compute_network: + name: network-instancetemplate project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" - scopes: - - https://www.googleapis.com/auth/compute - register: results -- name: verify that command succeeded - assert: - that: - - results['items'] | length == 1 -# ---------------------------------------------------------------------------- -- name: create a instance template that already exists - gcp_compute_instance_template: - name: "{{ resource_name }}" - properties: - disks: - - auto_delete: 'true' - boot: 'true' - initialize_params: - source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-1604-lts - machine_type: n1-standard-1 - network_interfaces: - - network: "{{ network }}" - access_configs: - - name: test-config - type: ONE_TO_ONE_NAT - nat_ip: "{{ address }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present - register: result -- name: assert changed is false - assert: - that: - - result.changed == false - - "result.kind == 'compute#instanceTemplate'" -#---------------------------------------------------------- -- name: delete a instance template - gcp_compute_instance_template: - name: "{{ resource_name }}" - properties: - disks: - - auto_delete: 'true' - boot: 'true' - initialize_params: - source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-1604-lts - machine_type: n1-standard-1 - network_interfaces: - - network: "{{ network }}" - access_configs: - - name: test-config - type: ONE_TO_ONE_NAT - nat_ip: "{{ address }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent - register: result -- name: assert changed is true - assert: - that: - - result.changed == true - - result.has_key('kind') == False -- name: verify that instance_template was deleted - gcp_compute_instance_template_facts: - filters: - - name = {{ resource_name }} + state: present + register: network + - name: create a address + gcp_compute_address: + name: address-instancetemplate + region: us-west1 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" - scopes: - - https://www.googleapis.com/auth/compute - register: results -- name: verify that command succeeded - assert: - that: - - results['items'] | length == 0 -# ---------------------------------------------------------------------------- -- name: delete a instance template that does not exist - gcp_compute_instance_template: - name: "{{ resource_name }}" - properties: - disks: - - auto_delete: 'true' - boot: 'true' - initialize_params: - source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-1604-lts - machine_type: n1-standard-1 - network_interfaces: - - network: "{{ network }}" - access_configs: - - name: test-config - type: ONE_TO_ONE_NAT - nat_ip: "{{ address }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent - register: result -- name: assert changed is false - assert: - that: - - result.changed == false - - result.has_key('kind') == False -#--------------------------------------------------------- -# Post-test teardown -# If errors happen, don't crash the playbook! -- name: delete a address - gcp_compute_address: - name: address-instancetemplate - region: us-west1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent - register: address - ignore_errors: true -- name: delete a network - gcp_compute_network: - name: network-instancetemplate - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent - register: network - ignore_errors: true + state: present + register: address + - name: delete a instance template + gcp_compute_instance_template: + name: "{{ resource_name }}" + properties: + disks: + - auto_delete: 'true' + boot: 'true' + initialize_params: + source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-1604-lts + machine_type: n1-standard-1 + network_interfaces: + - network: "{{ network }}" + access_configs: + - name: test-config + type: ONE_TO_ONE_NAT + nat_ip: "{{ address }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + #---------------------------------------------------------- + - name: create a instance template + gcp_compute_instance_template: + name: "{{ resource_name }}" + properties: + disks: + - auto_delete: 'true' + boot: 'true' + initialize_params: + source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-1604-lts + machine_type: n1-standard-1 + network_interfaces: + - network: "{{ network }}" + access_configs: + - name: test-config + type: ONE_TO_ONE_NAT + nat_ip: "{{ address }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present + register: result + - name: assert changed is true + assert: + that: + - result.changed == true + - "result.kind == 'compute#instanceTemplate'" + - name: verify that instance_template was created + gcp_compute_instance_template_facts: + filters: + - name = {{ resource_name }} + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + scopes: + - https://www.googleapis.com/auth/compute + register: results + - name: verify that command succeeded + assert: + that: + - results['items'] | length == 1 + # ---------------------------------------------------------------------------- + - name: create a instance template that already exists + gcp_compute_instance_template: + name: "{{ resource_name }}" + properties: + disks: + - auto_delete: 'true' + boot: 'true' + initialize_params: + source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-1604-lts + machine_type: n1-standard-1 + network_interfaces: + - network: "{{ network }}" + access_configs: + - name: test-config + type: ONE_TO_ONE_NAT + nat_ip: "{{ address }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present + register: result + - name: assert changed is false + assert: + that: + - result.changed == false + - "result.kind == 'compute#instanceTemplate'" + #---------------------------------------------------------- + - name: delete a instance template + gcp_compute_instance_template: + name: "{{ resource_name }}" + properties: + disks: + - auto_delete: 'true' + boot: 'true' + initialize_params: + source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-1604-lts + machine_type: n1-standard-1 + network_interfaces: + - network: "{{ network }}" + access_configs: + - name: test-config + type: ONE_TO_ONE_NAT + nat_ip: "{{ address }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: result + - name: assert changed is true + assert: + that: + - result.changed == true + - result.has_key('kind') == False + - name: verify that instance_template was deleted + gcp_compute_instance_template_facts: + filters: + - name = {{ resource_name }} + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + scopes: + - https://www.googleapis.com/auth/compute + register: results + - name: verify that command succeeded + assert: + that: + - results['items'] | length == 0 + # ---------------------------------------------------------------------------- + - name: delete a instance template that does not exist + gcp_compute_instance_template: + name: "{{ resource_name }}" + properties: + disks: + - auto_delete: 'true' + boot: 'true' + initialize_params: + source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-1604-lts + machine_type: n1-standard-1 + network_interfaces: + - network: "{{ network }}" + access_configs: + - name: test-config + type: ONE_TO_ONE_NAT + nat_ip: "{{ address }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: result + - name: assert changed is false + assert: + that: + - result.changed == false + - result.has_key('kind') == False + always: + #--------------------------------------------------------- + # Post-test teardown + # If errors happen, don't crash the playbook! + - name: delete a address + gcp_compute_address: + name: address-instancetemplate + region: us-west1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: address + ignore_errors: true + - name: delete a network + gcp_compute_network: + name: network-instancetemplate + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: network + ignore_errors: true diff --git a/test/integration/targets/gcp_compute_network/tasks/main.yml b/test/integration/targets/gcp_compute_network/tasks/main.yml index aedbf990f35e20..0ecce472e1d789 100644 --- a/test/integration/targets/gcp_compute_network/tasks/main.yml +++ b/test/integration/targets/gcp_compute_network/tasks/main.yml @@ -12,100 +12,101 @@ # https://www.github.com/GoogleCloudPlatform/magic-modules # # ---------------------------------------------------------------------------- -# Pre-test setup -- name: delete a network - gcp_compute_network: - name: "{{ resource_name }}" - auto_create_subnetworks: 'true' - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent -#---------------------------------------------------------- -- name: create a network - gcp_compute_network: - name: "{{ resource_name }}" - auto_create_subnetworks: 'true' - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present - register: result -- name: assert changed is true - assert: - that: - - result.changed == true - - "result.kind == 'compute#network'" -- name: verify that network was created - gcp_compute_network_facts: - filters: - - name = {{ resource_name }} +- block: + # Pre-test setup + - name: delete a network + gcp_compute_network: + name: "{{ resource_name }}" + auto_create_subnetworks: 'true' project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" - scopes: - - https://www.googleapis.com/auth/compute - register: results -- name: verify that command succeeded - assert: - that: - - results['items'] | length == 1 -# ---------------------------------------------------------------------------- -- name: create a network that already exists - gcp_compute_network: - name: "{{ resource_name }}" - auto_create_subnetworks: 'true' - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present - register: result -- name: assert changed is false - assert: - that: - - result.changed == false - - "result.kind == 'compute#network'" -#---------------------------------------------------------- -- name: delete a network - gcp_compute_network: - name: "{{ resource_name }}" - auto_create_subnetworks: 'true' - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent - register: result -- name: assert changed is true - assert: - that: - - result.changed == true - - result.has_key('kind') == False -- name: verify that network was deleted - gcp_compute_network_facts: - filters: - - name = {{ resource_name }} + state: absent + #---------------------------------------------------------- + - name: create a network + gcp_compute_network: + name: "{{ resource_name }}" + auto_create_subnetworks: 'true' project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" - scopes: - - https://www.googleapis.com/auth/compute - register: results -- name: verify that command succeeded - assert: - that: - - results['items'] | length == 0 -# ---------------------------------------------------------------------------- -- name: delete a network that does not exist - gcp_compute_network: - name: "{{ resource_name }}" - auto_create_subnetworks: 'true' - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent - register: result -- name: assert changed is false - assert: - that: - - result.changed == false - - result.has_key('kind') == False + state: present + register: result + - name: assert changed is true + assert: + that: + - result.changed == true + - "result.kind == 'compute#network'" + - name: verify that network was created + gcp_compute_network_facts: + filters: + - name = {{ resource_name }} + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + scopes: + - https://www.googleapis.com/auth/compute + register: results + - name: verify that command succeeded + assert: + that: + - results['items'] | length == 1 + # ---------------------------------------------------------------------------- + - name: create a network that already exists + gcp_compute_network: + name: "{{ resource_name }}" + auto_create_subnetworks: 'true' + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present + register: result + - name: assert changed is false + assert: + that: + - result.changed == false + - "result.kind == 'compute#network'" + #---------------------------------------------------------- + - name: delete a network + gcp_compute_network: + name: "{{ resource_name }}" + auto_create_subnetworks: 'true' + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: result + - name: assert changed is true + assert: + that: + - result.changed == true + - result.has_key('kind') == False + - name: verify that network was deleted + gcp_compute_network_facts: + filters: + - name = {{ resource_name }} + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + scopes: + - https://www.googleapis.com/auth/compute + register: results + - name: verify that command succeeded + assert: + that: + - results['items'] | length == 0 + # ---------------------------------------------------------------------------- + - name: delete a network that does not exist + gcp_compute_network: + name: "{{ resource_name }}" + auto_create_subnetworks: 'true' + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: result + - name: assert changed is false + assert: + that: + - result.changed == false + - result.has_key('kind') == False diff --git a/test/integration/targets/gcp_compute_region_disk/tasks/main.yml b/test/integration/targets/gcp_compute_region_disk/tasks/main.yml index f693bbe8442fda..f60129db0abb1d 100644 --- a/test/integration/targets/gcp_compute_region_disk/tasks/main.yml +++ b/test/integration/targets/gcp_compute_region_disk/tasks/main.yml @@ -12,132 +12,133 @@ # https://www.github.com/GoogleCloudPlatform/magic-modules # # ---------------------------------------------------------------------------- -# Pre-test setup -- name: delete a region disk - gcp_compute_region_disk: - name: "{{ resource_name }}" - size_gb: 50 - disk_encryption_key: - raw_key: SGVsbG8gZnJvbSBHb29nbGUgQ2xvdWQgUGxhdGZvcm0= - region: us-central1 - replica_zones: - - https://www.googleapis.com/compute/v1/projects/google.com:graphite-playground/zones/us-central1-a - - https://www.googleapis.com/compute/v1/projects/google.com:graphite-playground/zones/us-central1-b - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent -#---------------------------------------------------------- -- name: create a region disk - gcp_compute_region_disk: - name: "{{ resource_name }}" - size_gb: 50 - disk_encryption_key: - raw_key: SGVsbG8gZnJvbSBHb29nbGUgQ2xvdWQgUGxhdGZvcm0= - region: us-central1 - replica_zones: - - https://www.googleapis.com/compute/v1/projects/google.com:graphite-playground/zones/us-central1-a - - https://www.googleapis.com/compute/v1/projects/google.com:graphite-playground/zones/us-central1-b - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present - register: result -- name: assert changed is true - assert: - that: - - result.changed == true - - "result.kind == 'compute#disk'" -- name: verify that region_disk was created - gcp_compute_region_disk_facts: - filters: - - name = {{ resource_name }} +- block: + # Pre-test setup + - name: delete a region disk + gcp_compute_region_disk: + name: "{{ resource_name }}" + size_gb: 50 + disk_encryption_key: + raw_key: SGVsbG8gZnJvbSBHb29nbGUgQ2xvdWQgUGxhdGZvcm0= region: us-central1 + replica_zones: + - https://www.googleapis.com/compute/v1/projects/google.com:graphite-playground/zones/us-central1-a + - https://www.googleapis.com/compute/v1/projects/google.com:graphite-playground/zones/us-central1-b project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" - scopes: - - https://www.googleapis.com/auth/compute - register: results -- name: verify that command succeeded - assert: - that: - - results['items'] | length == 1 -# ---------------------------------------------------------------------------- -- name: create a region disk that already exists - gcp_compute_region_disk: - name: "{{ resource_name }}" - size_gb: 50 - disk_encryption_key: - raw_key: SGVsbG8gZnJvbSBHb29nbGUgQ2xvdWQgUGxhdGZvcm0= - region: us-central1 - replica_zones: - - https://www.googleapis.com/compute/v1/projects/google.com:graphite-playground/zones/us-central1-a - - https://www.googleapis.com/compute/v1/projects/google.com:graphite-playground/zones/us-central1-b - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present - register: result -- name: assert changed is false - assert: - that: - - result.changed == false - - "result.kind == 'compute#disk'" -#---------------------------------------------------------- -- name: delete a region disk - gcp_compute_region_disk: - name: "{{ resource_name }}" - size_gb: 50 - disk_encryption_key: - raw_key: SGVsbG8gZnJvbSBHb29nbGUgQ2xvdWQgUGxhdGZvcm0= - region: us-central1 - replica_zones: - - https://www.googleapis.com/compute/v1/projects/google.com:graphite-playground/zones/us-central1-a - - https://www.googleapis.com/compute/v1/projects/google.com:graphite-playground/zones/us-central1-b - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent - register: result -- name: assert changed is true - assert: - that: - - result.changed == true - - result.has_key('kind') == False -- name: verify that region_disk was deleted - gcp_compute_region_disk_facts: - filters: - - name = {{ resource_name }} + state: absent + #---------------------------------------------------------- + - name: create a region disk + gcp_compute_region_disk: + name: "{{ resource_name }}" + size_gb: 50 + disk_encryption_key: + raw_key: SGVsbG8gZnJvbSBHb29nbGUgQ2xvdWQgUGxhdGZvcm0= region: us-central1 + replica_zones: + - https://www.googleapis.com/compute/v1/projects/google.com:graphite-playground/zones/us-central1-a + - https://www.googleapis.com/compute/v1/projects/google.com:graphite-playground/zones/us-central1-b project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" - scopes: - - https://www.googleapis.com/auth/compute - register: results -- name: verify that command succeeded - assert: - that: - - results['items'] | length == 0 -# ---------------------------------------------------------------------------- -- name: delete a region disk that does not exist - gcp_compute_region_disk: - name: "{{ resource_name }}" - size_gb: 50 - disk_encryption_key: - raw_key: SGVsbG8gZnJvbSBHb29nbGUgQ2xvdWQgUGxhdGZvcm0= - region: us-central1 - replica_zones: - - https://www.googleapis.com/compute/v1/projects/google.com:graphite-playground/zones/us-central1-a - - https://www.googleapis.com/compute/v1/projects/google.com:graphite-playground/zones/us-central1-b - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent - register: result -- name: assert changed is false - assert: - that: - - result.changed == false - - result.has_key('kind') == False + state: present + register: result + - name: assert changed is true + assert: + that: + - result.changed == true + - "result.kind == 'compute#disk'" + - name: verify that region_disk was created + gcp_compute_region_disk_facts: + filters: + - name = {{ resource_name }} + region: us-central1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + scopes: + - https://www.googleapis.com/auth/compute + register: results + - name: verify that command succeeded + assert: + that: + - results['items'] | length == 1 + # ---------------------------------------------------------------------------- + - name: create a region disk that already exists + gcp_compute_region_disk: + name: "{{ resource_name }}" + size_gb: 50 + disk_encryption_key: + raw_key: SGVsbG8gZnJvbSBHb29nbGUgQ2xvdWQgUGxhdGZvcm0= + region: us-central1 + replica_zones: + - https://www.googleapis.com/compute/v1/projects/google.com:graphite-playground/zones/us-central1-a + - https://www.googleapis.com/compute/v1/projects/google.com:graphite-playground/zones/us-central1-b + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present + register: result + - name: assert changed is false + assert: + that: + - result.changed == false + - "result.kind == 'compute#disk'" + #---------------------------------------------------------- + - name: delete a region disk + gcp_compute_region_disk: + name: "{{ resource_name }}" + size_gb: 50 + disk_encryption_key: + raw_key: SGVsbG8gZnJvbSBHb29nbGUgQ2xvdWQgUGxhdGZvcm0= + region: us-central1 + replica_zones: + - https://www.googleapis.com/compute/v1/projects/google.com:graphite-playground/zones/us-central1-a + - https://www.googleapis.com/compute/v1/projects/google.com:graphite-playground/zones/us-central1-b + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: result + - name: assert changed is true + assert: + that: + - result.changed == true + - result.has_key('kind') == False + - name: verify that region_disk was deleted + gcp_compute_region_disk_facts: + filters: + - name = {{ resource_name }} + region: us-central1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + scopes: + - https://www.googleapis.com/auth/compute + register: results + - name: verify that command succeeded + assert: + that: + - results['items'] | length == 0 + # ---------------------------------------------------------------------------- + - name: delete a region disk that does not exist + gcp_compute_region_disk: + name: "{{ resource_name }}" + size_gb: 50 + disk_encryption_key: + raw_key: SGVsbG8gZnJvbSBHb29nbGUgQ2xvdWQgUGxhdGZvcm0= + region: us-central1 + replica_zones: + - https://www.googleapis.com/compute/v1/projects/google.com:graphite-playground/zones/us-central1-a + - https://www.googleapis.com/compute/v1/projects/google.com:graphite-playground/zones/us-central1-b + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: result + - name: assert changed is false + assert: + that: + - result.changed == false + - result.has_key('kind') == False diff --git a/test/integration/targets/gcp_compute_route/tasks/main.yml b/test/integration/targets/gcp_compute_route/tasks/main.yml index 1a657f02578b7f..ece6bd303886cc 100644 --- a/test/integration/targets/gcp_compute_route/tasks/main.yml +++ b/test/integration/targets/gcp_compute_route/tasks/main.yml @@ -12,145 +12,147 @@ # https://www.github.com/GoogleCloudPlatform/magic-modules # # ---------------------------------------------------------------------------- -# Pre-test setup -- name: create a network - gcp_compute_network: - name: network-route - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present - register: network -- name: delete a route - gcp_compute_route: - name: "{{ resource_name }}" - dest_range: 192.168.6.0/24 - next_hop_gateway: global/gateways/default-internet-gateway - network: "{{ network }}" - tags: - - backends - - databases - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent -#---------------------------------------------------------- -- name: create a route - gcp_compute_route: - name: "{{ resource_name }}" - dest_range: 192.168.6.0/24 - next_hop_gateway: global/gateways/default-internet-gateway - network: "{{ network }}" - tags: - - backends - - databases - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present - register: result -- name: assert changed is true - assert: - that: - - result.changed == true - - "result.kind == 'compute#route'" -- name: verify that route was created - gcp_compute_route_facts: - filters: - - name = {{ resource_name }} +- block: + # Pre-test setup + - name: create a network + gcp_compute_network: + name: network-route project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" - scopes: - - https://www.googleapis.com/auth/compute - register: results -- name: verify that command succeeded - assert: - that: - - results['items'] | length == 1 -# ---------------------------------------------------------------------------- -- name: create a route that already exists - gcp_compute_route: - name: "{{ resource_name }}" - dest_range: 192.168.6.0/24 - next_hop_gateway: global/gateways/default-internet-gateway - network: "{{ network }}" - tags: - - backends - - databases - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present - register: result -- name: assert changed is false - assert: - that: - - result.changed == false - - "result.kind == 'compute#route'" -#---------------------------------------------------------- -- name: delete a route - gcp_compute_route: - name: "{{ resource_name }}" - dest_range: 192.168.6.0/24 - next_hop_gateway: global/gateways/default-internet-gateway - network: "{{ network }}" - tags: - - backends - - databases - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent - register: result -- name: assert changed is true - assert: - that: - - result.changed == true - - result.has_key('kind') == False -- name: verify that route was deleted - gcp_compute_route_facts: - filters: - - name = {{ resource_name }} + state: present + register: network + - name: delete a route + gcp_compute_route: + name: "{{ resource_name }}" + dest_range: 192.168.6.0/24 + next_hop_gateway: global/gateways/default-internet-gateway + network: "{{ network }}" + tags: + - backends + - databases project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" - scopes: - - https://www.googleapis.com/auth/compute - register: results -- name: verify that command succeeded - assert: - that: - - results['items'] | length == 0 -# ---------------------------------------------------------------------------- -- name: delete a route that does not exist - gcp_compute_route: - name: "{{ resource_name }}" - dest_range: 192.168.6.0/24 - next_hop_gateway: global/gateways/default-internet-gateway - network: "{{ network }}" - tags: - - backends - - databases - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent - register: result -- name: assert changed is false - assert: - that: - - result.changed == false - - result.has_key('kind') == False -#--------------------------------------------------------- -# Post-test teardown -# If errors happen, don't crash the playbook! -- name: delete a network - gcp_compute_network: - name: network-route - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent - register: network - ignore_errors: true + state: absent + #---------------------------------------------------------- + - name: create a route + gcp_compute_route: + name: "{{ resource_name }}" + dest_range: 192.168.6.0/24 + next_hop_gateway: global/gateways/default-internet-gateway + network: "{{ network }}" + tags: + - backends + - databases + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present + register: result + - name: assert changed is true + assert: + that: + - result.changed == true + - "result.kind == 'compute#route'" + - name: verify that route was created + gcp_compute_route_facts: + filters: + - name = {{ resource_name }} + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + scopes: + - https://www.googleapis.com/auth/compute + register: results + - name: verify that command succeeded + assert: + that: + - results['items'] | length == 1 + # ---------------------------------------------------------------------------- + - name: create a route that already exists + gcp_compute_route: + name: "{{ resource_name }}" + dest_range: 192.168.6.0/24 + next_hop_gateway: global/gateways/default-internet-gateway + network: "{{ network }}" + tags: + - backends + - databases + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present + register: result + - name: assert changed is false + assert: + that: + - result.changed == false + - "result.kind == 'compute#route'" + #---------------------------------------------------------- + - name: delete a route + gcp_compute_route: + name: "{{ resource_name }}" + dest_range: 192.168.6.0/24 + next_hop_gateway: global/gateways/default-internet-gateway + network: "{{ network }}" + tags: + - backends + - databases + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: result + - name: assert changed is true + assert: + that: + - result.changed == true + - result.has_key('kind') == False + - name: verify that route was deleted + gcp_compute_route_facts: + filters: + - name = {{ resource_name }} + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + scopes: + - https://www.googleapis.com/auth/compute + register: results + - name: verify that command succeeded + assert: + that: + - results['items'] | length == 0 + # ---------------------------------------------------------------------------- + - name: delete a route that does not exist + gcp_compute_route: + name: "{{ resource_name }}" + dest_range: 192.168.6.0/24 + next_hop_gateway: global/gateways/default-internet-gateway + network: "{{ network }}" + tags: + - backends + - databases + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: result + - name: assert changed is false + assert: + that: + - result.changed == false + - result.has_key('kind') == False + always: + #--------------------------------------------------------- + # Post-test teardown + # If errors happen, don't crash the playbook! + - name: delete a network + gcp_compute_network: + name: network-route + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: network + ignore_errors: true diff --git a/test/integration/targets/gcp_compute_router/tasks/main.yml b/test/integration/targets/gcp_compute_router/tasks/main.yml index ac9e5f57b0bc37..e3a60f7c43f57b 100644 --- a/test/integration/targets/gcp_compute_router/tasks/main.yml +++ b/test/integration/targets/gcp_compute_router/tasks/main.yml @@ -12,167 +12,169 @@ # https://www.github.com/GoogleCloudPlatform/magic-modules # # ---------------------------------------------------------------------------- -# Pre-test setup -- name: create a network - gcp_compute_network: - name: network-router - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present - register: network -- name: delete a router - gcp_compute_router: - name: "{{ resource_name }}" - network: "{{ network }}" - bgp: - asn: 64514 - advertise_mode: CUSTOM - advertised_groups: - - ALL_SUBNETS - advertised_ip_ranges: - - range: 1.2.3.4 - - range: 6.7.0.0/16 - region: us-central1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent -#---------------------------------------------------------- -- name: create a router - gcp_compute_router: - name: "{{ resource_name }}" - network: "{{ network }}" - bgp: - asn: 64514 - advertise_mode: CUSTOM - advertised_groups: - - ALL_SUBNETS - advertised_ip_ranges: - - range: 1.2.3.4 - - range: 6.7.0.0/16 - region: us-central1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present - register: result -- name: assert changed is true - assert: - that: - - result.changed == true - - "result.kind == 'compute#router'" -- name: verify that router was created - gcp_compute_router_facts: - filters: - - name = {{ resource_name }} +- block: + # Pre-test setup + - name: create a network + gcp_compute_network: + name: network-router + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present + register: network + - name: delete a router + gcp_compute_router: + name: "{{ resource_name }}" + network: "{{ network }}" + bgp: + asn: 64514 + advertise_mode: CUSTOM + advertised_groups: + - ALL_SUBNETS + advertised_ip_ranges: + - range: 1.2.3.4 + - range: 6.7.0.0/16 region: us-central1 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" - scopes: - - https://www.googleapis.com/auth/compute - register: results -- name: verify that command succeeded - assert: - that: - - results['items'] | length == 1 -# ---------------------------------------------------------------------------- -- name: create a router that already exists - gcp_compute_router: - name: "{{ resource_name }}" - network: "{{ network }}" - bgp: - asn: 64514 - advertise_mode: CUSTOM - advertised_groups: - - ALL_SUBNETS - advertised_ip_ranges: - - range: 1.2.3.4 - - range: 6.7.0.0/16 - region: us-central1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present - register: result -- name: assert changed is false - assert: - that: - - result.changed == false - - "result.kind == 'compute#router'" -#---------------------------------------------------------- -- name: delete a router - gcp_compute_router: - name: "{{ resource_name }}" - network: "{{ network }}" - bgp: - asn: 64514 - advertise_mode: CUSTOM - advertised_groups: - - ALL_SUBNETS - advertised_ip_ranges: - - range: 1.2.3.4 - - range: 6.7.0.0/16 - region: us-central1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent - register: result -- name: assert changed is true - assert: - that: - - result.changed == true - - result.has_key('kind') == False -- name: verify that router was deleted - gcp_compute_router_facts: - filters: - - name = {{ resource_name }} + state: absent + #---------------------------------------------------------- + - name: create a router + gcp_compute_router: + name: "{{ resource_name }}" + network: "{{ network }}" + bgp: + asn: 64514 + advertise_mode: CUSTOM + advertised_groups: + - ALL_SUBNETS + advertised_ip_ranges: + - range: 1.2.3.4 + - range: 6.7.0.0/16 region: us-central1 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" - scopes: - - https://www.googleapis.com/auth/compute - register: results -- name: verify that command succeeded - assert: - that: - - results['items'] | length == 0 -# ---------------------------------------------------------------------------- -- name: delete a router that does not exist - gcp_compute_router: - name: "{{ resource_name }}" - network: "{{ network }}" - bgp: - asn: 64514 - advertise_mode: CUSTOM - advertised_groups: - - ALL_SUBNETS - advertised_ip_ranges: - - range: 1.2.3.4 - - range: 6.7.0.0/16 - region: us-central1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent - register: result -- name: assert changed is false - assert: - that: - - result.changed == false - - result.has_key('kind') == False -#--------------------------------------------------------- -# Post-test teardown -# If errors happen, don't crash the playbook! -- name: delete a network - gcp_compute_network: - name: network-router - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent - register: network - ignore_errors: true + state: present + register: result + - name: assert changed is true + assert: + that: + - result.changed == true + - "result.kind == 'compute#router'" + - name: verify that router was created + gcp_compute_router_facts: + filters: + - name = {{ resource_name }} + region: us-central1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + scopes: + - https://www.googleapis.com/auth/compute + register: results + - name: verify that command succeeded + assert: + that: + - results['items'] | length == 1 + # ---------------------------------------------------------------------------- + - name: create a router that already exists + gcp_compute_router: + name: "{{ resource_name }}" + network: "{{ network }}" + bgp: + asn: 64514 + advertise_mode: CUSTOM + advertised_groups: + - ALL_SUBNETS + advertised_ip_ranges: + - range: 1.2.3.4 + - range: 6.7.0.0/16 + region: us-central1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present + register: result + - name: assert changed is false + assert: + that: + - result.changed == false + - "result.kind == 'compute#router'" + #---------------------------------------------------------- + - name: delete a router + gcp_compute_router: + name: "{{ resource_name }}" + network: "{{ network }}" + bgp: + asn: 64514 + advertise_mode: CUSTOM + advertised_groups: + - ALL_SUBNETS + advertised_ip_ranges: + - range: 1.2.3.4 + - range: 6.7.0.0/16 + region: us-central1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: result + - name: assert changed is true + assert: + that: + - result.changed == true + - result.has_key('kind') == False + - name: verify that router was deleted + gcp_compute_router_facts: + filters: + - name = {{ resource_name }} + region: us-central1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + scopes: + - https://www.googleapis.com/auth/compute + register: results + - name: verify that command succeeded + assert: + that: + - results['items'] | length == 0 + # ---------------------------------------------------------------------------- + - name: delete a router that does not exist + gcp_compute_router: + name: "{{ resource_name }}" + network: "{{ network }}" + bgp: + asn: 64514 + advertise_mode: CUSTOM + advertised_groups: + - ALL_SUBNETS + advertised_ip_ranges: + - range: 1.2.3.4 + - range: 6.7.0.0/16 + region: us-central1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: result + - name: assert changed is false + assert: + that: + - result.changed == false + - result.has_key('kind') == False + always: + #--------------------------------------------------------- + # Post-test teardown + # If errors happen, don't crash the playbook! + - name: delete a network + gcp_compute_network: + name: network-router + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: network + ignore_errors: true diff --git a/test/integration/targets/gcp_compute_ssl_certificate/tasks/main.yml b/test/integration/targets/gcp_compute_ssl_certificate/tasks/main.yml index 467b1c418d3e1b..25a3946ca94c02 100644 --- a/test/integration/targets/gcp_compute_ssl_certificate/tasks/main.yml +++ b/test/integration/targets/gcp_compute_ssl_certificate/tasks/main.yml @@ -12,160 +12,161 @@ # https://www.github.com/GoogleCloudPlatform/magic-modules # # ---------------------------------------------------------------------------- -# Pre-test setup -- name: delete a ssl certificate - gcp_compute_ssl_certificate: - name: "{{ resource_name }}" - description: A certificate for testing. Do not use this certificate in production - certificate: "-----BEGIN CERTIFICATE----- MIICqjCCAk+gAwIBAgIJAIuJ+0352Kq4MAoGCCqGSM49BAMCMIGwMQswCQYDVQQG - EwJVUzETMBEGA1UECAwKV2FzaGluZ3RvbjERMA8GA1UEBwwIS2lya2xhbmQxFTAT BgNVBAoMDEdvb2dsZSwgSW5jLjEeMBwGA1UECwwVR29vZ2xlIENsb3VkIFBsYXRm - b3JtMR8wHQYDVQQDDBZ3d3cubXktc2VjdXJlLXNpdGUuY29tMSEwHwYJKoZIhvcN AQkBFhJuZWxzb25hQGdvb2dsZS5jb20wHhcNMTcwNjI4MDQ1NjI2WhcNMjcwNjI2 - MDQ1NjI2WjCBsDELMAkGA1UEBhMCVVMxEzARBgNVBAgMCldhc2hpbmd0b24xETAP BgNVBAcMCEtpcmtsYW5kMRUwEwYDVQQKDAxHb29nbGUsIEluYy4xHjAcBgNVBAsM - FUdvb2dsZSBDbG91ZCBQbGF0Zm9ybTEfMB0GA1UEAwwWd3d3Lm15LXNlY3VyZS1z aXRlLmNvbTEhMB8GCSqGSIb3DQEJARYSbmVsc29uYUBnb29nbGUuY29tMFkwEwYH - KoZIzj0CAQYIKoZIzj0DAQcDQgAEHGzpcRJ4XzfBJCCPMQeXQpTXwlblimODQCuQ 4mzkzTv0dXyB750fOGN02HtkpBOZzzvUARTR10JQoSe2/5PIwaNQME4wHQYDVR0O - BBYEFKIQC3A2SDpxcdfn0YLKineDNq/BMB8GA1UdIwQYMBaAFKIQC3A2SDpxcdfn 0YLKineDNq/BMAwGA1UdEwQFMAMBAf8wCgYIKoZIzj0EAwIDSQAwRgIhALs4vy+O - M3jcqgA4fSW/oKw6UJxp+M6a+nGMX+UJR3YgAiEAvvl39QRVAiv84hdoCuyON0lJ zqGNhIPGq2ULqXKK8BY= - -----END CERTIFICATE-----" - private_key: "-----BEGIN EC PRIVATE KEY----- MHcCAQEEIObtRo8tkUqoMjeHhsOh2ouPpXCgBcP+EDxZCB/tws15oAoGCCqGSM49 - AwEHoUQDQgAEHGzpcRJ4XzfBJCCPMQeXQpTXwlblimODQCuQ4mzkzTv0dXyB750f OGN02HtkpBOZzzvUARTR10JQoSe2/5PIwQ== - -----END EC PRIVATE KEY-----" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent -#---------------------------------------------------------- -- name: create a ssl certificate - gcp_compute_ssl_certificate: - name: "{{ resource_name }}" - description: A certificate for testing. Do not use this certificate in production - certificate: "-----BEGIN CERTIFICATE----- MIICqjCCAk+gAwIBAgIJAIuJ+0352Kq4MAoGCCqGSM49BAMCMIGwMQswCQYDVQQG - EwJVUzETMBEGA1UECAwKV2FzaGluZ3RvbjERMA8GA1UEBwwIS2lya2xhbmQxFTAT BgNVBAoMDEdvb2dsZSwgSW5jLjEeMBwGA1UECwwVR29vZ2xlIENsb3VkIFBsYXRm - b3JtMR8wHQYDVQQDDBZ3d3cubXktc2VjdXJlLXNpdGUuY29tMSEwHwYJKoZIhvcN AQkBFhJuZWxzb25hQGdvb2dsZS5jb20wHhcNMTcwNjI4MDQ1NjI2WhcNMjcwNjI2 - MDQ1NjI2WjCBsDELMAkGA1UEBhMCVVMxEzARBgNVBAgMCldhc2hpbmd0b24xETAP BgNVBAcMCEtpcmtsYW5kMRUwEwYDVQQKDAxHb29nbGUsIEluYy4xHjAcBgNVBAsM - FUdvb2dsZSBDbG91ZCBQbGF0Zm9ybTEfMB0GA1UEAwwWd3d3Lm15LXNlY3VyZS1z aXRlLmNvbTEhMB8GCSqGSIb3DQEJARYSbmVsc29uYUBnb29nbGUuY29tMFkwEwYH - KoZIzj0CAQYIKoZIzj0DAQcDQgAEHGzpcRJ4XzfBJCCPMQeXQpTXwlblimODQCuQ 4mzkzTv0dXyB750fOGN02HtkpBOZzzvUARTR10JQoSe2/5PIwaNQME4wHQYDVR0O - BBYEFKIQC3A2SDpxcdfn0YLKineDNq/BMB8GA1UdIwQYMBaAFKIQC3A2SDpxcdfn 0YLKineDNq/BMAwGA1UdEwQFMAMBAf8wCgYIKoZIzj0EAwIDSQAwRgIhALs4vy+O - M3jcqgA4fSW/oKw6UJxp+M6a+nGMX+UJR3YgAiEAvvl39QRVAiv84hdoCuyON0lJ zqGNhIPGq2ULqXKK8BY= - -----END CERTIFICATE-----" - private_key: "-----BEGIN EC PRIVATE KEY----- MHcCAQEEIObtRo8tkUqoMjeHhsOh2ouPpXCgBcP+EDxZCB/tws15oAoGCCqGSM49 - AwEHoUQDQgAEHGzpcRJ4XzfBJCCPMQeXQpTXwlblimODQCuQ4mzkzTv0dXyB750f OGN02HtkpBOZzzvUARTR10JQoSe2/5PIwQ== - -----END EC PRIVATE KEY-----" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present - register: result -- name: assert changed is true - assert: - that: - - result.changed == true - - "result.kind == 'compute#sslCertificate'" -- name: verify that ssl_certificate was created - gcp_compute_ssl_certificate_facts: - filters: - - name = {{ resource_name }} +- block: + # Pre-test setup + - name: delete a ssl certificate + gcp_compute_ssl_certificate: + name: "{{ resource_name }}" + description: A certificate for testing. Do not use this certificate in production + certificate: "-----BEGIN CERTIFICATE----- MIICqjCCAk+gAwIBAgIJAIuJ+0352Kq4MAoGCCqGSM49BAMCMIGwMQswCQYDVQQG + EwJVUzETMBEGA1UECAwKV2FzaGluZ3RvbjERMA8GA1UEBwwIS2lya2xhbmQxFTAT BgNVBAoMDEdvb2dsZSwgSW5jLjEeMBwGA1UECwwVR29vZ2xlIENsb3VkIFBsYXRm + b3JtMR8wHQYDVQQDDBZ3d3cubXktc2VjdXJlLXNpdGUuY29tMSEwHwYJKoZIhvcN AQkBFhJuZWxzb25hQGdvb2dsZS5jb20wHhcNMTcwNjI4MDQ1NjI2WhcNMjcwNjI2 + MDQ1NjI2WjCBsDELMAkGA1UEBhMCVVMxEzARBgNVBAgMCldhc2hpbmd0b24xETAP BgNVBAcMCEtpcmtsYW5kMRUwEwYDVQQKDAxHb29nbGUsIEluYy4xHjAcBgNVBAsM + FUdvb2dsZSBDbG91ZCBQbGF0Zm9ybTEfMB0GA1UEAwwWd3d3Lm15LXNlY3VyZS1z aXRlLmNvbTEhMB8GCSqGSIb3DQEJARYSbmVsc29uYUBnb29nbGUuY29tMFkwEwYH + KoZIzj0CAQYIKoZIzj0DAQcDQgAEHGzpcRJ4XzfBJCCPMQeXQpTXwlblimODQCuQ 4mzkzTv0dXyB750fOGN02HtkpBOZzzvUARTR10JQoSe2/5PIwaNQME4wHQYDVR0O + BBYEFKIQC3A2SDpxcdfn0YLKineDNq/BMB8GA1UdIwQYMBaAFKIQC3A2SDpxcdfn 0YLKineDNq/BMAwGA1UdEwQFMAMBAf8wCgYIKoZIzj0EAwIDSQAwRgIhALs4vy+O + M3jcqgA4fSW/oKw6UJxp+M6a+nGMX+UJR3YgAiEAvvl39QRVAiv84hdoCuyON0lJ zqGNhIPGq2ULqXKK8BY= + -----END CERTIFICATE-----" + private_key: "-----BEGIN EC PRIVATE KEY----- MHcCAQEEIObtRo8tkUqoMjeHhsOh2ouPpXCgBcP+EDxZCB/tws15oAoGCCqGSM49 + AwEHoUQDQgAEHGzpcRJ4XzfBJCCPMQeXQpTXwlblimODQCuQ4mzkzTv0dXyB750f OGN02HtkpBOZzzvUARTR10JQoSe2/5PIwQ== + -----END EC PRIVATE KEY-----" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" - scopes: - - https://www.googleapis.com/auth/compute - register: results -- name: verify that command succeeded - assert: - that: - - results['items'] | length == 1 -# ---------------------------------------------------------------------------- -- name: create a ssl certificate that already exists - gcp_compute_ssl_certificate: - name: "{{ resource_name }}" - description: A certificate for testing. Do not use this certificate in production - certificate: "-----BEGIN CERTIFICATE----- MIICqjCCAk+gAwIBAgIJAIuJ+0352Kq4MAoGCCqGSM49BAMCMIGwMQswCQYDVQQG - EwJVUzETMBEGA1UECAwKV2FzaGluZ3RvbjERMA8GA1UEBwwIS2lya2xhbmQxFTAT BgNVBAoMDEdvb2dsZSwgSW5jLjEeMBwGA1UECwwVR29vZ2xlIENsb3VkIFBsYXRm - b3JtMR8wHQYDVQQDDBZ3d3cubXktc2VjdXJlLXNpdGUuY29tMSEwHwYJKoZIhvcN AQkBFhJuZWxzb25hQGdvb2dsZS5jb20wHhcNMTcwNjI4MDQ1NjI2WhcNMjcwNjI2 - MDQ1NjI2WjCBsDELMAkGA1UEBhMCVVMxEzARBgNVBAgMCldhc2hpbmd0b24xETAP BgNVBAcMCEtpcmtsYW5kMRUwEwYDVQQKDAxHb29nbGUsIEluYy4xHjAcBgNVBAsM - FUdvb2dsZSBDbG91ZCBQbGF0Zm9ybTEfMB0GA1UEAwwWd3d3Lm15LXNlY3VyZS1z aXRlLmNvbTEhMB8GCSqGSIb3DQEJARYSbmVsc29uYUBnb29nbGUuY29tMFkwEwYH - KoZIzj0CAQYIKoZIzj0DAQcDQgAEHGzpcRJ4XzfBJCCPMQeXQpTXwlblimODQCuQ 4mzkzTv0dXyB750fOGN02HtkpBOZzzvUARTR10JQoSe2/5PIwaNQME4wHQYDVR0O - BBYEFKIQC3A2SDpxcdfn0YLKineDNq/BMB8GA1UdIwQYMBaAFKIQC3A2SDpxcdfn 0YLKineDNq/BMAwGA1UdEwQFMAMBAf8wCgYIKoZIzj0EAwIDSQAwRgIhALs4vy+O - M3jcqgA4fSW/oKw6UJxp+M6a+nGMX+UJR3YgAiEAvvl39QRVAiv84hdoCuyON0lJ zqGNhIPGq2ULqXKK8BY= - -----END CERTIFICATE-----" - private_key: "-----BEGIN EC PRIVATE KEY----- MHcCAQEEIObtRo8tkUqoMjeHhsOh2ouPpXCgBcP+EDxZCB/tws15oAoGCCqGSM49 - AwEHoUQDQgAEHGzpcRJ4XzfBJCCPMQeXQpTXwlblimODQCuQ4mzkzTv0dXyB750f OGN02HtkpBOZzzvUARTR10JQoSe2/5PIwQ== - -----END EC PRIVATE KEY-----" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present - register: result -- name: assert changed is false - assert: - that: - - result.changed == false - - "result.kind == 'compute#sslCertificate'" -#---------------------------------------------------------- -- name: delete a ssl certificate - gcp_compute_ssl_certificate: - name: "{{ resource_name }}" - description: A certificate for testing. Do not use this certificate in production - certificate: "-----BEGIN CERTIFICATE----- MIICqjCCAk+gAwIBAgIJAIuJ+0352Kq4MAoGCCqGSM49BAMCMIGwMQswCQYDVQQG - EwJVUzETMBEGA1UECAwKV2FzaGluZ3RvbjERMA8GA1UEBwwIS2lya2xhbmQxFTAT BgNVBAoMDEdvb2dsZSwgSW5jLjEeMBwGA1UECwwVR29vZ2xlIENsb3VkIFBsYXRm - b3JtMR8wHQYDVQQDDBZ3d3cubXktc2VjdXJlLXNpdGUuY29tMSEwHwYJKoZIhvcN AQkBFhJuZWxzb25hQGdvb2dsZS5jb20wHhcNMTcwNjI4MDQ1NjI2WhcNMjcwNjI2 - MDQ1NjI2WjCBsDELMAkGA1UEBhMCVVMxEzARBgNVBAgMCldhc2hpbmd0b24xETAP BgNVBAcMCEtpcmtsYW5kMRUwEwYDVQQKDAxHb29nbGUsIEluYy4xHjAcBgNVBAsM - FUdvb2dsZSBDbG91ZCBQbGF0Zm9ybTEfMB0GA1UEAwwWd3d3Lm15LXNlY3VyZS1z aXRlLmNvbTEhMB8GCSqGSIb3DQEJARYSbmVsc29uYUBnb29nbGUuY29tMFkwEwYH - KoZIzj0CAQYIKoZIzj0DAQcDQgAEHGzpcRJ4XzfBJCCPMQeXQpTXwlblimODQCuQ 4mzkzTv0dXyB750fOGN02HtkpBOZzzvUARTR10JQoSe2/5PIwaNQME4wHQYDVR0O - BBYEFKIQC3A2SDpxcdfn0YLKineDNq/BMB8GA1UdIwQYMBaAFKIQC3A2SDpxcdfn 0YLKineDNq/BMAwGA1UdEwQFMAMBAf8wCgYIKoZIzj0EAwIDSQAwRgIhALs4vy+O - M3jcqgA4fSW/oKw6UJxp+M6a+nGMX+UJR3YgAiEAvvl39QRVAiv84hdoCuyON0lJ zqGNhIPGq2ULqXKK8BY= - -----END CERTIFICATE-----" - private_key: "-----BEGIN EC PRIVATE KEY----- MHcCAQEEIObtRo8tkUqoMjeHhsOh2ouPpXCgBcP+EDxZCB/tws15oAoGCCqGSM49 - AwEHoUQDQgAEHGzpcRJ4XzfBJCCPMQeXQpTXwlblimODQCuQ4mzkzTv0dXyB750f OGN02HtkpBOZzzvUARTR10JQoSe2/5PIwQ== - -----END EC PRIVATE KEY-----" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent - register: result -- name: assert changed is true - assert: - that: - - result.changed == true - - result.has_key('kind') == False -- name: verify that ssl_certificate was deleted - gcp_compute_ssl_certificate_facts: - filters: - - name = {{ resource_name }} + state: absent + #---------------------------------------------------------- + - name: create a ssl certificate + gcp_compute_ssl_certificate: + name: "{{ resource_name }}" + description: A certificate for testing. Do not use this certificate in production + certificate: "-----BEGIN CERTIFICATE----- MIICqjCCAk+gAwIBAgIJAIuJ+0352Kq4MAoGCCqGSM49BAMCMIGwMQswCQYDVQQG + EwJVUzETMBEGA1UECAwKV2FzaGluZ3RvbjERMA8GA1UEBwwIS2lya2xhbmQxFTAT BgNVBAoMDEdvb2dsZSwgSW5jLjEeMBwGA1UECwwVR29vZ2xlIENsb3VkIFBsYXRm + b3JtMR8wHQYDVQQDDBZ3d3cubXktc2VjdXJlLXNpdGUuY29tMSEwHwYJKoZIhvcN AQkBFhJuZWxzb25hQGdvb2dsZS5jb20wHhcNMTcwNjI4MDQ1NjI2WhcNMjcwNjI2 + MDQ1NjI2WjCBsDELMAkGA1UEBhMCVVMxEzARBgNVBAgMCldhc2hpbmd0b24xETAP BgNVBAcMCEtpcmtsYW5kMRUwEwYDVQQKDAxHb29nbGUsIEluYy4xHjAcBgNVBAsM + FUdvb2dsZSBDbG91ZCBQbGF0Zm9ybTEfMB0GA1UEAwwWd3d3Lm15LXNlY3VyZS1z aXRlLmNvbTEhMB8GCSqGSIb3DQEJARYSbmVsc29uYUBnb29nbGUuY29tMFkwEwYH + KoZIzj0CAQYIKoZIzj0DAQcDQgAEHGzpcRJ4XzfBJCCPMQeXQpTXwlblimODQCuQ 4mzkzTv0dXyB750fOGN02HtkpBOZzzvUARTR10JQoSe2/5PIwaNQME4wHQYDVR0O + BBYEFKIQC3A2SDpxcdfn0YLKineDNq/BMB8GA1UdIwQYMBaAFKIQC3A2SDpxcdfn 0YLKineDNq/BMAwGA1UdEwQFMAMBAf8wCgYIKoZIzj0EAwIDSQAwRgIhALs4vy+O + M3jcqgA4fSW/oKw6UJxp+M6a+nGMX+UJR3YgAiEAvvl39QRVAiv84hdoCuyON0lJ zqGNhIPGq2ULqXKK8BY= + -----END CERTIFICATE-----" + private_key: "-----BEGIN EC PRIVATE KEY----- MHcCAQEEIObtRo8tkUqoMjeHhsOh2ouPpXCgBcP+EDxZCB/tws15oAoGCCqGSM49 + AwEHoUQDQgAEHGzpcRJ4XzfBJCCPMQeXQpTXwlblimODQCuQ4mzkzTv0dXyB750f OGN02HtkpBOZzzvUARTR10JQoSe2/5PIwQ== + -----END EC PRIVATE KEY-----" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" - scopes: - - https://www.googleapis.com/auth/compute - register: results -- name: verify that command succeeded - assert: - that: - - results['items'] | length == 0 -# ---------------------------------------------------------------------------- -- name: delete a ssl certificate that does not exist - gcp_compute_ssl_certificate: - name: "{{ resource_name }}" - description: A certificate for testing. Do not use this certificate in production - certificate: "-----BEGIN CERTIFICATE----- MIICqjCCAk+gAwIBAgIJAIuJ+0352Kq4MAoGCCqGSM49BAMCMIGwMQswCQYDVQQG - EwJVUzETMBEGA1UECAwKV2FzaGluZ3RvbjERMA8GA1UEBwwIS2lya2xhbmQxFTAT BgNVBAoMDEdvb2dsZSwgSW5jLjEeMBwGA1UECwwVR29vZ2xlIENsb3VkIFBsYXRm - b3JtMR8wHQYDVQQDDBZ3d3cubXktc2VjdXJlLXNpdGUuY29tMSEwHwYJKoZIhvcN AQkBFhJuZWxzb25hQGdvb2dsZS5jb20wHhcNMTcwNjI4MDQ1NjI2WhcNMjcwNjI2 - MDQ1NjI2WjCBsDELMAkGA1UEBhMCVVMxEzARBgNVBAgMCldhc2hpbmd0b24xETAP BgNVBAcMCEtpcmtsYW5kMRUwEwYDVQQKDAxHb29nbGUsIEluYy4xHjAcBgNVBAsM - FUdvb2dsZSBDbG91ZCBQbGF0Zm9ybTEfMB0GA1UEAwwWd3d3Lm15LXNlY3VyZS1z aXRlLmNvbTEhMB8GCSqGSIb3DQEJARYSbmVsc29uYUBnb29nbGUuY29tMFkwEwYH - KoZIzj0CAQYIKoZIzj0DAQcDQgAEHGzpcRJ4XzfBJCCPMQeXQpTXwlblimODQCuQ 4mzkzTv0dXyB750fOGN02HtkpBOZzzvUARTR10JQoSe2/5PIwaNQME4wHQYDVR0O - BBYEFKIQC3A2SDpxcdfn0YLKineDNq/BMB8GA1UdIwQYMBaAFKIQC3A2SDpxcdfn 0YLKineDNq/BMAwGA1UdEwQFMAMBAf8wCgYIKoZIzj0EAwIDSQAwRgIhALs4vy+O - M3jcqgA4fSW/oKw6UJxp+M6a+nGMX+UJR3YgAiEAvvl39QRVAiv84hdoCuyON0lJ zqGNhIPGq2ULqXKK8BY= - -----END CERTIFICATE-----" - private_key: "-----BEGIN EC PRIVATE KEY----- MHcCAQEEIObtRo8tkUqoMjeHhsOh2ouPpXCgBcP+EDxZCB/tws15oAoGCCqGSM49 - AwEHoUQDQgAEHGzpcRJ4XzfBJCCPMQeXQpTXwlblimODQCuQ4mzkzTv0dXyB750f OGN02HtkpBOZzzvUARTR10JQoSe2/5PIwQ== - -----END EC PRIVATE KEY-----" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent - register: result -- name: assert changed is false - assert: - that: - - result.changed == false - - result.has_key('kind') == False + state: present + register: result + - name: assert changed is true + assert: + that: + - result.changed == true + - "result.kind == 'compute#sslCertificate'" + - name: verify that ssl_certificate was created + gcp_compute_ssl_certificate_facts: + filters: + - name = {{ resource_name }} + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + scopes: + - https://www.googleapis.com/auth/compute + register: results + - name: verify that command succeeded + assert: + that: + - results['items'] | length == 1 + # ---------------------------------------------------------------------------- + - name: create a ssl certificate that already exists + gcp_compute_ssl_certificate: + name: "{{ resource_name }}" + description: A certificate for testing. Do not use this certificate in production + certificate: "-----BEGIN CERTIFICATE----- MIICqjCCAk+gAwIBAgIJAIuJ+0352Kq4MAoGCCqGSM49BAMCMIGwMQswCQYDVQQG + EwJVUzETMBEGA1UECAwKV2FzaGluZ3RvbjERMA8GA1UEBwwIS2lya2xhbmQxFTAT BgNVBAoMDEdvb2dsZSwgSW5jLjEeMBwGA1UECwwVR29vZ2xlIENsb3VkIFBsYXRm + b3JtMR8wHQYDVQQDDBZ3d3cubXktc2VjdXJlLXNpdGUuY29tMSEwHwYJKoZIhvcN AQkBFhJuZWxzb25hQGdvb2dsZS5jb20wHhcNMTcwNjI4MDQ1NjI2WhcNMjcwNjI2 + MDQ1NjI2WjCBsDELMAkGA1UEBhMCVVMxEzARBgNVBAgMCldhc2hpbmd0b24xETAP BgNVBAcMCEtpcmtsYW5kMRUwEwYDVQQKDAxHb29nbGUsIEluYy4xHjAcBgNVBAsM + FUdvb2dsZSBDbG91ZCBQbGF0Zm9ybTEfMB0GA1UEAwwWd3d3Lm15LXNlY3VyZS1z aXRlLmNvbTEhMB8GCSqGSIb3DQEJARYSbmVsc29uYUBnb29nbGUuY29tMFkwEwYH + KoZIzj0CAQYIKoZIzj0DAQcDQgAEHGzpcRJ4XzfBJCCPMQeXQpTXwlblimODQCuQ 4mzkzTv0dXyB750fOGN02HtkpBOZzzvUARTR10JQoSe2/5PIwaNQME4wHQYDVR0O + BBYEFKIQC3A2SDpxcdfn0YLKineDNq/BMB8GA1UdIwQYMBaAFKIQC3A2SDpxcdfn 0YLKineDNq/BMAwGA1UdEwQFMAMBAf8wCgYIKoZIzj0EAwIDSQAwRgIhALs4vy+O + M3jcqgA4fSW/oKw6UJxp+M6a+nGMX+UJR3YgAiEAvvl39QRVAiv84hdoCuyON0lJ zqGNhIPGq2ULqXKK8BY= + -----END CERTIFICATE-----" + private_key: "-----BEGIN EC PRIVATE KEY----- MHcCAQEEIObtRo8tkUqoMjeHhsOh2ouPpXCgBcP+EDxZCB/tws15oAoGCCqGSM49 + AwEHoUQDQgAEHGzpcRJ4XzfBJCCPMQeXQpTXwlblimODQCuQ4mzkzTv0dXyB750f OGN02HtkpBOZzzvUARTR10JQoSe2/5PIwQ== + -----END EC PRIVATE KEY-----" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present + register: result + - name: assert changed is false + assert: + that: + - result.changed == false + - "result.kind == 'compute#sslCertificate'" + #---------------------------------------------------------- + - name: delete a ssl certificate + gcp_compute_ssl_certificate: + name: "{{ resource_name }}" + description: A certificate for testing. Do not use this certificate in production + certificate: "-----BEGIN CERTIFICATE----- MIICqjCCAk+gAwIBAgIJAIuJ+0352Kq4MAoGCCqGSM49BAMCMIGwMQswCQYDVQQG + EwJVUzETMBEGA1UECAwKV2FzaGluZ3RvbjERMA8GA1UEBwwIS2lya2xhbmQxFTAT BgNVBAoMDEdvb2dsZSwgSW5jLjEeMBwGA1UECwwVR29vZ2xlIENsb3VkIFBsYXRm + b3JtMR8wHQYDVQQDDBZ3d3cubXktc2VjdXJlLXNpdGUuY29tMSEwHwYJKoZIhvcN AQkBFhJuZWxzb25hQGdvb2dsZS5jb20wHhcNMTcwNjI4MDQ1NjI2WhcNMjcwNjI2 + MDQ1NjI2WjCBsDELMAkGA1UEBhMCVVMxEzARBgNVBAgMCldhc2hpbmd0b24xETAP BgNVBAcMCEtpcmtsYW5kMRUwEwYDVQQKDAxHb29nbGUsIEluYy4xHjAcBgNVBAsM + FUdvb2dsZSBDbG91ZCBQbGF0Zm9ybTEfMB0GA1UEAwwWd3d3Lm15LXNlY3VyZS1z aXRlLmNvbTEhMB8GCSqGSIb3DQEJARYSbmVsc29uYUBnb29nbGUuY29tMFkwEwYH + KoZIzj0CAQYIKoZIzj0DAQcDQgAEHGzpcRJ4XzfBJCCPMQeXQpTXwlblimODQCuQ 4mzkzTv0dXyB750fOGN02HtkpBOZzzvUARTR10JQoSe2/5PIwaNQME4wHQYDVR0O + BBYEFKIQC3A2SDpxcdfn0YLKineDNq/BMB8GA1UdIwQYMBaAFKIQC3A2SDpxcdfn 0YLKineDNq/BMAwGA1UdEwQFMAMBAf8wCgYIKoZIzj0EAwIDSQAwRgIhALs4vy+O + M3jcqgA4fSW/oKw6UJxp+M6a+nGMX+UJR3YgAiEAvvl39QRVAiv84hdoCuyON0lJ zqGNhIPGq2ULqXKK8BY= + -----END CERTIFICATE-----" + private_key: "-----BEGIN EC PRIVATE KEY----- MHcCAQEEIObtRo8tkUqoMjeHhsOh2ouPpXCgBcP+EDxZCB/tws15oAoGCCqGSM49 + AwEHoUQDQgAEHGzpcRJ4XzfBJCCPMQeXQpTXwlblimODQCuQ4mzkzTv0dXyB750f OGN02HtkpBOZzzvUARTR10JQoSe2/5PIwQ== + -----END EC PRIVATE KEY-----" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: result + - name: assert changed is true + assert: + that: + - result.changed == true + - result.has_key('kind') == False + - name: verify that ssl_certificate was deleted + gcp_compute_ssl_certificate_facts: + filters: + - name = {{ resource_name }} + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + scopes: + - https://www.googleapis.com/auth/compute + register: results + - name: verify that command succeeded + assert: + that: + - results['items'] | length == 0 + # ---------------------------------------------------------------------------- + - name: delete a ssl certificate that does not exist + gcp_compute_ssl_certificate: + name: "{{ resource_name }}" + description: A certificate for testing. Do not use this certificate in production + certificate: "-----BEGIN CERTIFICATE----- MIICqjCCAk+gAwIBAgIJAIuJ+0352Kq4MAoGCCqGSM49BAMCMIGwMQswCQYDVQQG + EwJVUzETMBEGA1UECAwKV2FzaGluZ3RvbjERMA8GA1UEBwwIS2lya2xhbmQxFTAT BgNVBAoMDEdvb2dsZSwgSW5jLjEeMBwGA1UECwwVR29vZ2xlIENsb3VkIFBsYXRm + b3JtMR8wHQYDVQQDDBZ3d3cubXktc2VjdXJlLXNpdGUuY29tMSEwHwYJKoZIhvcN AQkBFhJuZWxzb25hQGdvb2dsZS5jb20wHhcNMTcwNjI4MDQ1NjI2WhcNMjcwNjI2 + MDQ1NjI2WjCBsDELMAkGA1UEBhMCVVMxEzARBgNVBAgMCldhc2hpbmd0b24xETAP BgNVBAcMCEtpcmtsYW5kMRUwEwYDVQQKDAxHb29nbGUsIEluYy4xHjAcBgNVBAsM + FUdvb2dsZSBDbG91ZCBQbGF0Zm9ybTEfMB0GA1UEAwwWd3d3Lm15LXNlY3VyZS1z aXRlLmNvbTEhMB8GCSqGSIb3DQEJARYSbmVsc29uYUBnb29nbGUuY29tMFkwEwYH + KoZIzj0CAQYIKoZIzj0DAQcDQgAEHGzpcRJ4XzfBJCCPMQeXQpTXwlblimODQCuQ 4mzkzTv0dXyB750fOGN02HtkpBOZzzvUARTR10JQoSe2/5PIwaNQME4wHQYDVR0O + BBYEFKIQC3A2SDpxcdfn0YLKineDNq/BMB8GA1UdIwQYMBaAFKIQC3A2SDpxcdfn 0YLKineDNq/BMAwGA1UdEwQFMAMBAf8wCgYIKoZIzj0EAwIDSQAwRgIhALs4vy+O + M3jcqgA4fSW/oKw6UJxp+M6a+nGMX+UJR3YgAiEAvvl39QRVAiv84hdoCuyON0lJ zqGNhIPGq2ULqXKK8BY= + -----END CERTIFICATE-----" + private_key: "-----BEGIN EC PRIVATE KEY----- MHcCAQEEIObtRo8tkUqoMjeHhsOh2ouPpXCgBcP+EDxZCB/tws15oAoGCCqGSM49 + AwEHoUQDQgAEHGzpcRJ4XzfBJCCPMQeXQpTXwlblimODQCuQ4mzkzTv0dXyB750f OGN02HtkpBOZzzvUARTR10JQoSe2/5PIwQ== + -----END EC PRIVATE KEY-----" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: result + - name: assert changed is false + assert: + that: + - result.changed == false + - result.has_key('kind') == False diff --git a/test/integration/targets/gcp_compute_ssl_policy/tasks/main.yml b/test/integration/targets/gcp_compute_ssl_policy/tasks/main.yml index 05bd52f6367f81..61001023d1ac9d 100644 --- a/test/integration/targets/gcp_compute_ssl_policy/tasks/main.yml +++ b/test/integration/targets/gcp_compute_ssl_policy/tasks/main.yml @@ -12,120 +12,121 @@ # https://www.github.com/GoogleCloudPlatform/magic-modules # # ---------------------------------------------------------------------------- -# Pre-test setup -- name: delete a ssl policy - gcp_compute_ssl_policy: - name: "{{ resource_name }}" - profile: CUSTOM - min_tls_version: TLS_1_2 - custom_features: - - TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 - - TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent -#---------------------------------------------------------- -- name: create a ssl policy - gcp_compute_ssl_policy: - name: "{{ resource_name }}" - profile: CUSTOM - min_tls_version: TLS_1_2 - custom_features: - - TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 - - TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present - register: result -- name: assert changed is true - assert: - that: - - result.changed == true - - "result.kind == 'compute#sslPolicy'" -- name: verify that ssl_policy was created - gcp_compute_ssl_policy_facts: - filters: - - name = {{ resource_name }} +- block: + # Pre-test setup + - name: delete a ssl policy + gcp_compute_ssl_policy: + name: "{{ resource_name }}" + profile: CUSTOM + min_tls_version: TLS_1_2 + custom_features: + - TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 + - TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" - scopes: - - https://www.googleapis.com/auth/compute - register: results -- name: verify that command succeeded - assert: - that: - - results['items'] | length == 1 -# ---------------------------------------------------------------------------- -- name: create a ssl policy that already exists - gcp_compute_ssl_policy: - name: "{{ resource_name }}" - profile: CUSTOM - min_tls_version: TLS_1_2 - custom_features: - - TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 - - TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present - register: result -- name: assert changed is false - assert: - that: - - result.changed == false - - "result.kind == 'compute#sslPolicy'" -#---------------------------------------------------------- -- name: delete a ssl policy - gcp_compute_ssl_policy: - name: "{{ resource_name }}" - profile: CUSTOM - min_tls_version: TLS_1_2 - custom_features: - - TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 - - TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent - register: result -- name: assert changed is true - assert: - that: - - result.changed == true - - result.has_key('kind') == False -- name: verify that ssl_policy was deleted - gcp_compute_ssl_policy_facts: - filters: - - name = {{ resource_name }} + state: absent + #---------------------------------------------------------- + - name: create a ssl policy + gcp_compute_ssl_policy: + name: "{{ resource_name }}" + profile: CUSTOM + min_tls_version: TLS_1_2 + custom_features: + - TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 + - TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" - scopes: - - https://www.googleapis.com/auth/compute - register: results -- name: verify that command succeeded - assert: - that: - - results['items'] | length == 0 -# ---------------------------------------------------------------------------- -- name: delete a ssl policy that does not exist - gcp_compute_ssl_policy: - name: "{{ resource_name }}" - profile: CUSTOM - min_tls_version: TLS_1_2 - custom_features: - - TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 - - TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent - register: result -- name: assert changed is false - assert: - that: - - result.changed == false - - result.has_key('kind') == False + state: present + register: result + - name: assert changed is true + assert: + that: + - result.changed == true + - "result.kind == 'compute#sslPolicy'" + - name: verify that ssl_policy was created + gcp_compute_ssl_policy_facts: + filters: + - name = {{ resource_name }} + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + scopes: + - https://www.googleapis.com/auth/compute + register: results + - name: verify that command succeeded + assert: + that: + - results['items'] | length == 1 + # ---------------------------------------------------------------------------- + - name: create a ssl policy that already exists + gcp_compute_ssl_policy: + name: "{{ resource_name }}" + profile: CUSTOM + min_tls_version: TLS_1_2 + custom_features: + - TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 + - TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present + register: result + - name: assert changed is false + assert: + that: + - result.changed == false + - "result.kind == 'compute#sslPolicy'" + #---------------------------------------------------------- + - name: delete a ssl policy + gcp_compute_ssl_policy: + name: "{{ resource_name }}" + profile: CUSTOM + min_tls_version: TLS_1_2 + custom_features: + - TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 + - TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: result + - name: assert changed is true + assert: + that: + - result.changed == true + - result.has_key('kind') == False + - name: verify that ssl_policy was deleted + gcp_compute_ssl_policy_facts: + filters: + - name = {{ resource_name }} + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + scopes: + - https://www.googleapis.com/auth/compute + register: results + - name: verify that command succeeded + assert: + that: + - results['items'] | length == 0 + # ---------------------------------------------------------------------------- + - name: delete a ssl policy that does not exist + gcp_compute_ssl_policy: + name: "{{ resource_name }}" + profile: CUSTOM + min_tls_version: TLS_1_2 + custom_features: + - TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 + - TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: result + - name: assert changed is false + assert: + that: + - result.changed == false + - result.has_key('kind') == False diff --git a/test/integration/targets/gcp_compute_subnetwork/tasks/main.yml b/test/integration/targets/gcp_compute_subnetwork/tasks/main.yml index ffcca46aea4b11..4ba9b2c4c4c400 100644 --- a/test/integration/targets/gcp_compute_subnetwork/tasks/main.yml +++ b/test/integration/targets/gcp_compute_subnetwork/tasks/main.yml @@ -12,134 +12,136 @@ # https://www.github.com/GoogleCloudPlatform/magic-modules # # ---------------------------------------------------------------------------- -# Pre-test setup -- name: create a network - gcp_compute_network: - name: network-subnetwork - auto_create_subnetworks: 'true' - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present - register: network -- name: delete a subnetwork - gcp_compute_subnetwork: - name: ansiblenet - region: us-west1 - network: "{{ network }}" - ip_cidr_range: 172.16.0.0/16 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent -#---------------------------------------------------------- -- name: create a subnetwork - gcp_compute_subnetwork: - name: ansiblenet - region: us-west1 - network: "{{ network }}" - ip_cidr_range: 172.16.0.0/16 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present - register: result -- name: assert changed is true - assert: - that: - - result.changed == true - - "result.kind == 'compute#subnetwork'" -- name: verify that subnetwork was created - gcp_compute_subnetwork_facts: - filters: - - name = ansiblenet +- block: + # Pre-test setup + - name: create a network + gcp_compute_network: + name: network-subnetwork + auto_create_subnetworks: 'true' + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present + register: network + - name: delete a subnetwork + gcp_compute_subnetwork: + name: ansiblenet region: us-west1 + network: "{{ network }}" + ip_cidr_range: 172.16.0.0/16 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" - scopes: - - https://www.googleapis.com/auth/compute - register: results -- name: verify that command succeeded - assert: - that: - - results['items'] | length == 1 -# ---------------------------------------------------------------------------- -- name: create a subnetwork that already exists - gcp_compute_subnetwork: - name: ansiblenet - region: us-west1 - network: "{{ network }}" - ip_cidr_range: 172.16.0.0/16 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present - register: result -- name: assert changed is false - assert: - that: - - result.changed == false - - "result.kind == 'compute#subnetwork'" -#---------------------------------------------------------- -- name: delete a subnetwork - gcp_compute_subnetwork: - name: ansiblenet - region: us-west1 - network: "{{ network }}" - ip_cidr_range: 172.16.0.0/16 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent - register: result -- name: assert changed is true - assert: - that: - - result.changed == true - - result.has_key('kind') == False -- name: verify that subnetwork was deleted - gcp_compute_subnetwork_facts: - filters: - - name = ansiblenet + state: absent + #---------------------------------------------------------- + - name: create a subnetwork + gcp_compute_subnetwork: + name: ansiblenet region: us-west1 + network: "{{ network }}" + ip_cidr_range: 172.16.0.0/16 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" - scopes: - - https://www.googleapis.com/auth/compute - register: results -- name: verify that command succeeded - assert: - that: - - results['items'] | length == 0 -# ---------------------------------------------------------------------------- -- name: delete a subnetwork that does not exist - gcp_compute_subnetwork: - name: ansiblenet - region: us-west1 - network: "{{ network }}" - ip_cidr_range: 172.16.0.0/16 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent - register: result -- name: assert changed is false - assert: - that: - - result.changed == false - - result.has_key('kind') == False -#--------------------------------------------------------- -# Post-test teardown -# If errors happen, don't crash the playbook! -- name: delete a network - gcp_compute_network: - name: network-subnetwork - auto_create_subnetworks: 'true' - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent - register: network - ignore_errors: true + state: present + register: result + - name: assert changed is true + assert: + that: + - result.changed == true + - "result.kind == 'compute#subnetwork'" + - name: verify that subnetwork was created + gcp_compute_subnetwork_facts: + filters: + - name = ansiblenet + region: us-west1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + scopes: + - https://www.googleapis.com/auth/compute + register: results + - name: verify that command succeeded + assert: + that: + - results['items'] | length == 1 + # ---------------------------------------------------------------------------- + - name: create a subnetwork that already exists + gcp_compute_subnetwork: + name: ansiblenet + region: us-west1 + network: "{{ network }}" + ip_cidr_range: 172.16.0.0/16 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present + register: result + - name: assert changed is false + assert: + that: + - result.changed == false + - "result.kind == 'compute#subnetwork'" + #---------------------------------------------------------- + - name: delete a subnetwork + gcp_compute_subnetwork: + name: ansiblenet + region: us-west1 + network: "{{ network }}" + ip_cidr_range: 172.16.0.0/16 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: result + - name: assert changed is true + assert: + that: + - result.changed == true + - result.has_key('kind') == False + - name: verify that subnetwork was deleted + gcp_compute_subnetwork_facts: + filters: + - name = ansiblenet + region: us-west1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + scopes: + - https://www.googleapis.com/auth/compute + register: results + - name: verify that command succeeded + assert: + that: + - results['items'] | length == 0 + # ---------------------------------------------------------------------------- + - name: delete a subnetwork that does not exist + gcp_compute_subnetwork: + name: ansiblenet + region: us-west1 + network: "{{ network }}" + ip_cidr_range: 172.16.0.0/16 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: result + - name: assert changed is false + assert: + that: + - result.changed == false + - result.has_key('kind') == False + always: + #--------------------------------------------------------- + # Post-test teardown + # If errors happen, don't crash the playbook! + - name: delete a network + gcp_compute_network: + name: network-subnetwork + auto_create_subnetworks: 'true' + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: network + ignore_errors: true diff --git a/test/integration/targets/gcp_compute_target_http_proxy/tasks/main.yml b/test/integration/targets/gcp_compute_target_http_proxy/tasks/main.yml index a5182a72249189..5fd1a56d417b65 100644 --- a/test/integration/targets/gcp_compute_target_http_proxy/tasks/main.yml +++ b/test/integration/targets/gcp_compute_target_http_proxy/tasks/main.yml @@ -12,193 +12,195 @@ # https://www.github.com/GoogleCloudPlatform/magic-modules # # ---------------------------------------------------------------------------- -# Pre-test setup -- name: create a instance group - gcp_compute_instance_group: - name: instancegroup-targethttpproxy - zone: us-central1-a - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present - register: instancegroup -- name: create a http health check - gcp_compute_http_health_check: - name: httphealthcheck-targethttpproxy - healthy_threshold: 10 - port: 8080 - timeout_sec: 2 - unhealthy_threshold: 5 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present - register: healthcheck -- name: create a backend service - gcp_compute_backend_service: - name: backendservice-targethttpproxy - 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 - register: backendservice -- name: create a url map - gcp_compute_url_map: - name: urlmap-targethttpproxy - default_service: "{{ backendservice }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present - register: urlmap -- name: delete a target http proxy - gcp_compute_target_http_proxy: - name: "{{ resource_name }}" - url_map: "{{ urlmap }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent -#---------------------------------------------------------- -- name: create a target http proxy - gcp_compute_target_http_proxy: - name: "{{ resource_name }}" - url_map: "{{ urlmap }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present - register: result -- name: assert changed is true - assert: - that: - - result.changed == true - - "result.kind == 'compute#targetHttpProxy'" -- name: verify that target_http_proxy was created - gcp_compute_target_http_proxy_facts: - filters: - - name = {{ resource_name }} +- block: + # Pre-test setup + - name: create a instance group + gcp_compute_instance_group: + name: instancegroup-targethttpproxy + zone: us-central1-a project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" - scopes: - - https://www.googleapis.com/auth/compute - register: results -- name: verify that command succeeded - assert: - that: - - results['items'] | length == 1 -# ---------------------------------------------------------------------------- -- name: create a target http proxy that already exists - gcp_compute_target_http_proxy: - name: "{{ resource_name }}" - url_map: "{{ urlmap }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present - register: result -- name: assert changed is false - assert: - that: - - result.changed == false - - "result.kind == 'compute#targetHttpProxy'" -#---------------------------------------------------------- -- name: delete a target http proxy - gcp_compute_target_http_proxy: - name: "{{ resource_name }}" - url_map: "{{ urlmap }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent - register: result -- name: assert changed is true - assert: - that: - - result.changed == true - - result.has_key('kind') == False -- name: verify that target_http_proxy was deleted - gcp_compute_target_http_proxy_facts: - filters: - - name = {{ resource_name }} + state: present + register: instancegroup + - name: create a http health check + gcp_compute_http_health_check: + name: httphealthcheck-targethttpproxy + healthy_threshold: 10 + port: 8080 + timeout_sec: 2 + unhealthy_threshold: 5 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" - scopes: - - https://www.googleapis.com/auth/compute - register: results -- name: verify that command succeeded - assert: - that: - - results['items'] | length == 0 -# ---------------------------------------------------------------------------- -- name: delete a target http proxy that does not exist - gcp_compute_target_http_proxy: - name: "{{ resource_name }}" - url_map: "{{ urlmap }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent - register: result -- name: assert changed is false - assert: - that: - - result.changed == false - - result.has_key('kind') == False -#--------------------------------------------------------- -# Post-test teardown -# If errors happen, don't crash the playbook! -- name: delete a url map - gcp_compute_url_map: - name: urlmap-targethttpproxy - default_service: "{{ backendservice }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent - register: urlmap - ignore_errors: true -- name: delete a backend service - gcp_compute_backend_service: - name: backendservice-targethttpproxy - 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 - register: backendservice - ignore_errors: true -- name: delete a http health check - gcp_compute_http_health_check: - name: httphealthcheck-targethttpproxy - healthy_threshold: 10 - port: 8080 - timeout_sec: 2 - unhealthy_threshold: 5 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent - register: healthcheck - ignore_errors: true -- name: delete a instance group - gcp_compute_instance_group: - name: instancegroup-targethttpproxy - zone: us-central1-a - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent - register: instancegroup - ignore_errors: true + state: present + register: healthcheck + - name: create a backend service + gcp_compute_backend_service: + name: backendservice-targethttpproxy + 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 + register: backendservice + - name: create a url map + gcp_compute_url_map: + name: urlmap-targethttpproxy + default_service: "{{ backendservice }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present + register: urlmap + - name: delete a target http proxy + gcp_compute_target_http_proxy: + name: "{{ resource_name }}" + url_map: "{{ urlmap }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + #---------------------------------------------------------- + - name: create a target http proxy + gcp_compute_target_http_proxy: + name: "{{ resource_name }}" + url_map: "{{ urlmap }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present + register: result + - name: assert changed is true + assert: + that: + - result.changed == true + - "result.kind == 'compute#targetHttpProxy'" + - name: verify that target_http_proxy was created + gcp_compute_target_http_proxy_facts: + filters: + - name = {{ resource_name }} + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + scopes: + - https://www.googleapis.com/auth/compute + register: results + - name: verify that command succeeded + assert: + that: + - results['items'] | length == 1 + # ---------------------------------------------------------------------------- + - name: create a target http proxy that already exists + gcp_compute_target_http_proxy: + name: "{{ resource_name }}" + url_map: "{{ urlmap }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present + register: result + - name: assert changed is false + assert: + that: + - result.changed == false + - "result.kind == 'compute#targetHttpProxy'" + #---------------------------------------------------------- + - name: delete a target http proxy + gcp_compute_target_http_proxy: + name: "{{ resource_name }}" + url_map: "{{ urlmap }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: result + - name: assert changed is true + assert: + that: + - result.changed == true + - result.has_key('kind') == False + - name: verify that target_http_proxy was deleted + gcp_compute_target_http_proxy_facts: + filters: + - name = {{ resource_name }} + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + scopes: + - https://www.googleapis.com/auth/compute + register: results + - name: verify that command succeeded + assert: + that: + - results['items'] | length == 0 + # ---------------------------------------------------------------------------- + - name: delete a target http proxy that does not exist + gcp_compute_target_http_proxy: + name: "{{ resource_name }}" + url_map: "{{ urlmap }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: result + - name: assert changed is false + assert: + that: + - result.changed == false + - result.has_key('kind') == False + always: + #--------------------------------------------------------- + # Post-test teardown + # If errors happen, don't crash the playbook! + - name: delete a url map + gcp_compute_url_map: + name: urlmap-targethttpproxy + default_service: "{{ backendservice }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: urlmap + ignore_errors: true + - name: delete a backend service + gcp_compute_backend_service: + name: backendservice-targethttpproxy + 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 + register: backendservice + ignore_errors: true + - name: delete a http health check + gcp_compute_http_health_check: + name: httphealthcheck-targethttpproxy + healthy_threshold: 10 + port: 8080 + timeout_sec: 2 + unhealthy_threshold: 5 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: healthcheck + ignore_errors: true + - name: delete a instance group + gcp_compute_instance_group: + name: instancegroup-targethttpproxy + zone: us-central1-a + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: instancegroup + ignore_errors: true diff --git a/test/integration/targets/gcp_compute_target_https_proxy/tasks/main.yml b/test/integration/targets/gcp_compute_target_https_proxy/tasks/main.yml index 144bf956fa8e90..283cc0420959f9 100644 --- a/test/integration/targets/gcp_compute_target_https_proxy/tasks/main.yml +++ b/test/integration/targets/gcp_compute_target_https_proxy/tasks/main.yml @@ -12,246 +12,248 @@ # https://www.github.com/GoogleCloudPlatform/magic-modules # # ---------------------------------------------------------------------------- -# Pre-test setup -- name: create a instance group - gcp_compute_instance_group: - name: instancegroup-targethttpsproxy - zone: us-central1-a - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present - register: instancegroup -- name: create a http health check - gcp_compute_http_health_check: - name: httphealthcheck-targethttpsproxy - healthy_threshold: 10 - port: 8080 - timeout_sec: 2 - unhealthy_threshold: 5 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present - register: healthcheck -- name: create a backend service - gcp_compute_backend_service: - name: backendservice-targethttpsproxy - 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 - register: backendservice -- name: create a url map - gcp_compute_url_map: - name: urlmap-targethttpsproxy - default_service: "{{ backendservice }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present - register: urlmap -- name: create a ssl certificate - gcp_compute_ssl_certificate: - name: sslcert-targethttpsproxy - description: A certificate for testing. Do not use this certificate in production - certificate: "-----BEGIN CERTIFICATE----- MIICqjCCAk+gAwIBAgIJAIuJ+0352Kq4MAoGCCqGSM49BAMCMIGwMQswCQYDVQQG - EwJVUzETMBEGA1UECAwKV2FzaGluZ3RvbjERMA8GA1UEBwwIS2lya2xhbmQxFTAT BgNVBAoMDEdvb2dsZSwgSW5jLjEeMBwGA1UECwwVR29vZ2xlIENsb3VkIFBsYXRm - b3JtMR8wHQYDVQQDDBZ3d3cubXktc2VjdXJlLXNpdGUuY29tMSEwHwYJKoZIhvcN AQkBFhJuZWxzb25hQGdvb2dsZS5jb20wHhcNMTcwNjI4MDQ1NjI2WhcNMjcwNjI2 - MDQ1NjI2WjCBsDELMAkGA1UEBhMCVVMxEzARBgNVBAgMCldhc2hpbmd0b24xETAP BgNVBAcMCEtpcmtsYW5kMRUwEwYDVQQKDAxHb29nbGUsIEluYy4xHjAcBgNVBAsM - FUdvb2dsZSBDbG91ZCBQbGF0Zm9ybTEfMB0GA1UEAwwWd3d3Lm15LXNlY3VyZS1z aXRlLmNvbTEhMB8GCSqGSIb3DQEJARYSbmVsc29uYUBnb29nbGUuY29tMFkwEwYH - KoZIzj0CAQYIKoZIzj0DAQcDQgAEHGzpcRJ4XzfBJCCPMQeXQpTXwlblimODQCuQ 4mzkzTv0dXyB750fOGN02HtkpBOZzzvUARTR10JQoSe2/5PIwaNQME4wHQYDVR0O - BBYEFKIQC3A2SDpxcdfn0YLKineDNq/BMB8GA1UdIwQYMBaAFKIQC3A2SDpxcdfn 0YLKineDNq/BMAwGA1UdEwQFMAMBAf8wCgYIKoZIzj0EAwIDSQAwRgIhALs4vy+O - M3jcqgA4fSW/oKw6UJxp+M6a+nGMX+UJR3YgAiEAvvl39QRVAiv84hdoCuyON0lJ zqGNhIPGq2ULqXKK8BY= - -----END CERTIFICATE-----" - private_key: "-----BEGIN EC PRIVATE KEY----- MHcCAQEEIObtRo8tkUqoMjeHhsOh2ouPpXCgBcP+EDxZCB/tws15oAoGCCqGSM49 - AwEHoUQDQgAEHGzpcRJ4XzfBJCCPMQeXQpTXwlblimODQCuQ4mzkzTv0dXyB750f OGN02HtkpBOZzzvUARTR10JQoSe2/5PIwQ== - -----END EC PRIVATE KEY-----" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present - register: sslcert -- name: delete a target https proxy - gcp_compute_target_https_proxy: - name: "{{ resource_name }}" - ssl_certificates: - - "{{ sslcert }}" - url_map: "{{ urlmap }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent -#---------------------------------------------------------- -- name: create a target https proxy - gcp_compute_target_https_proxy: - name: "{{ resource_name }}" - ssl_certificates: - - "{{ sslcert }}" - url_map: "{{ urlmap }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present - register: result -- name: assert changed is true - assert: - that: - - result.changed == true - - "result.kind == 'compute#targetHttpsProxy'" -- name: verify that target_https_proxy was created - gcp_compute_target_https_proxy_facts: - filters: - - name = {{ resource_name }} +- block: + # Pre-test setup + - name: create a instance group + gcp_compute_instance_group: + name: instancegroup-targethttpsproxy + zone: us-central1-a project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" - scopes: - - https://www.googleapis.com/auth/compute - register: results -- name: verify that command succeeded - assert: - that: - - results['items'] | length == 1 -# ---------------------------------------------------------------------------- -- name: create a target https proxy that already exists - gcp_compute_target_https_proxy: - name: "{{ resource_name }}" - ssl_certificates: - - "{{ sslcert }}" - url_map: "{{ urlmap }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present - register: result -- name: assert changed is false - assert: - that: - - result.changed == false - - "result.kind == 'compute#targetHttpsProxy'" -#---------------------------------------------------------- -- name: delete a target https proxy - gcp_compute_target_https_proxy: - name: "{{ resource_name }}" - ssl_certificates: - - "{{ sslcert }}" - url_map: "{{ urlmap }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent - register: result -- name: assert changed is true - assert: - that: - - result.changed == true - - result.has_key('kind') == False -- name: verify that target_https_proxy was deleted - gcp_compute_target_https_proxy_facts: - filters: - - name = {{ resource_name }} + state: present + register: instancegroup + - name: create a http health check + gcp_compute_http_health_check: + name: httphealthcheck-targethttpsproxy + healthy_threshold: 10 + port: 8080 + timeout_sec: 2 + unhealthy_threshold: 5 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" - scopes: - - https://www.googleapis.com/auth/compute - register: results -- name: verify that command succeeded - assert: - that: - - results['items'] | length == 0 -# ---------------------------------------------------------------------------- -- name: delete a target https proxy that does not exist - gcp_compute_target_https_proxy: - name: "{{ resource_name }}" - ssl_certificates: - - "{{ sslcert }}" - url_map: "{{ urlmap }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent - register: result -- name: assert changed is false - assert: - that: - - result.changed == false - - result.has_key('kind') == False -#--------------------------------------------------------- -# Post-test teardown -# If errors happen, don't crash the playbook! -- name: delete a ssl certificate - gcp_compute_ssl_certificate: - name: sslcert-targethttpsproxy - description: A certificate for testing. Do not use this certificate in production - certificate: "-----BEGIN CERTIFICATE----- MIICqjCCAk+gAwIBAgIJAIuJ+0352Kq4MAoGCCqGSM49BAMCMIGwMQswCQYDVQQG - EwJVUzETMBEGA1UECAwKV2FzaGluZ3RvbjERMA8GA1UEBwwIS2lya2xhbmQxFTAT BgNVBAoMDEdvb2dsZSwgSW5jLjEeMBwGA1UECwwVR29vZ2xlIENsb3VkIFBsYXRm - b3JtMR8wHQYDVQQDDBZ3d3cubXktc2VjdXJlLXNpdGUuY29tMSEwHwYJKoZIhvcN AQkBFhJuZWxzb25hQGdvb2dsZS5jb20wHhcNMTcwNjI4MDQ1NjI2WhcNMjcwNjI2 - MDQ1NjI2WjCBsDELMAkGA1UEBhMCVVMxEzARBgNVBAgMCldhc2hpbmd0b24xETAP BgNVBAcMCEtpcmtsYW5kMRUwEwYDVQQKDAxHb29nbGUsIEluYy4xHjAcBgNVBAsM - FUdvb2dsZSBDbG91ZCBQbGF0Zm9ybTEfMB0GA1UEAwwWd3d3Lm15LXNlY3VyZS1z aXRlLmNvbTEhMB8GCSqGSIb3DQEJARYSbmVsc29uYUBnb29nbGUuY29tMFkwEwYH - KoZIzj0CAQYIKoZIzj0DAQcDQgAEHGzpcRJ4XzfBJCCPMQeXQpTXwlblimODQCuQ 4mzkzTv0dXyB750fOGN02HtkpBOZzzvUARTR10JQoSe2/5PIwaNQME4wHQYDVR0O - BBYEFKIQC3A2SDpxcdfn0YLKineDNq/BMB8GA1UdIwQYMBaAFKIQC3A2SDpxcdfn 0YLKineDNq/BMAwGA1UdEwQFMAMBAf8wCgYIKoZIzj0EAwIDSQAwRgIhALs4vy+O - M3jcqgA4fSW/oKw6UJxp+M6a+nGMX+UJR3YgAiEAvvl39QRVAiv84hdoCuyON0lJ zqGNhIPGq2ULqXKK8BY= - -----END CERTIFICATE-----" - private_key: "-----BEGIN EC PRIVATE KEY----- MHcCAQEEIObtRo8tkUqoMjeHhsOh2ouPpXCgBcP+EDxZCB/tws15oAoGCCqGSM49 - AwEHoUQDQgAEHGzpcRJ4XzfBJCCPMQeXQpTXwlblimODQCuQ4mzkzTv0dXyB750f OGN02HtkpBOZzzvUARTR10JQoSe2/5PIwQ== - -----END EC PRIVATE KEY-----" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent - register: sslcert - ignore_errors: true -- name: delete a url map - gcp_compute_url_map: - name: urlmap-targethttpsproxy - default_service: "{{ backendservice }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent - register: urlmap - ignore_errors: true -- name: delete a backend service - gcp_compute_backend_service: - name: backendservice-targethttpsproxy - 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 - register: backendservice - ignore_errors: true -- name: delete a http health check - gcp_compute_http_health_check: - name: httphealthcheck-targethttpsproxy - healthy_threshold: 10 - port: 8080 - timeout_sec: 2 - unhealthy_threshold: 5 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent - register: healthcheck - ignore_errors: true -- name: delete a instance group - gcp_compute_instance_group: - name: instancegroup-targethttpsproxy - zone: us-central1-a - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent - register: instancegroup - ignore_errors: true + state: present + register: healthcheck + - name: create a backend service + gcp_compute_backend_service: + name: backendservice-targethttpsproxy + 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 + register: backendservice + - name: create a url map + gcp_compute_url_map: + name: urlmap-targethttpsproxy + default_service: "{{ backendservice }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present + register: urlmap + - name: create a ssl certificate + gcp_compute_ssl_certificate: + name: sslcert-targethttpsproxy + description: A certificate for testing. Do not use this certificate in production + certificate: "-----BEGIN CERTIFICATE----- MIICqjCCAk+gAwIBAgIJAIuJ+0352Kq4MAoGCCqGSM49BAMCMIGwMQswCQYDVQQG + EwJVUzETMBEGA1UECAwKV2FzaGluZ3RvbjERMA8GA1UEBwwIS2lya2xhbmQxFTAT BgNVBAoMDEdvb2dsZSwgSW5jLjEeMBwGA1UECwwVR29vZ2xlIENsb3VkIFBsYXRm + b3JtMR8wHQYDVQQDDBZ3d3cubXktc2VjdXJlLXNpdGUuY29tMSEwHwYJKoZIhvcN AQkBFhJuZWxzb25hQGdvb2dsZS5jb20wHhcNMTcwNjI4MDQ1NjI2WhcNMjcwNjI2 + MDQ1NjI2WjCBsDELMAkGA1UEBhMCVVMxEzARBgNVBAgMCldhc2hpbmd0b24xETAP BgNVBAcMCEtpcmtsYW5kMRUwEwYDVQQKDAxHb29nbGUsIEluYy4xHjAcBgNVBAsM + FUdvb2dsZSBDbG91ZCBQbGF0Zm9ybTEfMB0GA1UEAwwWd3d3Lm15LXNlY3VyZS1z aXRlLmNvbTEhMB8GCSqGSIb3DQEJARYSbmVsc29uYUBnb29nbGUuY29tMFkwEwYH + KoZIzj0CAQYIKoZIzj0DAQcDQgAEHGzpcRJ4XzfBJCCPMQeXQpTXwlblimODQCuQ 4mzkzTv0dXyB750fOGN02HtkpBOZzzvUARTR10JQoSe2/5PIwaNQME4wHQYDVR0O + BBYEFKIQC3A2SDpxcdfn0YLKineDNq/BMB8GA1UdIwQYMBaAFKIQC3A2SDpxcdfn 0YLKineDNq/BMAwGA1UdEwQFMAMBAf8wCgYIKoZIzj0EAwIDSQAwRgIhALs4vy+O + M3jcqgA4fSW/oKw6UJxp+M6a+nGMX+UJR3YgAiEAvvl39QRVAiv84hdoCuyON0lJ zqGNhIPGq2ULqXKK8BY= + -----END CERTIFICATE-----" + private_key: "-----BEGIN EC PRIVATE KEY----- MHcCAQEEIObtRo8tkUqoMjeHhsOh2ouPpXCgBcP+EDxZCB/tws15oAoGCCqGSM49 + AwEHoUQDQgAEHGzpcRJ4XzfBJCCPMQeXQpTXwlblimODQCuQ4mzkzTv0dXyB750f OGN02HtkpBOZzzvUARTR10JQoSe2/5PIwQ== + -----END EC PRIVATE KEY-----" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present + register: sslcert + - name: delete a target https proxy + gcp_compute_target_https_proxy: + name: "{{ resource_name }}" + ssl_certificates: + - "{{ sslcert }}" + url_map: "{{ urlmap }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + #---------------------------------------------------------- + - name: create a target https proxy + gcp_compute_target_https_proxy: + name: "{{ resource_name }}" + ssl_certificates: + - "{{ sslcert }}" + url_map: "{{ urlmap }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present + register: result + - name: assert changed is true + assert: + that: + - result.changed == true + - "result.kind == 'compute#targetHttpsProxy'" + - name: verify that target_https_proxy was created + gcp_compute_target_https_proxy_facts: + filters: + - name = {{ resource_name }} + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + scopes: + - https://www.googleapis.com/auth/compute + register: results + - name: verify that command succeeded + assert: + that: + - results['items'] | length == 1 + # ---------------------------------------------------------------------------- + - name: create a target https proxy that already exists + gcp_compute_target_https_proxy: + name: "{{ resource_name }}" + ssl_certificates: + - "{{ sslcert }}" + url_map: "{{ urlmap }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present + register: result + - name: assert changed is false + assert: + that: + - result.changed == false + - "result.kind == 'compute#targetHttpsProxy'" + #---------------------------------------------------------- + - name: delete a target https proxy + gcp_compute_target_https_proxy: + name: "{{ resource_name }}" + ssl_certificates: + - "{{ sslcert }}" + url_map: "{{ urlmap }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: result + - name: assert changed is true + assert: + that: + - result.changed == true + - result.has_key('kind') == False + - name: verify that target_https_proxy was deleted + gcp_compute_target_https_proxy_facts: + filters: + - name = {{ resource_name }} + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + scopes: + - https://www.googleapis.com/auth/compute + register: results + - name: verify that command succeeded + assert: + that: + - results['items'] | length == 0 + # ---------------------------------------------------------------------------- + - name: delete a target https proxy that does not exist + gcp_compute_target_https_proxy: + name: "{{ resource_name }}" + ssl_certificates: + - "{{ sslcert }}" + url_map: "{{ urlmap }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: result + - name: assert changed is false + assert: + that: + - result.changed == false + - result.has_key('kind') == False + always: + #--------------------------------------------------------- + # Post-test teardown + # If errors happen, don't crash the playbook! + - name: delete a ssl certificate + gcp_compute_ssl_certificate: + name: sslcert-targethttpsproxy + description: A certificate for testing. Do not use this certificate in production + certificate: "-----BEGIN CERTIFICATE----- MIICqjCCAk+gAwIBAgIJAIuJ+0352Kq4MAoGCCqGSM49BAMCMIGwMQswCQYDVQQG + EwJVUzETMBEGA1UECAwKV2FzaGluZ3RvbjERMA8GA1UEBwwIS2lya2xhbmQxFTAT BgNVBAoMDEdvb2dsZSwgSW5jLjEeMBwGA1UECwwVR29vZ2xlIENsb3VkIFBsYXRm + b3JtMR8wHQYDVQQDDBZ3d3cubXktc2VjdXJlLXNpdGUuY29tMSEwHwYJKoZIhvcN AQkBFhJuZWxzb25hQGdvb2dsZS5jb20wHhcNMTcwNjI4MDQ1NjI2WhcNMjcwNjI2 + MDQ1NjI2WjCBsDELMAkGA1UEBhMCVVMxEzARBgNVBAgMCldhc2hpbmd0b24xETAP BgNVBAcMCEtpcmtsYW5kMRUwEwYDVQQKDAxHb29nbGUsIEluYy4xHjAcBgNVBAsM + FUdvb2dsZSBDbG91ZCBQbGF0Zm9ybTEfMB0GA1UEAwwWd3d3Lm15LXNlY3VyZS1z aXRlLmNvbTEhMB8GCSqGSIb3DQEJARYSbmVsc29uYUBnb29nbGUuY29tMFkwEwYH + KoZIzj0CAQYIKoZIzj0DAQcDQgAEHGzpcRJ4XzfBJCCPMQeXQpTXwlblimODQCuQ 4mzkzTv0dXyB750fOGN02HtkpBOZzzvUARTR10JQoSe2/5PIwaNQME4wHQYDVR0O + BBYEFKIQC3A2SDpxcdfn0YLKineDNq/BMB8GA1UdIwQYMBaAFKIQC3A2SDpxcdfn 0YLKineDNq/BMAwGA1UdEwQFMAMBAf8wCgYIKoZIzj0EAwIDSQAwRgIhALs4vy+O + M3jcqgA4fSW/oKw6UJxp+M6a+nGMX+UJR3YgAiEAvvl39QRVAiv84hdoCuyON0lJ zqGNhIPGq2ULqXKK8BY= + -----END CERTIFICATE-----" + private_key: "-----BEGIN EC PRIVATE KEY----- MHcCAQEEIObtRo8tkUqoMjeHhsOh2ouPpXCgBcP+EDxZCB/tws15oAoGCCqGSM49 + AwEHoUQDQgAEHGzpcRJ4XzfBJCCPMQeXQpTXwlblimODQCuQ4mzkzTv0dXyB750f OGN02HtkpBOZzzvUARTR10JQoSe2/5PIwQ== + -----END EC PRIVATE KEY-----" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: sslcert + ignore_errors: true + - name: delete a url map + gcp_compute_url_map: + name: urlmap-targethttpsproxy + default_service: "{{ backendservice }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: urlmap + ignore_errors: true + - name: delete a backend service + gcp_compute_backend_service: + name: backendservice-targethttpsproxy + 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 + register: backendservice + ignore_errors: true + - name: delete a http health check + gcp_compute_http_health_check: + name: httphealthcheck-targethttpsproxy + healthy_threshold: 10 + port: 8080 + timeout_sec: 2 + unhealthy_threshold: 5 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: healthcheck + ignore_errors: true + - name: delete a instance group + gcp_compute_instance_group: + name: instancegroup-targethttpsproxy + zone: us-central1-a + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: instancegroup + ignore_errors: true diff --git a/test/integration/targets/gcp_compute_target_pool/tasks/main.yml b/test/integration/targets/gcp_compute_target_pool/tasks/main.yml index e829539097c332..458562e8fe6759 100644 --- a/test/integration/targets/gcp_compute_target_pool/tasks/main.yml +++ b/test/integration/targets/gcp_compute_target_pool/tasks/main.yml @@ -12,102 +12,103 @@ # https://www.github.com/GoogleCloudPlatform/magic-modules # # ---------------------------------------------------------------------------- -# Pre-test setup -- name: delete a target pool - gcp_compute_target_pool: - name: "{{ resource_name }}" - region: us-west1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent -#---------------------------------------------------------- -- name: create a target pool - gcp_compute_target_pool: - name: "{{ resource_name }}" - region: us-west1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present - register: result -- name: assert changed is true - assert: - that: - - result.changed == true - - "result.kind == 'compute#targetPool'" -- name: verify that target_pool was created - gcp_compute_target_pool_facts: - filters: - - name = {{ resource_name }} +- block: + # Pre-test setup + - name: delete a target pool + gcp_compute_target_pool: + name: "{{ resource_name }}" region: us-west1 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" - scopes: - - https://www.googleapis.com/auth/compute - register: results -- name: verify that command succeeded - assert: - that: - - results['items'] | length == 1 -# ---------------------------------------------------------------------------- -- name: create a target pool that already exists - gcp_compute_target_pool: - name: "{{ resource_name }}" - region: us-west1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present - register: result -- name: assert changed is false - assert: - that: - - result.changed == false - - "result.kind == 'compute#targetPool'" -#---------------------------------------------------------- -- name: delete a target pool - gcp_compute_target_pool: - name: "{{ resource_name }}" - region: us-west1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent - register: result -- name: assert changed is true - assert: - that: - - result.changed == true - - result.has_key('kind') == False -- name: verify that target_pool was deleted - gcp_compute_target_pool_facts: - filters: - - name = {{ resource_name }} + state: absent + #---------------------------------------------------------- + - name: create a target pool + gcp_compute_target_pool: + name: "{{ resource_name }}" region: us-west1 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" - scopes: - - https://www.googleapis.com/auth/compute - register: results -- name: verify that command succeeded - assert: - that: - - results['items'] | length == 0 -# ---------------------------------------------------------------------------- -- name: delete a target pool that does not exist - gcp_compute_target_pool: - name: "{{ resource_name }}" - region: us-west1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent - register: result -- name: assert changed is false - assert: - that: - - result.changed == false - - result.has_key('kind') == False + state: present + register: result + - name: assert changed is true + assert: + that: + - result.changed == true + - "result.kind == 'compute#targetPool'" + - name: verify that target_pool was created + gcp_compute_target_pool_facts: + filters: + - name = {{ resource_name }} + region: us-west1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + scopes: + - https://www.googleapis.com/auth/compute + register: results + - name: verify that command succeeded + assert: + that: + - results['items'] | length == 1 + # ---------------------------------------------------------------------------- + - name: create a target pool that already exists + gcp_compute_target_pool: + name: "{{ resource_name }}" + region: us-west1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present + register: result + - name: assert changed is false + assert: + that: + - result.changed == false + - "result.kind == 'compute#targetPool'" + #---------------------------------------------------------- + - name: delete a target pool + gcp_compute_target_pool: + name: "{{ resource_name }}" + region: us-west1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: result + - name: assert changed is true + assert: + that: + - result.changed == true + - result.has_key('kind') == False + - name: verify that target_pool was deleted + gcp_compute_target_pool_facts: + filters: + - name = {{ resource_name }} + region: us-west1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + scopes: + - https://www.googleapis.com/auth/compute + register: results + - name: verify that command succeeded + assert: + that: + - results['items'] | length == 0 + # ---------------------------------------------------------------------------- + - name: delete a target pool that does not exist + gcp_compute_target_pool: + name: "{{ resource_name }}" + region: us-west1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: result + - name: assert changed is false + assert: + that: + - result.changed == false + - result.has_key('kind') == False diff --git a/test/integration/targets/gcp_compute_target_ssl_proxy/tasks/main.yml b/test/integration/targets/gcp_compute_target_ssl_proxy/tasks/main.yml index 915789b16971a2..3a2f150ba7aa22 100644 --- a/test/integration/targets/gcp_compute_target_ssl_proxy/tasks/main.yml +++ b/test/integration/targets/gcp_compute_target_ssl_proxy/tasks/main.yml @@ -12,235 +12,237 @@ # https://www.github.com/GoogleCloudPlatform/magic-modules # # ---------------------------------------------------------------------------- -# Pre-test setup -- name: create a instance group - gcp_compute_instance_group: - name: instancegroup-targetsslproxy - zone: us-central1-a - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present - register: instancegroup -- name: create a health check - gcp_compute_health_check: - name: healthcheck-targetsslproxy - type: TCP - tcp_health_check: - port_name: service-health - request: ping - response: pong - healthy_threshold: 10 - timeout_sec: 2 - unhealthy_threshold: 5 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present - register: healthcheck -- name: create a backend service - gcp_compute_backend_service: - name: backendservice-targetsslproxy - backends: - - group: "{{ instancegroup }}" - health_checks: - - "{{ healthcheck.selfLink }}" - protocol: SSL - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present - register: backendservice -- name: create a ssl certificate - gcp_compute_ssl_certificate: - name: sslcert-targetsslproxy - description: A certificate for testing. Do not use this certificate in production - certificate: "-----BEGIN CERTIFICATE----- MIICqjCCAk+gAwIBAgIJAIuJ+0352Kq4MAoGCCqGSM49BAMCMIGwMQswCQYDVQQG - EwJVUzETMBEGA1UECAwKV2FzaGluZ3RvbjERMA8GA1UEBwwIS2lya2xhbmQxFTAT BgNVBAoMDEdvb2dsZSwgSW5jLjEeMBwGA1UECwwVR29vZ2xlIENsb3VkIFBsYXRm - b3JtMR8wHQYDVQQDDBZ3d3cubXktc2VjdXJlLXNpdGUuY29tMSEwHwYJKoZIhvcN AQkBFhJuZWxzb25hQGdvb2dsZS5jb20wHhcNMTcwNjI4MDQ1NjI2WhcNMjcwNjI2 - MDQ1NjI2WjCBsDELMAkGA1UEBhMCVVMxEzARBgNVBAgMCldhc2hpbmd0b24xETAP BgNVBAcMCEtpcmtsYW5kMRUwEwYDVQQKDAxHb29nbGUsIEluYy4xHjAcBgNVBAsM - FUdvb2dsZSBDbG91ZCBQbGF0Zm9ybTEfMB0GA1UEAwwWd3d3Lm15LXNlY3VyZS1z aXRlLmNvbTEhMB8GCSqGSIb3DQEJARYSbmVsc29uYUBnb29nbGUuY29tMFkwEwYH - KoZIzj0CAQYIKoZIzj0DAQcDQgAEHGzpcRJ4XzfBJCCPMQeXQpTXwlblimODQCuQ 4mzkzTv0dXyB750fOGN02HtkpBOZzzvUARTR10JQoSe2/5PIwaNQME4wHQYDVR0O - BBYEFKIQC3A2SDpxcdfn0YLKineDNq/BMB8GA1UdIwQYMBaAFKIQC3A2SDpxcdfn 0YLKineDNq/BMAwGA1UdEwQFMAMBAf8wCgYIKoZIzj0EAwIDSQAwRgIhALs4vy+O - M3jcqgA4fSW/oKw6UJxp+M6a+nGMX+UJR3YgAiEAvvl39QRVAiv84hdoCuyON0lJ zqGNhIPGq2ULqXKK8BY= - -----END CERTIFICATE-----" - private_key: "-----BEGIN EC PRIVATE KEY----- MHcCAQEEIObtRo8tkUqoMjeHhsOh2ouPpXCgBcP+EDxZCB/tws15oAoGCCqGSM49 - AwEHoUQDQgAEHGzpcRJ4XzfBJCCPMQeXQpTXwlblimODQCuQ4mzkzTv0dXyB750f OGN02HtkpBOZzzvUARTR10JQoSe2/5PIwQ== - -----END EC PRIVATE KEY-----" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present - register: sslcert -- name: delete a target ssl proxy - gcp_compute_target_ssl_proxy: - name: "{{ resource_name }}" - ssl_certificates: - - "{{ sslcert }}" - service: "{{ backendservice }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent -#---------------------------------------------------------- -- name: create a target ssl proxy - gcp_compute_target_ssl_proxy: - name: "{{ resource_name }}" - ssl_certificates: - - "{{ sslcert }}" - service: "{{ backendservice }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present - register: result -- name: assert changed is true - assert: - that: - - result.changed == true - - "result.kind == 'compute#targetSslProxy'" -- name: verify that target_ssl_proxy was created - gcp_compute_target_ssl_proxy_facts: - filters: - - name = {{ resource_name }} +- block: + # Pre-test setup + - name: create a instance group + gcp_compute_instance_group: + name: instancegroup-targetsslproxy + zone: us-central1-a project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" - scopes: - - https://www.googleapis.com/auth/compute - register: results -- name: verify that command succeeded - assert: - that: - - results['items'] | length == 1 -# ---------------------------------------------------------------------------- -- name: create a target ssl proxy that already exists - gcp_compute_target_ssl_proxy: - name: "{{ resource_name }}" - ssl_certificates: - - "{{ sslcert }}" - service: "{{ backendservice }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present - register: result -- name: assert changed is false - assert: - that: - - result.changed == false - - "result.kind == 'compute#targetSslProxy'" -#---------------------------------------------------------- -- name: delete a target ssl proxy - gcp_compute_target_ssl_proxy: - name: "{{ resource_name }}" - ssl_certificates: - - "{{ sslcert }}" - service: "{{ backendservice }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent - register: result -- name: assert changed is true - assert: - that: - - result.changed == true - - result.has_key('kind') == False -- name: verify that target_ssl_proxy was deleted - gcp_compute_target_ssl_proxy_facts: - filters: - - name = {{ resource_name }} + state: present + register: instancegroup + - name: create a health check + gcp_compute_health_check: + name: healthcheck-targetsslproxy + type: TCP + tcp_health_check: + port_name: service-health + request: ping + response: pong + healthy_threshold: 10 + timeout_sec: 2 + unhealthy_threshold: 5 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" - scopes: - - https://www.googleapis.com/auth/compute - register: results -- name: verify that command succeeded - assert: - that: - - results['items'] | length == 0 -# ---------------------------------------------------------------------------- -- name: delete a target ssl proxy that does not exist - gcp_compute_target_ssl_proxy: - name: "{{ resource_name }}" - ssl_certificates: - - "{{ sslcert }}" - service: "{{ backendservice }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent - register: result -- name: assert changed is false - assert: - that: - - result.changed == false - - result.has_key('kind') == False -#--------------------------------------------------------- -# Post-test teardown -# If errors happen, don't crash the playbook! -- name: delete a ssl certificate - gcp_compute_ssl_certificate: - name: sslcert-targetsslproxy - description: A certificate for testing. Do not use this certificate in production - certificate: "-----BEGIN CERTIFICATE----- MIICqjCCAk+gAwIBAgIJAIuJ+0352Kq4MAoGCCqGSM49BAMCMIGwMQswCQYDVQQG - EwJVUzETMBEGA1UECAwKV2FzaGluZ3RvbjERMA8GA1UEBwwIS2lya2xhbmQxFTAT BgNVBAoMDEdvb2dsZSwgSW5jLjEeMBwGA1UECwwVR29vZ2xlIENsb3VkIFBsYXRm - b3JtMR8wHQYDVQQDDBZ3d3cubXktc2VjdXJlLXNpdGUuY29tMSEwHwYJKoZIhvcN AQkBFhJuZWxzb25hQGdvb2dsZS5jb20wHhcNMTcwNjI4MDQ1NjI2WhcNMjcwNjI2 - MDQ1NjI2WjCBsDELMAkGA1UEBhMCVVMxEzARBgNVBAgMCldhc2hpbmd0b24xETAP BgNVBAcMCEtpcmtsYW5kMRUwEwYDVQQKDAxHb29nbGUsIEluYy4xHjAcBgNVBAsM - FUdvb2dsZSBDbG91ZCBQbGF0Zm9ybTEfMB0GA1UEAwwWd3d3Lm15LXNlY3VyZS1z aXRlLmNvbTEhMB8GCSqGSIb3DQEJARYSbmVsc29uYUBnb29nbGUuY29tMFkwEwYH - KoZIzj0CAQYIKoZIzj0DAQcDQgAEHGzpcRJ4XzfBJCCPMQeXQpTXwlblimODQCuQ 4mzkzTv0dXyB750fOGN02HtkpBOZzzvUARTR10JQoSe2/5PIwaNQME4wHQYDVR0O - BBYEFKIQC3A2SDpxcdfn0YLKineDNq/BMB8GA1UdIwQYMBaAFKIQC3A2SDpxcdfn 0YLKineDNq/BMAwGA1UdEwQFMAMBAf8wCgYIKoZIzj0EAwIDSQAwRgIhALs4vy+O - M3jcqgA4fSW/oKw6UJxp+M6a+nGMX+UJR3YgAiEAvvl39QRVAiv84hdoCuyON0lJ zqGNhIPGq2ULqXKK8BY= - -----END CERTIFICATE-----" - private_key: "-----BEGIN EC PRIVATE KEY----- MHcCAQEEIObtRo8tkUqoMjeHhsOh2ouPpXCgBcP+EDxZCB/tws15oAoGCCqGSM49 - AwEHoUQDQgAEHGzpcRJ4XzfBJCCPMQeXQpTXwlblimODQCuQ4mzkzTv0dXyB750f OGN02HtkpBOZzzvUARTR10JQoSe2/5PIwQ== - -----END EC PRIVATE KEY-----" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent - register: sslcert - ignore_errors: true -- name: delete a backend service - gcp_compute_backend_service: - name: backendservice-targetsslproxy - backends: - - group: "{{ instancegroup }}" - health_checks: - - "{{ healthcheck.selfLink }}" - protocol: SSL - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent - register: backendservice - ignore_errors: true -- name: delete a health check - gcp_compute_health_check: - name: healthcheck-targetsslproxy - type: TCP - tcp_health_check: - port_name: service-health - request: ping - response: pong - healthy_threshold: 10 - timeout_sec: 2 - unhealthy_threshold: 5 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent - register: healthcheck - ignore_errors: true -- name: delete a instance group - gcp_compute_instance_group: - name: instancegroup-targetsslproxy - zone: us-central1-a - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent - register: instancegroup - ignore_errors: true + state: present + register: healthcheck + - name: create a backend service + gcp_compute_backend_service: + name: backendservice-targetsslproxy + backends: + - group: "{{ instancegroup }}" + health_checks: + - "{{ healthcheck.selfLink }}" + protocol: SSL + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present + register: backendservice + - name: create a ssl certificate + gcp_compute_ssl_certificate: + name: sslcert-targetsslproxy + description: A certificate for testing. Do not use this certificate in production + certificate: "-----BEGIN CERTIFICATE----- MIICqjCCAk+gAwIBAgIJAIuJ+0352Kq4MAoGCCqGSM49BAMCMIGwMQswCQYDVQQG + EwJVUzETMBEGA1UECAwKV2FzaGluZ3RvbjERMA8GA1UEBwwIS2lya2xhbmQxFTAT BgNVBAoMDEdvb2dsZSwgSW5jLjEeMBwGA1UECwwVR29vZ2xlIENsb3VkIFBsYXRm + b3JtMR8wHQYDVQQDDBZ3d3cubXktc2VjdXJlLXNpdGUuY29tMSEwHwYJKoZIhvcN AQkBFhJuZWxzb25hQGdvb2dsZS5jb20wHhcNMTcwNjI4MDQ1NjI2WhcNMjcwNjI2 + MDQ1NjI2WjCBsDELMAkGA1UEBhMCVVMxEzARBgNVBAgMCldhc2hpbmd0b24xETAP BgNVBAcMCEtpcmtsYW5kMRUwEwYDVQQKDAxHb29nbGUsIEluYy4xHjAcBgNVBAsM + FUdvb2dsZSBDbG91ZCBQbGF0Zm9ybTEfMB0GA1UEAwwWd3d3Lm15LXNlY3VyZS1z aXRlLmNvbTEhMB8GCSqGSIb3DQEJARYSbmVsc29uYUBnb29nbGUuY29tMFkwEwYH + KoZIzj0CAQYIKoZIzj0DAQcDQgAEHGzpcRJ4XzfBJCCPMQeXQpTXwlblimODQCuQ 4mzkzTv0dXyB750fOGN02HtkpBOZzzvUARTR10JQoSe2/5PIwaNQME4wHQYDVR0O + BBYEFKIQC3A2SDpxcdfn0YLKineDNq/BMB8GA1UdIwQYMBaAFKIQC3A2SDpxcdfn 0YLKineDNq/BMAwGA1UdEwQFMAMBAf8wCgYIKoZIzj0EAwIDSQAwRgIhALs4vy+O + M3jcqgA4fSW/oKw6UJxp+M6a+nGMX+UJR3YgAiEAvvl39QRVAiv84hdoCuyON0lJ zqGNhIPGq2ULqXKK8BY= + -----END CERTIFICATE-----" + private_key: "-----BEGIN EC PRIVATE KEY----- MHcCAQEEIObtRo8tkUqoMjeHhsOh2ouPpXCgBcP+EDxZCB/tws15oAoGCCqGSM49 + AwEHoUQDQgAEHGzpcRJ4XzfBJCCPMQeXQpTXwlblimODQCuQ4mzkzTv0dXyB750f OGN02HtkpBOZzzvUARTR10JQoSe2/5PIwQ== + -----END EC PRIVATE KEY-----" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present + register: sslcert + - name: delete a target ssl proxy + gcp_compute_target_ssl_proxy: + name: "{{ resource_name }}" + ssl_certificates: + - "{{ sslcert }}" + service: "{{ backendservice }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + #---------------------------------------------------------- + - name: create a target ssl proxy + gcp_compute_target_ssl_proxy: + name: "{{ resource_name }}" + ssl_certificates: + - "{{ sslcert }}" + service: "{{ backendservice }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present + register: result + - name: assert changed is true + assert: + that: + - result.changed == true + - "result.kind == 'compute#targetSslProxy'" + - name: verify that target_ssl_proxy was created + gcp_compute_target_ssl_proxy_facts: + filters: + - name = {{ resource_name }} + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + scopes: + - https://www.googleapis.com/auth/compute + register: results + - name: verify that command succeeded + assert: + that: + - results['items'] | length == 1 + # ---------------------------------------------------------------------------- + - name: create a target ssl proxy that already exists + gcp_compute_target_ssl_proxy: + name: "{{ resource_name }}" + ssl_certificates: + - "{{ sslcert }}" + service: "{{ backendservice }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present + register: result + - name: assert changed is false + assert: + that: + - result.changed == false + - "result.kind == 'compute#targetSslProxy'" + #---------------------------------------------------------- + - name: delete a target ssl proxy + gcp_compute_target_ssl_proxy: + name: "{{ resource_name }}" + ssl_certificates: + - "{{ sslcert }}" + service: "{{ backendservice }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: result + - name: assert changed is true + assert: + that: + - result.changed == true + - result.has_key('kind') == False + - name: verify that target_ssl_proxy was deleted + gcp_compute_target_ssl_proxy_facts: + filters: + - name = {{ resource_name }} + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + scopes: + - https://www.googleapis.com/auth/compute + register: results + - name: verify that command succeeded + assert: + that: + - results['items'] | length == 0 + # ---------------------------------------------------------------------------- + - name: delete a target ssl proxy that does not exist + gcp_compute_target_ssl_proxy: + name: "{{ resource_name }}" + ssl_certificates: + - "{{ sslcert }}" + service: "{{ backendservice }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: result + - name: assert changed is false + assert: + that: + - result.changed == false + - result.has_key('kind') == False + always: + #--------------------------------------------------------- + # Post-test teardown + # If errors happen, don't crash the playbook! + - name: delete a ssl certificate + gcp_compute_ssl_certificate: + name: sslcert-targetsslproxy + description: A certificate for testing. Do not use this certificate in production + certificate: "-----BEGIN CERTIFICATE----- MIICqjCCAk+gAwIBAgIJAIuJ+0352Kq4MAoGCCqGSM49BAMCMIGwMQswCQYDVQQG + EwJVUzETMBEGA1UECAwKV2FzaGluZ3RvbjERMA8GA1UEBwwIS2lya2xhbmQxFTAT BgNVBAoMDEdvb2dsZSwgSW5jLjEeMBwGA1UECwwVR29vZ2xlIENsb3VkIFBsYXRm + b3JtMR8wHQYDVQQDDBZ3d3cubXktc2VjdXJlLXNpdGUuY29tMSEwHwYJKoZIhvcN AQkBFhJuZWxzb25hQGdvb2dsZS5jb20wHhcNMTcwNjI4MDQ1NjI2WhcNMjcwNjI2 + MDQ1NjI2WjCBsDELMAkGA1UEBhMCVVMxEzARBgNVBAgMCldhc2hpbmd0b24xETAP BgNVBAcMCEtpcmtsYW5kMRUwEwYDVQQKDAxHb29nbGUsIEluYy4xHjAcBgNVBAsM + FUdvb2dsZSBDbG91ZCBQbGF0Zm9ybTEfMB0GA1UEAwwWd3d3Lm15LXNlY3VyZS1z aXRlLmNvbTEhMB8GCSqGSIb3DQEJARYSbmVsc29uYUBnb29nbGUuY29tMFkwEwYH + KoZIzj0CAQYIKoZIzj0DAQcDQgAEHGzpcRJ4XzfBJCCPMQeXQpTXwlblimODQCuQ 4mzkzTv0dXyB750fOGN02HtkpBOZzzvUARTR10JQoSe2/5PIwaNQME4wHQYDVR0O + BBYEFKIQC3A2SDpxcdfn0YLKineDNq/BMB8GA1UdIwQYMBaAFKIQC3A2SDpxcdfn 0YLKineDNq/BMAwGA1UdEwQFMAMBAf8wCgYIKoZIzj0EAwIDSQAwRgIhALs4vy+O + M3jcqgA4fSW/oKw6UJxp+M6a+nGMX+UJR3YgAiEAvvl39QRVAiv84hdoCuyON0lJ zqGNhIPGq2ULqXKK8BY= + -----END CERTIFICATE-----" + private_key: "-----BEGIN EC PRIVATE KEY----- MHcCAQEEIObtRo8tkUqoMjeHhsOh2ouPpXCgBcP+EDxZCB/tws15oAoGCCqGSM49 + AwEHoUQDQgAEHGzpcRJ4XzfBJCCPMQeXQpTXwlblimODQCuQ4mzkzTv0dXyB750f OGN02HtkpBOZzzvUARTR10JQoSe2/5PIwQ== + -----END EC PRIVATE KEY-----" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: sslcert + ignore_errors: true + - name: delete a backend service + gcp_compute_backend_service: + name: backendservice-targetsslproxy + backends: + - group: "{{ instancegroup }}" + health_checks: + - "{{ healthcheck.selfLink }}" + protocol: SSL + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: backendservice + ignore_errors: true + - name: delete a health check + gcp_compute_health_check: + name: healthcheck-targetsslproxy + type: TCP + tcp_health_check: + port_name: service-health + request: ping + response: pong + healthy_threshold: 10 + timeout_sec: 2 + unhealthy_threshold: 5 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: healthcheck + ignore_errors: true + - name: delete a instance group + gcp_compute_instance_group: + name: instancegroup-targetsslproxy + zone: us-central1-a + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: instancegroup + ignore_errors: true diff --git a/test/integration/targets/gcp_compute_target_tcp_proxy/tasks/main.yml b/test/integration/targets/gcp_compute_target_tcp_proxy/tasks/main.yml index 0cfb6a319ef78c..5dcfc687f08f18 100644 --- a/test/integration/targets/gcp_compute_target_tcp_proxy/tasks/main.yml +++ b/test/integration/targets/gcp_compute_target_tcp_proxy/tasks/main.yml @@ -12,187 +12,189 @@ # https://www.github.com/GoogleCloudPlatform/magic-modules # # ---------------------------------------------------------------------------- -# Pre-test setup -- name: create a instance group - gcp_compute_instance_group: - name: instancegroup-targettcpproxy - zone: us-central1-a - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present - register: instancegroup -- name: create a health check - gcp_compute_health_check: - name: healthcheck-targettcpproxy - type: TCP - tcp_health_check: - port_name: service-health - request: ping - response: pong - healthy_threshold: 10 - timeout_sec: 2 - unhealthy_threshold: 5 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present - register: healthcheck -- name: create a backend service - gcp_compute_backend_service: - name: backendservice-targettcpproxy - backends: - - group: "{{ instancegroup }}" - health_checks: - - "{{ healthcheck.selfLink }}" - protocol: TCP - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present - register: backendservice -- name: delete a target tcp proxy - gcp_compute_target_tcp_proxy: - name: "{{ resource_name }}" - proxy_header: PROXY_V1 - service: "{{ backendservice }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent -#---------------------------------------------------------- -- name: create a target tcp proxy - gcp_compute_target_tcp_proxy: - name: "{{ resource_name }}" - proxy_header: PROXY_V1 - service: "{{ backendservice }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present - register: result -- name: assert changed is true - assert: - that: - - result.changed == true - - "result.kind == 'compute#targetTcpProxy'" -- name: verify that target_tcp_proxy was created - gcp_compute_target_tcp_proxy_facts: - filters: - - name = {{ resource_name }} +- block: + # Pre-test setup + - name: create a instance group + gcp_compute_instance_group: + name: instancegroup-targettcpproxy + zone: us-central1-a project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" - scopes: - - https://www.googleapis.com/auth/compute - register: results -- name: verify that command succeeded - assert: - that: - - results['items'] | length == 1 -# ---------------------------------------------------------------------------- -- name: create a target tcp proxy that already exists - gcp_compute_target_tcp_proxy: - name: "{{ resource_name }}" - proxy_header: PROXY_V1 - service: "{{ backendservice }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present - register: result -- name: assert changed is false - assert: - that: - - result.changed == false - - "result.kind == 'compute#targetTcpProxy'" -#---------------------------------------------------------- -- name: delete a target tcp proxy - gcp_compute_target_tcp_proxy: - name: "{{ resource_name }}" - proxy_header: PROXY_V1 - service: "{{ backendservice }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent - register: result -- name: assert changed is true - assert: - that: - - result.changed == true - - result.has_key('kind') == False -- name: verify that target_tcp_proxy was deleted - gcp_compute_target_tcp_proxy_facts: - filters: - - name = {{ resource_name }} + state: present + register: instancegroup + - name: create a health check + gcp_compute_health_check: + name: healthcheck-targettcpproxy + type: TCP + tcp_health_check: + port_name: service-health + request: ping + response: pong + healthy_threshold: 10 + timeout_sec: 2 + unhealthy_threshold: 5 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" - scopes: - - https://www.googleapis.com/auth/compute - register: results -- name: verify that command succeeded - assert: - that: - - results['items'] | length == 0 -# ---------------------------------------------------------------------------- -- name: delete a target tcp proxy that does not exist - gcp_compute_target_tcp_proxy: - name: "{{ resource_name }}" - proxy_header: PROXY_V1 - service: "{{ backendservice }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent - register: result -- name: assert changed is false - assert: - that: - - result.changed == false - - result.has_key('kind') == False -#--------------------------------------------------------- -# Post-test teardown -# If errors happen, don't crash the playbook! -- name: delete a backend service - gcp_compute_backend_service: - name: backendservice-targettcpproxy - backends: - - group: "{{ instancegroup }}" - health_checks: - - "{{ healthcheck.selfLink }}" - protocol: TCP - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent - register: backendservice - ignore_errors: true -- name: delete a health check - gcp_compute_health_check: - name: healthcheck-targettcpproxy - type: TCP - tcp_health_check: - port_name: service-health - request: ping - response: pong - healthy_threshold: 10 - timeout_sec: 2 - unhealthy_threshold: 5 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent - register: healthcheck - ignore_errors: true -- name: delete a instance group - gcp_compute_instance_group: - name: instancegroup-targettcpproxy - zone: us-central1-a - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent - register: instancegroup - ignore_errors: true + state: present + register: healthcheck + - name: create a backend service + gcp_compute_backend_service: + name: backendservice-targettcpproxy + backends: + - group: "{{ instancegroup }}" + health_checks: + - "{{ healthcheck.selfLink }}" + protocol: TCP + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present + register: backendservice + - name: delete a target tcp proxy + gcp_compute_target_tcp_proxy: + name: "{{ resource_name }}" + proxy_header: PROXY_V1 + service: "{{ backendservice }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + #---------------------------------------------------------- + - name: create a target tcp proxy + gcp_compute_target_tcp_proxy: + name: "{{ resource_name }}" + proxy_header: PROXY_V1 + service: "{{ backendservice }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present + register: result + - name: assert changed is true + assert: + that: + - result.changed == true + - "result.kind == 'compute#targetTcpProxy'" + - name: verify that target_tcp_proxy was created + gcp_compute_target_tcp_proxy_facts: + filters: + - name = {{ resource_name }} + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + scopes: + - https://www.googleapis.com/auth/compute + register: results + - name: verify that command succeeded + assert: + that: + - results['items'] | length == 1 + # ---------------------------------------------------------------------------- + - name: create a target tcp proxy that already exists + gcp_compute_target_tcp_proxy: + name: "{{ resource_name }}" + proxy_header: PROXY_V1 + service: "{{ backendservice }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present + register: result + - name: assert changed is false + assert: + that: + - result.changed == false + - "result.kind == 'compute#targetTcpProxy'" + #---------------------------------------------------------- + - name: delete a target tcp proxy + gcp_compute_target_tcp_proxy: + name: "{{ resource_name }}" + proxy_header: PROXY_V1 + service: "{{ backendservice }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: result + - name: assert changed is true + assert: + that: + - result.changed == true + - result.has_key('kind') == False + - name: verify that target_tcp_proxy was deleted + gcp_compute_target_tcp_proxy_facts: + filters: + - name = {{ resource_name }} + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + scopes: + - https://www.googleapis.com/auth/compute + register: results + - name: verify that command succeeded + assert: + that: + - results['items'] | length == 0 + # ---------------------------------------------------------------------------- + - name: delete a target tcp proxy that does not exist + gcp_compute_target_tcp_proxy: + name: "{{ resource_name }}" + proxy_header: PROXY_V1 + service: "{{ backendservice }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: result + - name: assert changed is false + assert: + that: + - result.changed == false + - result.has_key('kind') == False + always: + #--------------------------------------------------------- + # Post-test teardown + # If errors happen, don't crash the playbook! + - name: delete a backend service + gcp_compute_backend_service: + name: backendservice-targettcpproxy + backends: + - group: "{{ instancegroup }}" + health_checks: + - "{{ healthcheck.selfLink }}" + protocol: TCP + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: backendservice + ignore_errors: true + - name: delete a health check + gcp_compute_health_check: + name: healthcheck-targettcpproxy + type: TCP + tcp_health_check: + port_name: service-health + request: ping + response: pong + healthy_threshold: 10 + timeout_sec: 2 + unhealthy_threshold: 5 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: healthcheck + ignore_errors: true + - name: delete a instance group + gcp_compute_instance_group: + name: instancegroup-targettcpproxy + zone: us-central1-a + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: instancegroup + ignore_errors: true diff --git a/test/integration/targets/gcp_compute_target_vpn_gateway/tasks/main.yml b/test/integration/targets/gcp_compute_target_vpn_gateway/tasks/main.yml index a94f0585e708e3..da3faa0254cca0 100644 --- a/test/integration/targets/gcp_compute_target_vpn_gateway/tasks/main.yml +++ b/test/integration/targets/gcp_compute_target_vpn_gateway/tasks/main.yml @@ -12,146 +12,148 @@ # https://www.github.com/GoogleCloudPlatform/magic-modules # # ---------------------------------------------------------------------------- -# Pre-test setup -- name: create a address - gcp_compute_address: - name: address-vpngateway - region: us-west1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present - register: address -- name: create a network - gcp_compute_network: - name: network-vpngateway - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present - register: network -- name: delete a target vpn gateway - gcp_compute_target_vpn_gateway: - name: "{{ resource_name }}" - region: us-west1 - network: "{{ network }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent -#---------------------------------------------------------- -- name: create a target vpn gateway - gcp_compute_target_vpn_gateway: - name: "{{ resource_name }}" - region: us-west1 - network: "{{ network }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present - register: result -- name: assert changed is true - assert: - that: - - result.changed == true - - "result.kind == 'compute#targetVpnGateway'" -- name: verify that target_vpn_gateway was created - gcp_compute_target_vpn_gateway_facts: - filters: - - name = {{ resource_name }} +- block: + # Pre-test setup + - name: create a address + gcp_compute_address: + name: address-vpngateway region: us-west1 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" - scopes: - - https://www.googleapis.com/auth/compute - register: results -- name: verify that command succeeded - assert: - that: - - results['items'] | length == 1 -# ---------------------------------------------------------------------------- -- name: create a target vpn gateway that already exists - gcp_compute_target_vpn_gateway: - name: "{{ resource_name }}" - region: us-west1 - network: "{{ network }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present - register: result -- name: assert changed is false - assert: - that: - - result.changed == false - - "result.kind == 'compute#targetVpnGateway'" -#---------------------------------------------------------- -- name: delete a target vpn gateway - gcp_compute_target_vpn_gateway: - name: "{{ resource_name }}" - region: us-west1 - network: "{{ network }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent - register: result -- name: assert changed is true - assert: - that: - - result.changed == true - - result.has_key('kind') == False -- name: verify that target_vpn_gateway was deleted - gcp_compute_target_vpn_gateway_facts: - filters: - - name = {{ resource_name }} + state: present + register: address + - name: create a network + gcp_compute_network: + name: network-vpngateway + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present + register: network + - name: delete a target vpn gateway + gcp_compute_target_vpn_gateway: + name: "{{ resource_name }}" region: us-west1 + network: "{{ network }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" - scopes: - - https://www.googleapis.com/auth/compute - register: results -- name: verify that command succeeded - assert: - that: - - results['items'] | length == 0 -# ---------------------------------------------------------------------------- -- name: delete a target vpn gateway that does not exist - gcp_compute_target_vpn_gateway: - name: "{{ resource_name }}" - region: us-west1 - network: "{{ network }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent - register: result -- name: assert changed is false - assert: - that: - - result.changed == false - - result.has_key('kind') == False -#--------------------------------------------------------- -# Post-test teardown -# If errors happen, don't crash the playbook! -- name: delete a network - gcp_compute_network: - name: network-vpngateway - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent - register: network - ignore_errors: true -- name: delete a address - gcp_compute_address: - name: address-vpngateway - region: us-west1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent - register: address - ignore_errors: true + state: absent + #---------------------------------------------------------- + - name: create a target vpn gateway + gcp_compute_target_vpn_gateway: + name: "{{ resource_name }}" + region: us-west1 + network: "{{ network }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present + register: result + - name: assert changed is true + assert: + that: + - result.changed == true + - "result.kind == 'compute#targetVpnGateway'" + - name: verify that target_vpn_gateway was created + gcp_compute_target_vpn_gateway_facts: + filters: + - name = {{ resource_name }} + region: us-west1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + scopes: + - https://www.googleapis.com/auth/compute + register: results + - name: verify that command succeeded + assert: + that: + - results['items'] | length == 1 + # ---------------------------------------------------------------------------- + - name: create a target vpn gateway that already exists + gcp_compute_target_vpn_gateway: + name: "{{ resource_name }}" + region: us-west1 + network: "{{ network }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present + register: result + - name: assert changed is false + assert: + that: + - result.changed == false + - "result.kind == 'compute#targetVpnGateway'" + #---------------------------------------------------------- + - name: delete a target vpn gateway + gcp_compute_target_vpn_gateway: + name: "{{ resource_name }}" + region: us-west1 + network: "{{ network }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: result + - name: assert changed is true + assert: + that: + - result.changed == true + - result.has_key('kind') == False + - name: verify that target_vpn_gateway was deleted + gcp_compute_target_vpn_gateway_facts: + filters: + - name = {{ resource_name }} + region: us-west1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + scopes: + - https://www.googleapis.com/auth/compute + register: results + - name: verify that command succeeded + assert: + that: + - results['items'] | length == 0 + # ---------------------------------------------------------------------------- + - name: delete a target vpn gateway that does not exist + gcp_compute_target_vpn_gateway: + name: "{{ resource_name }}" + region: us-west1 + network: "{{ network }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: result + - name: assert changed is false + assert: + that: + - result.changed == false + - result.has_key('kind') == False + always: + #--------------------------------------------------------- + # Post-test teardown + # If errors happen, don't crash the playbook! + - name: delete a network + gcp_compute_network: + name: network-vpngateway + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: network + ignore_errors: true + - name: delete a address + gcp_compute_address: + name: address-vpngateway + region: us-west1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: address + ignore_errors: true diff --git a/test/integration/targets/gcp_compute_url_map/tasks/main.yml b/test/integration/targets/gcp_compute_url_map/tasks/main.yml index 5bb2b2ba17eaa1..4e695020f9bfdc 100644 --- a/test/integration/targets/gcp_compute_url_map/tasks/main.yml +++ b/test/integration/targets/gcp_compute_url_map/tasks/main.yml @@ -12,174 +12,176 @@ # https://www.github.com/GoogleCloudPlatform/magic-modules # # ---------------------------------------------------------------------------- -# Pre-test setup -- name: create a instance group - gcp_compute_instance_group: - name: instancegroup-urlmap - zone: us-central1-a - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present - register: instancegroup -- name: create a http health check - gcp_compute_http_health_check: - name: httphealthcheck-urlmap - healthy_threshold: 10 - port: 8080 - timeout_sec: 2 - unhealthy_threshold: 5 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present - register: healthcheck -- name: create a backend service - gcp_compute_backend_service: - name: backendservice-urlmap - 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 - register: backendservice -- name: delete a url map - gcp_compute_url_map: - name: "{{ resource_name }}" - default_service: "{{ backendservice }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent -#---------------------------------------------------------- -- name: create a url map - gcp_compute_url_map: - name: "{{ resource_name }}" - default_service: "{{ backendservice }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present - register: result -- name: assert changed is true - assert: - that: - - result.changed == true - - "result.kind == 'compute#urlMap'" -- name: verify that url_map was created - gcp_compute_url_map_facts: - filters: - - name = {{ resource_name }} +- block: + # Pre-test setup + - name: create a instance group + gcp_compute_instance_group: + name: instancegroup-urlmap + zone: us-central1-a project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" - scopes: - - https://www.googleapis.com/auth/compute - register: results -- name: verify that command succeeded - assert: - that: - - results['items'] | length == 1 -# ---------------------------------------------------------------------------- -- name: create a url map that already exists - gcp_compute_url_map: - name: "{{ resource_name }}" - default_service: "{{ backendservice }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present - register: result -- name: assert changed is false - assert: - that: - - result.changed == false - - "result.kind == 'compute#urlMap'" -#---------------------------------------------------------- -- name: delete a url map - gcp_compute_url_map: - name: "{{ resource_name }}" - default_service: "{{ backendservice }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent - register: result -- name: assert changed is true - assert: - that: - - result.changed == true - - result.has_key('kind') == False -- name: verify that url_map was deleted - gcp_compute_url_map_facts: - filters: - - name = {{ resource_name }} + state: present + register: instancegroup + - name: create a http health check + gcp_compute_http_health_check: + name: httphealthcheck-urlmap + healthy_threshold: 10 + port: 8080 + timeout_sec: 2 + unhealthy_threshold: 5 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" - scopes: - - https://www.googleapis.com/auth/compute - register: results -- name: verify that command succeeded - assert: - that: - - results['items'] | length == 0 -# ---------------------------------------------------------------------------- -- name: delete a url map that does not exist - gcp_compute_url_map: - name: "{{ resource_name }}" - default_service: "{{ backendservice }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent - register: result -- name: assert changed is false - assert: - that: - - result.changed == false - - result.has_key('kind') == False -#--------------------------------------------------------- -# Post-test teardown -# If errors happen, don't crash the playbook! -- name: delete a backend service - gcp_compute_backend_service: - name: backendservice-urlmap - 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 - register: backendservice - ignore_errors: true -- name: delete a http health check - gcp_compute_http_health_check: - name: httphealthcheck-urlmap - healthy_threshold: 10 - port: 8080 - timeout_sec: 2 - unhealthy_threshold: 5 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent - register: healthcheck - ignore_errors: true -- name: delete a instance group - gcp_compute_instance_group: - name: instancegroup-urlmap - zone: us-central1-a - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent - register: instancegroup - ignore_errors: true + state: present + register: healthcheck + - name: create a backend service + gcp_compute_backend_service: + name: backendservice-urlmap + 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 + register: backendservice + - name: delete a url map + gcp_compute_url_map: + name: "{{ resource_name }}" + default_service: "{{ backendservice }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + #---------------------------------------------------------- + - name: create a url map + gcp_compute_url_map: + name: "{{ resource_name }}" + default_service: "{{ backendservice }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present + register: result + - name: assert changed is true + assert: + that: + - result.changed == true + - "result.kind == 'compute#urlMap'" + - name: verify that url_map was created + gcp_compute_url_map_facts: + filters: + - name = {{ resource_name }} + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + scopes: + - https://www.googleapis.com/auth/compute + register: results + - name: verify that command succeeded + assert: + that: + - results['items'] | length == 1 + # ---------------------------------------------------------------------------- + - name: create a url map that already exists + gcp_compute_url_map: + name: "{{ resource_name }}" + default_service: "{{ backendservice }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present + register: result + - name: assert changed is false + assert: + that: + - result.changed == false + - "result.kind == 'compute#urlMap'" + #---------------------------------------------------------- + - name: delete a url map + gcp_compute_url_map: + name: "{{ resource_name }}" + default_service: "{{ backendservice }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: result + - name: assert changed is true + assert: + that: + - result.changed == true + - result.has_key('kind') == False + - name: verify that url_map was deleted + gcp_compute_url_map_facts: + filters: + - name = {{ resource_name }} + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + scopes: + - https://www.googleapis.com/auth/compute + register: results + - name: verify that command succeeded + assert: + that: + - results['items'] | length == 0 + # ---------------------------------------------------------------------------- + - name: delete a url map that does not exist + gcp_compute_url_map: + name: "{{ resource_name }}" + default_service: "{{ backendservice }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: result + - name: assert changed is false + assert: + that: + - result.changed == false + - result.has_key('kind') == False + always: + #--------------------------------------------------------- + # Post-test teardown + # If errors happen, don't crash the playbook! + - name: delete a backend service + gcp_compute_backend_service: + name: backendservice-urlmap + 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 + register: backendservice + ignore_errors: true + - name: delete a http health check + gcp_compute_http_health_check: + name: httphealthcheck-urlmap + healthy_threshold: 10 + port: 8080 + timeout_sec: 2 + unhealthy_threshold: 5 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: healthcheck + ignore_errors: true + - name: delete a instance group + gcp_compute_instance_group: + name: instancegroup-urlmap + zone: us-central1-a + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: instancegroup + ignore_errors: true diff --git a/test/integration/targets/gcp_compute_vpn_tunnel/tasks/main.yml b/test/integration/targets/gcp_compute_vpn_tunnel/tasks/main.yml index ffa4a266b2d8e7..37dad83b562b6f 100644 --- a/test/integration/targets/gcp_compute_vpn_tunnel/tasks/main.yml +++ b/test/integration/targets/gcp_compute_vpn_tunnel/tasks/main.yml @@ -12,195 +12,197 @@ # https://www.github.com/GoogleCloudPlatform/magic-modules # # ---------------------------------------------------------------------------- -# Pre-test setup -- name: create a network - gcp_compute_network: - name: network-vpn-tunnel - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present - register: network -- name: create a router - gcp_compute_router: - name: router-vpn-tunnel - network: "{{ network }}" - bgp: - asn: 64514 - advertise_mode: CUSTOM - advertised_groups: - - ALL_SUBNETS - advertised_ip_ranges: - - range: 1.2.3.4 - - range: 6.7.0.0/16 - region: us-central1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present - register: router -- name: create a target vpn gateway - gcp_compute_target_vpn_gateway: - name: gateway-vpn-tunnel - region: us-west1 - network: "{{ network }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present - register: gateway -- name: delete a vpn tunnel - gcp_compute_vpn_tunnel: - name: "{{ resource_name }}" - region: us-west1 - target_vpn_gateway: "{{ gateway }}" - router: "{{ router }}" - shared_secret: super secret - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent -#---------------------------------------------------------- -- name: create a vpn tunnel - gcp_compute_vpn_tunnel: - name: "{{ resource_name }}" - region: us-west1 - target_vpn_gateway: "{{ gateway }}" - router: "{{ router }}" - shared_secret: super secret - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present - register: result -- name: assert changed is true - assert: - that: - - result.changed == true - - "result.kind == 'compute#vpnTunnel'" -- name: verify that vpn_tunnel was created - gcp_compute_vpn_tunnel_facts: - filters: - - name = {{ resource_name }} +- block: + # Pre-test setup + - name: create a network + gcp_compute_network: + name: network-vpn-tunnel + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present + register: network + - name: create a router + gcp_compute_router: + name: router-vpn-tunnel + network: "{{ network }}" + bgp: + asn: 64514 + advertise_mode: CUSTOM + advertised_groups: + - ALL_SUBNETS + advertised_ip_ranges: + - range: 1.2.3.4 + - range: 6.7.0.0/16 + region: us-central1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present + register: router + - name: create a target vpn gateway + gcp_compute_target_vpn_gateway: + name: gateway-vpn-tunnel region: us-west1 + network: "{{ network }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" - scopes: - - https://www.googleapis.com/auth/compute - register: results -- name: verify that command succeeded - assert: - that: - - results['items'] | length == 1 -# ---------------------------------------------------------------------------- -- name: create a vpn tunnel that already exists - gcp_compute_vpn_tunnel: - name: "{{ resource_name }}" - region: us-west1 - target_vpn_gateway: "{{ gateway }}" - router: "{{ router }}" - shared_secret: super secret - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present - register: result -- name: assert changed is false - assert: - that: - - result.changed == false - - "result.kind == 'compute#vpnTunnel'" -#---------------------------------------------------------- -- name: delete a vpn tunnel - gcp_compute_vpn_tunnel: - name: "{{ resource_name }}" - region: us-west1 - target_vpn_gateway: "{{ gateway }}" - router: "{{ router }}" - shared_secret: super secret - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent - register: result -- name: assert changed is true - assert: - that: - - result.changed == true - - result.has_key('kind') == False -- name: verify that vpn_tunnel was deleted - gcp_compute_vpn_tunnel_facts: - filters: - - name = {{ resource_name }} + state: present + register: gateway + - name: delete a vpn tunnel + gcp_compute_vpn_tunnel: + name: "{{ resource_name }}" region: us-west1 + target_vpn_gateway: "{{ gateway }}" + router: "{{ router }}" + shared_secret: super secret project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" - scopes: - - https://www.googleapis.com/auth/compute - register: results -- name: verify that command succeeded - assert: - that: - - results['items'] | length == 0 -# ---------------------------------------------------------------------------- -- name: delete a vpn tunnel that does not exist - gcp_compute_vpn_tunnel: - name: "{{ resource_name }}" - region: us-west1 - target_vpn_gateway: "{{ gateway }}" - router: "{{ router }}" - shared_secret: super secret - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent - register: result -- name: assert changed is false - assert: - that: - - result.changed == false - - result.has_key('kind') == False -#--------------------------------------------------------- -# Post-test teardown -# If errors happen, don't crash the playbook! -- name: delete a target vpn gateway - gcp_compute_target_vpn_gateway: - name: gateway-vpn-tunnel - region: us-west1 - network: "{{ network }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent - register: gateway - ignore_errors: true -- name: delete a router - gcp_compute_router: - name: router-vpn-tunnel - network: "{{ network }}" - bgp: - asn: 64514 - advertise_mode: CUSTOM - advertised_groups: - - ALL_SUBNETS - advertised_ip_ranges: - - range: 1.2.3.4 - - range: 6.7.0.0/16 - region: us-central1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent - register: router - ignore_errors: true -- name: delete a network - gcp_compute_network: - name: network-vpn-tunnel - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent - register: network - ignore_errors: true + state: absent + #---------------------------------------------------------- + - name: create a vpn tunnel + gcp_compute_vpn_tunnel: + name: "{{ resource_name }}" + region: us-west1 + target_vpn_gateway: "{{ gateway }}" + router: "{{ router }}" + shared_secret: super secret + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present + register: result + - name: assert changed is true + assert: + that: + - result.changed == true + - "result.kind == 'compute#vpnTunnel'" + - name: verify that vpn_tunnel was created + gcp_compute_vpn_tunnel_facts: + filters: + - name = {{ resource_name }} + region: us-west1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + scopes: + - https://www.googleapis.com/auth/compute + register: results + - name: verify that command succeeded + assert: + that: + - results['items'] | length == 1 + # ---------------------------------------------------------------------------- + - name: create a vpn tunnel that already exists + gcp_compute_vpn_tunnel: + name: "{{ resource_name }}" + region: us-west1 + target_vpn_gateway: "{{ gateway }}" + router: "{{ router }}" + shared_secret: super secret + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present + register: result + - name: assert changed is false + assert: + that: + - result.changed == false + - "result.kind == 'compute#vpnTunnel'" + #---------------------------------------------------------- + - name: delete a vpn tunnel + gcp_compute_vpn_tunnel: + name: "{{ resource_name }}" + region: us-west1 + target_vpn_gateway: "{{ gateway }}" + router: "{{ router }}" + shared_secret: super secret + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: result + - name: assert changed is true + assert: + that: + - result.changed == true + - result.has_key('kind') == False + - name: verify that vpn_tunnel was deleted + gcp_compute_vpn_tunnel_facts: + filters: + - name = {{ resource_name }} + region: us-west1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + scopes: + - https://www.googleapis.com/auth/compute + register: results + - name: verify that command succeeded + assert: + that: + - results['items'] | length == 0 + # ---------------------------------------------------------------------------- + - name: delete a vpn tunnel that does not exist + gcp_compute_vpn_tunnel: + name: "{{ resource_name }}" + region: us-west1 + target_vpn_gateway: "{{ gateway }}" + router: "{{ router }}" + shared_secret: super secret + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: result + - name: assert changed is false + assert: + that: + - result.changed == false + - result.has_key('kind') == False + always: + #--------------------------------------------------------- + # Post-test teardown + # If errors happen, don't crash the playbook! + - name: delete a target vpn gateway + gcp_compute_target_vpn_gateway: + name: gateway-vpn-tunnel + region: us-west1 + network: "{{ network }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: gateway + ignore_errors: true + - name: delete a router + gcp_compute_router: + name: router-vpn-tunnel + network: "{{ network }}" + bgp: + asn: 64514 + advertise_mode: CUSTOM + advertised_groups: + - ALL_SUBNETS + advertised_ip_ranges: + - range: 1.2.3.4 + - range: 6.7.0.0/16 + region: us-central1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: router + ignore_errors: true + - name: delete a network + gcp_compute_network: + name: network-vpn-tunnel + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: network + ignore_errors: true diff --git a/test/integration/targets/gcp_container_cluster/tasks/main.yml b/test/integration/targets/gcp_container_cluster/tasks/main.yml index ebf2fa5c9325ec..5c56588d028c3a 100644 --- a/test/integration/targets/gcp_container_cluster/tasks/main.yml +++ b/test/integration/targets/gcp_container_cluster/tasks/main.yml @@ -12,129 +12,130 @@ # https://www.github.com/GoogleCloudPlatform/magic-modules # # ---------------------------------------------------------------------------- -# Pre-test setup -- name: delete a cluster - gcp_container_cluster: - name: my-cluster - initial_node_count: 2 - master_auth: - username: cluster_admin - password: my-secret-password - node_config: - machine_type: n1-standard-4 - disk_size_gb: 500 - location: us-central1-a - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent -#---------------------------------------------------------- -- name: create a cluster - gcp_container_cluster: - name: my-cluster - initial_node_count: 2 - master_auth: - username: cluster_admin - password: my-secret-password - node_config: - machine_type: n1-standard-4 - disk_size_gb: 500 - location: us-central1-a - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present - register: result -- name: assert changed is true - assert: - that: - - result.changed == true -- name: verify that cluster was created - gcp_container_cluster_facts: +- block: + # Pre-test setup + - name: delete a cluster + gcp_container_cluster: + name: my-cluster + initial_node_count: 2 + master_auth: + username: cluster_admin + password: my-secret-password + node_config: + machine_type: n1-standard-4 + disk_size_gb: 500 location: us-central1-a project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" - scopes: - - https://www.googleapis.com/auth/cloud-platform - register: results -- name: verify that command succeeded - assert: - that: - - "'my-cluster' in \"{{ results['items'] | map(attribute='name') | list }}\"" -# ---------------------------------------------------------------------------- -- name: create a cluster that already exists - gcp_container_cluster: - name: my-cluster - initial_node_count: 2 - master_auth: - username: cluster_admin - password: my-secret-password - node_config: - machine_type: n1-standard-4 - disk_size_gb: 500 - location: us-central1-a - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present - register: result -- name: assert changed is false - assert: - that: - - result.changed == false -#---------------------------------------------------------- -- name: delete a cluster - gcp_container_cluster: - name: my-cluster - initial_node_count: 2 - master_auth: - username: cluster_admin - password: my-secret-password - node_config: - machine_type: n1-standard-4 - disk_size_gb: 500 - location: us-central1-a - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent - register: result -- name: assert changed is true - assert: - that: - - result.changed == true -- name: verify that cluster was deleted - gcp_container_cluster_facts: + state: absent + #---------------------------------------------------------- + - name: create a cluster + gcp_container_cluster: + name: my-cluster + initial_node_count: 2 + master_auth: + username: cluster_admin + password: my-secret-password + node_config: + machine_type: n1-standard-4 + disk_size_gb: 500 location: us-central1-a project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" - scopes: - - https://www.googleapis.com/auth/cloud-platform - register: results -- name: verify that command succeeded - assert: - that: - - "'my-cluster' not in \"{{ results['items'] | map(attribute='name') | list }}\"" -# ---------------------------------------------------------------------------- -- name: delete a cluster that does not exist - gcp_container_cluster: - name: my-cluster - initial_node_count: 2 - master_auth: - username: cluster_admin - password: my-secret-password - node_config: - machine_type: n1-standard-4 - disk_size_gb: 500 - location: us-central1-a - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent - register: result -- name: assert changed is false - assert: - that: - - result.changed == false + state: present + register: result + - name: assert changed is true + assert: + that: + - result.changed == true + - name: verify that cluster was created + gcp_container_cluster_facts: + location: us-central1-a + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + scopes: + - https://www.googleapis.com/auth/cloud-platform + register: results + - name: verify that command succeeded + assert: + that: + - "'my-cluster' in \"{{ results['items'] | map(attribute='name') | list }}\"" + # ---------------------------------------------------------------------------- + - name: create a cluster that already exists + gcp_container_cluster: + name: my-cluster + initial_node_count: 2 + master_auth: + username: cluster_admin + password: my-secret-password + node_config: + machine_type: n1-standard-4 + disk_size_gb: 500 + location: us-central1-a + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present + register: result + - name: assert changed is false + assert: + that: + - result.changed == false + #---------------------------------------------------------- + - name: delete a cluster + gcp_container_cluster: + name: my-cluster + initial_node_count: 2 + master_auth: + username: cluster_admin + password: my-secret-password + node_config: + machine_type: n1-standard-4 + disk_size_gb: 500 + location: us-central1-a + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: result + - name: assert changed is true + assert: + that: + - result.changed == true + - name: verify that cluster was deleted + gcp_container_cluster_facts: + location: us-central1-a + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + scopes: + - https://www.googleapis.com/auth/cloud-platform + register: results + - name: verify that command succeeded + assert: + that: + - "'my-cluster' not in \"{{ results['items'] | map(attribute='name') | list }}\"" + # ---------------------------------------------------------------------------- + - name: delete a cluster that does not exist + gcp_container_cluster: + name: my-cluster + initial_node_count: 2 + master_auth: + username: cluster_admin + password: my-secret-password + node_config: + machine_type: n1-standard-4 + disk_size_gb: 500 + location: us-central1-a + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: result + - name: assert changed is false + assert: + that: + - result.changed == false diff --git a/test/integration/targets/gcp_container_node_pool/tasks/main.yml b/test/integration/targets/gcp_container_node_pool/tasks/main.yml index 3d41089b8f76e9..a306053a425702 100644 --- a/test/integration/targets/gcp_container_node_pool/tasks/main.yml +++ b/test/integration/targets/gcp_container_node_pool/tasks/main.yml @@ -12,130 +12,132 @@ # https://www.github.com/GoogleCloudPlatform/magic-modules # # ---------------------------------------------------------------------------- -# Pre-test setup -- name: create a cluster - gcp_container_cluster: - name: cluster-nodepool - initial_node_count: 4 - location: us-central1-a - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present - register: cluster -- name: delete a node pool - gcp_container_node_pool: - name: my-pool - initial_node_count: 4 - cluster: "{{ cluster }}" - location: us-central1-a - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent -#---------------------------------------------------------- -- name: create a node pool - gcp_container_node_pool: - name: my-pool - initial_node_count: 4 - cluster: "{{ cluster }}" - location: us-central1-a - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present - register: result -- name: assert changed is true - assert: - that: - - result.changed == true -- name: verify that node_pool was created - gcp_container_node_pool_facts: +- block: + # Pre-test setup + - name: create a cluster + gcp_container_cluster: + name: cluster-nodepool + initial_node_count: 4 + location: us-central1-a + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present + register: cluster + - name: delete a node pool + gcp_container_node_pool: + name: my-pool + initial_node_count: 4 cluster: "{{ cluster }}" location: us-central1-a project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" - scopes: - - https://www.googleapis.com/auth/cloud-platform - register: results -- name: verify that command succeeded - assert: - that: - - "'my-pool' in \"{{ results['items'] | map(attribute='name') | list }}\"" -# ---------------------------------------------------------------------------- -- name: create a node pool that already exists - gcp_container_node_pool: - name: my-pool - initial_node_count: 4 - cluster: "{{ cluster }}" - location: us-central1-a - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present - register: result -- name: assert changed is false - assert: - that: - - result.changed == false -#---------------------------------------------------------- -- name: delete a node pool - gcp_container_node_pool: - name: my-pool - initial_node_count: 4 - cluster: "{{ cluster }}" - location: us-central1-a - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent - register: result -- name: assert changed is true - assert: - that: - - result.changed == true -- name: verify that node_pool was deleted - gcp_container_node_pool_facts: + state: absent + #---------------------------------------------------------- + - name: create a node pool + gcp_container_node_pool: + name: my-pool + initial_node_count: 4 cluster: "{{ cluster }}" location: us-central1-a project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" - scopes: - - https://www.googleapis.com/auth/cloud-platform - register: results -- name: verify that command succeeded - assert: - that: - - "'my-pool' not in \"{{ results['items'] | map(attribute='name') | list }}\"" -# ---------------------------------------------------------------------------- -- name: delete a node pool that does not exist - gcp_container_node_pool: - name: my-pool - initial_node_count: 4 - cluster: "{{ cluster }}" - location: us-central1-a - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent - register: result -- name: assert changed is false - assert: - that: - - result.changed == false -#--------------------------------------------------------- -# Post-test teardown -# If errors happen, don't crash the playbook! -- name: delete a cluster - gcp_container_cluster: - name: cluster-nodepool - initial_node_count: 4 - location: us-central1-a - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent - register: cluster - ignore_errors: true + state: present + register: result + - name: assert changed is true + assert: + that: + - result.changed == true + - name: verify that node_pool was created + gcp_container_node_pool_facts: + cluster: "{{ cluster }}" + location: us-central1-a + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + scopes: + - https://www.googleapis.com/auth/cloud-platform + register: results + - name: verify that command succeeded + assert: + that: + - "'my-pool' in \"{{ results['items'] | map(attribute='name') | list }}\"" + # ---------------------------------------------------------------------------- + - name: create a node pool that already exists + gcp_container_node_pool: + name: my-pool + initial_node_count: 4 + cluster: "{{ cluster }}" + location: us-central1-a + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present + register: result + - name: assert changed is false + assert: + that: + - result.changed == false + #---------------------------------------------------------- + - name: delete a node pool + gcp_container_node_pool: + name: my-pool + initial_node_count: 4 + cluster: "{{ cluster }}" + location: us-central1-a + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: result + - name: assert changed is true + assert: + that: + - result.changed == true + - name: verify that node_pool was deleted + gcp_container_node_pool_facts: + cluster: "{{ cluster }}" + location: us-central1-a + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + scopes: + - https://www.googleapis.com/auth/cloud-platform + register: results + - name: verify that command succeeded + assert: + that: + - "'my-pool' not in \"{{ results['items'] | map(attribute='name') | list }}\"" + # ---------------------------------------------------------------------------- + - name: delete a node pool that does not exist + gcp_container_node_pool: + name: my-pool + initial_node_count: 4 + cluster: "{{ cluster }}" + location: us-central1-a + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: result + - name: assert changed is false + assert: + that: + - result.changed == false + always: + #--------------------------------------------------------- + # Post-test teardown + # If errors happen, don't crash the playbook! + - name: delete a cluster + gcp_container_cluster: + name: cluster-nodepool + initial_node_count: 4 + location: us-central1-a + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: cluster + ignore_errors: true diff --git a/test/integration/targets/gcp_dns_managed_zone/tasks/main.yml b/test/integration/targets/gcp_dns_managed_zone/tasks/main.yml index 425836bf0ddae8..569c2043be8ee5 100644 --- a/test/integration/targets/gcp_dns_managed_zone/tasks/main.yml +++ b/test/integration/targets/gcp_dns_managed_zone/tasks/main.yml @@ -12,103 +12,104 @@ # https://www.github.com/GoogleCloudPlatform/magic-modules # # ---------------------------------------------------------------------------- -# Pre-test setup -- name: delete a managed zone - gcp_dns_managed_zone: - name: "{{ resource_name }}" - dns_name: test.somewild2.example.com. - description: test zone - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent -#---------------------------------------------------------- -- name: create a managed zone - gcp_dns_managed_zone: - name: "{{ resource_name }}" - dns_name: test.somewild2.example.com. - description: test zone - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present - register: result -- name: assert changed is true - assert: - that: - - result.changed == true - - "result.kind == 'dns#managedZone'" -- name: verify that managed_zone was created - gcp_dns_managed_zone_facts: +- block: + # Pre-test setup + - name: delete a managed zone + gcp_dns_managed_zone: + name: "{{ resource_name }}" dns_name: test.somewild2.example.com. + description: test zone project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" - scopes: - - https://www.googleapis.com/auth/ndev.clouddns.readwrite - register: results -- name: verify that command succeeded - assert: - that: - - results['items'] | length == 1 -# ---------------------------------------------------------------------------- -- name: create a managed zone that already exists - gcp_dns_managed_zone: - name: "{{ resource_name }}" - dns_name: test.somewild2.example.com. - description: test zone - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present - register: result -- name: assert changed is false - assert: - that: - - result.changed == false - - "result.kind == 'dns#managedZone'" -#---------------------------------------------------------- -- name: delete a managed zone - gcp_dns_managed_zone: - name: "{{ resource_name }}" - dns_name: test.somewild2.example.com. - description: test zone - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent - register: result -- name: assert changed is true - assert: - that: - - result.changed == true - - result.has_key('kind') == False -- name: verify that managed_zone was deleted - gcp_dns_managed_zone_facts: + state: absent + #---------------------------------------------------------- + - name: create a managed zone + gcp_dns_managed_zone: + name: "{{ resource_name }}" dns_name: test.somewild2.example.com. + description: test zone project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" - scopes: - - https://www.googleapis.com/auth/ndev.clouddns.readwrite - register: results -- name: verify that command succeeded - assert: - that: - - results['items'] | length == 0 -# ---------------------------------------------------------------------------- -- name: delete a managed zone that does not exist - gcp_dns_managed_zone: - name: "{{ resource_name }}" - dns_name: test.somewild2.example.com. - description: test zone - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent - register: result -- name: assert changed is false - assert: - that: - - result.changed == false - - result.has_key('kind') == False + state: present + register: result + - name: assert changed is true + assert: + that: + - result.changed == true + - "result.kind == 'dns#managedZone'" + - name: verify that managed_zone was created + gcp_dns_managed_zone_facts: + dns_name: test.somewild2.example.com. + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + scopes: + - https://www.googleapis.com/auth/ndev.clouddns.readwrite + register: results + - name: verify that command succeeded + assert: + that: + - results['items'] | length == 1 + # ---------------------------------------------------------------------------- + - name: create a managed zone that already exists + gcp_dns_managed_zone: + name: "{{ resource_name }}" + dns_name: test.somewild2.example.com. + description: test zone + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present + register: result + - name: assert changed is false + assert: + that: + - result.changed == false + - "result.kind == 'dns#managedZone'" + #---------------------------------------------------------- + - name: delete a managed zone + gcp_dns_managed_zone: + name: "{{ resource_name }}" + dns_name: test.somewild2.example.com. + description: test zone + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: result + - name: assert changed is true + assert: + that: + - result.changed == true + - result.has_key('kind') == False + - name: verify that managed_zone was deleted + gcp_dns_managed_zone_facts: + dns_name: test.somewild2.example.com. + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + scopes: + - https://www.googleapis.com/auth/ndev.clouddns.readwrite + register: results + - name: verify that command succeeded + assert: + that: + - results['items'] | length == 0 + # ---------------------------------------------------------------------------- + - name: delete a managed zone that does not exist + gcp_dns_managed_zone: + name: "{{ resource_name }}" + dns_name: test.somewild2.example.com. + description: test zone + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: result + - name: assert changed is false + assert: + that: + - result.changed == false + - result.has_key('kind') == False diff --git a/test/integration/targets/gcp_dns_resource_record_set/tasks/main.yml b/test/integration/targets/gcp_dns_resource_record_set/tasks/main.yml index 55a56e05ae6399..e758e8e60fe767 100644 --- a/test/integration/targets/gcp_dns_resource_record_set/tasks/main.yml +++ b/test/integration/targets/gcp_dns_resource_record_set/tasks/main.yml @@ -12,147 +12,149 @@ # https://www.github.com/GoogleCloudPlatform/magic-modules # # ---------------------------------------------------------------------------- -# Pre-test setup -- name: create a managed zone - gcp_dns_managed_zone: - name: managedzone-rrs - dns_name: testzone-4.com. - description: test zone - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present - register: managed_zone -- name: delete a resource record set - gcp_dns_resource_record_set: - name: www.testzone-4.com. - managed_zone: "{{ managed_zone }}" - type: A - ttl: 600 - target: - - 10.1.2.3 - - 40.5.6.7 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent -#---------------------------------------------------------- -- name: create a resource record set - gcp_dns_resource_record_set: - name: www.testzone-4.com. - managed_zone: "{{ managed_zone }}" - type: A - ttl: 600 - target: - - 10.1.2.3 - - 40.5.6.7 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present - register: result -- name: assert changed is true - assert: - that: - - result.changed == true - - "result.kind == 'dns#resourceRecordSet'" -- name: verify that resource_record_set was created - gcp_dns_resource_record_set_facts: +- block: + # Pre-test setup + - name: create a managed zone + gcp_dns_managed_zone: + name: managedzone-rrs + dns_name: testzone-4.com. + description: test zone + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present + register: managed_zone + - name: delete a resource record set + gcp_dns_resource_record_set: + name: www.testzone-4.com. managed_zone: "{{ managed_zone }}" + type: A + ttl: 600 + target: + - 10.1.2.3 + - 40.5.6.7 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" - scopes: - - https://www.googleapis.com/auth/ndev.clouddns.readwrite - register: results -- name: verify that command succeeded - assert: - that: - - "'www.testzone-4.com.'in \"{{ results['items'] | map(attribute='name') | list }}\"" -# ---------------------------------------------------------------------------- -- name: create a resource record set that already exists - gcp_dns_resource_record_set: - name: www.testzone-4.com. - managed_zone: "{{ managed_zone }}" - type: A - ttl: 600 - target: - - 10.1.2.3 - - 40.5.6.7 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present - register: result -- name: assert changed is false - assert: - that: - - result.changed == false - - "result.kind == 'dns#resourceRecordSet'" -#---------------------------------------------------------- -- name: delete a resource record set - gcp_dns_resource_record_set: - name: www.testzone-4.com. - managed_zone: "{{ managed_zone }}" - type: A - ttl: 600 - target: - - 10.1.2.3 - - 40.5.6.7 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent - register: result -- name: assert changed is true - assert: - that: - - result.changed == true - - result.has_key('kind') == False -- name: verify that resource_record_set was deleted - gcp_dns_resource_record_set_facts: + state: absent + #---------------------------------------------------------- + - name: create a resource record set + gcp_dns_resource_record_set: + name: www.testzone-4.com. managed_zone: "{{ managed_zone }}" + type: A + ttl: 600 + target: + - 10.1.2.3 + - 40.5.6.7 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" - scopes: - - https://www.googleapis.com/auth/ndev.clouddns.readwrite - register: results -- name: verify that command succeeded - assert: - that: - - "'www.testzone-4.com.'not in \"{{ results['items'] | map(attribute='name') | list }}\"" -# ---------------------------------------------------------------------------- -- name: delete a resource record set that does not exist - gcp_dns_resource_record_set: - name: www.testzone-4.com. - managed_zone: "{{ managed_zone }}" - type: A - ttl: 600 - target: - - 10.1.2.3 - - 40.5.6.7 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent - register: result -- name: assert changed is false - assert: - that: - - result.changed == false - - result.has_key('kind') == False -#--------------------------------------------------------- -# Post-test teardown -# If errors happen, don't crash the playbook! -- name: delete a managed zone - gcp_dns_managed_zone: - name: managedzone-rrs - dns_name: testzone-4.com. - description: test zone - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent - register: managed_zone - ignore_errors: true + state: present + register: result + - name: assert changed is true + assert: + that: + - result.changed == true + - "result.kind == 'dns#resourceRecordSet'" + - name: verify that resource_record_set was created + gcp_dns_resource_record_set_facts: + managed_zone: "{{ managed_zone }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + scopes: + - https://www.googleapis.com/auth/ndev.clouddns.readwrite + register: results + - name: verify that command succeeded + assert: + that: + - "'www.testzone-4.com.'in \"{{ results['items'] | map(attribute='name') | list }}\"" + # ---------------------------------------------------------------------------- + - name: create a resource record set that already exists + gcp_dns_resource_record_set: + name: www.testzone-4.com. + managed_zone: "{{ managed_zone }}" + type: A + ttl: 600 + target: + - 10.1.2.3 + - 40.5.6.7 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present + register: result + - name: assert changed is false + assert: + that: + - result.changed == false + - "result.kind == 'dns#resourceRecordSet'" + #---------------------------------------------------------- + - name: delete a resource record set + gcp_dns_resource_record_set: + name: www.testzone-4.com. + managed_zone: "{{ managed_zone }}" + type: A + ttl: 600 + target: + - 10.1.2.3 + - 40.5.6.7 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: result + - name: assert changed is true + assert: + that: + - result.changed == true + - result.has_key('kind') == False + - name: verify that resource_record_set was deleted + gcp_dns_resource_record_set_facts: + managed_zone: "{{ managed_zone }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + scopes: + - https://www.googleapis.com/auth/ndev.clouddns.readwrite + register: results + - name: verify that command succeeded + assert: + that: + - "'www.testzone-4.com.'not in \"{{ results['items'] | map(attribute='name') | list }}\"" + # ---------------------------------------------------------------------------- + - name: delete a resource record set that does not exist + gcp_dns_resource_record_set: + name: www.testzone-4.com. + managed_zone: "{{ managed_zone }}" + type: A + ttl: 600 + target: + - 10.1.2.3 + - 40.5.6.7 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: result + - name: assert changed is false + assert: + that: + - result.changed == false + - result.has_key('kind') == False + always: + #--------------------------------------------------------- + # Post-test teardown + # If errors happen, don't crash the playbook! + - name: delete a managed zone + gcp_dns_managed_zone: + name: managedzone-rrs + dns_name: testzone-4.com. + description: test zone + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: managed_zone + ignore_errors: true diff --git a/test/integration/targets/gcp_iam_role/tasks/main.yml b/test/integration/targets/gcp_iam_role/tasks/main.yml index 6299f760ce206c..92214981a2d286 100644 --- a/test/integration/targets/gcp_iam_role/tasks/main.yml +++ b/test/integration/targets/gcp_iam_role/tasks/main.yml @@ -12,117 +12,118 @@ # https://www.github.com/GoogleCloudPlatform/magic-modules # # ---------------------------------------------------------------------------- -# Pre-test setup -- name: delete a role - gcp_iam_role: - name: myCustomRole2 - title: My Custom Role - description: My custom role description - included_permissions: - - iam.roles.list - - iam.roles.create - - iam.roles.delete - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent -#---------------------------------------------------------- -- name: create a role - gcp_iam_role: - name: myCustomRole2 - title: My Custom Role - description: My custom role description - included_permissions: - - iam.roles.list - - iam.roles.create - - iam.roles.delete - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present - register: result -- name: assert changed is true - assert: - that: - - result.changed == true -- name: verify that role was created - gcp_iam_role_facts: +- block: + # Pre-test setup + - name: delete a role + gcp_iam_role: + name: myCustomRole2 + title: My Custom Role + description: My custom role description + included_permissions: + - iam.roles.list + - iam.roles.create + - iam.roles.delete project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" - scopes: - - https://www.googleapis.com/auth/iam - register: results -- name: verify that command succeeded - assert: - that: - - results['items'] | length >= 1 -# ---------------------------------------------------------------------------- -- name: create a role that already exists - gcp_iam_role: - name: myCustomRole2 - title: My Custom Role - description: My custom role description - included_permissions: - - iam.roles.list - - iam.roles.create - - iam.roles.delete - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present - register: result -- name: assert changed is false - assert: - that: - - result.changed == false -#---------------------------------------------------------- -- name: delete a role - gcp_iam_role: - name: myCustomRole2 - title: My Custom Role - description: My custom role description - included_permissions: - - iam.roles.list - - iam.roles.create - - iam.roles.delete - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent - register: result -- name: assert changed is true - assert: - that: - - result.changed == true -- name: verify that role was deleted - gcp_iam_role_facts: + state: absent + #---------------------------------------------------------- + - name: create a role + gcp_iam_role: + name: myCustomRole2 + title: My Custom Role + description: My custom role description + included_permissions: + - iam.roles.list + - iam.roles.create + - iam.roles.delete project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" - scopes: - - https://www.googleapis.com/auth/iam - register: results -- name: verify that command succeeded - assert: - that: - - results['items'] | length == 0 -# ---------------------------------------------------------------------------- -- name: delete a role that does not exist - gcp_iam_role: - name: myCustomRole2 - title: My Custom Role - description: My custom role description - included_permissions: - - iam.roles.list - - iam.roles.create - - iam.roles.delete - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent - register: result -- name: assert changed is false - assert: - that: - - result.changed == false + state: present + register: result + - name: assert changed is true + assert: + that: + - result.changed == true + - name: verify that role was created + gcp_iam_role_facts: + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + scopes: + - https://www.googleapis.com/auth/iam + register: results + - name: verify that command succeeded + assert: + that: + - results['items'] | length >= 1 + # ---------------------------------------------------------------------------- + - name: create a role that already exists + gcp_iam_role: + name: myCustomRole2 + title: My Custom Role + description: My custom role description + included_permissions: + - iam.roles.list + - iam.roles.create + - iam.roles.delete + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present + register: result + - name: assert changed is false + assert: + that: + - result.changed == false + #---------------------------------------------------------- + - name: delete a role + gcp_iam_role: + name: myCustomRole2 + title: My Custom Role + description: My custom role description + included_permissions: + - iam.roles.list + - iam.roles.create + - iam.roles.delete + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: result + - name: assert changed is true + assert: + that: + - result.changed == true + - name: verify that role was deleted + gcp_iam_role_facts: + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + scopes: + - https://www.googleapis.com/auth/iam + register: results + - name: verify that command succeeded + assert: + that: + - results['items'] | length == 0 + # ---------------------------------------------------------------------------- + - name: delete a role that does not exist + gcp_iam_role: + name: myCustomRole2 + title: My Custom Role + description: My custom role description + included_permissions: + - iam.roles.list + - iam.roles.create + - iam.roles.delete + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: result + - name: assert changed is false + assert: + that: + - result.changed == false diff --git a/test/integration/targets/gcp_iam_service_account/tasks/main.yml b/test/integration/targets/gcp_iam_service_account/tasks/main.yml index f302e82e9766ea..0d6c6d47e4b2b1 100644 --- a/test/integration/targets/gcp_iam_service_account/tasks/main.yml +++ b/test/integration/targets/gcp_iam_service_account/tasks/main.yml @@ -12,92 +12,93 @@ # https://www.github.com/GoogleCloudPlatform/magic-modules # # ---------------------------------------------------------------------------- -# Pre-test setup -- name: delete a service account - gcp_iam_service_account: - name: "{{ sa_name }}" - display_name: My Ansible test key - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent -#---------------------------------------------------------- -- name: create a service account - gcp_iam_service_account: - name: "{{ sa_name }}" - display_name: My Ansible test key - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present - register: result -- name: assert changed is true - assert: - that: - - result.changed == true -- name: verify that service_account was created - gcp_iam_service_account_facts: +- block: + # Pre-test setup + - name: delete a service account + gcp_iam_service_account: + name: "{{ sa_name }}" + display_name: My Ansible test key project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" - scopes: - - https://www.googleapis.com/auth/iam - register: results -- name: verify that command succeeded - assert: - that: - - results['items'] | length >= 1 -# ---------------------------------------------------------------------------- -- name: create a service account that already exists - gcp_iam_service_account: - name: "{{ sa_name }}" - display_name: My Ansible test key - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present - register: result -- name: assert changed is false - assert: - that: - - result.changed == false -#---------------------------------------------------------- -- name: delete a service account - gcp_iam_service_account: - name: "{{ sa_name }}" - display_name: My Ansible test key - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent - register: result -- name: assert changed is true - assert: - that: - - result.changed == true -- name: verify that service_account was deleted - gcp_iam_service_account_facts: + state: absent + #---------------------------------------------------------- + - name: create a service account + gcp_iam_service_account: + name: "{{ sa_name }}" + display_name: My Ansible test key project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" - scopes: - - https://www.googleapis.com/auth/iam - register: results -- name: verify that command succeeded - assert: - that: - - results['items'] | length == 0 -# ---------------------------------------------------------------------------- -- name: delete a service account that does not exist - gcp_iam_service_account: - name: "{{ sa_name }}" - display_name: My Ansible test key - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent - register: result -- name: assert changed is false - assert: - that: - - result.changed == false + state: present + register: result + - name: assert changed is true + assert: + that: + - result.changed == true + - name: verify that service_account was created + gcp_iam_service_account_facts: + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + scopes: + - https://www.googleapis.com/auth/iam + register: results + - name: verify that command succeeded + assert: + that: + - results['items'] | length >= 1 + # ---------------------------------------------------------------------------- + - name: create a service account that already exists + gcp_iam_service_account: + name: "{{ sa_name }}" + display_name: My Ansible test key + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present + register: result + - name: assert changed is false + assert: + that: + - result.changed == false + #---------------------------------------------------------- + - name: delete a service account + gcp_iam_service_account: + name: "{{ sa_name }}" + display_name: My Ansible test key + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: result + - name: assert changed is true + assert: + that: + - result.changed == true + - name: verify that service_account was deleted + gcp_iam_service_account_facts: + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + scopes: + - https://www.googleapis.com/auth/iam + register: results + - name: verify that command succeeded + assert: + that: + - results['items'] | length == 0 + # ---------------------------------------------------------------------------- + - name: delete a service account that does not exist + gcp_iam_service_account: + name: "{{ sa_name }}" + display_name: My Ansible test key + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: result + - name: assert changed is false + assert: + that: + - result.changed == false diff --git a/test/integration/targets/gcp_pubsub_subscription/tasks/main.yml b/test/integration/targets/gcp_pubsub_subscription/tasks/main.yml index 8a05e2a46fd03e..36fa2ac9b5c802 100644 --- a/test/integration/targets/gcp_pubsub_subscription/tasks/main.yml +++ b/test/integration/targets/gcp_pubsub_subscription/tasks/main.yml @@ -12,117 +12,119 @@ # https://www.github.com/GoogleCloudPlatform/magic-modules # # ---------------------------------------------------------------------------- -# Pre-test setup -- name: create a topic - gcp_pubsub_topic: - name: topic-subscription - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present - register: topic -- name: delete a subscription - gcp_pubsub_subscription: - name: "{{ resource_name }}" - topic: "{{ topic }}" - ack_deadline_seconds: 300 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent -#---------------------------------------------------------- -- name: create a subscription - gcp_pubsub_subscription: - name: "{{ resource_name }}" - topic: "{{ topic }}" - ack_deadline_seconds: 300 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present - register: result -- name: assert changed is true - assert: - that: - - result.changed == true -- name: verify that subscription was created - gcp_pubsub_subscription_facts: +- block: + # Pre-test setup + - name: create a topic + gcp_pubsub_topic: + name: topic-subscription project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" - scopes: - - https://www.googleapis.com/auth/pubsub - register: results -- name: verify that command succeeded - assert: - that: - - "\"{{resource_name}}\" in \"{{ results['items'] | map(attribute='name') | list }}\"" -# ---------------------------------------------------------------------------- -- name: create a subscription that already exists - gcp_pubsub_subscription: - name: "{{ resource_name }}" - topic: "{{ topic }}" - ack_deadline_seconds: 300 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present - register: result -- name: assert changed is false - assert: - that: - - result.changed == false -#---------------------------------------------------------- -- name: delete a subscription - gcp_pubsub_subscription: - name: "{{ resource_name }}" - topic: "{{ topic }}" - ack_deadline_seconds: 300 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent - register: result -- name: assert changed is true - assert: - that: - - result.changed == true -- name: verify that subscription was deleted - gcp_pubsub_subscription_facts: + state: present + register: topic + - name: delete a subscription + gcp_pubsub_subscription: + name: "{{ resource_name }}" + topic: "{{ topic }}" + ack_deadline_seconds: 300 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" - scopes: - - https://www.googleapis.com/auth/pubsub - register: results -- name: verify that command succeeded - assert: - that: - - "\"{{resource_name}}\" not in \"{{ results['items'] | map(attribute='name') | list }}\"" -# ---------------------------------------------------------------------------- -- name: delete a subscription that does not exist - gcp_pubsub_subscription: - name: "{{ resource_name }}" - topic: "{{ topic }}" - ack_deadline_seconds: 300 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent - register: result -- name: assert changed is false - assert: - that: - - result.changed == false -#--------------------------------------------------------- -# Post-test teardown -# If errors happen, don't crash the playbook! -- name: delete a topic - gcp_pubsub_topic: - name: topic-subscription - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent - register: topic - ignore_errors: true + state: absent + #---------------------------------------------------------- + - name: create a subscription + gcp_pubsub_subscription: + name: "{{ resource_name }}" + topic: "{{ topic }}" + ack_deadline_seconds: 300 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present + register: result + - name: assert changed is true + assert: + that: + - result.changed == true + - name: verify that subscription was created + gcp_pubsub_subscription_facts: + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + scopes: + - https://www.googleapis.com/auth/pubsub + register: results + - name: verify that command succeeded + assert: + that: + - "\"{{resource_name}}\" in \"{{ results['items'] | map(attribute='name') | list }}\"" + # ---------------------------------------------------------------------------- + - name: create a subscription that already exists + gcp_pubsub_subscription: + name: "{{ resource_name }}" + topic: "{{ topic }}" + ack_deadline_seconds: 300 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present + register: result + - name: assert changed is false + assert: + that: + - result.changed == false + #---------------------------------------------------------- + - name: delete a subscription + gcp_pubsub_subscription: + name: "{{ resource_name }}" + topic: "{{ topic }}" + ack_deadline_seconds: 300 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: result + - name: assert changed is true + assert: + that: + - result.changed == true + - name: verify that subscription was deleted + gcp_pubsub_subscription_facts: + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + scopes: + - https://www.googleapis.com/auth/pubsub + register: results + - name: verify that command succeeded + assert: + that: + - "\"{{resource_name}}\" not in \"{{ results['items'] | map(attribute='name') | list }}\"" + # ---------------------------------------------------------------------------- + - name: delete a subscription that does not exist + gcp_pubsub_subscription: + name: "{{ resource_name }}" + topic: "{{ topic }}" + ack_deadline_seconds: 300 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: result + - name: assert changed is false + assert: + that: + - result.changed == false + always: + #--------------------------------------------------------- + # Post-test teardown + # If errors happen, don't crash the playbook! + - name: delete a topic + gcp_pubsub_topic: + name: topic-subscription + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: topic + ignore_errors: true diff --git a/test/integration/targets/gcp_pubsub_topic/tasks/main.yml b/test/integration/targets/gcp_pubsub_topic/tasks/main.yml index 0d3bda081573d0..a9282ed2011a3f 100644 --- a/test/integration/targets/gcp_pubsub_topic/tasks/main.yml +++ b/test/integration/targets/gcp_pubsub_topic/tasks/main.yml @@ -12,87 +12,88 @@ # https://www.github.com/GoogleCloudPlatform/magic-modules # # ---------------------------------------------------------------------------- -# Pre-test setup -- name: delete a topic - gcp_pubsub_topic: - name: test-topic1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent -#---------------------------------------------------------- -- name: create a topic - gcp_pubsub_topic: - name: test-topic1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present - register: result -- name: assert changed is true - assert: - that: - - result.changed == true -- name: verify that topic was created - gcp_pubsub_topic_facts: +- block: + # Pre-test setup + - name: delete a topic + gcp_pubsub_topic: + name: test-topic1 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" - scopes: - - https://www.googleapis.com/auth/pubsub - register: results -- name: verify that command succeeded - assert: - that: - - "'test-topic1' in \"{{ results['items'] | map(attribute='name') | list }}\"" -# ---------------------------------------------------------------------------- -- name: create a topic that already exists - gcp_pubsub_topic: - name: test-topic1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present - register: result -- name: assert changed is false - assert: - that: - - result.changed == false -#---------------------------------------------------------- -- name: delete a topic - gcp_pubsub_topic: - name: test-topic1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent - register: result -- name: assert changed is true - assert: - that: - - result.changed == true -- name: verify that topic was deleted - gcp_pubsub_topic_facts: + state: absent + #---------------------------------------------------------- + - name: create a topic + gcp_pubsub_topic: + name: test-topic1 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" - scopes: - - https://www.googleapis.com/auth/pubsub - register: results -- name: verify that command succeeded - assert: - that: - - "'test-topic1' not in \"{{ results['items'] | map(attribute='name') | list }}\"" -# ---------------------------------------------------------------------------- -- name: delete a topic that does not exist - gcp_pubsub_topic: - name: test-topic1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent - register: result -- name: assert changed is false - assert: - that: - - result.changed == false + state: present + register: result + - name: assert changed is true + assert: + that: + - result.changed == true + - name: verify that topic was created + gcp_pubsub_topic_facts: + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + scopes: + - https://www.googleapis.com/auth/pubsub + register: results + - name: verify that command succeeded + assert: + that: + - "'test-topic1' in \"{{ results['items'] | map(attribute='name') | list }}\"" + # ---------------------------------------------------------------------------- + - name: create a topic that already exists + gcp_pubsub_topic: + name: test-topic1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present + register: result + - name: assert changed is false + assert: + that: + - result.changed == false + #---------------------------------------------------------- + - name: delete a topic + gcp_pubsub_topic: + name: test-topic1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: result + - name: assert changed is true + assert: + that: + - result.changed == true + - name: verify that topic was deleted + gcp_pubsub_topic_facts: + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + scopes: + - https://www.googleapis.com/auth/pubsub + register: results + - name: verify that command succeeded + assert: + that: + - "'test-topic1' not in \"{{ results['items'] | map(attribute='name') | list }}\"" + # ---------------------------------------------------------------------------- + - name: delete a topic that does not exist + gcp_pubsub_topic: + name: test-topic1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: result + - name: assert changed is false + assert: + that: + - result.changed == false diff --git a/test/integration/targets/gcp_redis_instance/tasks/main.yml b/test/integration/targets/gcp_redis_instance/tasks/main.yml index 55febdbcde03ea..7a6bb2d088d986 100644 --- a/test/integration/targets/gcp_redis_instance/tasks/main.yml +++ b/test/integration/targets/gcp_redis_instance/tasks/main.yml @@ -12,159 +12,161 @@ # https://www.github.com/GoogleCloudPlatform/magic-modules # # ---------------------------------------------------------------------------- -# Pre-test setup -- name: create a network - gcp_compute_network: - name: network-instance - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present - register: network -- name: delete a instance - gcp_redis_instance: - name: instance37 - tier: STANDARD_HA - memory_size_gb: 1 - region: us-central1 - location_id: us-central1-a - redis_version: REDIS_3_2 - display_name: Ansible Test Instance - reserved_ip_range: 192.168.0.0/29 - labels: - my_key: my_val - other_key: other_val - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent -#---------------------------------------------------------- -- name: create a instance - gcp_redis_instance: - name: instance37 - tier: STANDARD_HA - memory_size_gb: 1 - region: us-central1 - location_id: us-central1-a - redis_version: REDIS_3_2 - display_name: Ansible Test Instance - reserved_ip_range: 192.168.0.0/29 - labels: - my_key: my_val - other_key: other_val - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present - register: result -- name: assert changed is true - assert: - that: - - result.changed == true -- name: verify that instance was created - gcp_redis_instance_facts: +- block: + # Pre-test setup + - name: create a network + gcp_compute_network: + name: network-instance + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present + register: network + - name: delete a instance + gcp_redis_instance: + name: instance37 + tier: STANDARD_HA + memory_size_gb: 1 region: us-central1 + location_id: us-central1-a + redis_version: REDIS_3_2 + display_name: Ansible Test Instance + reserved_ip_range: 192.168.0.0/29 + labels: + my_key: my_val + other_key: other_val project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" - scopes: - - https://www.googleapis.com/auth/cloud-platform - register: results -- name: verify that command succeeded - assert: - that: - - results['items'] | length >= 1 -# ---------------------------------------------------------------------------- -- name: create a instance that already exists - gcp_redis_instance: - name: instance37 - tier: STANDARD_HA - memory_size_gb: 1 - region: us-central1 - location_id: us-central1-a - redis_version: REDIS_3_2 - display_name: Ansible Test Instance - reserved_ip_range: 192.168.0.0/29 - labels: - my_key: my_val - other_key: other_val - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present - register: result -- name: assert changed is false - assert: - that: - - result.changed == false -#---------------------------------------------------------- -- name: delete a instance - gcp_redis_instance: - name: instance37 - tier: STANDARD_HA - memory_size_gb: 1 - region: us-central1 - location_id: us-central1-a - redis_version: REDIS_3_2 - display_name: Ansible Test Instance - reserved_ip_range: 192.168.0.0/29 - labels: - my_key: my_val - other_key: other_val - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent - register: result -- name: assert changed is true - assert: - that: - - result.changed == true -- name: verify that instance was deleted - gcp_redis_instance_facts: + state: absent + #---------------------------------------------------------- + - name: create a instance + gcp_redis_instance: + name: instance37 + tier: STANDARD_HA + memory_size_gb: 1 region: us-central1 + location_id: us-central1-a + redis_version: REDIS_3_2 + display_name: Ansible Test Instance + reserved_ip_range: 192.168.0.0/29 + labels: + my_key: my_val + other_key: other_val project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" - scopes: - - https://www.googleapis.com/auth/cloud-platform - register: results -- name: verify that command succeeded - assert: - that: - - results['items'] | length == 0 -# ---------------------------------------------------------------------------- -- name: delete a instance that does not exist - gcp_redis_instance: - name: instance37 - tier: STANDARD_HA - memory_size_gb: 1 - region: us-central1 - location_id: us-central1-a - redis_version: REDIS_3_2 - display_name: Ansible Test Instance - reserved_ip_range: 192.168.0.0/29 - labels: - my_key: my_val - other_key: other_val - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent - register: result -- name: assert changed is false - assert: - that: - - result.changed == false -#--------------------------------------------------------- -# Post-test teardown -# If errors happen, don't crash the playbook! -- name: delete a network - gcp_compute_network: - name: network-instance - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent - register: network - ignore_errors: true + state: present + register: result + - name: assert changed is true + assert: + that: + - result.changed == true + - name: verify that instance was created + gcp_redis_instance_facts: + region: us-central1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + scopes: + - https://www.googleapis.com/auth/cloud-platform + register: results + - name: verify that command succeeded + assert: + that: + - results['items'] | length >= 1 + # ---------------------------------------------------------------------------- + - name: create a instance that already exists + gcp_redis_instance: + name: instance37 + tier: STANDARD_HA + memory_size_gb: 1 + region: us-central1 + location_id: us-central1-a + redis_version: REDIS_3_2 + display_name: Ansible Test Instance + reserved_ip_range: 192.168.0.0/29 + labels: + my_key: my_val + other_key: other_val + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present + register: result + - name: assert changed is false + assert: + that: + - result.changed == false + #---------------------------------------------------------- + - name: delete a instance + gcp_redis_instance: + name: instance37 + tier: STANDARD_HA + memory_size_gb: 1 + region: us-central1 + location_id: us-central1-a + redis_version: REDIS_3_2 + display_name: Ansible Test Instance + reserved_ip_range: 192.168.0.0/29 + labels: + my_key: my_val + other_key: other_val + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: result + - name: assert changed is true + assert: + that: + - result.changed == true + - name: verify that instance was deleted + gcp_redis_instance_facts: + region: us-central1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + scopes: + - https://www.googleapis.com/auth/cloud-platform + register: results + - name: verify that command succeeded + assert: + that: + - results['items'] | length == 0 + # ---------------------------------------------------------------------------- + - name: delete a instance that does not exist + gcp_redis_instance: + name: instance37 + tier: STANDARD_HA + memory_size_gb: 1 + region: us-central1 + location_id: us-central1-a + redis_version: REDIS_3_2 + display_name: Ansible Test Instance + reserved_ip_range: 192.168.0.0/29 + labels: + my_key: my_val + other_key: other_val + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: result + - name: assert changed is false + assert: + that: + - result.changed == false + always: + #--------------------------------------------------------- + # Post-test teardown + # If errors happen, don't crash the playbook! + - name: delete a network + gcp_compute_network: + name: network-instance + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: network + ignore_errors: true diff --git a/test/integration/targets/gcp_resourcemanager_project/tasks/main.yml b/test/integration/targets/gcp_resourcemanager_project/tasks/main.yml index 50cb58639d7fe9..0608f5166de403 100644 --- a/test/integration/targets/gcp_resourcemanager_project/tasks/main.yml +++ b/test/integration/targets/gcp_resourcemanager_project/tasks/main.yml @@ -12,102 +12,103 @@ # https://www.github.com/GoogleCloudPlatform/magic-modules # # ---------------------------------------------------------------------------- -# Pre-test setup -- name: delete a project - gcp_resourcemanager_project: - name: My Sample Project - id: alextest-{{ 10000000000 | random }} - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - parent: - type: organization - id: 636173955921 - state: absent -#---------------------------------------------------------- -- name: create a project - gcp_resourcemanager_project: - name: My Sample Project - id: alextest-{{ 10000000000 | random }} - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - parent: - type: organization - id: 636173955921 - state: present - register: result -- name: assert changed is true - assert: - that: - - result.changed == true -- name: verify that project was created - gcp_resourcemanager_project_facts: - project: "{{ gcp_project }}" +- block: + # Pre-test setup + - name: delete a project + gcp_resourcemanager_project: + name: My Sample Project + id: alextest-{{ 10000000000 | random }} auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" - scopes: - - https://www.googleapis.com/auth/cloud-platform - register: results -- name: verify that command succeeded - assert: - that: - - results['items'] | length >= 1 -# ---------------------------------------------------------------------------- -- name: create a project that already exists - gcp_resourcemanager_project: - name: My Sample Project - id: alextest-{{ 10000000000 | random }} - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - parent: - type: organization - id: 636173955921 - state: present - register: result -- name: assert changed is false - assert: - that: - - result.changed == false -#---------------------------------------------------------- -- name: delete a project - gcp_resourcemanager_project: - name: My Sample Project - id: alextest-{{ 10000000000 | random }} - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - parent: - type: organization - id: 636173955921 - state: absent - register: result -- name: assert changed is true - assert: - that: - - result.changed == true -- name: verify that project was deleted - gcp_resourcemanager_project_facts: - project: "{{ gcp_project }}" + parent: + type: organization + id: 636173955921 + state: absent + #---------------------------------------------------------- + - name: create a project + gcp_resourcemanager_project: + name: My Sample Project + id: alextest-{{ 10000000000 | random }} auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" - scopes: - - https://www.googleapis.com/auth/cloud-platform - register: results -- name: verify that command succeeded - assert: - that: - - results['items'] | length == 0 -# ---------------------------------------------------------------------------- -- name: delete a project that does not exist - gcp_resourcemanager_project: - name: My Sample Project - id: alextest-{{ 10000000000 | random }} - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - parent: - type: organization - id: 636173955921 - state: absent - register: result -- name: assert changed is false - assert: - that: - - result.changed == false + parent: + type: organization + id: 636173955921 + state: present + register: result + - name: assert changed is true + assert: + that: + - result.changed == true + - name: verify that project was created + gcp_resourcemanager_project_facts: + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + scopes: + - https://www.googleapis.com/auth/cloud-platform + register: results + - name: verify that command succeeded + assert: + that: + - results['items'] | length >= 1 + # ---------------------------------------------------------------------------- + - name: create a project that already exists + gcp_resourcemanager_project: + name: My Sample Project + id: alextest-{{ 10000000000 | random }} + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + parent: + type: organization + id: 636173955921 + state: present + register: result + - name: assert changed is false + assert: + that: + - result.changed == false + #---------------------------------------------------------- + - name: delete a project + gcp_resourcemanager_project: + name: My Sample Project + id: alextest-{{ 10000000000 | random }} + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + parent: + type: organization + id: 636173955921 + state: absent + register: result + - name: assert changed is true + assert: + that: + - result.changed == true + - name: verify that project was deleted + gcp_resourcemanager_project_facts: + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + scopes: + - https://www.googleapis.com/auth/cloud-platform + register: results + - name: verify that command succeeded + assert: + that: + - results['items'] | length == 0 + # ---------------------------------------------------------------------------- + - name: delete a project that does not exist + gcp_resourcemanager_project: + name: My Sample Project + id: alextest-{{ 10000000000 | random }} + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + parent: + type: organization + id: 636173955921 + state: absent + register: result + - name: assert changed is false + assert: + that: + - result.changed == false diff --git a/test/integration/targets/gcp_sourcerepo_repository/tasks/main.yml b/test/integration/targets/gcp_sourcerepo_repository/tasks/main.yml index 5d704fcb6b6a29..14db973cd74649 100644 --- a/test/integration/targets/gcp_sourcerepo_repository/tasks/main.yml +++ b/test/integration/targets/gcp_sourcerepo_repository/tasks/main.yml @@ -12,87 +12,88 @@ # https://www.github.com/GoogleCloudPlatform/magic-modules # # ---------------------------------------------------------------------------- -# Pre-test setup -- name: delete a repository - gcp_sourcerepo_repository: - name: projects/{{ gcp_project }}/repos/{{ resource_name }} - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent -#---------------------------------------------------------- -- name: create a repository - gcp_sourcerepo_repository: - name: projects/{{ gcp_project }}/repos/{{ resource_name }} - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present - register: result -- name: assert changed is true - assert: - that: - - result.changed == true -- name: verify that repository was created - gcp_sourcerepo_repository_facts: +- block: + # Pre-test setup + - name: delete a repository + gcp_sourcerepo_repository: + name: projects/{{ gcp_project }}/repos/{{ resource_name }} project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" - scopes: - - https://www.googleapis.com/auth/cloud-platform - register: results -- name: verify that command succeeded - assert: - that: - - results['items'] | length >= 1 -# ---------------------------------------------------------------------------- -- name: create a repository that already exists - gcp_sourcerepo_repository: - name: projects/{{ gcp_project }}/repos/{{ resource_name }} - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present - register: result -- name: assert changed is false - assert: - that: - - result.changed == false -#---------------------------------------------------------- -- name: delete a repository - gcp_sourcerepo_repository: - name: projects/{{ gcp_project }}/repos/{{ resource_name }} - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent - register: result -- name: assert changed is true - assert: - that: - - result.changed == true -- name: verify that repository was deleted - gcp_sourcerepo_repository_facts: + state: absent + #---------------------------------------------------------- + - name: create a repository + gcp_sourcerepo_repository: + name: projects/{{ gcp_project }}/repos/{{ resource_name }} project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" - scopes: - - https://www.googleapis.com/auth/cloud-platform - register: results -- name: verify that command succeeded - assert: - that: - - results['items'] | length == 0 -# ---------------------------------------------------------------------------- -- name: delete a repository that does not exist - gcp_sourcerepo_repository: - name: projects/{{ gcp_project }}/repos/{{ resource_name }} - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent - register: result -- name: assert changed is false - assert: - that: - - result.changed == false + state: present + register: result + - name: assert changed is true + assert: + that: + - result.changed == true + - name: verify that repository was created + gcp_sourcerepo_repository_facts: + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + scopes: + - https://www.googleapis.com/auth/cloud-platform + register: results + - name: verify that command succeeded + assert: + that: + - results['items'] | length >= 1 + # ---------------------------------------------------------------------------- + - name: create a repository that already exists + gcp_sourcerepo_repository: + name: projects/{{ gcp_project }}/repos/{{ resource_name }} + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present + register: result + - name: assert changed is false + assert: + that: + - result.changed == false + #---------------------------------------------------------- + - name: delete a repository + gcp_sourcerepo_repository: + name: projects/{{ gcp_project }}/repos/{{ resource_name }} + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: result + - name: assert changed is true + assert: + that: + - result.changed == true + - name: verify that repository was deleted + gcp_sourcerepo_repository_facts: + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + scopes: + - https://www.googleapis.com/auth/cloud-platform + register: results + - name: verify that command succeeded + assert: + that: + - results['items'] | length == 0 + # ---------------------------------------------------------------------------- + - name: delete a repository that does not exist + gcp_sourcerepo_repository: + name: projects/{{ gcp_project }}/repos/{{ resource_name }} + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: result + - name: assert changed is false + assert: + that: + - result.changed == false diff --git a/test/integration/targets/gcp_spanner_database/tasks/main.yml b/test/integration/targets/gcp_spanner_database/tasks/main.yml index c059ad2e38c910..bc27b9093f63da 100644 --- a/test/integration/targets/gcp_spanner_database/tasks/main.yml +++ b/test/integration/targets/gcp_spanner_database/tasks/main.yml @@ -12,124 +12,126 @@ # https://www.github.com/GoogleCloudPlatform/magic-modules # # ---------------------------------------------------------------------------- -# Pre-test setup -- name: create a instance - gcp_spanner_instance: - name: instance-database - display_name: My Spanner Instance - node_count: 2 - labels: - cost_center: ti-1700004 - config: regional-us-central1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present - register: instance -- name: delete a database - gcp_spanner_database: - name: webstore - instance: "{{ instance }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent -#---------------------------------------------------------- -- name: create a database - gcp_spanner_database: - name: webstore - instance: "{{ instance }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present - register: result -- name: assert changed is true - assert: - that: - - result.changed == true -- name: verify that database was created - gcp_spanner_database_facts: +- block: + # Pre-test setup + - name: create a instance + gcp_spanner_instance: + name: instance-database + display_name: My Spanner Instance + node_count: 2 + labels: + cost_center: ti-1700004 + config: regional-us-central1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present + register: instance + - name: delete a database + gcp_spanner_database: + name: webstore instance: "{{ instance }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" - scopes: - - https://www.googleapis.com/auth/spanner.admin - register: results -- name: verify that command succeeded - assert: - that: - - "'webstore' in \"{{ results['items'] | map(attribute='name') | list }}\"" -# ---------------------------------------------------------------------------- -- name: create a database that already exists - gcp_spanner_database: - name: webstore - instance: "{{ instance }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present - register: result -- name: assert changed is false - assert: - that: - - result.changed == false -#---------------------------------------------------------- -- name: delete a database - gcp_spanner_database: - name: webstore - instance: "{{ instance }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent - register: result -- name: assert changed is true - assert: - that: - - result.changed == true -- name: verify that database was deleted - gcp_spanner_database_facts: + state: absent + #---------------------------------------------------------- + - name: create a database + gcp_spanner_database: + name: webstore instance: "{{ instance }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" - scopes: - - https://www.googleapis.com/auth/spanner.admin - register: results -- name: verify that command succeeded - assert: - that: - - "'webstore' not in \"{{ results['items'] | map(attribute='name') | list }}\"" -# ---------------------------------------------------------------------------- -- name: delete a database that does not exist - gcp_spanner_database: - name: webstore - instance: "{{ instance }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent - register: result -- name: assert changed is false - assert: - that: - - result.changed == false -#--------------------------------------------------------- -# Post-test teardown -# If errors happen, don't crash the playbook! -- name: delete a instance - gcp_spanner_instance: - name: instance-database - display_name: My Spanner Instance - node_count: 2 - labels: - cost_center: ti-1700004 - config: regional-us-central1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent - register: instance - ignore_errors: true + state: present + register: result + - name: assert changed is true + assert: + that: + - result.changed == true + - name: verify that database was created + gcp_spanner_database_facts: + instance: "{{ instance }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + scopes: + - https://www.googleapis.com/auth/spanner.admin + register: results + - name: verify that command succeeded + assert: + that: + - "'webstore' in \"{{ results['items'] | map(attribute='name') | list }}\"" + # ---------------------------------------------------------------------------- + - name: create a database that already exists + gcp_spanner_database: + name: webstore + instance: "{{ instance }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present + register: result + - name: assert changed is false + assert: + that: + - result.changed == false + #---------------------------------------------------------- + - name: delete a database + gcp_spanner_database: + name: webstore + instance: "{{ instance }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: result + - name: assert changed is true + assert: + that: + - result.changed == true + - name: verify that database was deleted + gcp_spanner_database_facts: + instance: "{{ instance }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + scopes: + - https://www.googleapis.com/auth/spanner.admin + register: results + - name: verify that command succeeded + assert: + that: + - "'webstore' not in \"{{ results['items'] | map(attribute='name') | list }}\"" + # ---------------------------------------------------------------------------- + - name: delete a database that does not exist + gcp_spanner_database: + name: webstore + instance: "{{ instance }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: result + - name: assert changed is false + assert: + that: + - result.changed == false + always: + #--------------------------------------------------------- + # Post-test teardown + # If errors happen, don't crash the playbook! + - name: delete a instance + gcp_spanner_instance: + name: instance-database + display_name: My Spanner Instance + node_count: 2 + labels: + cost_center: ti-1700004 + config: regional-us-central1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: instance + ignore_errors: true diff --git a/test/integration/targets/gcp_spanner_instance/tasks/main.yml b/test/integration/targets/gcp_spanner_instance/tasks/main.yml index 15c720610dd6a5..5c7941761474b3 100644 --- a/test/integration/targets/gcp_spanner_instance/tasks/main.yml +++ b/test/integration/targets/gcp_spanner_instance/tasks/main.yml @@ -12,112 +12,113 @@ # https://www.github.com/GoogleCloudPlatform/magic-modules # # ---------------------------------------------------------------------------- -# Pre-test setup -- name: delete a instance - gcp_spanner_instance: - name: testinstance - display_name: My Spanner Instance - node_count: 2 - labels: - cost_center: ti-1700004 - config: regional-us-central1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent -#---------------------------------------------------------- -- name: create a instance - gcp_spanner_instance: - name: testinstance - display_name: My Spanner Instance - node_count: 2 - labels: - cost_center: ti-1700004 - config: regional-us-central1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present - register: result -- name: assert changed is true - assert: - that: - - result.changed == true -- name: verify that instance was created - gcp_spanner_instance_facts: +- block: + # Pre-test setup + - name: delete a instance + gcp_spanner_instance: + name: testinstance + display_name: My Spanner Instance + node_count: 2 + labels: + cost_center: ti-1700004 + config: regional-us-central1 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" - scopes: - - https://www.googleapis.com/auth/spanner.admin - register: results -- name: verify that command succeeded - assert: - that: - - "\"{{resource_name}}\" in \"{{ results['items'] | map(attribute='name') | list }}\"" -# ---------------------------------------------------------------------------- -- name: create a instance that already exists - gcp_spanner_instance: - name: testinstance - display_name: My Spanner Instance - node_count: 2 - labels: - cost_center: ti-1700004 - config: regional-us-central1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present - register: result -- name: assert changed is false - assert: - that: - - result.changed == false -#---------------------------------------------------------- -- name: delete a instance - gcp_spanner_instance: - name: testinstance - display_name: My Spanner Instance - node_count: 2 - labels: - cost_center: ti-1700004 - config: regional-us-central1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent - register: result -- name: assert changed is true - assert: - that: - - result.changed == true -- name: verify that instance was deleted - gcp_spanner_instance_facts: + state: absent + #---------------------------------------------------------- + - name: create a instance + gcp_spanner_instance: + name: testinstance + display_name: My Spanner Instance + node_count: 2 + labels: + cost_center: ti-1700004 + config: regional-us-central1 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" - scopes: - - https://www.googleapis.com/auth/spanner.admin - register: results -- name: verify that command succeeded - assert: - that: - - "\"{{resource_name}}\" not in \"{{ results['items'] | map(attribute='name') | list }}\"" -# ---------------------------------------------------------------------------- -- name: delete a instance that does not exist - gcp_spanner_instance: - name: testinstance - display_name: My Spanner Instance - node_count: 2 - labels: - cost_center: ti-1700004 - config: regional-us-central1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent - register: result -- name: assert changed is false - assert: - that: - - result.changed == false + state: present + register: result + - name: assert changed is true + assert: + that: + - result.changed == true + - name: verify that instance was created + gcp_spanner_instance_facts: + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + scopes: + - https://www.googleapis.com/auth/spanner.admin + register: results + - name: verify that command succeeded + assert: + that: + - "\"{{resource_name}}\" in \"{{ results['items'] | map(attribute='name') | list }}\"" + # ---------------------------------------------------------------------------- + - name: create a instance that already exists + gcp_spanner_instance: + name: testinstance + display_name: My Spanner Instance + node_count: 2 + labels: + cost_center: ti-1700004 + config: regional-us-central1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present + register: result + - name: assert changed is false + assert: + that: + - result.changed == false + #---------------------------------------------------------- + - name: delete a instance + gcp_spanner_instance: + name: testinstance + display_name: My Spanner Instance + node_count: 2 + labels: + cost_center: ti-1700004 + config: regional-us-central1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: result + - name: assert changed is true + assert: + that: + - result.changed == true + - name: verify that instance was deleted + gcp_spanner_instance_facts: + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + scopes: + - https://www.googleapis.com/auth/spanner.admin + register: results + - name: verify that command succeeded + assert: + that: + - "\"{{resource_name}}\" not in \"{{ results['items'] | map(attribute='name') | list }}\"" + # ---------------------------------------------------------------------------- + - name: delete a instance that does not exist + gcp_spanner_instance: + name: testinstance + display_name: My Spanner Instance + node_count: 2 + labels: + cost_center: ti-1700004 + config: regional-us-central1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: result + - name: assert changed is false + assert: + that: + - result.changed == false diff --git a/test/integration/targets/gcp_sql_database/tasks/main.yml b/test/integration/targets/gcp_sql_database/tasks/main.yml index 53210046943e5b..9e87c21b57a895 100644 --- a/test/integration/targets/gcp_sql_database/tasks/main.yml +++ b/test/integration/targets/gcp_sql_database/tasks/main.yml @@ -12,137 +12,139 @@ # https://www.github.com/GoogleCloudPlatform/magic-modules # # ---------------------------------------------------------------------------- -# Pre-test setup -- name: create a instance - gcp_sql_instance: - name: "{{resource_name}}-3" - settings: - ip_configuration: - authorized_networks: - - name: google dns server - value: 8.8.8.8/32 - tier: db-n1-standard-1 - region: us-central1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present - register: instance -- name: delete a database - gcp_sql_database: - name: "{{ resource_name }}" - charset: utf8 - instance: "{{ instance }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent -#---------------------------------------------------------- -- name: create a database - gcp_sql_database: - name: "{{ resource_name }}" - charset: utf8 - instance: "{{ instance }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present - register: result -- name: assert changed is true - assert: - that: - - result.changed == true - - "result.kind == 'sql#database'" -- name: verify that database was created - gcp_sql_database_facts: +- block: + # Pre-test setup + - name: create a instance + gcp_sql_instance: + name: "{{resource_name}}-3" + settings: + ip_configuration: + authorized_networks: + - name: google dns server + value: 8.8.8.8/32 + tier: db-n1-standard-1 + region: us-central1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present + register: instance + - name: delete a database + gcp_sql_database: + name: "{{ resource_name }}" + charset: utf8 instance: "{{ instance }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" - scopes: - - https://www.googleapis.com/auth/sqlservice.admin - register: results -- name: verify that command succeeded - assert: - that: - - "\"{{resource_name}}\" in \"{{ results['items'] | map(attribute='name') | list }}\"" -# ---------------------------------------------------------------------------- -- name: create a database that already exists - gcp_sql_database: - name: "{{ resource_name }}" - charset: utf8 - instance: "{{ instance }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present - register: result -- name: assert changed is false - assert: - that: - - result.changed == false - - "result.kind == 'sql#database'" -#---------------------------------------------------------- -- name: delete a database - gcp_sql_database: - name: "{{ resource_name }}" - charset: utf8 - instance: "{{ instance }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent - register: result -- name: assert changed is true - assert: - that: - - result.changed == true - - result.has_key('kind') == False -- name: verify that database was deleted - gcp_sql_database_facts: + state: absent + #---------------------------------------------------------- + - name: create a database + gcp_sql_database: + name: "{{ resource_name }}" + charset: utf8 instance: "{{ instance }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" - scopes: - - https://www.googleapis.com/auth/sqlservice.admin - register: results -- name: verify that command succeeded - assert: - that: - - "\"{{resource_name}}\" not in \"{{ results['items'] | map(attribute='name') | list }}\"" -# ---------------------------------------------------------------------------- -- name: delete a database that does not exist - gcp_sql_database: - name: "{{ resource_name }}" - charset: utf8 - instance: "{{ instance }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent - register: result -- name: assert changed is false - assert: - that: - - result.changed == false - - result.has_key('kind') == False -#--------------------------------------------------------- -# Post-test teardown -# If errors happen, don't crash the playbook! -- name: delete a instance - gcp_sql_instance: - name: "{{resource_name}}-3" - settings: - ip_configuration: - authorized_networks: - - name: google dns server - value: 8.8.8.8/32 - tier: db-n1-standard-1 - region: us-central1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent - register: instance - ignore_errors: true + state: present + register: result + - name: assert changed is true + assert: + that: + - result.changed == true + - "result.kind == 'sql#database'" + - name: verify that database was created + gcp_sql_database_facts: + instance: "{{ instance }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + scopes: + - https://www.googleapis.com/auth/sqlservice.admin + register: results + - name: verify that command succeeded + assert: + that: + - "\"{{resource_name}}\" in \"{{ results['items'] | map(attribute='name') | list }}\"" + # ---------------------------------------------------------------------------- + - name: create a database that already exists + gcp_sql_database: + name: "{{ resource_name }}" + charset: utf8 + instance: "{{ instance }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present + register: result + - name: assert changed is false + assert: + that: + - result.changed == false + - "result.kind == 'sql#database'" + #---------------------------------------------------------- + - name: delete a database + gcp_sql_database: + name: "{{ resource_name }}" + charset: utf8 + instance: "{{ instance }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: result + - name: assert changed is true + assert: + that: + - result.changed == true + - result.has_key('kind') == False + - name: verify that database was deleted + gcp_sql_database_facts: + instance: "{{ instance }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + scopes: + - https://www.googleapis.com/auth/sqlservice.admin + register: results + - name: verify that command succeeded + assert: + that: + - "\"{{resource_name}}\" not in \"{{ results['items'] | map(attribute='name') | list }}\"" + # ---------------------------------------------------------------------------- + - name: delete a database that does not exist + gcp_sql_database: + name: "{{ resource_name }}" + charset: utf8 + instance: "{{ instance }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: result + - name: assert changed is false + assert: + that: + - result.changed == false + - result.has_key('kind') == False + always: + #--------------------------------------------------------- + # Post-test teardown + # If errors happen, don't crash the playbook! + - name: delete a instance + gcp_sql_instance: + name: "{{resource_name}}-3" + settings: + ip_configuration: + authorized_networks: + - name: google dns server + value: 8.8.8.8/32 + tier: db-n1-standard-1 + region: us-central1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: instance + ignore_errors: true diff --git a/test/integration/targets/gcp_sql_instance/tasks/main.yml b/test/integration/targets/gcp_sql_instance/tasks/main.yml index eace727c02f39b..7c46385aa9f532 100644 --- a/test/integration/targets/gcp_sql_instance/tasks/main.yml +++ b/test/integration/targets/gcp_sql_instance/tasks/main.yml @@ -12,126 +12,127 @@ # https://www.github.com/GoogleCloudPlatform/magic-modules # # ---------------------------------------------------------------------------- -# Pre-test setup -- name: delete a instance - gcp_sql_instance: - name: "{{resource_name}}-2" - settings: - ip_configuration: - authorized_networks: - - name: google dns server - value: 8.8.8.8/32 - tier: db-n1-standard-1 - region: us-central1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent -#---------------------------------------------------------- -- name: create a instance - gcp_sql_instance: - name: "{{resource_name}}-2" - settings: - ip_configuration: - authorized_networks: - - name: google dns server - value: 8.8.8.8/32 - tier: db-n1-standard-1 - region: us-central1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present - register: result -- name: assert changed is true - assert: - that: - - result.changed == true - - "result.kind == 'sql#instance'" -- name: verify that instance was created - gcp_sql_instance_facts: +- block: + # Pre-test setup + - name: delete a instance + gcp_sql_instance: + name: "{{resource_name}}-2" + settings: + ip_configuration: + authorized_networks: + - name: google dns server + value: 8.8.8.8/32 + tier: db-n1-standard-1 + region: us-central1 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" - scopes: - - https://www.googleapis.com/auth/sqlservice.admin - register: results -- name: verify that command succeeded - assert: - that: - - results['items'] | length >= 1 -# ---------------------------------------------------------------------------- -- name: create a instance that already exists - gcp_sql_instance: - name: "{{resource_name}}-2" - settings: - ip_configuration: - authorized_networks: - - name: google dns server - value: 8.8.8.8/32 - tier: db-n1-standard-1 - region: us-central1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present - register: result -- name: assert changed is false - assert: - that: - - result.changed == false - - "result.kind == 'sql#instance'" -#---------------------------------------------------------- -- name: delete a instance - gcp_sql_instance: - name: "{{resource_name}}-2" - settings: - ip_configuration: - authorized_networks: - - name: google dns server - value: 8.8.8.8/32 - tier: db-n1-standard-1 - region: us-central1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent - register: result -- name: assert changed is true - assert: - that: - - result.changed == true - - result.has_key('kind') == False -- name: verify that instance was deleted - gcp_sql_instance_facts: + state: absent + #---------------------------------------------------------- + - name: create a instance + gcp_sql_instance: + name: "{{resource_name}}-2" + settings: + ip_configuration: + authorized_networks: + - name: google dns server + value: 8.8.8.8/32 + tier: db-n1-standard-1 + region: us-central1 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" - scopes: - - https://www.googleapis.com/auth/sqlservice.admin - register: results -- name: verify that command succeeded - assert: - that: - - results['items'] | length == 0 -# ---------------------------------------------------------------------------- -- name: delete a instance that does not exist - gcp_sql_instance: - name: "{{resource_name}}-2" - settings: - ip_configuration: - authorized_networks: - - name: google dns server - value: 8.8.8.8/32 - tier: db-n1-standard-1 - region: us-central1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent - register: result -- name: assert changed is false - assert: - that: - - result.changed == false - - result.has_key('kind') == False + state: present + register: result + - name: assert changed is true + assert: + that: + - result.changed == true + - "result.kind == 'sql#instance'" + - name: verify that instance was created + gcp_sql_instance_facts: + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + scopes: + - https://www.googleapis.com/auth/sqlservice.admin + register: results + - name: verify that command succeeded + assert: + that: + - results['items'] | length >= 1 + # ---------------------------------------------------------------------------- + - name: create a instance that already exists + gcp_sql_instance: + name: "{{resource_name}}-2" + settings: + ip_configuration: + authorized_networks: + - name: google dns server + value: 8.8.8.8/32 + tier: db-n1-standard-1 + region: us-central1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present + register: result + - name: assert changed is false + assert: + that: + - result.changed == false + - "result.kind == 'sql#instance'" + #---------------------------------------------------------- + - name: delete a instance + gcp_sql_instance: + name: "{{resource_name}}-2" + settings: + ip_configuration: + authorized_networks: + - name: google dns server + value: 8.8.8.8/32 + tier: db-n1-standard-1 + region: us-central1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: result + - name: assert changed is true + assert: + that: + - result.changed == true + - result.has_key('kind') == False + - name: verify that instance was deleted + gcp_sql_instance_facts: + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + scopes: + - https://www.googleapis.com/auth/sqlservice.admin + register: results + - name: verify that command succeeded + assert: + that: + - results['items'] | length == 0 + # ---------------------------------------------------------------------------- + - name: delete a instance that does not exist + gcp_sql_instance: + name: "{{resource_name}}-2" + settings: + ip_configuration: + authorized_networks: + - name: google dns server + value: 8.8.8.8/32 + tier: db-n1-standard-1 + region: us-central1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: result + - name: assert changed is false + assert: + that: + - result.changed == false + - result.has_key('kind') == False diff --git a/test/integration/targets/gcp_sql_user/tasks/main.yml b/test/integration/targets/gcp_sql_user/tasks/main.yml index 653308c764f67c..3180624c197917 100644 --- a/test/integration/targets/gcp_sql_user/tasks/main.yml +++ b/test/integration/targets/gcp_sql_user/tasks/main.yml @@ -12,142 +12,144 @@ # https://www.github.com/GoogleCloudPlatform/magic-modules # # ---------------------------------------------------------------------------- -# Pre-test setup -- name: create a instance - gcp_sql_instance: - name: "{{resource_name}}-1" - settings: - ip_configuration: - authorized_networks: - - name: google dns server - value: 8.8.8.8/32 - tier: db-n1-standard-1 - region: us-central1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present - register: instance -- name: delete a user - gcp_sql_user: - name: test-user - host: 10.1.2.3 - password: secret-password - instance: "{{ instance }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent -#---------------------------------------------------------- -- name: create a user - gcp_sql_user: - name: test-user - host: 10.1.2.3 - password: secret-password - instance: "{{ instance }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present - register: result -- name: assert changed is true - assert: - that: - - result.changed == true - - "result.kind == 'sql#user'" -- name: verify that user was created - gcp_sql_user_facts: +- block: + # Pre-test setup + - name: create a instance + gcp_sql_instance: + name: "{{resource_name}}-1" + settings: + ip_configuration: + authorized_networks: + - name: google dns server + value: 8.8.8.8/32 + tier: db-n1-standard-1 + region: us-central1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present + register: instance + - name: delete a user + gcp_sql_user: + name: test-user + host: 10.1.2.3 + password: secret-password instance: "{{ instance }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" - scopes: - - https://www.googleapis.com/auth/sqlservice.admin - register: results -- name: verify that command succeeded - assert: - that: - - "'test-user' in \"{{ results['items'] | map(attribute='name') | list }}\"" -# ---------------------------------------------------------------------------- -- name: create a user that already exists - gcp_sql_user: - name: test-user - host: 10.1.2.3 - password: secret-password - instance: "{{ instance }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present - register: result -- name: assert changed is false - assert: - that: - - result.changed == false - - "result.kind == 'sql#user'" -#---------------------------------------------------------- -- name: delete a user - gcp_sql_user: - name: test-user - host: 10.1.2.3 - password: secret-password - instance: "{{ instance }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent - register: result -- name: assert changed is true - assert: - that: - - result.changed == true - - result.has_key('kind') == False -- name: verify that user was deleted - gcp_sql_user_facts: + state: absent + #---------------------------------------------------------- + - name: create a user + gcp_sql_user: + name: test-user + host: 10.1.2.3 + password: secret-password instance: "{{ instance }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" - scopes: - - https://www.googleapis.com/auth/sqlservice.admin - register: results -- name: verify that command succeeded - assert: - that: - - "'test-user' not in \"{{ results['items'] | map(attribute='name') | list }}\"" -# ---------------------------------------------------------------------------- -- name: delete a user that does not exist - gcp_sql_user: - name: test-user - host: 10.1.2.3 - password: secret-password - instance: "{{ instance }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent - register: result -- name: assert changed is false - assert: - that: - - result.changed == false - - result.has_key('kind') == False -#--------------------------------------------------------- -# Post-test teardown -# If errors happen, don't crash the playbook! -- name: delete a instance - gcp_sql_instance: - name: "{{resource_name}}-1" - settings: - ip_configuration: - authorized_networks: - - name: google dns server - value: 8.8.8.8/32 - tier: db-n1-standard-1 - region: us-central1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent - register: instance - ignore_errors: true + state: present + register: result + - name: assert changed is true + assert: + that: + - result.changed == true + - "result.kind == 'sql#user'" + - name: verify that user was created + gcp_sql_user_facts: + instance: "{{ instance }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + scopes: + - https://www.googleapis.com/auth/sqlservice.admin + register: results + - name: verify that command succeeded + assert: + that: + - "'test-user' in \"{{ results['items'] | map(attribute='name') | list }}\"" + # ---------------------------------------------------------------------------- + - name: create a user that already exists + gcp_sql_user: + name: test-user + host: 10.1.2.3 + password: secret-password + instance: "{{ instance }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present + register: result + - name: assert changed is false + assert: + that: + - result.changed == false + - "result.kind == 'sql#user'" + #---------------------------------------------------------- + - name: delete a user + gcp_sql_user: + name: test-user + host: 10.1.2.3 + password: secret-password + instance: "{{ instance }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: result + - name: assert changed is true + assert: + that: + - result.changed == true + - result.has_key('kind') == False + - name: verify that user was deleted + gcp_sql_user_facts: + instance: "{{ instance }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + scopes: + - https://www.googleapis.com/auth/sqlservice.admin + register: results + - name: verify that command succeeded + assert: + that: + - "'test-user' not in \"{{ results['items'] | map(attribute='name') | list }}\"" + # ---------------------------------------------------------------------------- + - name: delete a user that does not exist + gcp_sql_user: + name: test-user + host: 10.1.2.3 + password: secret-password + instance: "{{ instance }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: result + - name: assert changed is false + assert: + that: + - result.changed == false + - result.has_key('kind') == False + always: + #--------------------------------------------------------- + # Post-test teardown + # If errors happen, don't crash the playbook! + - name: delete a instance + gcp_sql_instance: + name: "{{resource_name}}-1" + settings: + ip_configuration: + authorized_networks: + - name: google dns server + value: 8.8.8.8/32 + tier: db-n1-standard-1 + region: us-central1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: instance + ignore_errors: true diff --git a/test/integration/targets/gcp_storage_bucket/tasks/main.yml b/test/integration/targets/gcp_storage_bucket/tasks/main.yml index 1f3fe22aa4d626..aae58dfdd01b3a 100644 --- a/test/integration/targets/gcp_storage_bucket/tasks/main.yml +++ b/test/integration/targets/gcp_storage_bucket/tasks/main.yml @@ -12,67 +12,68 @@ # https://www.github.com/GoogleCloudPlatform/magic-modules # # ---------------------------------------------------------------------------- -# Pre-test setup -- name: delete a bucket - gcp_storage_bucket: - name: ansible-storage-module - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent -#---------------------------------------------------------- -- name: create a bucket - gcp_storage_bucket: - name: ansible-storage-module - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present - register: result -- name: assert changed is true - assert: - that: - - result.changed == true - - "result.kind == 'storage#bucket'" -# ---------------------------------------------------------------------------- -- name: create a bucket that already exists - gcp_storage_bucket: - name: ansible-storage-module - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present - register: result -- name: assert changed is false - assert: - that: - - result.changed == false - - "result.kind == 'storage#bucket'" -#---------------------------------------------------------- -- name: delete a bucket - gcp_storage_bucket: - name: ansible-storage-module - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent - register: result -- name: assert changed is true - assert: - that: - - result.changed == true - - result.has_key('kind') == False -# ---------------------------------------------------------------------------- -- name: delete a bucket that does not exist - gcp_storage_bucket: - name: ansible-storage-module - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent - register: result -- name: assert changed is false - assert: - that: - - result.changed == false - - result.has_key('kind') == False +- block: + # Pre-test setup + - name: delete a bucket + gcp_storage_bucket: + name: ansible-storage-module + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + #---------------------------------------------------------- + - name: create a bucket + gcp_storage_bucket: + name: ansible-storage-module + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present + register: result + - name: assert changed is true + assert: + that: + - result.changed == true + - "result.kind == 'storage#bucket'" + # ---------------------------------------------------------------------------- + - name: create a bucket that already exists + gcp_storage_bucket: + name: ansible-storage-module + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present + register: result + - name: assert changed is false + assert: + that: + - result.changed == false + - "result.kind == 'storage#bucket'" + #---------------------------------------------------------- + - name: delete a bucket + gcp_storage_bucket: + name: ansible-storage-module + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: result + - name: assert changed is true + assert: + that: + - result.changed == true + - result.has_key('kind') == False + # ---------------------------------------------------------------------------- + - name: delete a bucket that does not exist + gcp_storage_bucket: + name: ansible-storage-module + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: result + - name: assert changed is false + assert: + that: + - result.changed == false + - result.has_key('kind') == False diff --git a/test/integration/targets/gcp_storage_bucket_access_control/tasks/main.yml b/test/integration/targets/gcp_storage_bucket_access_control/tasks/main.yml index 52c63b638a6420..842d6bfb4500d9 100644 --- a/test/integration/targets/gcp_storage_bucket_access_control/tasks/main.yml +++ b/test/integration/targets/gcp_storage_bucket_access_control/tasks/main.yml @@ -12,97 +12,99 @@ # https://www.github.com/GoogleCloudPlatform/magic-modules # # ---------------------------------------------------------------------------- -# Pre-test setup -- name: create a bucket - gcp_storage_bucket: - name: "{{ resource_name }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present - register: bucket -- name: delete a bucket access control - gcp_storage_bucket_access_control: - bucket: "{{ resource_name }}" - entity: user-alexstephen@google.com - role: WRITER - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent -#---------------------------------------------------------- -- name: create a bucket access control - gcp_storage_bucket_access_control: - bucket: "{{ resource_name }}" - entity: user-alexstephen@google.com - role: WRITER - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present - register: result -- name: assert changed is true - assert: - that: - - result.changed == true - - "result.kind == 'storage#bucketAccessControl'" -# ---------------------------------------------------------------------------- -- name: create a bucket access control that already exists - gcp_storage_bucket_access_control: - bucket: "{{ resource_name }}" - entity: user-alexstephen@google.com - role: WRITER - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present - register: result -- name: assert changed is false - assert: - that: - - result.changed == false - - "result.kind == 'storage#bucketAccessControl'" -#---------------------------------------------------------- -- name: delete a bucket access control - gcp_storage_bucket_access_control: - bucket: "{{ resource_name }}" - entity: user-alexstephen@google.com - role: WRITER - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent - register: result -- name: assert changed is true - assert: - that: - - result.changed == true - - result.has_key('kind') == False -# ---------------------------------------------------------------------------- -- name: delete a bucket access control that does not exist - gcp_storage_bucket_access_control: - bucket: "{{ resource_name }}" - entity: user-alexstephen@google.com - role: WRITER - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent - register: result -- name: assert changed is false - assert: - that: - - result.changed == false - - result.has_key('kind') == False -#--------------------------------------------------------- -# Post-test teardown -# If errors happen, don't crash the playbook! -- name: delete a bucket - gcp_storage_bucket: - name: "{{ resource_name }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent - register: bucket - ignore_errors: true +- block: + # Pre-test setup + - name: create a bucket + gcp_storage_bucket: + name: "{{ resource_name }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present + register: bucket + - name: delete a bucket access control + gcp_storage_bucket_access_control: + bucket: "{{ resource_name }}" + entity: user-alexstephen@google.com + role: WRITER + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + #---------------------------------------------------------- + - name: create a bucket access control + gcp_storage_bucket_access_control: + bucket: "{{ resource_name }}" + entity: user-alexstephen@google.com + role: WRITER + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present + register: result + - name: assert changed is true + assert: + that: + - result.changed == true + - "result.kind == 'storage#bucketAccessControl'" + # ---------------------------------------------------------------------------- + - name: create a bucket access control that already exists + gcp_storage_bucket_access_control: + bucket: "{{ resource_name }}" + entity: user-alexstephen@google.com + role: WRITER + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present + register: result + - name: assert changed is false + assert: + that: + - result.changed == false + - "result.kind == 'storage#bucketAccessControl'" + #---------------------------------------------------------- + - name: delete a bucket access control + gcp_storage_bucket_access_control: + bucket: "{{ resource_name }}" + entity: user-alexstephen@google.com + role: WRITER + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: result + - name: assert changed is true + assert: + that: + - result.changed == true + - result.has_key('kind') == False + # ---------------------------------------------------------------------------- + - name: delete a bucket access control that does not exist + gcp_storage_bucket_access_control: + bucket: "{{ resource_name }}" + entity: user-alexstephen@google.com + role: WRITER + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: result + - name: assert changed is false + assert: + that: + - result.changed == false + - result.has_key('kind') == False + always: + #--------------------------------------------------------- + # Post-test teardown + # If errors happen, don't crash the playbook! + - name: delete a bucket + gcp_storage_bucket: + name: "{{ resource_name }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: bucket + ignore_errors: true