From b4d15b3040e22c88b8e508ad45a61609a2933542 Mon Sep 17 00:00:00 2001 From: The Magician Date: Tue, 1 Oct 2019 15:27:03 -0700 Subject: [PATCH] Bug fixes for GCP modules (#61917) --- .../modules/cloud/google/gcp_iam_role.py | 40 ++++- .../modules/cloud/google/gcp_iam_role_info.py | 53 +++++- .../cloud/google/gcp_iam_service_account.py | 40 ++++- .../google/gcp_iam_service_account_info.py | 53 +++++- .../google/gcp_iam_service_account_key.py | 40 ++++- .../cloud/google/gcp_kms_crypto_key.py | 50 +++++- .../cloud/google/gcp_kms_crypto_key_info.py | 51 +++++- .../modules/cloud/google/gcp_kms_key_ring.py | 50 +++++- .../cloud/google/gcp_kms_key_ring_info.py | 51 +++++- .../cloud/google/gcp_mlengine_model.py | 40 ++++- .../cloud/google/gcp_mlengine_model_info.py | 53 +++++- .../cloud/google/gcp_mlengine_version.py | 40 ++++- .../cloud/google/gcp_mlengine_version_info.py | 51 +++++- .../cloud/google/gcp_pubsub_subscription.py | 58 +++++- .../google/gcp_pubsub_subscription_info.py | 53 +++++- .../modules/cloud/google/gcp_pubsub_topic.py | 56 +++++- .../cloud/google/gcp_pubsub_topic_info.py | 53 +++++- .../cloud/google/gcp_redis_instance.py | 50 +++++- .../cloud/google/gcp_redis_instance_info.py | 51 +++++- .../google/gcp_resourcemanager_project.py | 40 ++++- .../gcp_resourcemanager_project_info.py | 53 +++++- .../cloud/google/gcp_sourcerepo_repository.py | 50 +++++- .../google/gcp_sourcerepo_repository_info.py | 53 +++++- .../targets/gcp_iam_role/tasks/autogen.yml | 128 +++++++++++++ .../targets/gcp_iam_role/tasks/main.yml | 128 +------------ .../gcp_iam_service_account/tasks/autogen.yml | 103 +++++++++++ .../gcp_iam_service_account/tasks/main.yml | 103 +---------- .../gcp_kms_crypto_key/tasks/autogen.yml | 73 ++++++++ .../targets/gcp_kms_crypto_key/tasks/main.yml | 73 +------- .../gcp_kms_key_ring/tasks/autogen.yml | 63 +++++++ .../targets/gcp_kms_key_ring/tasks/main.yml | 65 +------ .../gcp_mlengine_model/tasks/autogen.yml | 113 ++++++++++++ .../targets/gcp_mlengine_model/tasks/main.yml | 113 +----------- .../gcp_mlengine_version/tasks/autogen.yml | 155 ++++++++++++++++ .../gcp_mlengine_version/tasks/main.yml | 155 +--------------- .../gcp_pubsub_subscription/tasks/autogen.yml | 128 +++++++++++++ .../gcp_pubsub_subscription/tasks/main.yml | 128 +------------ .../gcp_pubsub_topic/tasks/autogen.yml | 98 ++++++++++ .../targets/gcp_pubsub_topic/tasks/main.yml | 98 +--------- .../gcp_redis_instance/tasks/autogen.yml | 170 ++++++++++++++++++ .../targets/gcp_redis_instance/tasks/main.yml | 170 +----------------- .../tasks/autogen.yml | 113 ++++++++++++ .../tasks/main.yml | 113 +----------- .../tasks/autogen.yml | 98 ++++++++++ .../gcp_sourcerepo_repository/tasks/main.yml | 98 +--------- 45 files changed, 2323 insertions(+), 1292 deletions(-) create mode 100644 test/integration/targets/gcp_iam_role/tasks/autogen.yml create mode 100644 test/integration/targets/gcp_iam_service_account/tasks/autogen.yml create mode 100644 test/integration/targets/gcp_kms_crypto_key/tasks/autogen.yml create mode 100644 test/integration/targets/gcp_kms_key_ring/tasks/autogen.yml create mode 100644 test/integration/targets/gcp_mlengine_model/tasks/autogen.yml create mode 100644 test/integration/targets/gcp_mlengine_version/tasks/autogen.yml create mode 100644 test/integration/targets/gcp_pubsub_subscription/tasks/autogen.yml create mode 100644 test/integration/targets/gcp_pubsub_topic/tasks/autogen.yml create mode 100644 test/integration/targets/gcp_redis_instance/tasks/autogen.yml create mode 100644 test/integration/targets/gcp_resourcemanager_project/tasks/autogen.yml create mode 100644 test/integration/targets/gcp_sourcerepo_repository/tasks/autogen.yml diff --git a/lib/ansible/modules/cloud/google/gcp_iam_role.py b/lib/ansible/modules/cloud/google/gcp_iam_role.py index 47512f8f1bf..a9159e9112e 100644 --- a/lib/ansible/modules/cloud/google/gcp_iam_role.py +++ b/lib/ansible/modules/cloud/google/gcp_iam_role.py @@ -33,7 +33,7 @@ module: gcp_iam_role description: - A role in the Identity and Access Management API . short_description: Creates a GCP Role -version_added: 2.8 +version_added: '2.8' author: Google Inc. (@googlecloudplatform) requirements: - python >= 2.6 @@ -76,7 +76,43 @@ options: "EAP"' required: false type: str -extends_documentation_fragment: gcp + project: + description: + - The Google Cloud Platform project to use. + type: str + auth_kind: + description: + - The type of credential used. + type: str + required: true + choices: + - application + - machineaccount + - serviceaccount + service_account_contents: + description: + - The contents of a Service Account JSON file, either in a dictionary or as a + JSON string that represents it. + type: jsonarg + service_account_file: + description: + - The path of a Service Account JSON file if serviceaccount is selected as type. + type: path + service_account_email: + description: + - An optional service account email address if machineaccount is selected and + the user does not wish to use the default email. + type: str + scopes: + description: + - Array of scopes to be used + type: list + env_type: + description: + - Specifies which Ansible environment you're running this module within. + - This should not be set unless you know what you're doing. + - This only alters the User Agent string for any API requests. + type: str ''' EXAMPLES = ''' diff --git a/lib/ansible/modules/cloud/google/gcp_iam_role_info.py b/lib/ansible/modules/cloud/google/gcp_iam_role_info.py index 8c302354b28..4500e41a5c5 100644 --- a/lib/ansible/modules/cloud/google/gcp_iam_role_info.py +++ b/lib/ansible/modules/cloud/google/gcp_iam_role_info.py @@ -35,14 +35,61 @@ description: - This module was called C(gcp_iam_role_facts) before Ansible 2.9. The usage has not changed. short_description: Gather info for GCP Role -version_added: 2.8 +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 +options: + project: + description: + - The Google Cloud Platform project to use. + type: str + auth_kind: + description: + - The type of credential used. + type: str + required: true + choices: + - application + - machineaccount + - serviceaccount + service_account_contents: + description: + - The contents of a Service Account JSON file, either in a dictionary or as a + JSON string that represents it. + type: jsonarg + service_account_file: + description: + - The path of a Service Account JSON file if serviceaccount is selected as type. + type: path + service_account_email: + description: + - An optional service account email address if machineaccount is selected and + the user does not wish to use the default email. + type: str + scopes: + description: + - Array of scopes to be used + type: list + env_type: + description: + - Specifies which Ansible environment you're running this module within. + - This should not be set unless you know what you're doing. + - This only alters the User Agent string for any API requests. + type: str +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_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 variable. +- For authentication, you can set scopes using the C(GCP_SCOPES) env variable. +- Environment variables values will only be used if the playbook values are not set. +- The I(service_account_email) and I(service_account_file) options are mutually exclusive. ''' EXAMPLES = ''' 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 642c57e9b32..4a7ec111d30 100644 --- a/lib/ansible/modules/cloud/google/gcp_iam_service_account.py +++ b/lib/ansible/modules/cloud/google/gcp_iam_service_account.py @@ -33,7 +33,7 @@ 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 +version_added: '2.8' author: Google Inc. (@googlecloudplatform) requirements: - python >= 2.6 @@ -58,7 +58,43 @@ options: - User specified description of service account. required: false type: str -extends_documentation_fragment: gcp + project: + description: + - The Google Cloud Platform project to use. + type: str + auth_kind: + description: + - The type of credential used. + type: str + required: true + choices: + - application + - machineaccount + - serviceaccount + service_account_contents: + description: + - The contents of a Service Account JSON file, either in a dictionary or as a + JSON string that represents it. + type: jsonarg + service_account_file: + description: + - The path of a Service Account JSON file if serviceaccount is selected as type. + type: path + service_account_email: + description: + - An optional service account email address if machineaccount is selected and + the user does not wish to use the default email. + type: str + scopes: + description: + - Array of scopes to be used + type: list + env_type: + description: + - Specifies which Ansible environment you're running this module within. + - This should not be set unless you know what you're doing. + - This only alters the User Agent string for any API requests. + type: str ''' EXAMPLES = ''' diff --git a/lib/ansible/modules/cloud/google/gcp_iam_service_account_info.py b/lib/ansible/modules/cloud/google/gcp_iam_service_account_info.py index f3f56495a6c..62ff0d4b6eb 100644 --- a/lib/ansible/modules/cloud/google/gcp_iam_service_account_info.py +++ b/lib/ansible/modules/cloud/google/gcp_iam_service_account_info.py @@ -35,14 +35,61 @@ description: - This module was called C(gcp_iam_service_account_facts) before Ansible 2.9. The usage has not changed. short_description: Gather info for GCP ServiceAccount -version_added: 2.8 +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 +options: + project: + description: + - The Google Cloud Platform project to use. + type: str + auth_kind: + description: + - The type of credential used. + type: str + required: true + choices: + - application + - machineaccount + - serviceaccount + service_account_contents: + description: + - The contents of a Service Account JSON file, either in a dictionary or as a + JSON string that represents it. + type: jsonarg + service_account_file: + description: + - The path of a Service Account JSON file if serviceaccount is selected as type. + type: path + service_account_email: + description: + - An optional service account email address if machineaccount is selected and + the user does not wish to use the default email. + type: str + scopes: + description: + - Array of scopes to be used + type: list + env_type: + description: + - Specifies which Ansible environment you're running this module within. + - This should not be set unless you know what you're doing. + - This only alters the User Agent string for any API requests. + type: str +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_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 variable. +- For authentication, you can set scopes using the C(GCP_SCOPES) env variable. +- Environment variables values will only be used if the playbook values are not set. +- The I(service_account_email) and I(service_account_file) options are mutually exclusive. ''' EXAMPLES = ''' 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 a7491d65159..afa63a40de4 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 @@ -33,7 +33,7 @@ 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 +version_added: '2.8' author: Google Inc. (@googlecloudplatform) requirements: - python >= 2.6 @@ -77,7 +77,43 @@ options: - File path must be absolute. required: false type: path -extends_documentation_fragment: gcp + project: + description: + - The Google Cloud Platform project to use. + type: str + auth_kind: + description: + - The type of credential used. + type: str + required: true + choices: + - application + - machineaccount + - serviceaccount + service_account_contents: + description: + - The contents of a Service Account JSON file, either in a dictionary or as a + JSON string that represents it. + type: jsonarg + service_account_file: + description: + - The path of a Service Account JSON file if serviceaccount is selected as type. + type: path + service_account_email: + description: + - An optional service account email address if machineaccount is selected and + the user does not wish to use the default email. + type: str + scopes: + description: + - Array of scopes to be used + type: list + env_type: + description: + - Specifies which Ansible environment you're running this module within. + - This should not be set unless you know what you're doing. + - This only alters the User Agent string for any API requests. + type: str ''' EXAMPLES = ''' diff --git a/lib/ansible/modules/cloud/google/gcp_kms_crypto_key.py b/lib/ansible/modules/cloud/google/gcp_kms_crypto_key.py index 1b1f11bdebb..7b3ac97b7fe 100644 --- a/lib/ansible/modules/cloud/google/gcp_kms_crypto_key.py +++ b/lib/ansible/modules/cloud/google/gcp_kms_crypto_key.py @@ -33,7 +33,7 @@ module: gcp_kms_crypto_key description: - A `CryptoKey` represents a logical key that can be used for cryptographic operations. short_description: Creates a GCP CryptoKey -version_added: 2.9 +version_added: '2.9' author: Google Inc. (@googlecloudplatform) requirements: - python >= 2.6 @@ -100,10 +100,56 @@ options: - 'Format: `''projects/{{project}}/locations/{{location}}/keyRings/{{keyRing}}''`.' required: true type: str -extends_documentation_fragment: gcp + project: + description: + - The Google Cloud Platform project to use. + type: str + auth_kind: + description: + - The type of credential used. + type: str + required: true + choices: + - application + - machineaccount + - serviceaccount + service_account_contents: + description: + - The contents of a Service Account JSON file, either in a dictionary or as a + JSON string that represents it. + type: jsonarg + service_account_file: + description: + - The path of a Service Account JSON file if serviceaccount is selected as type. + type: path + service_account_email: + description: + - An optional service account email address if machineaccount is selected and + the user does not wish to use the default email. + type: str + scopes: + description: + - Array of scopes to be used + type: list + env_type: + description: + - Specifies which Ansible environment you're running this module within. + - This should not be set unless you know what you're doing. + - This only alters the User Agent string for any API requests. + type: str notes: - 'API Reference: U(https://cloud.google.com/kms/docs/reference/rest/v1/projects.locations.keyRings.cryptoKeys)' - 'Creating a key: U(https://cloud.google.com/kms/docs/creating-keys#create_a_key)' +- 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 variable. +- For authentication, you can set scopes using the C(GCP_SCOPES) env variable. +- Environment variables values will only be used if the playbook values are not set. +- The I(service_account_email) and I(service_account_file) options are mutually exclusive. ''' EXAMPLES = ''' diff --git a/lib/ansible/modules/cloud/google/gcp_kms_crypto_key_info.py b/lib/ansible/modules/cloud/google/gcp_kms_crypto_key_info.py index 1777c41bea7..59caebf22b0 100644 --- a/lib/ansible/modules/cloud/google/gcp_kms_crypto_key_info.py +++ b/lib/ansible/modules/cloud/google/gcp_kms_crypto_key_info.py @@ -33,7 +33,7 @@ module: gcp_kms_crypto_key_info description: - Gather info for GCP CryptoKey short_description: Gather info for GCP CryptoKey -version_added: 2.9 +version_added: '2.9' author: Google Inc. (@googlecloudplatform) requirements: - python >= 2.6 @@ -46,7 +46,54 @@ options: - 'Format: `''projects/{{project}}/locations/{{location}}/keyRings/{{keyRing}}''`.' required: true type: str -extends_documentation_fragment: gcp + project: + description: + - The Google Cloud Platform project to use. + type: str + auth_kind: + description: + - The type of credential used. + type: str + required: true + choices: + - application + - machineaccount + - serviceaccount + service_account_contents: + description: + - The contents of a Service Account JSON file, either in a dictionary or as a + JSON string that represents it. + type: jsonarg + service_account_file: + description: + - The path of a Service Account JSON file if serviceaccount is selected as type. + type: path + service_account_email: + description: + - An optional service account email address if machineaccount is selected and + the user does not wish to use the default email. + type: str + scopes: + description: + - Array of scopes to be used + type: list + env_type: + description: + - Specifies which Ansible environment you're running this module within. + - This should not be set unless you know what you're doing. + - This only alters the User Agent string for any API requests. + type: str +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_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 variable. +- For authentication, you can set scopes using the C(GCP_SCOPES) env variable. +- Environment variables values will only be used if the playbook values are not set. +- The I(service_account_email) and I(service_account_file) options are mutually exclusive. ''' EXAMPLES = ''' diff --git a/lib/ansible/modules/cloud/google/gcp_kms_key_ring.py b/lib/ansible/modules/cloud/google/gcp_kms_key_ring.py index b57a4eef208..6e4944fb2bf 100644 --- a/lib/ansible/modules/cloud/google/gcp_kms_key_ring.py +++ b/lib/ansible/modules/cloud/google/gcp_kms_key_ring.py @@ -33,7 +33,7 @@ module: gcp_kms_key_ring description: - A `KeyRing` is a toplevel logical grouping of `CryptoKeys`. short_description: Creates a GCP KeyRing -version_added: 2.9 +version_added: '2.9' author: Google Inc. (@googlecloudplatform) requirements: - python >= 2.6 @@ -60,10 +60,56 @@ options: list`. required: true type: str -extends_documentation_fragment: gcp + project: + description: + - The Google Cloud Platform project to use. + type: str + auth_kind: + description: + - The type of credential used. + type: str + required: true + choices: + - application + - machineaccount + - serviceaccount + service_account_contents: + description: + - The contents of a Service Account JSON file, either in a dictionary or as a + JSON string that represents it. + type: jsonarg + service_account_file: + description: + - The path of a Service Account JSON file if serviceaccount is selected as type. + type: path + service_account_email: + description: + - An optional service account email address if machineaccount is selected and + the user does not wish to use the default email. + type: str + scopes: + description: + - Array of scopes to be used + type: list + env_type: + description: + - Specifies which Ansible environment you're running this module within. + - This should not be set unless you know what you're doing. + - This only alters the User Agent string for any API requests. + type: str notes: - 'API Reference: U(https://cloud.google.com/kms/docs/reference/rest/v1/projects.locations.keyRings)' - 'Creating a key ring: U(https://cloud.google.com/kms/docs/creating-keys#create_a_key_ring)' +- 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 variable. +- For authentication, you can set scopes using the C(GCP_SCOPES) env variable. +- Environment variables values will only be used if the playbook values are not set. +- The I(service_account_email) and I(service_account_file) options are mutually exclusive. ''' EXAMPLES = ''' diff --git a/lib/ansible/modules/cloud/google/gcp_kms_key_ring_info.py b/lib/ansible/modules/cloud/google/gcp_kms_key_ring_info.py index d2fcc59f3e7..e5ef4d88748 100644 --- a/lib/ansible/modules/cloud/google/gcp_kms_key_ring_info.py +++ b/lib/ansible/modules/cloud/google/gcp_kms_key_ring_info.py @@ -33,7 +33,7 @@ module: gcp_kms_key_ring_info description: - Gather info for GCP KeyRing short_description: Gather info for GCP KeyRing -version_added: 2.9 +version_added: '2.9' author: Google Inc. (@googlecloudplatform) requirements: - python >= 2.6 @@ -47,7 +47,54 @@ options: list`. required: true type: str -extends_documentation_fragment: gcp + project: + description: + - The Google Cloud Platform project to use. + type: str + auth_kind: + description: + - The type of credential used. + type: str + required: true + choices: + - application + - machineaccount + - serviceaccount + service_account_contents: + description: + - The contents of a Service Account JSON file, either in a dictionary or as a + JSON string that represents it. + type: jsonarg + service_account_file: + description: + - The path of a Service Account JSON file if serviceaccount is selected as type. + type: path + service_account_email: + description: + - An optional service account email address if machineaccount is selected and + the user does not wish to use the default email. + type: str + scopes: + description: + - Array of scopes to be used + type: list + env_type: + description: + - Specifies which Ansible environment you're running this module within. + - This should not be set unless you know what you're doing. + - This only alters the User Agent string for any API requests. + type: str +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_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 variable. +- For authentication, you can set scopes using the C(GCP_SCOPES) env variable. +- Environment variables values will only be used if the playbook values are not set. +- The I(service_account_email) and I(service_account_file) options are mutually exclusive. ''' EXAMPLES = ''' diff --git a/lib/ansible/modules/cloud/google/gcp_mlengine_model.py b/lib/ansible/modules/cloud/google/gcp_mlengine_model.py index 4150aec01d8..083d5b3dd33 100644 --- a/lib/ansible/modules/cloud/google/gcp_mlengine_model.py +++ b/lib/ansible/modules/cloud/google/gcp_mlengine_model.py @@ -35,7 +35,7 @@ description: - A model can have multiple versions, each of which is a deployed, trained model ready to receive prediction requests. The model itself is just a container. short_description: Creates a GCP Model -version_added: 2.9 +version_added: '2.9' author: Google Inc. (@googlecloudplatform) requirements: - python >= 2.6 @@ -94,7 +94,43 @@ options: - One or more labels that you can add, to organize your models. required: false type: dict -extends_documentation_fragment: gcp + project: + description: + - The Google Cloud Platform project to use. + type: str + auth_kind: + description: + - The type of credential used. + type: str + required: true + choices: + - application + - machineaccount + - serviceaccount + service_account_contents: + description: + - The contents of a Service Account JSON file, either in a dictionary or as a + JSON string that represents it. + type: jsonarg + service_account_file: + description: + - The path of a Service Account JSON file if serviceaccount is selected as type. + type: path + service_account_email: + description: + - An optional service account email address if machineaccount is selected and + the user does not wish to use the default email. + type: str + scopes: + description: + - Array of scopes to be used + type: list + env_type: + description: + - Specifies which Ansible environment you're running this module within. + - This should not be set unless you know what you're doing. + - This only alters the User Agent string for any API requests. + type: str ''' EXAMPLES = ''' diff --git a/lib/ansible/modules/cloud/google/gcp_mlengine_model_info.py b/lib/ansible/modules/cloud/google/gcp_mlengine_model_info.py index 0dfdcf24865..4f497332e99 100644 --- a/lib/ansible/modules/cloud/google/gcp_mlengine_model_info.py +++ b/lib/ansible/modules/cloud/google/gcp_mlengine_model_info.py @@ -33,14 +33,61 @@ module: gcp_mlengine_model_info description: - Gather info for GCP Model short_description: Gather info for GCP Model -version_added: 2.9 +version_added: '2.9' author: Google Inc. (@googlecloudplatform) requirements: - python >= 2.6 - requests >= 2.18.4 - google-auth >= 1.3.0 -options: {} -extends_documentation_fragment: gcp +options: + project: + description: + - The Google Cloud Platform project to use. + type: str + auth_kind: + description: + - The type of credential used. + type: str + required: true + choices: + - application + - machineaccount + - serviceaccount + service_account_contents: + description: + - The contents of a Service Account JSON file, either in a dictionary or as a + JSON string that represents it. + type: jsonarg + service_account_file: + description: + - The path of a Service Account JSON file if serviceaccount is selected as type. + type: path + service_account_email: + description: + - An optional service account email address if machineaccount is selected and + the user does not wish to use the default email. + type: str + scopes: + description: + - Array of scopes to be used + type: list + env_type: + description: + - Specifies which Ansible environment you're running this module within. + - This should not be set unless you know what you're doing. + - This only alters the User Agent string for any API requests. + type: str +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_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 variable. +- For authentication, you can set scopes using the C(GCP_SCOPES) env variable. +- Environment variables values will only be used if the playbook values are not set. +- The I(service_account_email) and I(service_account_file) options are mutually exclusive. ''' EXAMPLES = ''' diff --git a/lib/ansible/modules/cloud/google/gcp_mlengine_version.py b/lib/ansible/modules/cloud/google/gcp_mlengine_version.py index 478af73059d..f977ec212a2 100644 --- a/lib/ansible/modules/cloud/google/gcp_mlengine_version.py +++ b/lib/ansible/modules/cloud/google/gcp_mlengine_version.py @@ -34,7 +34,7 @@ description: - Each version is a trained model deployed in the cloud, ready to handle prediction requests. A model can have multiple versions . short_description: Creates a GCP Version -version_added: 2.9 +version_added: '2.9' author: Google Inc. (@googlecloudplatform) requirements: - python >= 2.6 @@ -158,7 +158,43 @@ options: type: bool aliases: - default -extends_documentation_fragment: gcp + project: + description: + - The Google Cloud Platform project to use. + type: str + auth_kind: + description: + - The type of credential used. + type: str + required: true + choices: + - application + - machineaccount + - serviceaccount + service_account_contents: + description: + - The contents of a Service Account JSON file, either in a dictionary or as a + JSON string that represents it. + type: jsonarg + service_account_file: + description: + - The path of a Service Account JSON file if serviceaccount is selected as type. + type: path + service_account_email: + description: + - An optional service account email address if machineaccount is selected and + the user does not wish to use the default email. + type: str + scopes: + description: + - Array of scopes to be used + type: list + env_type: + description: + - Specifies which Ansible environment you're running this module within. + - This should not be set unless you know what you're doing. + - This only alters the User Agent string for any API requests. + type: str ''' EXAMPLES = ''' diff --git a/lib/ansible/modules/cloud/google/gcp_mlengine_version_info.py b/lib/ansible/modules/cloud/google/gcp_mlengine_version_info.py index c982268a179..688657f31f2 100644 --- a/lib/ansible/modules/cloud/google/gcp_mlengine_version_info.py +++ b/lib/ansible/modules/cloud/google/gcp_mlengine_version_info.py @@ -33,7 +33,7 @@ module: gcp_mlengine_version_info description: - Gather info for GCP Version short_description: Gather info for GCP Version -version_added: 2.9 +version_added: '2.9' author: Google Inc. (@googlecloudplatform) requirements: - python >= 2.6 @@ -50,7 +50,54 @@ options: }}"' required: true type: dict -extends_documentation_fragment: gcp + project: + description: + - The Google Cloud Platform project to use. + type: str + auth_kind: + description: + - The type of credential used. + type: str + required: true + choices: + - application + - machineaccount + - serviceaccount + service_account_contents: + description: + - The contents of a Service Account JSON file, either in a dictionary or as a + JSON string that represents it. + type: jsonarg + service_account_file: + description: + - The path of a Service Account JSON file if serviceaccount is selected as type. + type: path + service_account_email: + description: + - An optional service account email address if machineaccount is selected and + the user does not wish to use the default email. + type: str + scopes: + description: + - Array of scopes to be used + type: list + env_type: + description: + - Specifies which Ansible environment you're running this module within. + - This should not be set unless you know what you're doing. + - This only alters the User Agent string for any API requests. + type: str +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_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 variable. +- For authentication, you can set scopes using the C(GCP_SCOPES) env variable. +- Environment variables values will only be used if the playbook values are not set. +- The I(service_account_email) and I(service_account_file) options are mutually exclusive. ''' EXAMPLES = ''' diff --git a/lib/ansible/modules/cloud/google/gcp_pubsub_subscription.py b/lib/ansible/modules/cloud/google/gcp_pubsub_subscription.py index 01bb03dd8c0..15d8231079e 100644 --- a/lib/ansible/modules/cloud/google/gcp_pubsub_subscription.py +++ b/lib/ansible/modules/cloud/google/gcp_pubsub_subscription.py @@ -34,7 +34,7 @@ description: - 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 +version_added: '2.6' author: Google Inc. (@googlecloudplatform) requirements: - python >= 2.6 @@ -69,7 +69,7 @@ options: - A set of key/value label pairs to assign to this Subscription. required: false type: dict - version_added: 2.8 + version_added: '2.8' push_config: description: - If push delivery is used with this subscription, this field is used to configure @@ -134,7 +134,7 @@ options: required: false default: 604800s type: str - version_added: 2.8 + version_added: '2.8' retain_acked_messages: description: - Indicates whether to retain acknowledged messages. If `true`, then messages @@ -142,7 +142,7 @@ options: until they fall out of the messageRetentionDuration window. required: false type: bool - version_added: 2.8 + version_added: '2.8' expiration_policy: description: - A policy that specifies the conditions for this subscription's expiration. @@ -152,7 +152,7 @@ options: used. The minimum allowed value for expirationPolicy.ttl is 1 day. required: false type: dict - version_added: 2.9 + version_added: '2.9' suboptions: ttl: description: @@ -165,10 +165,56 @@ options: - Example - "3.5s". required: false type: str -extends_documentation_fragment: gcp + project: + description: + - The Google Cloud Platform project to use. + type: str + auth_kind: + description: + - The type of credential used. + type: str + required: true + choices: + - application + - machineaccount + - serviceaccount + service_account_contents: + description: + - The contents of a Service Account JSON file, either in a dictionary or as a + JSON string that represents it. + type: jsonarg + service_account_file: + description: + - The path of a Service Account JSON file if serviceaccount is selected as type. + type: path + service_account_email: + description: + - An optional service account email address if machineaccount is selected and + the user does not wish to use the default email. + type: str + scopes: + description: + - Array of scopes to be used + type: list + env_type: + description: + - Specifies which Ansible environment you're running this module within. + - This should not be set unless you know what you're doing. + - This only alters the User Agent string for any API requests. + type: str 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)' +- 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 variable. +- For authentication, you can set scopes using the C(GCP_SCOPES) env variable. +- Environment variables values will only be used if the playbook values are not set. +- The I(service_account_email) and I(service_account_file) options are mutually exclusive. ''' EXAMPLES = ''' diff --git a/lib/ansible/modules/cloud/google/gcp_pubsub_subscription_info.py b/lib/ansible/modules/cloud/google/gcp_pubsub_subscription_info.py index 7748f936991..a3fd50bd23b 100644 --- a/lib/ansible/modules/cloud/google/gcp_pubsub_subscription_info.py +++ b/lib/ansible/modules/cloud/google/gcp_pubsub_subscription_info.py @@ -35,14 +35,61 @@ description: - This module was called C(gcp_pubsub_subscription_facts) before Ansible 2.9. The usage has not changed. short_description: Gather info for GCP Subscription -version_added: 2.8 +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 +options: + project: + description: + - The Google Cloud Platform project to use. + type: str + auth_kind: + description: + - The type of credential used. + type: str + required: true + choices: + - application + - machineaccount + - serviceaccount + service_account_contents: + description: + - The contents of a Service Account JSON file, either in a dictionary or as a + JSON string that represents it. + type: jsonarg + service_account_file: + description: + - The path of a Service Account JSON file if serviceaccount is selected as type. + type: path + service_account_email: + description: + - An optional service account email address if machineaccount is selected and + the user does not wish to use the default email. + type: str + scopes: + description: + - Array of scopes to be used + type: list + env_type: + description: + - Specifies which Ansible environment you're running this module within. + - This should not be set unless you know what you're doing. + - This only alters the User Agent string for any API requests. + type: str +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_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 variable. +- For authentication, you can set scopes using the C(GCP_SCOPES) env variable. +- Environment variables values will only be used if the playbook values are not set. +- The I(service_account_email) and I(service_account_file) options are mutually exclusive. ''' EXAMPLES = ''' diff --git a/lib/ansible/modules/cloud/google/gcp_pubsub_topic.py b/lib/ansible/modules/cloud/google/gcp_pubsub_topic.py index 81545575699..6bb0d3225bf 100644 --- a/lib/ansible/modules/cloud/google/gcp_pubsub_topic.py +++ b/lib/ansible/modules/cloud/google/gcp_pubsub_topic.py @@ -33,7 +33,7 @@ module: gcp_pubsub_topic description: - A named resource to which messages are sent by publishers. short_description: Creates a GCP Topic -version_added: 2.6 +version_added: '2.6' author: Google Inc. (@googlecloudplatform) requirements: - python >= 2.6 @@ -61,13 +61,13 @@ options: - The expected format is `projects/*/locations/*/keyRings/*/cryptoKeys/*` . required: false type: str - version_added: 2.9 + version_added: '2.9' labels: description: - A set of key/value label pairs to assign to this Topic. required: false type: dict - version_added: 2.8 + version_added: '2.8' message_storage_policy: description: - Policy constraining the set of Google Cloud Platform regions where messages @@ -75,7 +75,7 @@ options: in effect. required: false type: dict - version_added: 2.9 + version_added: '2.9' suboptions: allowed_persistence_regions: description: @@ -86,10 +86,56 @@ options: are allowed, and is not a valid configuration. required: true type: list -extends_documentation_fragment: gcp + project: + description: + - The Google Cloud Platform project to use. + type: str + auth_kind: + description: + - The type of credential used. + type: str + required: true + choices: + - application + - machineaccount + - serviceaccount + service_account_contents: + description: + - The contents of a Service Account JSON file, either in a dictionary or as a + JSON string that represents it. + type: jsonarg + service_account_file: + description: + - The path of a Service Account JSON file if serviceaccount is selected as type. + type: path + service_account_email: + description: + - An optional service account email address if machineaccount is selected and + the user does not wish to use the default email. + type: str + scopes: + description: + - Array of scopes to be used + type: list + env_type: + description: + - Specifies which Ansible environment you're running this module within. + - This should not be set unless you know what you're doing. + - This only alters the User Agent string for any API requests. + type: str 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)' +- 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 variable. +- For authentication, you can set scopes using the C(GCP_SCOPES) env variable. +- Environment variables values will only be used if the playbook values are not set. +- The I(service_account_email) and I(service_account_file) options are mutually exclusive. ''' EXAMPLES = ''' diff --git a/lib/ansible/modules/cloud/google/gcp_pubsub_topic_info.py b/lib/ansible/modules/cloud/google/gcp_pubsub_topic_info.py index 648070db953..7a410bb86d3 100644 --- a/lib/ansible/modules/cloud/google/gcp_pubsub_topic_info.py +++ b/lib/ansible/modules/cloud/google/gcp_pubsub_topic_info.py @@ -35,14 +35,61 @@ description: - This module was called C(gcp_pubsub_topic_facts) before Ansible 2.9. The usage has not changed. short_description: Gather info for GCP Topic -version_added: 2.8 +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 +options: + project: + description: + - The Google Cloud Platform project to use. + type: str + auth_kind: + description: + - The type of credential used. + type: str + required: true + choices: + - application + - machineaccount + - serviceaccount + service_account_contents: + description: + - The contents of a Service Account JSON file, either in a dictionary or as a + JSON string that represents it. + type: jsonarg + service_account_file: + description: + - The path of a Service Account JSON file if serviceaccount is selected as type. + type: path + service_account_email: + description: + - An optional service account email address if machineaccount is selected and + the user does not wish to use the default email. + type: str + scopes: + description: + - Array of scopes to be used + type: list + env_type: + description: + - Specifies which Ansible environment you're running this module within. + - This should not be set unless you know what you're doing. + - This only alters the User Agent string for any API requests. + type: str +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_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 variable. +- For authentication, you can set scopes using the C(GCP_SCOPES) env variable. +- Environment variables values will only be used if the playbook values are not set. +- The I(service_account_email) and I(service_account_file) options are mutually exclusive. ''' EXAMPLES = ''' diff --git a/lib/ansible/modules/cloud/google/gcp_redis_instance.py b/lib/ansible/modules/cloud/google/gcp_redis_instance.py index 88bf13ba218..bb491f44a9a 100644 --- a/lib/ansible/modules/cloud/google/gcp_redis_instance.py +++ b/lib/ansible/modules/cloud/google/gcp_redis_instance.py @@ -33,7 +33,7 @@ module: gcp_redis_instance description: - A Google Cloud Redis instance. short_description: Creates a GCP Instance -version_added: 2.8 +version_added: '2.8' author: Google Inc. (@googlecloudplatform) requirements: - python >= 2.6 @@ -125,10 +125,56 @@ options: - The name of the Redis region of the instance. required: true type: str -extends_documentation_fragment: gcp + project: + description: + - The Google Cloud Platform project to use. + type: str + auth_kind: + description: + - The type of credential used. + type: str + required: true + choices: + - application + - machineaccount + - serviceaccount + service_account_contents: + description: + - The contents of a Service Account JSON file, either in a dictionary or as a + JSON string that represents it. + type: jsonarg + service_account_file: + description: + - The path of a Service Account JSON file if serviceaccount is selected as type. + type: path + service_account_email: + description: + - An optional service account email address if machineaccount is selected and + the user does not wish to use the default email. + type: str + scopes: + description: + - Array of scopes to be used + type: list + env_type: + description: + - Specifies which Ansible environment you're running this module within. + - This should not be set unless you know what you're doing. + - This only alters the User Agent string for any API requests. + type: str notes: - 'API Reference: U(https://cloud.google.com/memorystore/docs/redis/reference/rest/)' - 'Official Documentation: U(https://cloud.google.com/memorystore/docs/redis/)' +- 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 variable. +- For authentication, you can set scopes using the C(GCP_SCOPES) env variable. +- Environment variables values will only be used if the playbook values are not set. +- The I(service_account_email) and I(service_account_file) options are mutually exclusive. ''' EXAMPLES = ''' diff --git a/lib/ansible/modules/cloud/google/gcp_redis_instance_info.py b/lib/ansible/modules/cloud/google/gcp_redis_instance_info.py index 72fdca38f32..80f9194dfe0 100644 --- a/lib/ansible/modules/cloud/google/gcp_redis_instance_info.py +++ b/lib/ansible/modules/cloud/google/gcp_redis_instance_info.py @@ -35,7 +35,7 @@ description: - This module was called C(gcp_redis_instance_facts) before Ansible 2.9. The usage has not changed. short_description: Gather info for GCP Instance -version_added: 2.8 +version_added: '2.8' author: Google Inc. (@googlecloudplatform) requirements: - python >= 2.6 @@ -47,7 +47,54 @@ options: - The name of the Redis region of the instance. required: true type: str -extends_documentation_fragment: gcp + project: + description: + - The Google Cloud Platform project to use. + type: str + auth_kind: + description: + - The type of credential used. + type: str + required: true + choices: + - application + - machineaccount + - serviceaccount + service_account_contents: + description: + - The contents of a Service Account JSON file, either in a dictionary or as a + JSON string that represents it. + type: jsonarg + service_account_file: + description: + - The path of a Service Account JSON file if serviceaccount is selected as type. + type: path + service_account_email: + description: + - An optional service account email address if machineaccount is selected and + the user does not wish to use the default email. + type: str + scopes: + description: + - Array of scopes to be used + type: list + env_type: + description: + - Specifies which Ansible environment you're running this module within. + - This should not be set unless you know what you're doing. + - This only alters the User Agent string for any API requests. + type: str +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_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 variable. +- For authentication, you can set scopes using the C(GCP_SCOPES) env variable. +- Environment variables values will only be used if the playbook values are not set. +- The I(service_account_email) and I(service_account_file) options are mutually exclusive. ''' EXAMPLES = ''' diff --git a/lib/ansible/modules/cloud/google/gcp_resourcemanager_project.py b/lib/ansible/modules/cloud/google/gcp_resourcemanager_project.py index 547bef274b7..6908446d6d2 100644 --- a/lib/ansible/modules/cloud/google/gcp_resourcemanager_project.py +++ b/lib/ansible/modules/cloud/google/gcp_resourcemanager_project.py @@ -34,7 +34,7 @@ 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 +version_added: '2.8' author: Google Inc. (@googlecloudplatform) requirements: - python >= 2.6 @@ -91,7 +91,43 @@ options: - Trailing hyphens are prohibited. required: true type: str -extends_documentation_fragment: gcp + project: + description: + - The Google Cloud Platform project to use. + type: str + auth_kind: + description: + - The type of credential used. + type: str + required: true + choices: + - application + - machineaccount + - serviceaccount + service_account_contents: + description: + - The contents of a Service Account JSON file, either in a dictionary or as a + JSON string that represents it. + type: jsonarg + service_account_file: + description: + - The path of a Service Account JSON file if serviceaccount is selected as type. + type: path + service_account_email: + description: + - An optional service account email address if machineaccount is selected and + the user does not wish to use the default email. + type: str + scopes: + description: + - Array of scopes to be used + type: list + env_type: + description: + - Specifies which Ansible environment you're running this module within. + - This should not be set unless you know what you're doing. + - This only alters the User Agent string for any API requests. + type: str ''' EXAMPLES = ''' diff --git a/lib/ansible/modules/cloud/google/gcp_resourcemanager_project_info.py b/lib/ansible/modules/cloud/google/gcp_resourcemanager_project_info.py index 64cf786b961..a6ba0d2a7cc 100644 --- a/lib/ansible/modules/cloud/google/gcp_resourcemanager_project_info.py +++ b/lib/ansible/modules/cloud/google/gcp_resourcemanager_project_info.py @@ -35,14 +35,61 @@ description: - This module was called C(gcp_resourcemanager_project_facts) before Ansible 2.9. The usage has not changed. short_description: Gather info for GCP Project -version_added: 2.8 +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 +options: + project: + description: + - The Google Cloud Platform project to use. + type: str + auth_kind: + description: + - The type of credential used. + type: str + required: true + choices: + - application + - machineaccount + - serviceaccount + service_account_contents: + description: + - The contents of a Service Account JSON file, either in a dictionary or as a + JSON string that represents it. + type: jsonarg + service_account_file: + description: + - The path of a Service Account JSON file if serviceaccount is selected as type. + type: path + service_account_email: + description: + - An optional service account email address if machineaccount is selected and + the user does not wish to use the default email. + type: str + scopes: + description: + - Array of scopes to be used + type: list + env_type: + description: + - Specifies which Ansible environment you're running this module within. + - This should not be set unless you know what you're doing. + - This only alters the User Agent string for any API requests. + type: str +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_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 variable. +- For authentication, you can set scopes using the C(GCP_SCOPES) env variable. +- Environment variables values will only be used if the playbook values are not set. +- The I(service_account_email) and I(service_account_file) options are mutually exclusive. ''' EXAMPLES = ''' diff --git a/lib/ansible/modules/cloud/google/gcp_sourcerepo_repository.py b/lib/ansible/modules/cloud/google/gcp_sourcerepo_repository.py index b702f28fec4..6fa47e9d384 100644 --- a/lib/ansible/modules/cloud/google/gcp_sourcerepo_repository.py +++ b/lib/ansible/modules/cloud/google/gcp_sourcerepo_repository.py @@ -33,7 +33,7 @@ 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 +version_added: '2.8' author: Google Inc. (@googlecloudplatform) requirements: - python >= 2.6 @@ -55,10 +55,56 @@ options: . required: true type: str -extends_documentation_fragment: gcp + project: + description: + - The Google Cloud Platform project to use. + type: str + auth_kind: + description: + - The type of credential used. + type: str + required: true + choices: + - application + - machineaccount + - serviceaccount + service_account_contents: + description: + - The contents of a Service Account JSON file, either in a dictionary or as a + JSON string that represents it. + type: jsonarg + service_account_file: + description: + - The path of a Service Account JSON file if serviceaccount is selected as type. + type: path + service_account_email: + description: + - An optional service account email address if machineaccount is selected and + the user does not wish to use the default email. + type: str + scopes: + description: + - Array of scopes to be used + type: list + env_type: + description: + - Specifies which Ansible environment you're running this module within. + - This should not be set unless you know what you're doing. + - This only alters the User Agent string for any API requests. + type: str 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/)' +- 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 variable. +- For authentication, you can set scopes using the C(GCP_SCOPES) env variable. +- Environment variables values will only be used if the playbook values are not set. +- The I(service_account_email) and I(service_account_file) options are mutually exclusive. ''' EXAMPLES = ''' diff --git a/lib/ansible/modules/cloud/google/gcp_sourcerepo_repository_info.py b/lib/ansible/modules/cloud/google/gcp_sourcerepo_repository_info.py index 2e9cef2531c..e987074546d 100644 --- a/lib/ansible/modules/cloud/google/gcp_sourcerepo_repository_info.py +++ b/lib/ansible/modules/cloud/google/gcp_sourcerepo_repository_info.py @@ -35,14 +35,61 @@ description: - This module was called C(gcp_sourcerepo_repository_facts) before Ansible 2.9. The usage has not changed. short_description: Gather info for GCP Repository -version_added: 2.8 +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 +options: + project: + description: + - The Google Cloud Platform project to use. + type: str + auth_kind: + description: + - The type of credential used. + type: str + required: true + choices: + - application + - machineaccount + - serviceaccount + service_account_contents: + description: + - The contents of a Service Account JSON file, either in a dictionary or as a + JSON string that represents it. + type: jsonarg + service_account_file: + description: + - The path of a Service Account JSON file if serviceaccount is selected as type. + type: path + service_account_email: + description: + - An optional service account email address if machineaccount is selected and + the user does not wish to use the default email. + type: str + scopes: + description: + - Array of scopes to be used + type: list + env_type: + description: + - Specifies which Ansible environment you're running this module within. + - This should not be set unless you know what you're doing. + - This only alters the User Agent string for any API requests. + type: str +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_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 variable. +- For authentication, you can set scopes using the C(GCP_SCOPES) env variable. +- Environment variables values will only be used if the playbook values are not set. +- The I(service_account_email) and I(service_account_file) options are mutually exclusive. ''' EXAMPLES = ''' diff --git a/test/integration/targets/gcp_iam_role/tasks/autogen.yml b/test/integration/targets/gcp_iam_role/tasks/autogen.yml new file mode 100644 index 00000000000..04779f9489e --- /dev/null +++ b/test/integration/targets/gcp_iam_role/tasks/autogen.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_info: + 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['resources'] | map(attribute='name') | select("match", ".*myCustomRole2.*") | list | 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_info: + 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['resources'] | map(attribute='name') | select("match", ".*myCustomRole2.*") | list | 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_role/tasks/main.yml b/test/integration/targets/gcp_iam_role/tasks/main.yml index 04779f9489e..45d6e49178c 100644 --- a/test/integration/targets/gcp_iam_role/tasks/main.yml +++ b/test/integration/targets/gcp_iam_role/tasks/main.yml @@ -1,128 +1,2 @@ --- -# ---------------------------------------------------------------------------- -# -# *** 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_info: - 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['resources'] | map(attribute='name') | select("match", ".*myCustomRole2.*") | list | 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_info: - 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['resources'] | map(attribute='name') | select("match", ".*myCustomRole2.*") | list | 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 +- include_tasks: autogen.yml diff --git a/test/integration/targets/gcp_iam_service_account/tasks/autogen.yml b/test/integration/targets/gcp_iam_service_account/tasks/autogen.yml new file mode 100644 index 00000000000..1911ad9c278 --- /dev/null +++ b/test/integration/targets/gcp_iam_service_account/tasks/autogen.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: sa-{{ resource_name.split("-")[-1] }}@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: sa-{{ resource_name.split("-")[-1] }}@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_info: + 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['resources'] | map(attribute='name') | select("match", ".*sa-{{ resource_name.split("-")[-1] }}@graphite-playground.google.com.iam.gserviceaccount.com.*") | list | length == 1 +# ---------------------------------------------------------------------------- +- name: create a service account that already exists + gcp_iam_service_account: + name: sa-{{ resource_name.split("-")[-1] }}@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: sa-{{ resource_name.split("-")[-1] }}@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_info: + 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['resources'] | map(attribute='name') | select("match", ".*sa-{{ resource_name.split("-")[-1] }}@graphite-playground.google.com.iam.gserviceaccount.com.*") | list | length == 0 +# ---------------------------------------------------------------------------- +- name: delete a service account that does not exist + gcp_iam_service_account: + name: sa-{{ resource_name.split("-")[-1] }}@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 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 1911ad9c278..45d6e49178c 100644 --- a/test/integration/targets/gcp_iam_service_account/tasks/main.yml +++ b/test/integration/targets/gcp_iam_service_account/tasks/main.yml @@ -1,103 +1,2 @@ --- -# ---------------------------------------------------------------------------- -# -# *** 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: sa-{{ resource_name.split("-")[-1] }}@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: sa-{{ resource_name.split("-")[-1] }}@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_info: - 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['resources'] | map(attribute='name') | select("match", ".*sa-{{ resource_name.split("-")[-1] }}@graphite-playground.google.com.iam.gserviceaccount.com.*") | list | length == 1 -# ---------------------------------------------------------------------------- -- name: create a service account that already exists - gcp_iam_service_account: - name: sa-{{ resource_name.split("-")[-1] }}@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: sa-{{ resource_name.split("-")[-1] }}@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_info: - 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['resources'] | map(attribute='name') | select("match", ".*sa-{{ resource_name.split("-")[-1] }}@graphite-playground.google.com.iam.gserviceaccount.com.*") | list | length == 0 -# ---------------------------------------------------------------------------- -- name: delete a service account that does not exist - gcp_iam_service_account: - name: sa-{{ resource_name.split("-")[-1] }}@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 +- include_tasks: autogen.yml diff --git a/test/integration/targets/gcp_kms_crypto_key/tasks/autogen.yml b/test/integration/targets/gcp_kms_crypto_key/tasks/autogen.yml new file mode 100644 index 00000000000..ef2252c863e --- /dev/null +++ b/test/integration/targets/gcp_kms_crypto_key/tasks/autogen.yml @@ -0,0 +1,73 @@ +# Copyright 2019 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. + +--- +# Pre-test setup +- name: create a key ring + gcp_kms_key_ring: + name: key-key-ring + location: us-central1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present + register: keyring +- name: delete a crypto key + gcp_kms_crypto_key: + name: "{{ resource_name }}" + key_ring: projects/{{ gcp_project }}/locations/us-central1/keyRings/key-key-ring + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent +#---------------------------------------------------------- +- name: create a crypto key + gcp_kms_crypto_key: + name: "{{ resource_name }}" + key_ring: projects/{{ gcp_project }}/locations/us-central1/keyRings/key-key-ring + 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 crypto_key was created + gcp_kms_crypto_key_info: + key_ring: "projects/{{ gcp_project }}/locations/us-central1/keyRings/key-key-ring" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + scopes: + - https://www.googleapis.com/auth/cloudkms + register: results +- name: verify that command succeeded + assert: + that: + - results['resources'] | map(attribute='name') | select("match", ".*{{ resource_name }}.*") | list | length == 1 +# ---------------------------------------------------------------------------- +- name: create a crypto key that already exists + gcp_kms_crypto_key: + name: "{{ resource_name }}" + key_ring: projects/{{ gcp_project }}/locations/us-central1/keyRings/key-key-ring + 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 diff --git a/test/integration/targets/gcp_kms_crypto_key/tasks/main.yml b/test/integration/targets/gcp_kms_crypto_key/tasks/main.yml index ef2252c863e..45d6e49178c 100644 --- a/test/integration/targets/gcp_kms_crypto_key/tasks/main.yml +++ b/test/integration/targets/gcp_kms_crypto_key/tasks/main.yml @@ -1,73 +1,2 @@ -# Copyright 2019 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. - --- -# Pre-test setup -- name: create a key ring - gcp_kms_key_ring: - name: key-key-ring - location: us-central1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present - register: keyring -- name: delete a crypto key - gcp_kms_crypto_key: - name: "{{ resource_name }}" - key_ring: projects/{{ gcp_project }}/locations/us-central1/keyRings/key-key-ring - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent -#---------------------------------------------------------- -- name: create a crypto key - gcp_kms_crypto_key: - name: "{{ resource_name }}" - key_ring: projects/{{ gcp_project }}/locations/us-central1/keyRings/key-key-ring - 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 crypto_key was created - gcp_kms_crypto_key_info: - key_ring: "projects/{{ gcp_project }}/locations/us-central1/keyRings/key-key-ring" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - scopes: - - https://www.googleapis.com/auth/cloudkms - register: results -- name: verify that command succeeded - assert: - that: - - results['resources'] | map(attribute='name') | select("match", ".*{{ resource_name }}.*") | list | length == 1 -# ---------------------------------------------------------------------------- -- name: create a crypto key that already exists - gcp_kms_crypto_key: - name: "{{ resource_name }}" - key_ring: projects/{{ gcp_project }}/locations/us-central1/keyRings/key-key-ring - 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 +- include_tasks: autogen.yml diff --git a/test/integration/targets/gcp_kms_key_ring/tasks/autogen.yml b/test/integration/targets/gcp_kms_key_ring/tasks/autogen.yml new file mode 100644 index 00000000000..34999ab1bb4 --- /dev/null +++ b/test/integration/targets/gcp_kms_key_ring/tasks/autogen.yml @@ -0,0 +1,63 @@ +# Copyright 2019 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. + +# Pre-test setup +- name: delete a key ring + gcp_kms_key_ring: + name: "{{ resource_name }}" + location: us-central1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent +#---------------------------------------------------------- +- name: create a key ring + gcp_kms_key_ring: + name: "{{ resource_name }}" + location: 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 key_ring was created + gcp_kms_key_ring_info: + location: us-central1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + scopes: + - https://www.googleapis.com/auth/cloudkms + register: results +- name: verify that command succeeded + assert: + that: + - results['resources'] | map(attribute='name') | select("match", ".*{{ resource_name }}.*") | list | length == 1 +# ---------------------------------------------------------------------------- +- name: create a key ring that already exists + gcp_kms_key_ring: + name: "{{ resource_name }}" + location: 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 diff --git a/test/integration/targets/gcp_kms_key_ring/tasks/main.yml b/test/integration/targets/gcp_kms_key_ring/tasks/main.yml index 34999ab1bb4..45d6e49178c 100644 --- a/test/integration/targets/gcp_kms_key_ring/tasks/main.yml +++ b/test/integration/targets/gcp_kms_key_ring/tasks/main.yml @@ -1,63 +1,2 @@ -# Copyright 2019 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. - -# Pre-test setup -- name: delete a key ring - gcp_kms_key_ring: - name: "{{ resource_name }}" - location: us-central1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent -#---------------------------------------------------------- -- name: create a key ring - gcp_kms_key_ring: - name: "{{ resource_name }}" - location: 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 key_ring was created - gcp_kms_key_ring_info: - location: us-central1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - scopes: - - https://www.googleapis.com/auth/cloudkms - register: results -- name: verify that command succeeded - assert: - that: - - results['resources'] | map(attribute='name') | select("match", ".*{{ resource_name }}.*") | list | length == 1 -# ---------------------------------------------------------------------------- -- name: create a key ring that already exists - gcp_kms_key_ring: - name: "{{ resource_name }}" - location: 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 +--- +- include_tasks: autogen.yml diff --git a/test/integration/targets/gcp_mlengine_model/tasks/autogen.yml b/test/integration/targets/gcp_mlengine_model/tasks/autogen.yml new file mode 100644 index 00000000000..c30bd524a84 --- /dev/null +++ b/test/integration/targets/gcp_mlengine_model/tasks/autogen.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 model + gcp_mlengine_model: + name: "{{ resource_name | replace('-', '_') }}" + description: My model + regions: + - us-central1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent +#---------------------------------------------------------- +- name: create a model + gcp_mlengine_model: + name: "{{ resource_name | replace('-', '_') }}" + description: My model + regions: + - 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 model was created + gcp_mlengine_model_info: + 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['resources'] | map(attribute='name') | select("match", ".*{{ resource_name | replace('-', '_') }}.*") | list | length == 1 +# ---------------------------------------------------------------------------- +- name: create a model that already exists + gcp_mlengine_model: + name: "{{ resource_name | replace('-', '_') }}" + description: My model + regions: + - 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 model + gcp_mlengine_model: + name: "{{ resource_name | replace('-', '_') }}" + description: My model + regions: + - 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 model was deleted + gcp_mlengine_model_info: + 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['resources'] | map(attribute='name') | select("match", ".*{{ resource_name | replace('-', '_') }}.*") | list | length == 0 +# ---------------------------------------------------------------------------- +- name: delete a model that does not exist + gcp_mlengine_model: + name: "{{ resource_name | replace('-', '_') }}" + description: My model + regions: + - 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_mlengine_model/tasks/main.yml b/test/integration/targets/gcp_mlengine_model/tasks/main.yml index c30bd524a84..45d6e49178c 100644 --- a/test/integration/targets/gcp_mlengine_model/tasks/main.yml +++ b/test/integration/targets/gcp_mlengine_model/tasks/main.yml @@ -1,113 +1,2 @@ --- -# ---------------------------------------------------------------------------- -# -# *** 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 model - gcp_mlengine_model: - name: "{{ resource_name | replace('-', '_') }}" - description: My model - regions: - - us-central1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent -#---------------------------------------------------------- -- name: create a model - gcp_mlengine_model: - name: "{{ resource_name | replace('-', '_') }}" - description: My model - regions: - - 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 model was created - gcp_mlengine_model_info: - 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['resources'] | map(attribute='name') | select("match", ".*{{ resource_name | replace('-', '_') }}.*") | list | length == 1 -# ---------------------------------------------------------------------------- -- name: create a model that already exists - gcp_mlengine_model: - name: "{{ resource_name | replace('-', '_') }}" - description: My model - regions: - - 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 model - gcp_mlengine_model: - name: "{{ resource_name | replace('-', '_') }}" - description: My model - regions: - - 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 model was deleted - gcp_mlengine_model_info: - 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['resources'] | map(attribute='name') | select("match", ".*{{ resource_name | replace('-', '_') }}.*") | list | length == 0 -# ---------------------------------------------------------------------------- -- name: delete a model that does not exist - gcp_mlengine_model: - name: "{{ resource_name | replace('-', '_') }}" - description: My model - regions: - - 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 +- include_tasks: autogen.yml diff --git a/test/integration/targets/gcp_mlengine_version/tasks/autogen.yml b/test/integration/targets/gcp_mlengine_version/tasks/autogen.yml new file mode 100644 index 00000000000..c84d3a5e9e3 --- /dev/null +++ b/test/integration/targets/gcp_mlengine_version/tasks/autogen.yml @@ -0,0 +1,155 @@ +--- +# ---------------------------------------------------------------------------- +# +# *** 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 model + gcp_mlengine_model: + name: model_version + description: My model + regions: + - us-central1 + online_prediction_logging: 'true' + online_prediction_console_logging: 'true' + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present + register: model +- name: delete a version + gcp_mlengine_version: + name: "{{ resource_name | replace('-', '_') }}" + model: "{{ model }}" + runtime_version: 1.13 + python_version: 3.5 + is_default: 'true' + deployment_uri: gs://ansible-cloudml-bucket/ + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent +#---------------------------------------------------------- +- name: create a version + gcp_mlengine_version: + name: "{{ resource_name | replace('-', '_') }}" + model: "{{ model }}" + runtime_version: 1.13 + python_version: 3.5 + is_default: 'true' + deployment_uri: gs://ansible-cloudml-bucket/ + 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 version was created + gcp_mlengine_version_info: + model: "{{ model }}" + 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['resources'] | map(attribute='name') | select("match", ".*{{ resource_name | replace('-', '_') }}.*") | list | length == 1 +# ---------------------------------------------------------------------------- +- name: create a version that already exists + gcp_mlengine_version: + name: "{{ resource_name | replace('-', '_') }}" + model: "{{ model }}" + runtime_version: 1.13 + python_version: 3.5 + is_default: 'true' + deployment_uri: gs://ansible-cloudml-bucket/ + 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 version + gcp_mlengine_version: + name: "{{ resource_name | replace('-', '_') }}" + model: "{{ model }}" + runtime_version: 1.13 + python_version: 3.5 + is_default: 'true' + deployment_uri: gs://ansible-cloudml-bucket/ + 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 version was deleted + gcp_mlengine_version_info: + model: "{{ model }}" + 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['resources'] | map(attribute='name') | select("match", ".*{{ resource_name | replace('-', '_') }}.*") | list | length == 0 +# ---------------------------------------------------------------------------- +- name: delete a version that does not exist + gcp_mlengine_version: + name: "{{ resource_name | replace('-', '_') }}" + model: "{{ model }}" + runtime_version: 1.13 + python_version: 3.5 + is_default: 'true' + deployment_uri: gs://ansible-cloudml-bucket/ + 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 model + gcp_mlengine_model: + name: model_version + description: My model + regions: + - us-central1 + online_prediction_logging: 'true' + online_prediction_console_logging: 'true' + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: model + ignore_errors: true diff --git a/test/integration/targets/gcp_mlengine_version/tasks/main.yml b/test/integration/targets/gcp_mlengine_version/tasks/main.yml index c84d3a5e9e3..45d6e49178c 100644 --- a/test/integration/targets/gcp_mlengine_version/tasks/main.yml +++ b/test/integration/targets/gcp_mlengine_version/tasks/main.yml @@ -1,155 +1,2 @@ --- -# ---------------------------------------------------------------------------- -# -# *** 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 model - gcp_mlengine_model: - name: model_version - description: My model - regions: - - us-central1 - online_prediction_logging: 'true' - online_prediction_console_logging: 'true' - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present - register: model -- name: delete a version - gcp_mlengine_version: - name: "{{ resource_name | replace('-', '_') }}" - model: "{{ model }}" - runtime_version: 1.13 - python_version: 3.5 - is_default: 'true' - deployment_uri: gs://ansible-cloudml-bucket/ - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent -#---------------------------------------------------------- -- name: create a version - gcp_mlengine_version: - name: "{{ resource_name | replace('-', '_') }}" - model: "{{ model }}" - runtime_version: 1.13 - python_version: 3.5 - is_default: 'true' - deployment_uri: gs://ansible-cloudml-bucket/ - 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 version was created - gcp_mlengine_version_info: - model: "{{ model }}" - 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['resources'] | map(attribute='name') | select("match", ".*{{ resource_name | replace('-', '_') }}.*") | list | length == 1 -# ---------------------------------------------------------------------------- -- name: create a version that already exists - gcp_mlengine_version: - name: "{{ resource_name | replace('-', '_') }}" - model: "{{ model }}" - runtime_version: 1.13 - python_version: 3.5 - is_default: 'true' - deployment_uri: gs://ansible-cloudml-bucket/ - 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 version - gcp_mlengine_version: - name: "{{ resource_name | replace('-', '_') }}" - model: "{{ model }}" - runtime_version: 1.13 - python_version: 3.5 - is_default: 'true' - deployment_uri: gs://ansible-cloudml-bucket/ - 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 version was deleted - gcp_mlengine_version_info: - model: "{{ model }}" - 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['resources'] | map(attribute='name') | select("match", ".*{{ resource_name | replace('-', '_') }}.*") | list | length == 0 -# ---------------------------------------------------------------------------- -- name: delete a version that does not exist - gcp_mlengine_version: - name: "{{ resource_name | replace('-', '_') }}" - model: "{{ model }}" - runtime_version: 1.13 - python_version: 3.5 - is_default: 'true' - deployment_uri: gs://ansible-cloudml-bucket/ - 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 model - gcp_mlengine_model: - name: model_version - description: My model - regions: - - us-central1 - online_prediction_logging: 'true' - online_prediction_console_logging: 'true' - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent - register: model - ignore_errors: true +- include_tasks: autogen.yml diff --git a/test/integration/targets/gcp_pubsub_subscription/tasks/autogen.yml b/test/integration/targets/gcp_pubsub_subscription/tasks/autogen.yml new file mode 100644 index 00000000000..c7babda72ee --- /dev/null +++ b/test/integration/targets/gcp_pubsub_subscription/tasks/autogen.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: 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_info: + 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['resources'] | 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_info: + 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['resources'] | 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 diff --git a/test/integration/targets/gcp_pubsub_subscription/tasks/main.yml b/test/integration/targets/gcp_pubsub_subscription/tasks/main.yml index c7babda72ee..45d6e49178c 100644 --- a/test/integration/targets/gcp_pubsub_subscription/tasks/main.yml +++ b/test/integration/targets/gcp_pubsub_subscription/tasks/main.yml @@ -1,128 +1,2 @@ --- -# ---------------------------------------------------------------------------- -# -# *** 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 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_info: - 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['resources'] | 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_info: - 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['resources'] | 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 +- include_tasks: autogen.yml diff --git a/test/integration/targets/gcp_pubsub_topic/tasks/autogen.yml b/test/integration/targets/gcp_pubsub_topic/tasks/autogen.yml new file mode 100644 index 00000000000..9dff2b2d719 --- /dev/null +++ b/test/integration/targets/gcp_pubsub_topic/tasks/autogen.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 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_info: + 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['resources'] | 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_info: + 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['resources'] | 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_pubsub_topic/tasks/main.yml b/test/integration/targets/gcp_pubsub_topic/tasks/main.yml index 9dff2b2d719..45d6e49178c 100644 --- a/test/integration/targets/gcp_pubsub_topic/tasks/main.yml +++ b/test/integration/targets/gcp_pubsub_topic/tasks/main.yml @@ -1,98 +1,2 @@ --- -# ---------------------------------------------------------------------------- -# -# *** 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 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_info: - 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['resources'] | 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_info: - 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['resources'] | 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 +- include_tasks: autogen.yml diff --git a/test/integration/targets/gcp_redis_instance/tasks/autogen.yml b/test/integration/targets/gcp_redis_instance/tasks/autogen.yml new file mode 100644 index 00000000000..b859625b98c --- /dev/null +++ b/test/integration/targets/gcp_redis_instance/tasks/autogen.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_info: + 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['resources'] | map(attribute='name') | select("match", ".*instance37.*") | list | 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_info: + 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['resources'] | map(attribute='name') | select("match", ".*instance37.*") | list | 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 diff --git a/test/integration/targets/gcp_redis_instance/tasks/main.yml b/test/integration/targets/gcp_redis_instance/tasks/main.yml index b859625b98c..45d6e49178c 100644 --- a/test/integration/targets/gcp_redis_instance/tasks/main.yml +++ b/test/integration/targets/gcp_redis_instance/tasks/main.yml @@ -1,170 +1,2 @@ --- -# ---------------------------------------------------------------------------- -# -# *** 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_info: - 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['resources'] | map(attribute='name') | select("match", ".*instance37.*") | list | 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_info: - 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['resources'] | map(attribute='name') | select("match", ".*instance37.*") | list | 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 +- include_tasks: autogen.yml diff --git a/test/integration/targets/gcp_resourcemanager_project/tasks/autogen.yml b/test/integration/targets/gcp_resourcemanager_project/tasks/autogen.yml new file mode 100644 index 00000000000..083660a9d27 --- /dev/null +++ b/test/integration/targets/gcp_resourcemanager_project/tasks/autogen.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_info: + 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['resources'] | map(attribute='name') | select("match", ".*My Sample Project.*") | list | 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_info: + 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['resources'] | map(attribute='name') | select("match", ".*My Sample Project.*") | list | 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_resourcemanager_project/tasks/main.yml b/test/integration/targets/gcp_resourcemanager_project/tasks/main.yml index 083660a9d27..45d6e49178c 100644 --- a/test/integration/targets/gcp_resourcemanager_project/tasks/main.yml +++ b/test/integration/targets/gcp_resourcemanager_project/tasks/main.yml @@ -1,113 +1,2 @@ --- -# ---------------------------------------------------------------------------- -# -# *** 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_info: - 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['resources'] | map(attribute='name') | select("match", ".*My Sample Project.*") | list | 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_info: - 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['resources'] | map(attribute='name') | select("match", ".*My Sample Project.*") | list | 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 +- include_tasks: autogen.yml diff --git a/test/integration/targets/gcp_sourcerepo_repository/tasks/autogen.yml b/test/integration/targets/gcp_sourcerepo_repository/tasks/autogen.yml new file mode 100644 index 00000000000..5ae6e349451 --- /dev/null +++ b/test/integration/targets/gcp_sourcerepo_repository/tasks/autogen.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: "{{ 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: "{{ 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_info: + 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['resources'] | map(attribute='name') | select("match", ".*{{ resource_name }}.*") | list | length == 1 +# ---------------------------------------------------------------------------- +- name: create a repository that already exists + gcp_sourcerepo_repository: + 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 +#---------------------------------------------------------- +- name: delete a repository + gcp_sourcerepo_repository: + 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 +- name: verify that repository was deleted + gcp_sourcerepo_repository_info: + 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['resources'] | map(attribute='name') | select("match", ".*{{ resource_name }}.*") | list | length == 0 +# ---------------------------------------------------------------------------- +- name: delete a repository that does not exist + gcp_sourcerepo_repository: + 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 diff --git a/test/integration/targets/gcp_sourcerepo_repository/tasks/main.yml b/test/integration/targets/gcp_sourcerepo_repository/tasks/main.yml index 5ae6e349451..45d6e49178c 100644 --- a/test/integration/targets/gcp_sourcerepo_repository/tasks/main.yml +++ b/test/integration/targets/gcp_sourcerepo_repository/tasks/main.yml @@ -1,98 +1,2 @@ --- -# ---------------------------------------------------------------------------- -# -# *** 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: "{{ 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: "{{ 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_info: - 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['resources'] | map(attribute='name') | select("match", ".*{{ resource_name }}.*") | list | length == 1 -# ---------------------------------------------------------------------------- -- name: create a repository that already exists - gcp_sourcerepo_repository: - 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 -#---------------------------------------------------------- -- name: delete a repository - gcp_sourcerepo_repository: - 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 -- name: verify that repository was deleted - gcp_sourcerepo_repository_info: - 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['resources'] | map(attribute='name') | select("match", ".*{{ resource_name }}.*") | list | length == 0 -# ---------------------------------------------------------------------------- -- name: delete a repository that does not exist - gcp_sourcerepo_repository: - 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 +- include_tasks: autogen.yml