mirror of https://github.com/ansible/ansible.git
Bug fixes for GCP modules (#61917)
parent
ecc47b653b
commit
b4d15b3040
@ -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
|
@ -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
|
||||
|
@ -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
|
@ -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
|
||||
|
@ -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
|
@ -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
|
||||
|
@ -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
|
@ -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
|
||||
|
@ -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
|
@ -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
|
||||
|
@ -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
|
@ -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
|
||||
|
@ -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
|
@ -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
|
||||
|
@ -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
|
@ -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
|
||||
|
@ -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
|
@ -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
|
||||
|
@ -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
|
@ -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
|
||||
|
@ -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
|
@ -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
|
||||
|
Loading…
Reference in New Issue