mirror of https://github.com/ansible/ansible.git
Bug fixes for GCP modules (#61918)
parent
8bfc39e231
commit
ecc47b653b
@ -0,0 +1,135 @@
|
|||||||
|
---
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
#
|
||||||
|
# *** 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 instance
|
||||||
|
gcp_spanner_instance:
|
||||||
|
name: instance-database
|
||||||
|
display_name: My Spanner Instance
|
||||||
|
node_count: 2
|
||||||
|
labels:
|
||||||
|
cost_center: ti-1700004
|
||||||
|
config: regional-us-central1
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: present
|
||||||
|
register: instance
|
||||||
|
- name: delete a database
|
||||||
|
gcp_spanner_database:
|
||||||
|
name: webstore
|
||||||
|
instance: "{{ instance }}"
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: absent
|
||||||
|
#----------------------------------------------------------
|
||||||
|
- name: create a database
|
||||||
|
gcp_spanner_database:
|
||||||
|
name: webstore
|
||||||
|
instance: "{{ instance }}"
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: present
|
||||||
|
register: result
|
||||||
|
- name: assert changed is true
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- result.changed == true
|
||||||
|
- name: verify that database was created
|
||||||
|
gcp_spanner_database_info:
|
||||||
|
instance: "{{ instance }}"
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
scopes:
|
||||||
|
- https://www.googleapis.com/auth/spanner.admin
|
||||||
|
register: results
|
||||||
|
- name: verify that command succeeded
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- results['resources'] | map(attribute='name') | select("match", ".*webstore.*") | list | length == 1
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
- name: create a database that already exists
|
||||||
|
gcp_spanner_database:
|
||||||
|
name: webstore
|
||||||
|
instance: "{{ instance }}"
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: present
|
||||||
|
register: result
|
||||||
|
- name: assert changed is false
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- result.changed == false
|
||||||
|
#----------------------------------------------------------
|
||||||
|
- name: delete a database
|
||||||
|
gcp_spanner_database:
|
||||||
|
name: webstore
|
||||||
|
instance: "{{ instance }}"
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: absent
|
||||||
|
register: result
|
||||||
|
- name: assert changed is true
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- result.changed == true
|
||||||
|
- name: verify that database was deleted
|
||||||
|
gcp_spanner_database_info:
|
||||||
|
instance: "{{ instance }}"
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
scopes:
|
||||||
|
- https://www.googleapis.com/auth/spanner.admin
|
||||||
|
register: results
|
||||||
|
- name: verify that command succeeded
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- results['resources'] | map(attribute='name') | select("match", ".*webstore.*") | list | length == 0
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
- name: delete a database that does not exist
|
||||||
|
gcp_spanner_database:
|
||||||
|
name: webstore
|
||||||
|
instance: "{{ instance }}"
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: absent
|
||||||
|
register: result
|
||||||
|
- name: assert changed is false
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- result.changed == false
|
||||||
|
#---------------------------------------------------------
|
||||||
|
# Post-test teardown
|
||||||
|
# If errors happen, don't crash the playbook!
|
||||||
|
- name: delete a instance
|
||||||
|
gcp_spanner_instance:
|
||||||
|
name: instance-database
|
||||||
|
display_name: My Spanner Instance
|
||||||
|
node_count: 2
|
||||||
|
labels:
|
||||||
|
cost_center: ti-1700004
|
||||||
|
config: regional-us-central1
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: absent
|
||||||
|
register: instance
|
||||||
|
ignore_errors: true
|
@ -1,135 +1,2 @@
|
|||||||
---
|
---
|
||||||
# ----------------------------------------------------------------------------
|
- include_tasks: autogen.yml
|
||||||
#
|
|
||||||
# *** 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 instance
|
|
||||||
gcp_spanner_instance:
|
|
||||||
name: instance-database
|
|
||||||
display_name: My Spanner Instance
|
|
||||||
node_count: 2
|
|
||||||
labels:
|
|
||||||
cost_center: ti-1700004
|
|
||||||
config: regional-us-central1
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: present
|
|
||||||
register: instance
|
|
||||||
- name: delete a database
|
|
||||||
gcp_spanner_database:
|
|
||||||
name: webstore
|
|
||||||
instance: "{{ instance }}"
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: absent
|
|
||||||
#----------------------------------------------------------
|
|
||||||
- name: create a database
|
|
||||||
gcp_spanner_database:
|
|
||||||
name: webstore
|
|
||||||
instance: "{{ instance }}"
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: present
|
|
||||||
register: result
|
|
||||||
- name: assert changed is true
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- result.changed == true
|
|
||||||
- name: verify that database was created
|
|
||||||
gcp_spanner_database_info:
|
|
||||||
instance: "{{ instance }}"
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
scopes:
|
|
||||||
- https://www.googleapis.com/auth/spanner.admin
|
|
||||||
register: results
|
|
||||||
- name: verify that command succeeded
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- results['resources'] | map(attribute='name') | select("match", ".*webstore.*") | list | length == 1
|
|
||||||
# ----------------------------------------------------------------------------
|
|
||||||
- name: create a database that already exists
|
|
||||||
gcp_spanner_database:
|
|
||||||
name: webstore
|
|
||||||
instance: "{{ instance }}"
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: present
|
|
||||||
register: result
|
|
||||||
- name: assert changed is false
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- result.changed == false
|
|
||||||
#----------------------------------------------------------
|
|
||||||
- name: delete a database
|
|
||||||
gcp_spanner_database:
|
|
||||||
name: webstore
|
|
||||||
instance: "{{ instance }}"
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: absent
|
|
||||||
register: result
|
|
||||||
- name: assert changed is true
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- result.changed == true
|
|
||||||
- name: verify that database was deleted
|
|
||||||
gcp_spanner_database_info:
|
|
||||||
instance: "{{ instance }}"
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
scopes:
|
|
||||||
- https://www.googleapis.com/auth/spanner.admin
|
|
||||||
register: results
|
|
||||||
- name: verify that command succeeded
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- results['resources'] | map(attribute='name') | select("match", ".*webstore.*") | list | length == 0
|
|
||||||
# ----------------------------------------------------------------------------
|
|
||||||
- name: delete a database that does not exist
|
|
||||||
gcp_spanner_database:
|
|
||||||
name: webstore
|
|
||||||
instance: "{{ instance }}"
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: absent
|
|
||||||
register: result
|
|
||||||
- name: assert changed is false
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- result.changed == false
|
|
||||||
#---------------------------------------------------------
|
|
||||||
# Post-test teardown
|
|
||||||
# If errors happen, don't crash the playbook!
|
|
||||||
- name: delete a instance
|
|
||||||
gcp_spanner_instance:
|
|
||||||
name: instance-database
|
|
||||||
display_name: My Spanner Instance
|
|
||||||
node_count: 2
|
|
||||||
labels:
|
|
||||||
cost_center: ti-1700004
|
|
||||||
config: regional-us-central1
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: absent
|
|
||||||
register: instance
|
|
||||||
ignore_errors: true
|
|
||||||
|
@ -0,0 +1,123 @@
|
|||||||
|
---
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
#
|
||||||
|
# *** 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 instance
|
||||||
|
gcp_spanner_instance:
|
||||||
|
name: testinstance
|
||||||
|
display_name: My Spanner Instance
|
||||||
|
node_count: 2
|
||||||
|
labels:
|
||||||
|
cost_center: ti-1700004
|
||||||
|
config: regional-us-central1
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: absent
|
||||||
|
#----------------------------------------------------------
|
||||||
|
- name: create a instance
|
||||||
|
gcp_spanner_instance:
|
||||||
|
name: testinstance
|
||||||
|
display_name: My Spanner Instance
|
||||||
|
node_count: 2
|
||||||
|
labels:
|
||||||
|
cost_center: ti-1700004
|
||||||
|
config: regional-us-central1
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: present
|
||||||
|
register: result
|
||||||
|
- name: assert changed is true
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- result.changed == true
|
||||||
|
- name: verify that instance was created
|
||||||
|
gcp_spanner_instance_info:
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
scopes:
|
||||||
|
- https://www.googleapis.com/auth/spanner.admin
|
||||||
|
register: results
|
||||||
|
- name: verify that command succeeded
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- results['resources'] | map(attribute='name') | select("match", ".*testinstance.*") | list | length == 1
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
- name: create a instance that already exists
|
||||||
|
gcp_spanner_instance:
|
||||||
|
name: testinstance
|
||||||
|
display_name: My Spanner Instance
|
||||||
|
node_count: 2
|
||||||
|
labels:
|
||||||
|
cost_center: ti-1700004
|
||||||
|
config: regional-us-central1
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: present
|
||||||
|
register: result
|
||||||
|
- name: assert changed is false
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- result.changed == false
|
||||||
|
#----------------------------------------------------------
|
||||||
|
- name: delete a instance
|
||||||
|
gcp_spanner_instance:
|
||||||
|
name: testinstance
|
||||||
|
display_name: My Spanner Instance
|
||||||
|
node_count: 2
|
||||||
|
labels:
|
||||||
|
cost_center: ti-1700004
|
||||||
|
config: regional-us-central1
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: absent
|
||||||
|
register: result
|
||||||
|
- name: assert changed is true
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- result.changed == true
|
||||||
|
- name: verify that instance was deleted
|
||||||
|
gcp_spanner_instance_info:
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
scopes:
|
||||||
|
- https://www.googleapis.com/auth/spanner.admin
|
||||||
|
register: results
|
||||||
|
- name: verify that command succeeded
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- results['resources'] | map(attribute='name') | select("match", ".*testinstance.*") | list | length == 0
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
- name: delete a instance that does not exist
|
||||||
|
gcp_spanner_instance:
|
||||||
|
name: testinstance
|
||||||
|
display_name: My Spanner Instance
|
||||||
|
node_count: 2
|
||||||
|
labels:
|
||||||
|
cost_center: ti-1700004
|
||||||
|
config: regional-us-central1
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: absent
|
||||||
|
register: result
|
||||||
|
- name: assert changed is false
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- result.changed == false
|
@ -1,123 +1,2 @@
|
|||||||
---
|
---
|
||||||
# ----------------------------------------------------------------------------
|
- include_tasks: autogen.yml
|
||||||
#
|
|
||||||
# *** 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 instance
|
|
||||||
gcp_spanner_instance:
|
|
||||||
name: testinstance
|
|
||||||
display_name: My Spanner Instance
|
|
||||||
node_count: 2
|
|
||||||
labels:
|
|
||||||
cost_center: ti-1700004
|
|
||||||
config: regional-us-central1
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: absent
|
|
||||||
#----------------------------------------------------------
|
|
||||||
- name: create a instance
|
|
||||||
gcp_spanner_instance:
|
|
||||||
name: testinstance
|
|
||||||
display_name: My Spanner Instance
|
|
||||||
node_count: 2
|
|
||||||
labels:
|
|
||||||
cost_center: ti-1700004
|
|
||||||
config: regional-us-central1
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: present
|
|
||||||
register: result
|
|
||||||
- name: assert changed is true
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- result.changed == true
|
|
||||||
- name: verify that instance was created
|
|
||||||
gcp_spanner_instance_info:
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
scopes:
|
|
||||||
- https://www.googleapis.com/auth/spanner.admin
|
|
||||||
register: results
|
|
||||||
- name: verify that command succeeded
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- results['resources'] | map(attribute='name') | select("match", ".*testinstance.*") | list | length == 1
|
|
||||||
# ----------------------------------------------------------------------------
|
|
||||||
- name: create a instance that already exists
|
|
||||||
gcp_spanner_instance:
|
|
||||||
name: testinstance
|
|
||||||
display_name: My Spanner Instance
|
|
||||||
node_count: 2
|
|
||||||
labels:
|
|
||||||
cost_center: ti-1700004
|
|
||||||
config: regional-us-central1
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: present
|
|
||||||
register: result
|
|
||||||
- name: assert changed is false
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- result.changed == false
|
|
||||||
#----------------------------------------------------------
|
|
||||||
- name: delete a instance
|
|
||||||
gcp_spanner_instance:
|
|
||||||
name: testinstance
|
|
||||||
display_name: My Spanner Instance
|
|
||||||
node_count: 2
|
|
||||||
labels:
|
|
||||||
cost_center: ti-1700004
|
|
||||||
config: regional-us-central1
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: absent
|
|
||||||
register: result
|
|
||||||
- name: assert changed is true
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- result.changed == true
|
|
||||||
- name: verify that instance was deleted
|
|
||||||
gcp_spanner_instance_info:
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
scopes:
|
|
||||||
- https://www.googleapis.com/auth/spanner.admin
|
|
||||||
register: results
|
|
||||||
- name: verify that command succeeded
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- results['resources'] | map(attribute='name') | select("match", ".*testinstance.*") | list | length == 0
|
|
||||||
# ----------------------------------------------------------------------------
|
|
||||||
- name: delete a instance that does not exist
|
|
||||||
gcp_spanner_instance:
|
|
||||||
name: testinstance
|
|
||||||
display_name: My Spanner Instance
|
|
||||||
node_count: 2
|
|
||||||
labels:
|
|
||||||
cost_center: ti-1700004
|
|
||||||
config: regional-us-central1
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: absent
|
|
||||||
register: result
|
|
||||||
- name: assert changed is false
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- result.changed == false
|
|
||||||
|
@ -0,0 +1,144 @@
|
|||||||
|
---
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
#
|
||||||
|
# *** 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 instance
|
||||||
|
gcp_sql_instance:
|
||||||
|
name: "{{resource_name}}-3"
|
||||||
|
settings:
|
||||||
|
ip_configuration:
|
||||||
|
authorized_networks:
|
||||||
|
- name: google dns server
|
||||||
|
value: 8.8.8.8/32
|
||||||
|
tier: db-n1-standard-1
|
||||||
|
region: us-central1
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: present
|
||||||
|
register: instance
|
||||||
|
- name: delete a database
|
||||||
|
gcp_sql_database:
|
||||||
|
name: "{{ resource_name }}"
|
||||||
|
charset: utf8
|
||||||
|
instance: "{{ instance.name }}"
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: absent
|
||||||
|
#----------------------------------------------------------
|
||||||
|
- name: create a database
|
||||||
|
gcp_sql_database:
|
||||||
|
name: "{{ resource_name }}"
|
||||||
|
charset: utf8
|
||||||
|
instance: "{{ instance.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 database was created
|
||||||
|
gcp_sql_database_info:
|
||||||
|
instance: "{{ instance.name }}"
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
scopes:
|
||||||
|
- https://www.googleapis.com/auth/sqlservice.admin
|
||||||
|
register: results
|
||||||
|
- name: verify that command succeeded
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- "\"{{resource_name}}\" in \"{{ results['resources'] | map(attribute='name') | list }}\""
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
- name: create a database that already exists
|
||||||
|
gcp_sql_database:
|
||||||
|
name: "{{ resource_name }}"
|
||||||
|
charset: utf8
|
||||||
|
instance: "{{ instance.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 database
|
||||||
|
gcp_sql_database:
|
||||||
|
name: "{{ resource_name }}"
|
||||||
|
charset: utf8
|
||||||
|
instance: "{{ instance.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 database was deleted
|
||||||
|
gcp_sql_database_info:
|
||||||
|
instance: "{{ instance.name }}"
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
scopes:
|
||||||
|
- https://www.googleapis.com/auth/sqlservice.admin
|
||||||
|
register: results
|
||||||
|
- name: verify that command succeeded
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- "\"{{resource_name}}\" not in \"{{ results['resources'] | map(attribute='name') | list }}\""
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
- name: delete a database that does not exist
|
||||||
|
gcp_sql_database:
|
||||||
|
name: "{{ resource_name }}"
|
||||||
|
charset: utf8
|
||||||
|
instance: "{{ instance.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
|
||||||
|
#---------------------------------------------------------
|
||||||
|
# Post-test teardown
|
||||||
|
# If errors happen, don't crash the playbook!
|
||||||
|
- name: delete a instance
|
||||||
|
gcp_sql_instance:
|
||||||
|
name: "{{resource_name}}-3"
|
||||||
|
settings:
|
||||||
|
ip_configuration:
|
||||||
|
authorized_networks:
|
||||||
|
- name: google dns server
|
||||||
|
value: 8.8.8.8/32
|
||||||
|
tier: db-n1-standard-1
|
||||||
|
region: us-central1
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: absent
|
||||||
|
register: instance
|
||||||
|
ignore_errors: true
|
@ -1,144 +1,2 @@
|
|||||||
---
|
---
|
||||||
# ----------------------------------------------------------------------------
|
- include_tasks: autogen.yml
|
||||||
#
|
|
||||||
# *** 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 instance
|
|
||||||
gcp_sql_instance:
|
|
||||||
name: "{{resource_name}}-3"
|
|
||||||
settings:
|
|
||||||
ip_configuration:
|
|
||||||
authorized_networks:
|
|
||||||
- name: google dns server
|
|
||||||
value: 8.8.8.8/32
|
|
||||||
tier: db-n1-standard-1
|
|
||||||
region: us-central1
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: present
|
|
||||||
register: instance
|
|
||||||
- name: delete a database
|
|
||||||
gcp_sql_database:
|
|
||||||
name: "{{ resource_name }}"
|
|
||||||
charset: utf8
|
|
||||||
instance: "{{ instance.name }}"
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: absent
|
|
||||||
#----------------------------------------------------------
|
|
||||||
- name: create a database
|
|
||||||
gcp_sql_database:
|
|
||||||
name: "{{ resource_name }}"
|
|
||||||
charset: utf8
|
|
||||||
instance: "{{ instance.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 database was created
|
|
||||||
gcp_sql_database_info:
|
|
||||||
instance: "{{ instance.name }}"
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
scopes:
|
|
||||||
- https://www.googleapis.com/auth/sqlservice.admin
|
|
||||||
register: results
|
|
||||||
- name: verify that command succeeded
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- "\"{{resource_name}}\" in \"{{ results['resources'] | map(attribute='name') | list }}\""
|
|
||||||
# ----------------------------------------------------------------------------
|
|
||||||
- name: create a database that already exists
|
|
||||||
gcp_sql_database:
|
|
||||||
name: "{{ resource_name }}"
|
|
||||||
charset: utf8
|
|
||||||
instance: "{{ instance.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 database
|
|
||||||
gcp_sql_database:
|
|
||||||
name: "{{ resource_name }}"
|
|
||||||
charset: utf8
|
|
||||||
instance: "{{ instance.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 database was deleted
|
|
||||||
gcp_sql_database_info:
|
|
||||||
instance: "{{ instance.name }}"
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
scopes:
|
|
||||||
- https://www.googleapis.com/auth/sqlservice.admin
|
|
||||||
register: results
|
|
||||||
- name: verify that command succeeded
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- "\"{{resource_name}}\" not in \"{{ results['resources'] | map(attribute='name') | list }}\""
|
|
||||||
# ----------------------------------------------------------------------------
|
|
||||||
- name: delete a database that does not exist
|
|
||||||
gcp_sql_database:
|
|
||||||
name: "{{ resource_name }}"
|
|
||||||
charset: utf8
|
|
||||||
instance: "{{ instance.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
|
|
||||||
#---------------------------------------------------------
|
|
||||||
# Post-test teardown
|
|
||||||
# If errors happen, don't crash the playbook!
|
|
||||||
- name: delete a instance
|
|
||||||
gcp_sql_instance:
|
|
||||||
name: "{{resource_name}}-3"
|
|
||||||
settings:
|
|
||||||
ip_configuration:
|
|
||||||
authorized_networks:
|
|
||||||
- name: google dns server
|
|
||||||
value: 8.8.8.8/32
|
|
||||||
tier: db-n1-standard-1
|
|
||||||
region: us-central1
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: absent
|
|
||||||
register: instance
|
|
||||||
ignore_errors: true
|
|
||||||
|
@ -0,0 +1,133 @@
|
|||||||
|
---
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
#
|
||||||
|
# *** 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 instance
|
||||||
|
gcp_sql_instance:
|
||||||
|
name: "{{resource_name}}-2"
|
||||||
|
settings:
|
||||||
|
ip_configuration:
|
||||||
|
authorized_networks:
|
||||||
|
- name: google dns server
|
||||||
|
value: 8.8.8.8/32
|
||||||
|
tier: db-n1-standard-1
|
||||||
|
region: us-central1
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: absent
|
||||||
|
#----------------------------------------------------------
|
||||||
|
- name: create a instance
|
||||||
|
gcp_sql_instance:
|
||||||
|
name: "{{resource_name}}-2"
|
||||||
|
settings:
|
||||||
|
ip_configuration:
|
||||||
|
authorized_networks:
|
||||||
|
- name: google dns server
|
||||||
|
value: 8.8.8.8/32
|
||||||
|
tier: db-n1-standard-1
|
||||||
|
region: us-central1
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: present
|
||||||
|
register: result
|
||||||
|
- name: assert changed is true
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- result.changed == true
|
||||||
|
- name: verify that instance was created
|
||||||
|
gcp_sql_instance_info:
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
scopes:
|
||||||
|
- https://www.googleapis.com/auth/sqlservice.admin
|
||||||
|
register: results
|
||||||
|
- name: verify that command succeeded
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- results['resources'] | map(attribute='name') | select("match", ".*{{resource_name}}-2.*") | list | length == 1
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
- name: create a instance that already exists
|
||||||
|
gcp_sql_instance:
|
||||||
|
name: "{{resource_name}}-2"
|
||||||
|
settings:
|
||||||
|
ip_configuration:
|
||||||
|
authorized_networks:
|
||||||
|
- name: google dns server
|
||||||
|
value: 8.8.8.8/32
|
||||||
|
tier: db-n1-standard-1
|
||||||
|
region: us-central1
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: present
|
||||||
|
register: result
|
||||||
|
- name: assert changed is false
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- result.changed == false
|
||||||
|
#----------------------------------------------------------
|
||||||
|
- name: delete a instance
|
||||||
|
gcp_sql_instance:
|
||||||
|
name: "{{resource_name}}-2"
|
||||||
|
settings:
|
||||||
|
ip_configuration:
|
||||||
|
authorized_networks:
|
||||||
|
- name: google dns server
|
||||||
|
value: 8.8.8.8/32
|
||||||
|
tier: db-n1-standard-1
|
||||||
|
region: us-central1
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: absent
|
||||||
|
register: result
|
||||||
|
- name: assert changed is true
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- result.changed == true
|
||||||
|
- name: verify that instance was deleted
|
||||||
|
gcp_sql_instance_info:
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
scopes:
|
||||||
|
- https://www.googleapis.com/auth/sqlservice.admin
|
||||||
|
register: results
|
||||||
|
- name: verify that command succeeded
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- results['resources'] | map(attribute='name') | select("match", ".*{{resource_name}}-2.*") | list | length == 0
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
- name: delete a instance that does not exist
|
||||||
|
gcp_sql_instance:
|
||||||
|
name: "{{resource_name}}-2"
|
||||||
|
settings:
|
||||||
|
ip_configuration:
|
||||||
|
authorized_networks:
|
||||||
|
- name: google dns server
|
||||||
|
value: 8.8.8.8/32
|
||||||
|
tier: db-n1-standard-1
|
||||||
|
region: us-central1
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: absent
|
||||||
|
register: result
|
||||||
|
- name: assert changed is false
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- result.changed == false
|
@ -1,133 +1,2 @@
|
|||||||
---
|
---
|
||||||
# ----------------------------------------------------------------------------
|
- include_tasks: autogen.yml
|
||||||
#
|
|
||||||
# *** 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 instance
|
|
||||||
gcp_sql_instance:
|
|
||||||
name: "{{resource_name}}-2"
|
|
||||||
settings:
|
|
||||||
ip_configuration:
|
|
||||||
authorized_networks:
|
|
||||||
- name: google dns server
|
|
||||||
value: 8.8.8.8/32
|
|
||||||
tier: db-n1-standard-1
|
|
||||||
region: us-central1
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: absent
|
|
||||||
#----------------------------------------------------------
|
|
||||||
- name: create a instance
|
|
||||||
gcp_sql_instance:
|
|
||||||
name: "{{resource_name}}-2"
|
|
||||||
settings:
|
|
||||||
ip_configuration:
|
|
||||||
authorized_networks:
|
|
||||||
- name: google dns server
|
|
||||||
value: 8.8.8.8/32
|
|
||||||
tier: db-n1-standard-1
|
|
||||||
region: us-central1
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: present
|
|
||||||
register: result
|
|
||||||
- name: assert changed is true
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- result.changed == true
|
|
||||||
- name: verify that instance was created
|
|
||||||
gcp_sql_instance_info:
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
scopes:
|
|
||||||
- https://www.googleapis.com/auth/sqlservice.admin
|
|
||||||
register: results
|
|
||||||
- name: verify that command succeeded
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- results['resources'] | map(attribute='name') | select("match", ".*{{resource_name}}-2.*") | list | length == 1
|
|
||||||
# ----------------------------------------------------------------------------
|
|
||||||
- name: create a instance that already exists
|
|
||||||
gcp_sql_instance:
|
|
||||||
name: "{{resource_name}}-2"
|
|
||||||
settings:
|
|
||||||
ip_configuration:
|
|
||||||
authorized_networks:
|
|
||||||
- name: google dns server
|
|
||||||
value: 8.8.8.8/32
|
|
||||||
tier: db-n1-standard-1
|
|
||||||
region: us-central1
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: present
|
|
||||||
register: result
|
|
||||||
- name: assert changed is false
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- result.changed == false
|
|
||||||
#----------------------------------------------------------
|
|
||||||
- name: delete a instance
|
|
||||||
gcp_sql_instance:
|
|
||||||
name: "{{resource_name}}-2"
|
|
||||||
settings:
|
|
||||||
ip_configuration:
|
|
||||||
authorized_networks:
|
|
||||||
- name: google dns server
|
|
||||||
value: 8.8.8.8/32
|
|
||||||
tier: db-n1-standard-1
|
|
||||||
region: us-central1
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: absent
|
|
||||||
register: result
|
|
||||||
- name: assert changed is true
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- result.changed == true
|
|
||||||
- name: verify that instance was deleted
|
|
||||||
gcp_sql_instance_info:
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
scopes:
|
|
||||||
- https://www.googleapis.com/auth/sqlservice.admin
|
|
||||||
register: results
|
|
||||||
- name: verify that command succeeded
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- results['resources'] | map(attribute='name') | select("match", ".*{{resource_name}}-2.*") | list | length == 0
|
|
||||||
# ----------------------------------------------------------------------------
|
|
||||||
- name: delete a instance that does not exist
|
|
||||||
gcp_sql_instance:
|
|
||||||
name: "{{resource_name}}-2"
|
|
||||||
settings:
|
|
||||||
ip_configuration:
|
|
||||||
authorized_networks:
|
|
||||||
- name: google dns server
|
|
||||||
value: 8.8.8.8/32
|
|
||||||
tier: db-n1-standard-1
|
|
||||||
region: us-central1
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: absent
|
|
||||||
register: result
|
|
||||||
- name: assert changed is false
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- result.changed == false
|
|
||||||
|
@ -0,0 +1,149 @@
|
|||||||
|
---
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
#
|
||||||
|
# *** 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 instance
|
||||||
|
gcp_sql_instance:
|
||||||
|
name: "{{resource_name}}-1"
|
||||||
|
settings:
|
||||||
|
ip_configuration:
|
||||||
|
authorized_networks:
|
||||||
|
- name: google dns server
|
||||||
|
value: 8.8.8.8/32
|
||||||
|
tier: db-n1-standard-1
|
||||||
|
region: us-central1
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: present
|
||||||
|
register: instance
|
||||||
|
- name: delete a user
|
||||||
|
gcp_sql_user:
|
||||||
|
name: test-user
|
||||||
|
host: 10.1.2.3
|
||||||
|
password: secret-password
|
||||||
|
instance: "{{ instance }}"
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: absent
|
||||||
|
#----------------------------------------------------------
|
||||||
|
- name: create a user
|
||||||
|
gcp_sql_user:
|
||||||
|
name: test-user
|
||||||
|
host: 10.1.2.3
|
||||||
|
password: secret-password
|
||||||
|
instance: "{{ instance }}"
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: present
|
||||||
|
register: result
|
||||||
|
- name: assert changed is true
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- result.changed == true
|
||||||
|
- name: verify that user was created
|
||||||
|
gcp_sql_user_info:
|
||||||
|
instance: "{{ instance }}"
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
scopes:
|
||||||
|
- https://www.googleapis.com/auth/sqlservice.admin
|
||||||
|
register: results
|
||||||
|
- name: verify that command succeeded
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- "'test-user' in \"{{ results['resources'] | map(attribute='name') | list }}\""
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
- name: create a user that already exists
|
||||||
|
gcp_sql_user:
|
||||||
|
name: test-user
|
||||||
|
host: 10.1.2.3
|
||||||
|
password: secret-password
|
||||||
|
instance: "{{ instance }}"
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: present
|
||||||
|
register: result
|
||||||
|
- name: assert changed is false
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- result.changed == false
|
||||||
|
#----------------------------------------------------------
|
||||||
|
- name: delete a user
|
||||||
|
gcp_sql_user:
|
||||||
|
name: test-user
|
||||||
|
host: 10.1.2.3
|
||||||
|
password: secret-password
|
||||||
|
instance: "{{ instance }}"
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: absent
|
||||||
|
register: result
|
||||||
|
- name: assert changed is true
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- result.changed == true
|
||||||
|
- name: verify that user was deleted
|
||||||
|
gcp_sql_user_info:
|
||||||
|
instance: "{{ instance }}"
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
scopes:
|
||||||
|
- https://www.googleapis.com/auth/sqlservice.admin
|
||||||
|
register: results
|
||||||
|
- name: verify that command succeeded
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- "'test-user' not in \"{{ results['resources'] | map(attribute='name') | list }}\""
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
- name: delete a user that does not exist
|
||||||
|
gcp_sql_user:
|
||||||
|
name: test-user
|
||||||
|
host: 10.1.2.3
|
||||||
|
password: secret-password
|
||||||
|
instance: "{{ instance }}"
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: absent
|
||||||
|
register: result
|
||||||
|
- name: assert changed is false
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- result.changed == false
|
||||||
|
#---------------------------------------------------------
|
||||||
|
# Post-test teardown
|
||||||
|
# If errors happen, don't crash the playbook!
|
||||||
|
- name: delete a instance
|
||||||
|
gcp_sql_instance:
|
||||||
|
name: "{{resource_name}}-1"
|
||||||
|
settings:
|
||||||
|
ip_configuration:
|
||||||
|
authorized_networks:
|
||||||
|
- name: google dns server
|
||||||
|
value: 8.8.8.8/32
|
||||||
|
tier: db-n1-standard-1
|
||||||
|
region: us-central1
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: absent
|
||||||
|
register: instance
|
||||||
|
ignore_errors: true
|
@ -1,149 +1,2 @@
|
|||||||
---
|
---
|
||||||
# ----------------------------------------------------------------------------
|
- include_tasks: autogen.yml
|
||||||
#
|
|
||||||
# *** 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 instance
|
|
||||||
gcp_sql_instance:
|
|
||||||
name: "{{resource_name}}-1"
|
|
||||||
settings:
|
|
||||||
ip_configuration:
|
|
||||||
authorized_networks:
|
|
||||||
- name: google dns server
|
|
||||||
value: 8.8.8.8/32
|
|
||||||
tier: db-n1-standard-1
|
|
||||||
region: us-central1
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: present
|
|
||||||
register: instance
|
|
||||||
- name: delete a user
|
|
||||||
gcp_sql_user:
|
|
||||||
name: test-user
|
|
||||||
host: 10.1.2.3
|
|
||||||
password: secret-password
|
|
||||||
instance: "{{ instance }}"
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: absent
|
|
||||||
#----------------------------------------------------------
|
|
||||||
- name: create a user
|
|
||||||
gcp_sql_user:
|
|
||||||
name: test-user
|
|
||||||
host: 10.1.2.3
|
|
||||||
password: secret-password
|
|
||||||
instance: "{{ instance }}"
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: present
|
|
||||||
register: result
|
|
||||||
- name: assert changed is true
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- result.changed == true
|
|
||||||
- name: verify that user was created
|
|
||||||
gcp_sql_user_info:
|
|
||||||
instance: "{{ instance }}"
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
scopes:
|
|
||||||
- https://www.googleapis.com/auth/sqlservice.admin
|
|
||||||
register: results
|
|
||||||
- name: verify that command succeeded
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- "'test-user' in \"{{ results['resources'] | map(attribute='name') | list }}\""
|
|
||||||
# ----------------------------------------------------------------------------
|
|
||||||
- name: create a user that already exists
|
|
||||||
gcp_sql_user:
|
|
||||||
name: test-user
|
|
||||||
host: 10.1.2.3
|
|
||||||
password: secret-password
|
|
||||||
instance: "{{ instance }}"
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: present
|
|
||||||
register: result
|
|
||||||
- name: assert changed is false
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- result.changed == false
|
|
||||||
#----------------------------------------------------------
|
|
||||||
- name: delete a user
|
|
||||||
gcp_sql_user:
|
|
||||||
name: test-user
|
|
||||||
host: 10.1.2.3
|
|
||||||
password: secret-password
|
|
||||||
instance: "{{ instance }}"
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: absent
|
|
||||||
register: result
|
|
||||||
- name: assert changed is true
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- result.changed == true
|
|
||||||
- name: verify that user was deleted
|
|
||||||
gcp_sql_user_info:
|
|
||||||
instance: "{{ instance }}"
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
scopes:
|
|
||||||
- https://www.googleapis.com/auth/sqlservice.admin
|
|
||||||
register: results
|
|
||||||
- name: verify that command succeeded
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- "'test-user' not in \"{{ results['resources'] | map(attribute='name') | list }}\""
|
|
||||||
# ----------------------------------------------------------------------------
|
|
||||||
- name: delete a user that does not exist
|
|
||||||
gcp_sql_user:
|
|
||||||
name: test-user
|
|
||||||
host: 10.1.2.3
|
|
||||||
password: secret-password
|
|
||||||
instance: "{{ instance }}"
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: absent
|
|
||||||
register: result
|
|
||||||
- name: assert changed is false
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- result.changed == false
|
|
||||||
#---------------------------------------------------------
|
|
||||||
# Post-test teardown
|
|
||||||
# If errors happen, don't crash the playbook!
|
|
||||||
- name: delete a instance
|
|
||||||
gcp_sql_instance:
|
|
||||||
name: "{{resource_name}}-1"
|
|
||||||
settings:
|
|
||||||
ip_configuration:
|
|
||||||
authorized_networks:
|
|
||||||
- name: google dns server
|
|
||||||
value: 8.8.8.8/32
|
|
||||||
tier: db-n1-standard-1
|
|
||||||
region: us-central1
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: absent
|
|
||||||
register: instance
|
|
||||||
ignore_errors: true
|
|
||||||
|
@ -0,0 +1,74 @@
|
|||||||
|
---
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
#
|
||||||
|
# *** 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 bucket
|
||||||
|
gcp_storage_bucket:
|
||||||
|
name: ansible-storage-module
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: absent
|
||||||
|
#----------------------------------------------------------
|
||||||
|
- name: create a bucket
|
||||||
|
gcp_storage_bucket:
|
||||||
|
name: ansible-storage-module
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: present
|
||||||
|
register: result
|
||||||
|
- name: assert changed is true
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- result.changed == true
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
- name: create a bucket that already exists
|
||||||
|
gcp_storage_bucket:
|
||||||
|
name: ansible-storage-module
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: present
|
||||||
|
register: result
|
||||||
|
- name: assert changed is false
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- result.changed == false
|
||||||
|
#----------------------------------------------------------
|
||||||
|
- name: delete a bucket
|
||||||
|
gcp_storage_bucket:
|
||||||
|
name: ansible-storage-module
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: absent
|
||||||
|
register: result
|
||||||
|
- name: assert changed is true
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- result.changed == true
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
- name: delete a bucket that does not exist
|
||||||
|
gcp_storage_bucket:
|
||||||
|
name: ansible-storage-module
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: absent
|
||||||
|
register: result
|
||||||
|
- name: assert changed is false
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- result.changed == false
|
@ -1,74 +1,2 @@
|
|||||||
---
|
---
|
||||||
# ----------------------------------------------------------------------------
|
- include_tasks: autogen.yml
|
||||||
#
|
|
||||||
# *** 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 bucket
|
|
||||||
gcp_storage_bucket:
|
|
||||||
name: ansible-storage-module
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: absent
|
|
||||||
#----------------------------------------------------------
|
|
||||||
- name: create a bucket
|
|
||||||
gcp_storage_bucket:
|
|
||||||
name: ansible-storage-module
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: present
|
|
||||||
register: result
|
|
||||||
- name: assert changed is true
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- result.changed == true
|
|
||||||
# ----------------------------------------------------------------------------
|
|
||||||
- name: create a bucket that already exists
|
|
||||||
gcp_storage_bucket:
|
|
||||||
name: ansible-storage-module
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: present
|
|
||||||
register: result
|
|
||||||
- name: assert changed is false
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- result.changed == false
|
|
||||||
#----------------------------------------------------------
|
|
||||||
- name: delete a bucket
|
|
||||||
gcp_storage_bucket:
|
|
||||||
name: ansible-storage-module
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: absent
|
|
||||||
register: result
|
|
||||||
- name: assert changed is true
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- result.changed == true
|
|
||||||
# ----------------------------------------------------------------------------
|
|
||||||
- name: delete a bucket that does not exist
|
|
||||||
gcp_storage_bucket:
|
|
||||||
name: ansible-storage-module
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: absent
|
|
||||||
register: result
|
|
||||||
- name: assert changed is false
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- result.changed == false
|
|
||||||
|
@ -0,0 +1,104 @@
|
|||||||
|
---
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
#
|
||||||
|
# *** 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 bucket
|
||||||
|
gcp_storage_bucket:
|
||||||
|
name: "{{ resource_name }}"
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: present
|
||||||
|
register: bucket
|
||||||
|
- name: delete a bucket access control
|
||||||
|
gcp_storage_bucket_access_control:
|
||||||
|
bucket: "{{ bucket }}"
|
||||||
|
entity: user-alexstephen@google.com
|
||||||
|
role: WRITER
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: absent
|
||||||
|
#----------------------------------------------------------
|
||||||
|
- name: create a bucket access control
|
||||||
|
gcp_storage_bucket_access_control:
|
||||||
|
bucket: "{{ bucket }}"
|
||||||
|
entity: user-alexstephen@google.com
|
||||||
|
role: WRITER
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: present
|
||||||
|
register: result
|
||||||
|
- name: assert changed is true
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- result.changed == true
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
- name: create a bucket access control that already exists
|
||||||
|
gcp_storage_bucket_access_control:
|
||||||
|
bucket: "{{ bucket }}"
|
||||||
|
entity: user-alexstephen@google.com
|
||||||
|
role: WRITER
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: present
|
||||||
|
register: result
|
||||||
|
- name: assert changed is false
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- result.changed == false
|
||||||
|
#----------------------------------------------------------
|
||||||
|
- name: delete a bucket access control
|
||||||
|
gcp_storage_bucket_access_control:
|
||||||
|
bucket: "{{ bucket }}"
|
||||||
|
entity: user-alexstephen@google.com
|
||||||
|
role: WRITER
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: absent
|
||||||
|
register: result
|
||||||
|
- name: assert changed is true
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- result.changed == true
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
- name: delete a bucket access control that does not exist
|
||||||
|
gcp_storage_bucket_access_control:
|
||||||
|
bucket: "{{ bucket }}"
|
||||||
|
entity: user-alexstephen@google.com
|
||||||
|
role: WRITER
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: absent
|
||||||
|
register: result
|
||||||
|
- name: assert changed is false
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- result.changed == false
|
||||||
|
#---------------------------------------------------------
|
||||||
|
# Post-test teardown
|
||||||
|
# If errors happen, don't crash the playbook!
|
||||||
|
- name: delete a bucket
|
||||||
|
gcp_storage_bucket:
|
||||||
|
name: "{{ resource_name }}"
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: absent
|
||||||
|
register: bucket
|
||||||
|
ignore_errors: true
|
@ -1,104 +1,2 @@
|
|||||||
---
|
---
|
||||||
# ----------------------------------------------------------------------------
|
- include_tasks: autogen.yml
|
||||||
#
|
|
||||||
# *** 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 bucket
|
|
||||||
gcp_storage_bucket:
|
|
||||||
name: "{{ resource_name }}"
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: present
|
|
||||||
register: bucket
|
|
||||||
- name: delete a bucket access control
|
|
||||||
gcp_storage_bucket_access_control:
|
|
||||||
bucket: "{{ bucket }}"
|
|
||||||
entity: user-alexstephen@google.com
|
|
||||||
role: WRITER
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: absent
|
|
||||||
#----------------------------------------------------------
|
|
||||||
- name: create a bucket access control
|
|
||||||
gcp_storage_bucket_access_control:
|
|
||||||
bucket: "{{ bucket }}"
|
|
||||||
entity: user-alexstephen@google.com
|
|
||||||
role: WRITER
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: present
|
|
||||||
register: result
|
|
||||||
- name: assert changed is true
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- result.changed == true
|
|
||||||
# ----------------------------------------------------------------------------
|
|
||||||
- name: create a bucket access control that already exists
|
|
||||||
gcp_storage_bucket_access_control:
|
|
||||||
bucket: "{{ bucket }}"
|
|
||||||
entity: user-alexstephen@google.com
|
|
||||||
role: WRITER
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: present
|
|
||||||
register: result
|
|
||||||
- name: assert changed is false
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- result.changed == false
|
|
||||||
#----------------------------------------------------------
|
|
||||||
- name: delete a bucket access control
|
|
||||||
gcp_storage_bucket_access_control:
|
|
||||||
bucket: "{{ bucket }}"
|
|
||||||
entity: user-alexstephen@google.com
|
|
||||||
role: WRITER
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: absent
|
|
||||||
register: result
|
|
||||||
- name: assert changed is true
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- result.changed == true
|
|
||||||
# ----------------------------------------------------------------------------
|
|
||||||
- name: delete a bucket access control that does not exist
|
|
||||||
gcp_storage_bucket_access_control:
|
|
||||||
bucket: "{{ bucket }}"
|
|
||||||
entity: user-alexstephen@google.com
|
|
||||||
role: WRITER
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: absent
|
|
||||||
register: result
|
|
||||||
- name: assert changed is false
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- result.changed == false
|
|
||||||
#---------------------------------------------------------
|
|
||||||
# Post-test teardown
|
|
||||||
# If errors happen, don't crash the playbook!
|
|
||||||
- name: delete a bucket
|
|
||||||
gcp_storage_bucket:
|
|
||||||
name: "{{ resource_name }}"
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: absent
|
|
||||||
register: bucket
|
|
||||||
ignore_errors: true
|
|
||||||
|
@ -0,0 +1,120 @@
|
|||||||
|
---
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
#
|
||||||
|
# *** 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 node
|
||||||
|
gcp_tpu_node:
|
||||||
|
name: "{{ resource_name }}"
|
||||||
|
zone: us-central1-b
|
||||||
|
accelerator_type: v3-8
|
||||||
|
tensorflow_version: '1.11'
|
||||||
|
cidr_block: 10.2.0.0/29
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: absent
|
||||||
|
#----------------------------------------------------------
|
||||||
|
- name: create a node
|
||||||
|
gcp_tpu_node:
|
||||||
|
name: "{{ resource_name }}"
|
||||||
|
zone: us-central1-b
|
||||||
|
accelerator_type: v3-8
|
||||||
|
tensorflow_version: '1.11'
|
||||||
|
cidr_block: 10.2.0.0/29
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: present
|
||||||
|
register: result
|
||||||
|
- name: assert changed is true
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- result.changed == true
|
||||||
|
- name: verify that node was created
|
||||||
|
gcp_tpu_node_info:
|
||||||
|
zone: us-central1-b
|
||||||
|
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 node that already exists
|
||||||
|
gcp_tpu_node:
|
||||||
|
name: "{{ resource_name }}"
|
||||||
|
zone: us-central1-b
|
||||||
|
accelerator_type: v3-8
|
||||||
|
tensorflow_version: '1.11'
|
||||||
|
cidr_block: 10.2.0.0/29
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: present
|
||||||
|
register: result
|
||||||
|
- name: assert changed is false
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- result.changed == false
|
||||||
|
#----------------------------------------------------------
|
||||||
|
- name: delete a node
|
||||||
|
gcp_tpu_node:
|
||||||
|
name: "{{ resource_name }}"
|
||||||
|
zone: us-central1-b
|
||||||
|
accelerator_type: v3-8
|
||||||
|
tensorflow_version: '1.11'
|
||||||
|
cidr_block: 10.2.0.0/29
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: absent
|
||||||
|
register: result
|
||||||
|
- name: assert changed is true
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- result.changed == true
|
||||||
|
- name: verify that node was deleted
|
||||||
|
gcp_tpu_node_info:
|
||||||
|
zone: us-central1-b
|
||||||
|
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 node that does not exist
|
||||||
|
gcp_tpu_node:
|
||||||
|
name: "{{ resource_name }}"
|
||||||
|
zone: us-central1-b
|
||||||
|
accelerator_type: v3-8
|
||||||
|
tensorflow_version: '1.11'
|
||||||
|
cidr_block: 10.2.0.0/29
|
||||||
|
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,120 +1,2 @@
|
|||||||
---
|
---
|
||||||
# ----------------------------------------------------------------------------
|
- include_tasks: autogen.yml
|
||||||
#
|
|
||||||
# *** 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 node
|
|
||||||
gcp_tpu_node:
|
|
||||||
name: "{{ resource_name }}"
|
|
||||||
zone: us-central1-b
|
|
||||||
accelerator_type: v3-8
|
|
||||||
tensorflow_version: '1.11'
|
|
||||||
cidr_block: 10.2.0.0/29
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: absent
|
|
||||||
#----------------------------------------------------------
|
|
||||||
- name: create a node
|
|
||||||
gcp_tpu_node:
|
|
||||||
name: "{{ resource_name }}"
|
|
||||||
zone: us-central1-b
|
|
||||||
accelerator_type: v3-8
|
|
||||||
tensorflow_version: '1.11'
|
|
||||||
cidr_block: 10.2.0.0/29
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: present
|
|
||||||
register: result
|
|
||||||
- name: assert changed is true
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- result.changed == true
|
|
||||||
- name: verify that node was created
|
|
||||||
gcp_tpu_node_info:
|
|
||||||
zone: us-central1-b
|
|
||||||
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 node that already exists
|
|
||||||
gcp_tpu_node:
|
|
||||||
name: "{{ resource_name }}"
|
|
||||||
zone: us-central1-b
|
|
||||||
accelerator_type: v3-8
|
|
||||||
tensorflow_version: '1.11'
|
|
||||||
cidr_block: 10.2.0.0/29
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: present
|
|
||||||
register: result
|
|
||||||
- name: assert changed is false
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- result.changed == false
|
|
||||||
#----------------------------------------------------------
|
|
||||||
- name: delete a node
|
|
||||||
gcp_tpu_node:
|
|
||||||
name: "{{ resource_name }}"
|
|
||||||
zone: us-central1-b
|
|
||||||
accelerator_type: v3-8
|
|
||||||
tensorflow_version: '1.11'
|
|
||||||
cidr_block: 10.2.0.0/29
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: absent
|
|
||||||
register: result
|
|
||||||
- name: assert changed is true
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- result.changed == true
|
|
||||||
- name: verify that node was deleted
|
|
||||||
gcp_tpu_node_info:
|
|
||||||
zone: us-central1-b
|
|
||||||
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 node that does not exist
|
|
||||||
gcp_tpu_node:
|
|
||||||
name: "{{ resource_name }}"
|
|
||||||
zone: us-central1-b
|
|
||||||
accelerator_type: v3-8
|
|
||||||
tensorflow_version: '1.11'
|
|
||||||
cidr_block: 10.2.0.0/29
|
|
||||||
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
|
|
||||||
|
Loading…
Reference in New Issue