mirror of https://github.com/ansible/ansible.git
Bug fixes for GCP modules (#61829)
parent
53cd75bee6
commit
2b535cc59a
@ -0,0 +1,108 @@
|
|||||||
|
---
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
#
|
||||||
|
# *** 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 firewall rule
|
||||||
|
gcp_appengine_firewall_rule:
|
||||||
|
priority: 1000
|
||||||
|
source_range: 10.0.0.0
|
||||||
|
action: ALLOW
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: absent
|
||||||
|
#----------------------------------------------------------
|
||||||
|
- name: create a firewall rule
|
||||||
|
gcp_appengine_firewall_rule:
|
||||||
|
priority: 1000
|
||||||
|
source_range: 10.0.0.0
|
||||||
|
action: ALLOW
|
||||||
|
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 firewall_rule was created
|
||||||
|
gcp_appengine_firewall_rule_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'] | length >= 1
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
- name: create a firewall rule that already exists
|
||||||
|
gcp_appengine_firewall_rule:
|
||||||
|
priority: 1000
|
||||||
|
source_range: 10.0.0.0
|
||||||
|
action: ALLOW
|
||||||
|
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 firewall rule
|
||||||
|
gcp_appengine_firewall_rule:
|
||||||
|
priority: 1000
|
||||||
|
source_range: 10.0.0.0
|
||||||
|
action: ALLOW
|
||||||
|
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 firewall_rule was deleted
|
||||||
|
gcp_appengine_firewall_rule_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'] | length == 0
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
- name: delete a firewall rule that does not exist
|
||||||
|
gcp_appengine_firewall_rule:
|
||||||
|
priority: 1000
|
||||||
|
source_range: 10.0.0.0
|
||||||
|
action: ALLOW
|
||||||
|
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,108 +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 firewall rule
|
|
||||||
gcp_appengine_firewall_rule:
|
|
||||||
priority: 1000
|
|
||||||
source_range: 10.0.0.0
|
|
||||||
action: ALLOW
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: absent
|
|
||||||
#----------------------------------------------------------
|
|
||||||
- name: create a firewall rule
|
|
||||||
gcp_appengine_firewall_rule:
|
|
||||||
priority: 1000
|
|
||||||
source_range: 10.0.0.0
|
|
||||||
action: ALLOW
|
|
||||||
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 firewall_rule was created
|
|
||||||
gcp_appengine_firewall_rule_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'] | length >= 1
|
|
||||||
# ----------------------------------------------------------------------------
|
|
||||||
- name: create a firewall rule that already exists
|
|
||||||
gcp_appengine_firewall_rule:
|
|
||||||
priority: 1000
|
|
||||||
source_range: 10.0.0.0
|
|
||||||
action: ALLOW
|
|
||||||
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 firewall rule
|
|
||||||
gcp_appengine_firewall_rule:
|
|
||||||
priority: 1000
|
|
||||||
source_range: 10.0.0.0
|
|
||||||
action: ALLOW
|
|
||||||
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 firewall_rule was deleted
|
|
||||||
gcp_appengine_firewall_rule_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'] | length == 0
|
|
||||||
# ----------------------------------------------------------------------------
|
|
||||||
- name: delete a firewall rule that does not exist
|
|
||||||
gcp_appengine_firewall_rule:
|
|
||||||
priority: 1000
|
|
||||||
source_range: 10.0.0.0
|
|
||||||
action: ALLOW
|
|
||||||
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,108 @@
|
|||||||
|
---
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
#
|
||||||
|
# *** AUTO GENERATED CODE *** AUTO GENERATED CODE ***
|
||||||
|
#
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
#
|
||||||
|
# This file is automatically generated by Magic Modules and manual
|
||||||
|
# changes will be clobbered when the file is regenerated.
|
||||||
|
#
|
||||||
|
# Please read more about how to change this file at
|
||||||
|
# https://www.github.com/GoogleCloudPlatform/magic-modules
|
||||||
|
#
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
# Pre-test setup
|
||||||
|
- name: delete a dataset
|
||||||
|
gcp_bigquery_dataset:
|
||||||
|
name: my_example_dataset
|
||||||
|
dataset_reference:
|
||||||
|
dataset_id: my_example_dataset
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: absent
|
||||||
|
#----------------------------------------------------------
|
||||||
|
- name: create a dataset
|
||||||
|
gcp_bigquery_dataset:
|
||||||
|
name: my_example_dataset
|
||||||
|
dataset_reference:
|
||||||
|
dataset_id: my_example_dataset
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: present
|
||||||
|
register: result
|
||||||
|
- name: assert changed is true
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- result.changed == true
|
||||||
|
- name: verify that dataset was created
|
||||||
|
gcp_bigquery_dataset_info:
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
scopes:
|
||||||
|
- https://www.googleapis.com/auth/bigquery
|
||||||
|
register: results
|
||||||
|
- name: verify that command succeeded
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- results['resources'] | map(attribute='datasetReference') | map(attribute='datasetId') | select("match", ".*my_example_dataset.*") | list | length == 1
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
- name: create a dataset that already exists
|
||||||
|
gcp_bigquery_dataset:
|
||||||
|
name: my_example_dataset
|
||||||
|
dataset_reference:
|
||||||
|
dataset_id: my_example_dataset
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: present
|
||||||
|
register: result
|
||||||
|
- name: assert changed is false
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- result.changed == false
|
||||||
|
#----------------------------------------------------------
|
||||||
|
- name: delete a dataset
|
||||||
|
gcp_bigquery_dataset:
|
||||||
|
name: my_example_dataset
|
||||||
|
dataset_reference:
|
||||||
|
dataset_id: my_example_dataset
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: absent
|
||||||
|
register: result
|
||||||
|
- name: assert changed is true
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- result.changed == true
|
||||||
|
- name: verify that dataset was deleted
|
||||||
|
gcp_bigquery_dataset_info:
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
scopes:
|
||||||
|
- https://www.googleapis.com/auth/bigquery
|
||||||
|
register: results
|
||||||
|
- name: verify that command succeeded
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- results['resources'] | map(attribute='datasetReference') | map(attribute='datasetId') | select("match", ".*my_example_dataset.*") | list | length == 0
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
- name: delete a dataset that does not exist
|
||||||
|
gcp_bigquery_dataset:
|
||||||
|
name: my_example_dataset
|
||||||
|
dataset_reference:
|
||||||
|
dataset_id: my_example_dataset
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: absent
|
||||||
|
register: result
|
||||||
|
- name: assert changed is false
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- result.changed == false
|
||||||
@ -1,108 +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 dataset
|
|
||||||
gcp_bigquery_dataset:
|
|
||||||
name: my_example_dataset
|
|
||||||
dataset_reference:
|
|
||||||
dataset_id: my_example_dataset
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: absent
|
|
||||||
#----------------------------------------------------------
|
|
||||||
- name: create a dataset
|
|
||||||
gcp_bigquery_dataset:
|
|
||||||
name: my_example_dataset
|
|
||||||
dataset_reference:
|
|
||||||
dataset_id: my_example_dataset
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: present
|
|
||||||
register: result
|
|
||||||
- name: assert changed is true
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- result.changed == true
|
|
||||||
- name: verify that dataset was created
|
|
||||||
gcp_bigquery_dataset_info:
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
scopes:
|
|
||||||
- https://www.googleapis.com/auth/bigquery
|
|
||||||
register: results
|
|
||||||
- name: verify that command succeeded
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- results['resources'] | map(attribute='datasetReference') | map(attribute='datasetId') | select("match", ".*my_example_dataset.*") | list | length == 1
|
|
||||||
# ----------------------------------------------------------------------------
|
|
||||||
- name: create a dataset that already exists
|
|
||||||
gcp_bigquery_dataset:
|
|
||||||
name: my_example_dataset
|
|
||||||
dataset_reference:
|
|
||||||
dataset_id: my_example_dataset
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: present
|
|
||||||
register: result
|
|
||||||
- name: assert changed is false
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- result.changed == false
|
|
||||||
#----------------------------------------------------------
|
|
||||||
- name: delete a dataset
|
|
||||||
gcp_bigquery_dataset:
|
|
||||||
name: my_example_dataset
|
|
||||||
dataset_reference:
|
|
||||||
dataset_id: my_example_dataset
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: absent
|
|
||||||
register: result
|
|
||||||
- name: assert changed is true
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- result.changed == true
|
|
||||||
- name: verify that dataset was deleted
|
|
||||||
gcp_bigquery_dataset_info:
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
scopes:
|
|
||||||
- https://www.googleapis.com/auth/bigquery
|
|
||||||
register: results
|
|
||||||
- name: verify that command succeeded
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- results['resources'] | map(attribute='datasetReference') | map(attribute='datasetId') | select("match", ".*my_example_dataset.*") | list | length == 0
|
|
||||||
# ----------------------------------------------------------------------------
|
|
||||||
- name: delete a dataset that does not exist
|
|
||||||
gcp_bigquery_dataset:
|
|
||||||
name: my_example_dataset
|
|
||||||
dataset_reference:
|
|
||||||
dataset_id: my_example_dataset
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: absent
|
|
||||||
register: result
|
|
||||||
- name: assert changed is false
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- result.changed == false
|
|
||||||
|
|||||||
@ -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 dataset
|
||||||
|
gcp_bigquery_dataset:
|
||||||
|
name: example_dataset
|
||||||
|
dataset_reference:
|
||||||
|
dataset_id: example_dataset
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: present
|
||||||
|
register: dataset
|
||||||
|
- name: delete a table
|
||||||
|
gcp_bigquery_table:
|
||||||
|
name: example_table
|
||||||
|
dataset: example_dataset
|
||||||
|
table_reference:
|
||||||
|
dataset_id: example_dataset
|
||||||
|
project_id: "{{ gcp_project }}"
|
||||||
|
table_id: example_table
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: absent
|
||||||
|
#----------------------------------------------------------
|
||||||
|
- name: create a table
|
||||||
|
gcp_bigquery_table:
|
||||||
|
name: example_table
|
||||||
|
dataset: example_dataset
|
||||||
|
table_reference:
|
||||||
|
dataset_id: example_dataset
|
||||||
|
project_id: "{{ gcp_project }}"
|
||||||
|
table_id: example_table
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: present
|
||||||
|
register: result
|
||||||
|
- name: assert changed is true
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- result.changed == true
|
||||||
|
- name: verify that table was created
|
||||||
|
gcp_bigquery_table_info:
|
||||||
|
dataset: example_dataset
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
scopes:
|
||||||
|
- https://www.googleapis.com/auth/bigquery
|
||||||
|
register: results
|
||||||
|
- name: verify that command succeeded
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- results['resources'] | map(attribute='tableReference') | map(attribute='tableId') | select("match", ".*example_table.*") | list | length == 1
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
- name: create a table that already exists
|
||||||
|
gcp_bigquery_table:
|
||||||
|
name: example_table
|
||||||
|
dataset: example_dataset
|
||||||
|
table_reference:
|
||||||
|
dataset_id: example_dataset
|
||||||
|
project_id: "{{ gcp_project }}"
|
||||||
|
table_id: example_table
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: present
|
||||||
|
register: result
|
||||||
|
- name: assert changed is false
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- result.changed == false
|
||||||
|
#----------------------------------------------------------
|
||||||
|
- name: delete a table
|
||||||
|
gcp_bigquery_table:
|
||||||
|
name: example_table
|
||||||
|
dataset: example_dataset
|
||||||
|
table_reference:
|
||||||
|
dataset_id: example_dataset
|
||||||
|
project_id: "{{ gcp_project }}"
|
||||||
|
table_id: example_table
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: absent
|
||||||
|
register: result
|
||||||
|
- name: assert changed is true
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- result.changed == true
|
||||||
|
- name: verify that table was deleted
|
||||||
|
gcp_bigquery_table_info:
|
||||||
|
dataset: example_dataset
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
scopes:
|
||||||
|
- https://www.googleapis.com/auth/bigquery
|
||||||
|
register: results
|
||||||
|
- name: verify that command succeeded
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- results['resources'] | map(attribute='tableReference') | map(attribute='tableId') | select("match", ".*example_table.*") | list | length == 0
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
- name: delete a table that does not exist
|
||||||
|
gcp_bigquery_table:
|
||||||
|
name: example_table
|
||||||
|
dataset: example_dataset
|
||||||
|
table_reference:
|
||||||
|
dataset_id: example_dataset
|
||||||
|
project_id: "{{ gcp_project }}"
|
||||||
|
table_id: example_table
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: absent
|
||||||
|
register: result
|
||||||
|
- name: assert changed is false
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- result.changed == false
|
||||||
|
#---------------------------------------------------------
|
||||||
|
# Post-test teardown
|
||||||
|
# If errors happen, don't crash the playbook!
|
||||||
|
- name: delete a dataset
|
||||||
|
gcp_bigquery_dataset:
|
||||||
|
name: example_dataset
|
||||||
|
dataset_reference:
|
||||||
|
dataset_id: example_dataset
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: absent
|
||||||
|
register: dataset
|
||||||
|
ignore_errors: true
|
||||||
@ -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 dataset
|
|
||||||
gcp_bigquery_dataset:
|
|
||||||
name: example_dataset
|
|
||||||
dataset_reference:
|
|
||||||
dataset_id: example_dataset
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: present
|
|
||||||
register: dataset
|
|
||||||
- name: delete a table
|
|
||||||
gcp_bigquery_table:
|
|
||||||
name: example_table
|
|
||||||
dataset: example_dataset
|
|
||||||
table_reference:
|
|
||||||
dataset_id: example_dataset
|
|
||||||
project_id: "{{ gcp_project }}"
|
|
||||||
table_id: example_table
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: absent
|
|
||||||
#----------------------------------------------------------
|
|
||||||
- name: create a table
|
|
||||||
gcp_bigquery_table:
|
|
||||||
name: example_table
|
|
||||||
dataset: example_dataset
|
|
||||||
table_reference:
|
|
||||||
dataset_id: example_dataset
|
|
||||||
project_id: "{{ gcp_project }}"
|
|
||||||
table_id: example_table
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: present
|
|
||||||
register: result
|
|
||||||
- name: assert changed is true
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- result.changed == true
|
|
||||||
- name: verify that table was created
|
|
||||||
gcp_bigquery_table_info:
|
|
||||||
dataset: example_dataset
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
scopes:
|
|
||||||
- https://www.googleapis.com/auth/bigquery
|
|
||||||
register: results
|
|
||||||
- name: verify that command succeeded
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- results['resources'] | map(attribute='tableReference') | map(attribute='tableId') | select("match", ".*example_table.*") | list | length == 1
|
|
||||||
# ----------------------------------------------------------------------------
|
|
||||||
- name: create a table that already exists
|
|
||||||
gcp_bigquery_table:
|
|
||||||
name: example_table
|
|
||||||
dataset: example_dataset
|
|
||||||
table_reference:
|
|
||||||
dataset_id: example_dataset
|
|
||||||
project_id: "{{ gcp_project }}"
|
|
||||||
table_id: example_table
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: present
|
|
||||||
register: result
|
|
||||||
- name: assert changed is false
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- result.changed == false
|
|
||||||
#----------------------------------------------------------
|
|
||||||
- name: delete a table
|
|
||||||
gcp_bigquery_table:
|
|
||||||
name: example_table
|
|
||||||
dataset: example_dataset
|
|
||||||
table_reference:
|
|
||||||
dataset_id: example_dataset
|
|
||||||
project_id: "{{ gcp_project }}"
|
|
||||||
table_id: example_table
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: absent
|
|
||||||
register: result
|
|
||||||
- name: assert changed is true
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- result.changed == true
|
|
||||||
- name: verify that table was deleted
|
|
||||||
gcp_bigquery_table_info:
|
|
||||||
dataset: example_dataset
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
scopes:
|
|
||||||
- https://www.googleapis.com/auth/bigquery
|
|
||||||
register: results
|
|
||||||
- name: verify that command succeeded
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- results['resources'] | map(attribute='tableReference') | map(attribute='tableId') | select("match", ".*example_table.*") | list | length == 0
|
|
||||||
# ----------------------------------------------------------------------------
|
|
||||||
- name: delete a table that does not exist
|
|
||||||
gcp_bigquery_table:
|
|
||||||
name: example_table
|
|
||||||
dataset: example_dataset
|
|
||||||
table_reference:
|
|
||||||
dataset_id: example_dataset
|
|
||||||
project_id: "{{ gcp_project }}"
|
|
||||||
table_id: example_table
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: absent
|
|
||||||
register: result
|
|
||||||
- name: assert changed is false
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- result.changed == false
|
|
||||||
#---------------------------------------------------------
|
|
||||||
# Post-test teardown
|
|
||||||
# If errors happen, don't crash the playbook!
|
|
||||||
- name: delete a dataset
|
|
||||||
gcp_bigquery_dataset:
|
|
||||||
name: example_dataset
|
|
||||||
dataset_reference:
|
|
||||||
dataset_id: example_dataset
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: absent
|
|
||||||
register: dataset
|
|
||||||
ignore_errors: true
|
|
||||||
|
|||||||
@ -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 cloud function
|
||||||
|
gcp_cloudfunctions_cloud_function:
|
||||||
|
name: "{{ resource_name }}"
|
||||||
|
location: us-central1
|
||||||
|
entry_point: helloGET
|
||||||
|
source_archive_url: gs://ansible-cloudfunctions-bucket/function.zip
|
||||||
|
trigger_http: 'true'
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: absent
|
||||||
|
#----------------------------------------------------------
|
||||||
|
- name: create a cloud function
|
||||||
|
gcp_cloudfunctions_cloud_function:
|
||||||
|
name: "{{ resource_name }}"
|
||||||
|
location: us-central1
|
||||||
|
entry_point: helloGET
|
||||||
|
source_archive_url: gs://ansible-cloudfunctions-bucket/function.zip
|
||||||
|
trigger_http: 'true'
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: present
|
||||||
|
register: result
|
||||||
|
- name: assert changed is true
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- result.changed == true
|
||||||
|
- name: verify that cloud_function was created
|
||||||
|
gcp_cloudfunctions_cloud_function_info:
|
||||||
|
location: 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", ".*{{ resource_name }}.*") | list | length == 1
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
- name: create a cloud function that already exists
|
||||||
|
gcp_cloudfunctions_cloud_function:
|
||||||
|
name: "{{ resource_name }}"
|
||||||
|
location: us-central1
|
||||||
|
entry_point: helloGET
|
||||||
|
source_archive_url: gs://ansible-cloudfunctions-bucket/function.zip
|
||||||
|
trigger_http: 'true'
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: present
|
||||||
|
register: result
|
||||||
|
- name: assert changed is false
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- result.changed == false
|
||||||
|
#----------------------------------------------------------
|
||||||
|
- name: delete a cloud function
|
||||||
|
gcp_cloudfunctions_cloud_function:
|
||||||
|
name: "{{ resource_name }}"
|
||||||
|
location: us-central1
|
||||||
|
entry_point: helloGET
|
||||||
|
source_archive_url: gs://ansible-cloudfunctions-bucket/function.zip
|
||||||
|
trigger_http: 'true'
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: absent
|
||||||
|
register: result
|
||||||
|
- name: assert changed is true
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- result.changed == true
|
||||||
|
- name: verify that cloud_function was deleted
|
||||||
|
gcp_cloudfunctions_cloud_function_info:
|
||||||
|
location: 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", ".*{{ resource_name }}.*") | list | length == 0
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
- name: delete a cloud function that does not exist
|
||||||
|
gcp_cloudfunctions_cloud_function:
|
||||||
|
name: "{{ resource_name }}"
|
||||||
|
location: us-central1
|
||||||
|
entry_point: helloGET
|
||||||
|
source_archive_url: gs://ansible-cloudfunctions-bucket/function.zip
|
||||||
|
trigger_http: 'true'
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: absent
|
||||||
|
register: result
|
||||||
|
- name: assert changed is false
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- result.changed == false
|
||||||
@ -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 cloud function
|
|
||||||
gcp_cloudfunctions_cloud_function:
|
|
||||||
name: "{{ resource_name }}"
|
|
||||||
location: us-central1
|
|
||||||
entry_point: helloGET
|
|
||||||
source_archive_url: gs://ansible-cloudfunctions-bucket/function.zip
|
|
||||||
trigger_http: 'true'
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: absent
|
|
||||||
#----------------------------------------------------------
|
|
||||||
- name: create a cloud function
|
|
||||||
gcp_cloudfunctions_cloud_function:
|
|
||||||
name: "{{ resource_name }}"
|
|
||||||
location: us-central1
|
|
||||||
entry_point: helloGET
|
|
||||||
source_archive_url: gs://ansible-cloudfunctions-bucket/function.zip
|
|
||||||
trigger_http: 'true'
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: present
|
|
||||||
register: result
|
|
||||||
- name: assert changed is true
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- result.changed == true
|
|
||||||
- name: verify that cloud_function was created
|
|
||||||
gcp_cloudfunctions_cloud_function_info:
|
|
||||||
location: 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", ".*{{ resource_name }}.*") | list | length == 1
|
|
||||||
# ----------------------------------------------------------------------------
|
|
||||||
- name: create a cloud function that already exists
|
|
||||||
gcp_cloudfunctions_cloud_function:
|
|
||||||
name: "{{ resource_name }}"
|
|
||||||
location: us-central1
|
|
||||||
entry_point: helloGET
|
|
||||||
source_archive_url: gs://ansible-cloudfunctions-bucket/function.zip
|
|
||||||
trigger_http: 'true'
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: present
|
|
||||||
register: result
|
|
||||||
- name: assert changed is false
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- result.changed == false
|
|
||||||
#----------------------------------------------------------
|
|
||||||
- name: delete a cloud function
|
|
||||||
gcp_cloudfunctions_cloud_function:
|
|
||||||
name: "{{ resource_name }}"
|
|
||||||
location: us-central1
|
|
||||||
entry_point: helloGET
|
|
||||||
source_archive_url: gs://ansible-cloudfunctions-bucket/function.zip
|
|
||||||
trigger_http: 'true'
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: absent
|
|
||||||
register: result
|
|
||||||
- name: assert changed is true
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- result.changed == true
|
|
||||||
- name: verify that cloud_function was deleted
|
|
||||||
gcp_cloudfunctions_cloud_function_info:
|
|
||||||
location: 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", ".*{{ resource_name }}.*") | list | length == 0
|
|
||||||
# ----------------------------------------------------------------------------
|
|
||||||
- name: delete a cloud function that does not exist
|
|
||||||
gcp_cloudfunctions_cloud_function:
|
|
||||||
name: "{{ resource_name }}"
|
|
||||||
location: us-central1
|
|
||||||
entry_point: helloGET
|
|
||||||
source_archive_url: gs://ansible-cloudfunctions-bucket/function.zip
|
|
||||||
trigger_http: 'true'
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: absent
|
|
||||||
register: result
|
|
||||||
- name: assert changed is false
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- result.changed == false
|
|
||||||
|
|||||||
@ -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: delete a job
|
||||||
|
gcp_cloudscheduler_job:
|
||||||
|
name: job
|
||||||
|
region: us-central1
|
||||||
|
schedule: "*/4 * * * *"
|
||||||
|
description: test app engine job
|
||||||
|
time_zone: Europe/London
|
||||||
|
app_engine_http_target:
|
||||||
|
http_method: POST
|
||||||
|
app_engine_routing:
|
||||||
|
service: web
|
||||||
|
version: prod
|
||||||
|
instance: my-instance-001
|
||||||
|
relative_uri: "/ping"
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: absent
|
||||||
|
#----------------------------------------------------------
|
||||||
|
- name: create a job
|
||||||
|
gcp_cloudscheduler_job:
|
||||||
|
name: job
|
||||||
|
region: us-central1
|
||||||
|
schedule: "*/4 * * * *"
|
||||||
|
description: test app engine job
|
||||||
|
time_zone: Europe/London
|
||||||
|
app_engine_http_target:
|
||||||
|
http_method: POST
|
||||||
|
app_engine_routing:
|
||||||
|
service: web
|
||||||
|
version: prod
|
||||||
|
instance: my-instance-001
|
||||||
|
relative_uri: "/ping"
|
||||||
|
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 job was created
|
||||||
|
gcp_cloudscheduler_job_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", ".*job.*") | list | length == 1
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
- name: create a job that already exists
|
||||||
|
gcp_cloudscheduler_job:
|
||||||
|
name: job
|
||||||
|
region: us-central1
|
||||||
|
schedule: "*/4 * * * *"
|
||||||
|
description: test app engine job
|
||||||
|
time_zone: Europe/London
|
||||||
|
app_engine_http_target:
|
||||||
|
http_method: POST
|
||||||
|
app_engine_routing:
|
||||||
|
service: web
|
||||||
|
version: prod
|
||||||
|
instance: my-instance-001
|
||||||
|
relative_uri: "/ping"
|
||||||
|
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 job
|
||||||
|
gcp_cloudscheduler_job:
|
||||||
|
name: job
|
||||||
|
region: us-central1
|
||||||
|
schedule: "*/4 * * * *"
|
||||||
|
description: test app engine job
|
||||||
|
time_zone: Europe/London
|
||||||
|
app_engine_http_target:
|
||||||
|
http_method: POST
|
||||||
|
app_engine_routing:
|
||||||
|
service: web
|
||||||
|
version: prod
|
||||||
|
instance: my-instance-001
|
||||||
|
relative_uri: "/ping"
|
||||||
|
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 job was deleted
|
||||||
|
gcp_cloudscheduler_job_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", ".*job.*") | list | length == 0
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
- name: delete a job that does not exist
|
||||||
|
gcp_cloudscheduler_job:
|
||||||
|
name: job
|
||||||
|
region: us-central1
|
||||||
|
schedule: "*/4 * * * *"
|
||||||
|
description: test app engine job
|
||||||
|
time_zone: Europe/London
|
||||||
|
app_engine_http_target:
|
||||||
|
http_method: POST
|
||||||
|
app_engine_routing:
|
||||||
|
service: web
|
||||||
|
version: prod
|
||||||
|
instance: my-instance-001
|
||||||
|
relative_uri: "/ping"
|
||||||
|
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,155 +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 job
|
|
||||||
gcp_cloudscheduler_job:
|
|
||||||
name: job
|
|
||||||
region: us-central1
|
|
||||||
schedule: "*/4 * * * *"
|
|
||||||
description: test app engine job
|
|
||||||
time_zone: Europe/London
|
|
||||||
app_engine_http_target:
|
|
||||||
http_method: POST
|
|
||||||
app_engine_routing:
|
|
||||||
service: web
|
|
||||||
version: prod
|
|
||||||
instance: my-instance-001
|
|
||||||
relative_uri: "/ping"
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: absent
|
|
||||||
#----------------------------------------------------------
|
|
||||||
- name: create a job
|
|
||||||
gcp_cloudscheduler_job:
|
|
||||||
name: job
|
|
||||||
region: us-central1
|
|
||||||
schedule: "*/4 * * * *"
|
|
||||||
description: test app engine job
|
|
||||||
time_zone: Europe/London
|
|
||||||
app_engine_http_target:
|
|
||||||
http_method: POST
|
|
||||||
app_engine_routing:
|
|
||||||
service: web
|
|
||||||
version: prod
|
|
||||||
instance: my-instance-001
|
|
||||||
relative_uri: "/ping"
|
|
||||||
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 job was created
|
|
||||||
gcp_cloudscheduler_job_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", ".*job.*") | list | length == 1
|
|
||||||
# ----------------------------------------------------------------------------
|
|
||||||
- name: create a job that already exists
|
|
||||||
gcp_cloudscheduler_job:
|
|
||||||
name: job
|
|
||||||
region: us-central1
|
|
||||||
schedule: "*/4 * * * *"
|
|
||||||
description: test app engine job
|
|
||||||
time_zone: Europe/London
|
|
||||||
app_engine_http_target:
|
|
||||||
http_method: POST
|
|
||||||
app_engine_routing:
|
|
||||||
service: web
|
|
||||||
version: prod
|
|
||||||
instance: my-instance-001
|
|
||||||
relative_uri: "/ping"
|
|
||||||
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 job
|
|
||||||
gcp_cloudscheduler_job:
|
|
||||||
name: job
|
|
||||||
region: us-central1
|
|
||||||
schedule: "*/4 * * * *"
|
|
||||||
description: test app engine job
|
|
||||||
time_zone: Europe/London
|
|
||||||
app_engine_http_target:
|
|
||||||
http_method: POST
|
|
||||||
app_engine_routing:
|
|
||||||
service: web
|
|
||||||
version: prod
|
|
||||||
instance: my-instance-001
|
|
||||||
relative_uri: "/ping"
|
|
||||||
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 job was deleted
|
|
||||||
gcp_cloudscheduler_job_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", ".*job.*") | list | length == 0
|
|
||||||
# ----------------------------------------------------------------------------
|
|
||||||
- name: delete a job that does not exist
|
|
||||||
gcp_cloudscheduler_job:
|
|
||||||
name: job
|
|
||||||
region: us-central1
|
|
||||||
schedule: "*/4 * * * *"
|
|
||||||
description: test app engine job
|
|
||||||
time_zone: Europe/London
|
|
||||||
app_engine_http_target:
|
|
||||||
http_method: POST
|
|
||||||
app_engine_routing:
|
|
||||||
service: web
|
|
||||||
version: prod
|
|
||||||
instance: my-instance-001
|
|
||||||
relative_uri: "/ping"
|
|
||||||
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,105 @@
|
|||||||
|
---
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
#
|
||||||
|
# *** 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 queue
|
||||||
|
gcp_cloudtasks_queue:
|
||||||
|
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 queue
|
||||||
|
gcp_cloudtasks_queue:
|
||||||
|
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 queue was created
|
||||||
|
gcp_cloudtasks_queue_info:
|
||||||
|
location: 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", ".*{{ resource_name }}.*") | list | length == 1
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
- name: create a queue that already exists
|
||||||
|
gcp_cloudtasks_queue:
|
||||||
|
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
|
||||||
|
#----------------------------------------------------------
|
||||||
|
- name: delete a queue
|
||||||
|
gcp_cloudtasks_queue:
|
||||||
|
name: "{{ resource_name }}"
|
||||||
|
location: 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 queue was deleted
|
||||||
|
gcp_cloudtasks_queue_info:
|
||||||
|
location: 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", ".*{{ resource_name }}.*") | list | length == 0
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
- name: delete a queue that does not exist
|
||||||
|
gcp_cloudtasks_queue:
|
||||||
|
name: "{{ resource_name }}"
|
||||||
|
location: 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,105 +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 queue
|
|
||||||
gcp_cloudtasks_queue:
|
|
||||||
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 queue
|
|
||||||
gcp_cloudtasks_queue:
|
|
||||||
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 queue was created
|
|
||||||
gcp_cloudtasks_queue_info:
|
|
||||||
location: 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", ".*{{ resource_name }}.*") | list | length == 1
|
|
||||||
# ----------------------------------------------------------------------------
|
|
||||||
- name: create a queue that already exists
|
|
||||||
gcp_cloudtasks_queue:
|
|
||||||
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
|
|
||||||
#----------------------------------------------------------
|
|
||||||
- name: delete a queue
|
|
||||||
gcp_cloudtasks_queue:
|
|
||||||
name: "{{ resource_name }}"
|
|
||||||
location: 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 queue was deleted
|
|
||||||
gcp_cloudtasks_queue_info:
|
|
||||||
location: 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", ".*{{ resource_name }}.*") | list | length == 0
|
|
||||||
# ----------------------------------------------------------------------------
|
|
||||||
- name: delete a queue that does not exist
|
|
||||||
gcp_cloudtasks_queue:
|
|
||||||
name: "{{ resource_name }}"
|
|
||||||
location: 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,109 @@
|
|||||||
|
---
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
#
|
||||||
|
# *** 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 address
|
||||||
|
gcp_compute_address:
|
||||||
|
name: test-address1
|
||||||
|
region: us-west1
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: absent
|
||||||
|
#----------------------------------------------------------
|
||||||
|
- name: create a address
|
||||||
|
gcp_compute_address:
|
||||||
|
name: test-address1
|
||||||
|
region: us-west1
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: present
|
||||||
|
register: result
|
||||||
|
- name: assert changed is true
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- result.changed == true
|
||||||
|
- name: verify that address was created
|
||||||
|
gcp_compute_address_info:
|
||||||
|
filters:
|
||||||
|
- name = test-address1
|
||||||
|
region: us-west1
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
scopes:
|
||||||
|
- https://www.googleapis.com/auth/compute
|
||||||
|
register: results
|
||||||
|
- name: verify that command succeeded
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- results['resources'] | length == 1
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
- name: create a address that already exists
|
||||||
|
gcp_compute_address:
|
||||||
|
name: test-address1
|
||||||
|
region: us-west1
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: present
|
||||||
|
register: result
|
||||||
|
- name: assert changed is false
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- result.changed == false
|
||||||
|
#----------------------------------------------------------
|
||||||
|
- name: delete a address
|
||||||
|
gcp_compute_address:
|
||||||
|
name: test-address1
|
||||||
|
region: us-west1
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: absent
|
||||||
|
register: result
|
||||||
|
- name: assert changed is true
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- result.changed == true
|
||||||
|
- name: verify that address was deleted
|
||||||
|
gcp_compute_address_info:
|
||||||
|
filters:
|
||||||
|
- name = test-address1
|
||||||
|
region: us-west1
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
scopes:
|
||||||
|
- https://www.googleapis.com/auth/compute
|
||||||
|
register: results
|
||||||
|
- name: verify that command succeeded
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- results['resources'] | length == 0
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
- name: delete a address that does not exist
|
||||||
|
gcp_compute_address:
|
||||||
|
name: test-address1
|
||||||
|
region: us-west1
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: absent
|
||||||
|
register: result
|
||||||
|
- name: assert changed is false
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- result.changed == false
|
||||||
@ -1,109 +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 address
|
|
||||||
gcp_compute_address:
|
|
||||||
name: test-address1
|
|
||||||
region: us-west1
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: absent
|
|
||||||
#----------------------------------------------------------
|
|
||||||
- name: create a address
|
|
||||||
gcp_compute_address:
|
|
||||||
name: test-address1
|
|
||||||
region: us-west1
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: present
|
|
||||||
register: result
|
|
||||||
- name: assert changed is true
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- result.changed == true
|
|
||||||
- name: verify that address was created
|
|
||||||
gcp_compute_address_info:
|
|
||||||
filters:
|
|
||||||
- name = test-address1
|
|
||||||
region: us-west1
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
scopes:
|
|
||||||
- https://www.googleapis.com/auth/compute
|
|
||||||
register: results
|
|
||||||
- name: verify that command succeeded
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- results['resources'] | length == 1
|
|
||||||
# ----------------------------------------------------------------------------
|
|
||||||
- name: create a address that already exists
|
|
||||||
gcp_compute_address:
|
|
||||||
name: test-address1
|
|
||||||
region: us-west1
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: present
|
|
||||||
register: result
|
|
||||||
- name: assert changed is false
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- result.changed == false
|
|
||||||
#----------------------------------------------------------
|
|
||||||
- name: delete a address
|
|
||||||
gcp_compute_address:
|
|
||||||
name: test-address1
|
|
||||||
region: us-west1
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: absent
|
|
||||||
register: result
|
|
||||||
- name: assert changed is true
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- result.changed == true
|
|
||||||
- name: verify that address was deleted
|
|
||||||
gcp_compute_address_info:
|
|
||||||
filters:
|
|
||||||
- name = test-address1
|
|
||||||
region: us-west1
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
scopes:
|
|
||||||
- https://www.googleapis.com/auth/compute
|
|
||||||
register: results
|
|
||||||
- name: verify that command succeeded
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- results['resources'] | length == 0
|
|
||||||
# ----------------------------------------------------------------------------
|
|
||||||
- name: delete a address that does not exist
|
|
||||||
gcp_compute_address:
|
|
||||||
name: test-address1
|
|
||||||
region: us-west1
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: absent
|
|
||||||
register: result
|
|
||||||
- name: assert changed is false
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- result.changed == false
|
|
||||||
|
|||||||
@ -0,0 +1,251 @@
|
|||||||
|
---
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
#
|
||||||
|
# *** 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-instancetemplate
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: present
|
||||||
|
register: network
|
||||||
|
- name: create a address
|
||||||
|
gcp_compute_address:
|
||||||
|
name: address-instancetemplate
|
||||||
|
region: us-central1
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: present
|
||||||
|
register: address
|
||||||
|
- name: create a instance template
|
||||||
|
gcp_compute_instance_template:
|
||||||
|
name: "{{ resource_name }}"
|
||||||
|
properties:
|
||||||
|
disks:
|
||||||
|
- auto_delete: 'true'
|
||||||
|
boot: 'true'
|
||||||
|
initialize_params:
|
||||||
|
source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-1604-lts
|
||||||
|
machine_type: n1-standard-1
|
||||||
|
network_interfaces:
|
||||||
|
- network: "{{ network }}"
|
||||||
|
access_configs:
|
||||||
|
- name: test-config
|
||||||
|
type: ONE_TO_ONE_NAT
|
||||||
|
nat_ip: "{{ address }}"
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: present
|
||||||
|
register: instancetemplate
|
||||||
|
- name: create a instance group manager
|
||||||
|
gcp_compute_instance_group_manager:
|
||||||
|
name: "{{ resource_name }}"
|
||||||
|
base_instance_name: test1-child
|
||||||
|
instance_template: "{{ instancetemplate }}"
|
||||||
|
target_size: 3
|
||||||
|
zone: us-central1-a
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: present
|
||||||
|
register: igm
|
||||||
|
- name: delete a autoscaler
|
||||||
|
gcp_compute_autoscaler:
|
||||||
|
name: "{{ resource_name }}"
|
||||||
|
zone: us-central1-a
|
||||||
|
target: "{{ igm }}"
|
||||||
|
autoscaling_policy:
|
||||||
|
max_num_replicas: 5
|
||||||
|
min_num_replicas: 1
|
||||||
|
cool_down_period_sec: 60
|
||||||
|
cpu_utilization:
|
||||||
|
utilization_target: 0.5
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: absent
|
||||||
|
#----------------------------------------------------------
|
||||||
|
- name: create a autoscaler
|
||||||
|
gcp_compute_autoscaler:
|
||||||
|
name: "{{ resource_name }}"
|
||||||
|
zone: us-central1-a
|
||||||
|
target: "{{ igm }}"
|
||||||
|
autoscaling_policy:
|
||||||
|
max_num_replicas: 5
|
||||||
|
min_num_replicas: 1
|
||||||
|
cool_down_period_sec: 60
|
||||||
|
cpu_utilization:
|
||||||
|
utilization_target: 0.5
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: present
|
||||||
|
register: result
|
||||||
|
- name: assert changed is true
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- result.changed == true
|
||||||
|
- name: verify that autoscaler was created
|
||||||
|
gcp_compute_autoscaler_info:
|
||||||
|
filters:
|
||||||
|
- name = {{ resource_name }}
|
||||||
|
zone: us-central1-a
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
scopes:
|
||||||
|
- https://www.googleapis.com/auth/compute
|
||||||
|
register: results
|
||||||
|
- name: verify that command succeeded
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- results['resources'] | length == 1
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
- name: create a autoscaler that already exists
|
||||||
|
gcp_compute_autoscaler:
|
||||||
|
name: "{{ resource_name }}"
|
||||||
|
zone: us-central1-a
|
||||||
|
target: "{{ igm }}"
|
||||||
|
autoscaling_policy:
|
||||||
|
max_num_replicas: 5
|
||||||
|
min_num_replicas: 1
|
||||||
|
cool_down_period_sec: 60
|
||||||
|
cpu_utilization:
|
||||||
|
utilization_target: 0.5
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: present
|
||||||
|
register: result
|
||||||
|
- name: assert changed is false
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- result.changed == false
|
||||||
|
#----------------------------------------------------------
|
||||||
|
- name: delete a autoscaler
|
||||||
|
gcp_compute_autoscaler:
|
||||||
|
name: "{{ resource_name }}"
|
||||||
|
zone: us-central1-a
|
||||||
|
target: "{{ igm }}"
|
||||||
|
autoscaling_policy:
|
||||||
|
max_num_replicas: 5
|
||||||
|
min_num_replicas: 1
|
||||||
|
cool_down_period_sec: 60
|
||||||
|
cpu_utilization:
|
||||||
|
utilization_target: 0.5
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: absent
|
||||||
|
register: result
|
||||||
|
- name: assert changed is true
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- result.changed == true
|
||||||
|
- name: verify that autoscaler was deleted
|
||||||
|
gcp_compute_autoscaler_info:
|
||||||
|
filters:
|
||||||
|
- name = {{ resource_name }}
|
||||||
|
zone: us-central1-a
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
scopes:
|
||||||
|
- https://www.googleapis.com/auth/compute
|
||||||
|
register: results
|
||||||
|
- name: verify that command succeeded
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- results['resources'] | length == 0
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
- name: delete a autoscaler that does not exist
|
||||||
|
gcp_compute_autoscaler:
|
||||||
|
name: "{{ resource_name }}"
|
||||||
|
zone: us-central1-a
|
||||||
|
target: "{{ igm }}"
|
||||||
|
autoscaling_policy:
|
||||||
|
max_num_replicas: 5
|
||||||
|
min_num_replicas: 1
|
||||||
|
cool_down_period_sec: 60
|
||||||
|
cpu_utilization:
|
||||||
|
utilization_target: 0.5
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: absent
|
||||||
|
register: result
|
||||||
|
- name: assert changed is false
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- result.changed == false
|
||||||
|
#---------------------------------------------------------
|
||||||
|
# Post-test teardown
|
||||||
|
# If errors happen, don't crash the playbook!
|
||||||
|
- name: delete a instance group manager
|
||||||
|
gcp_compute_instance_group_manager:
|
||||||
|
name: "{{ resource_name }}"
|
||||||
|
base_instance_name: test1-child
|
||||||
|
instance_template: "{{ instancetemplate }}"
|
||||||
|
target_size: 3
|
||||||
|
zone: us-central1-a
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: absent
|
||||||
|
register: igm
|
||||||
|
ignore_errors: true
|
||||||
|
- name: delete a instance template
|
||||||
|
gcp_compute_instance_template:
|
||||||
|
name: "{{ resource_name }}"
|
||||||
|
properties:
|
||||||
|
disks:
|
||||||
|
- auto_delete: 'true'
|
||||||
|
boot: 'true'
|
||||||
|
initialize_params:
|
||||||
|
source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-1604-lts
|
||||||
|
machine_type: n1-standard-1
|
||||||
|
network_interfaces:
|
||||||
|
- network: "{{ network }}"
|
||||||
|
access_configs:
|
||||||
|
- name: test-config
|
||||||
|
type: ONE_TO_ONE_NAT
|
||||||
|
nat_ip: "{{ address }}"
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: absent
|
||||||
|
register: instancetemplate
|
||||||
|
ignore_errors: true
|
||||||
|
- name: delete a address
|
||||||
|
gcp_compute_address:
|
||||||
|
name: address-instancetemplate
|
||||||
|
region: us-central1
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: absent
|
||||||
|
register: address
|
||||||
|
ignore_errors: true
|
||||||
|
- name: delete a network
|
||||||
|
gcp_compute_network:
|
||||||
|
name: network-instancetemplate
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: absent
|
||||||
|
register: network
|
||||||
|
ignore_errors: true
|
||||||
@ -1,251 +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 network
|
|
||||||
gcp_compute_network:
|
|
||||||
name: network-instancetemplate
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: present
|
|
||||||
register: network
|
|
||||||
- name: create a address
|
|
||||||
gcp_compute_address:
|
|
||||||
name: address-instancetemplate
|
|
||||||
region: us-central1
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: present
|
|
||||||
register: address
|
|
||||||
- name: create a instance template
|
|
||||||
gcp_compute_instance_template:
|
|
||||||
name: "{{ resource_name }}"
|
|
||||||
properties:
|
|
||||||
disks:
|
|
||||||
- auto_delete: 'true'
|
|
||||||
boot: 'true'
|
|
||||||
initialize_params:
|
|
||||||
source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-1604-lts
|
|
||||||
machine_type: n1-standard-1
|
|
||||||
network_interfaces:
|
|
||||||
- network: "{{ network }}"
|
|
||||||
access_configs:
|
|
||||||
- name: test-config
|
|
||||||
type: ONE_TO_ONE_NAT
|
|
||||||
nat_ip: "{{ address }}"
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: present
|
|
||||||
register: instancetemplate
|
|
||||||
- name: create a instance group manager
|
|
||||||
gcp_compute_instance_group_manager:
|
|
||||||
name: "{{ resource_name }}"
|
|
||||||
base_instance_name: test1-child
|
|
||||||
instance_template: "{{ instancetemplate }}"
|
|
||||||
target_size: 3
|
|
||||||
zone: us-central1-a
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: present
|
|
||||||
register: igm
|
|
||||||
- name: delete a autoscaler
|
|
||||||
gcp_compute_autoscaler:
|
|
||||||
name: "{{ resource_name }}"
|
|
||||||
zone: us-central1-a
|
|
||||||
target: "{{ igm }}"
|
|
||||||
autoscaling_policy:
|
|
||||||
max_num_replicas: 5
|
|
||||||
min_num_replicas: 1
|
|
||||||
cool_down_period_sec: 60
|
|
||||||
cpu_utilization:
|
|
||||||
utilization_target: 0.5
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: absent
|
|
||||||
#----------------------------------------------------------
|
|
||||||
- name: create a autoscaler
|
|
||||||
gcp_compute_autoscaler:
|
|
||||||
name: "{{ resource_name }}"
|
|
||||||
zone: us-central1-a
|
|
||||||
target: "{{ igm }}"
|
|
||||||
autoscaling_policy:
|
|
||||||
max_num_replicas: 5
|
|
||||||
min_num_replicas: 1
|
|
||||||
cool_down_period_sec: 60
|
|
||||||
cpu_utilization:
|
|
||||||
utilization_target: 0.5
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: present
|
|
||||||
register: result
|
|
||||||
- name: assert changed is true
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- result.changed == true
|
|
||||||
- name: verify that autoscaler was created
|
|
||||||
gcp_compute_autoscaler_info:
|
|
||||||
filters:
|
|
||||||
- name = {{ resource_name }}
|
|
||||||
zone: us-central1-a
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
scopes:
|
|
||||||
- https://www.googleapis.com/auth/compute
|
|
||||||
register: results
|
|
||||||
- name: verify that command succeeded
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- results['resources'] | length == 1
|
|
||||||
# ----------------------------------------------------------------------------
|
|
||||||
- name: create a autoscaler that already exists
|
|
||||||
gcp_compute_autoscaler:
|
|
||||||
name: "{{ resource_name }}"
|
|
||||||
zone: us-central1-a
|
|
||||||
target: "{{ igm }}"
|
|
||||||
autoscaling_policy:
|
|
||||||
max_num_replicas: 5
|
|
||||||
min_num_replicas: 1
|
|
||||||
cool_down_period_sec: 60
|
|
||||||
cpu_utilization:
|
|
||||||
utilization_target: 0.5
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: present
|
|
||||||
register: result
|
|
||||||
- name: assert changed is false
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- result.changed == false
|
|
||||||
#----------------------------------------------------------
|
|
||||||
- name: delete a autoscaler
|
|
||||||
gcp_compute_autoscaler:
|
|
||||||
name: "{{ resource_name }}"
|
|
||||||
zone: us-central1-a
|
|
||||||
target: "{{ igm }}"
|
|
||||||
autoscaling_policy:
|
|
||||||
max_num_replicas: 5
|
|
||||||
min_num_replicas: 1
|
|
||||||
cool_down_period_sec: 60
|
|
||||||
cpu_utilization:
|
|
||||||
utilization_target: 0.5
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: absent
|
|
||||||
register: result
|
|
||||||
- name: assert changed is true
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- result.changed == true
|
|
||||||
- name: verify that autoscaler was deleted
|
|
||||||
gcp_compute_autoscaler_info:
|
|
||||||
filters:
|
|
||||||
- name = {{ resource_name }}
|
|
||||||
zone: us-central1-a
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
scopes:
|
|
||||||
- https://www.googleapis.com/auth/compute
|
|
||||||
register: results
|
|
||||||
- name: verify that command succeeded
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- results['resources'] | length == 0
|
|
||||||
# ----------------------------------------------------------------------------
|
|
||||||
- name: delete a autoscaler that does not exist
|
|
||||||
gcp_compute_autoscaler:
|
|
||||||
name: "{{ resource_name }}"
|
|
||||||
zone: us-central1-a
|
|
||||||
target: "{{ igm }}"
|
|
||||||
autoscaling_policy:
|
|
||||||
max_num_replicas: 5
|
|
||||||
min_num_replicas: 1
|
|
||||||
cool_down_period_sec: 60
|
|
||||||
cpu_utilization:
|
|
||||||
utilization_target: 0.5
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: absent
|
|
||||||
register: result
|
|
||||||
- name: assert changed is false
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- result.changed == false
|
|
||||||
#---------------------------------------------------------
|
|
||||||
# Post-test teardown
|
|
||||||
# If errors happen, don't crash the playbook!
|
|
||||||
- name: delete a instance group manager
|
|
||||||
gcp_compute_instance_group_manager:
|
|
||||||
name: "{{ resource_name }}"
|
|
||||||
base_instance_name: test1-child
|
|
||||||
instance_template: "{{ instancetemplate }}"
|
|
||||||
target_size: 3
|
|
||||||
zone: us-central1-a
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: absent
|
|
||||||
register: igm
|
|
||||||
ignore_errors: true
|
|
||||||
- name: delete a instance template
|
|
||||||
gcp_compute_instance_template:
|
|
||||||
name: "{{ resource_name }}"
|
|
||||||
properties:
|
|
||||||
disks:
|
|
||||||
- auto_delete: 'true'
|
|
||||||
boot: 'true'
|
|
||||||
initialize_params:
|
|
||||||
source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-1604-lts
|
|
||||||
machine_type: n1-standard-1
|
|
||||||
network_interfaces:
|
|
||||||
- network: "{{ network }}"
|
|
||||||
access_configs:
|
|
||||||
- name: test-config
|
|
||||||
type: ONE_TO_ONE_NAT
|
|
||||||
nat_ip: "{{ address }}"
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: absent
|
|
||||||
register: instancetemplate
|
|
||||||
ignore_errors: true
|
|
||||||
- name: delete a address
|
|
||||||
gcp_compute_address:
|
|
||||||
name: address-instancetemplate
|
|
||||||
region: us-central1
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: absent
|
|
||||||
register: address
|
|
||||||
ignore_errors: true
|
|
||||||
- name: delete a network
|
|
||||||
gcp_compute_network:
|
|
||||||
name: network-instancetemplate
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: absent
|
|
||||||
register: network
|
|
||||||
ignore_errors: true
|
|
||||||
|
|||||||
@ -0,0 +1,137 @@
|
|||||||
|
---
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
#
|
||||||
|
# *** 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: bucket-backendbucket
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: present
|
||||||
|
register: bucket
|
||||||
|
- name: delete a backend bucket
|
||||||
|
gcp_compute_backend_bucket:
|
||||||
|
name: "{{ resource_name }}"
|
||||||
|
bucket_name: "{{ bucket.name }}"
|
||||||
|
description: A BackendBucket to connect LNB w/ Storage Bucket
|
||||||
|
enable_cdn: 'true'
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: absent
|
||||||
|
#----------------------------------------------------------
|
||||||
|
- name: create a backend bucket
|
||||||
|
gcp_compute_backend_bucket:
|
||||||
|
name: "{{ resource_name }}"
|
||||||
|
bucket_name: "{{ bucket.name }}"
|
||||||
|
description: A BackendBucket to connect LNB w/ Storage Bucket
|
||||||
|
enable_cdn: 'true'
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: present
|
||||||
|
register: result
|
||||||
|
- name: assert changed is true
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- result.changed == true
|
||||||
|
- name: verify that backend_bucket was created
|
||||||
|
gcp_compute_backend_bucket_info:
|
||||||
|
filters:
|
||||||
|
- name = {{ resource_name }}
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
scopes:
|
||||||
|
- https://www.googleapis.com/auth/compute
|
||||||
|
register: results
|
||||||
|
- name: verify that command succeeded
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- results['resources'] | length == 1
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
- name: create a backend bucket that already exists
|
||||||
|
gcp_compute_backend_bucket:
|
||||||
|
name: "{{ resource_name }}"
|
||||||
|
bucket_name: "{{ bucket.name }}"
|
||||||
|
description: A BackendBucket to connect LNB w/ Storage Bucket
|
||||||
|
enable_cdn: 'true'
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: present
|
||||||
|
register: result
|
||||||
|
- name: assert changed is false
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- result.changed == false
|
||||||
|
#----------------------------------------------------------
|
||||||
|
- name: delete a backend bucket
|
||||||
|
gcp_compute_backend_bucket:
|
||||||
|
name: "{{ resource_name }}"
|
||||||
|
bucket_name: "{{ bucket.name }}"
|
||||||
|
description: A BackendBucket to connect LNB w/ Storage Bucket
|
||||||
|
enable_cdn: 'true'
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: absent
|
||||||
|
register: result
|
||||||
|
- name: assert changed is true
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- result.changed == true
|
||||||
|
- name: verify that backend_bucket was deleted
|
||||||
|
gcp_compute_backend_bucket_info:
|
||||||
|
filters:
|
||||||
|
- name = {{ resource_name }}
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
scopes:
|
||||||
|
- https://www.googleapis.com/auth/compute
|
||||||
|
register: results
|
||||||
|
- name: verify that command succeeded
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- results['resources'] | length == 0
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
- name: delete a backend bucket that does not exist
|
||||||
|
gcp_compute_backend_bucket:
|
||||||
|
name: "{{ resource_name }}"
|
||||||
|
bucket_name: "{{ bucket.name }}"
|
||||||
|
description: A BackendBucket to connect LNB w/ Storage Bucket
|
||||||
|
enable_cdn: 'true'
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: absent
|
||||||
|
register: result
|
||||||
|
- name: assert changed is false
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- result.changed == false
|
||||||
|
#---------------------------------------------------------
|
||||||
|
# Post-test teardown
|
||||||
|
# If errors happen, don't crash the playbook!
|
||||||
|
- name: delete a bucket
|
||||||
|
gcp_storage_bucket:
|
||||||
|
name: bucket-backendbucket
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: absent
|
||||||
|
register: bucket
|
||||||
|
ignore_errors: true
|
||||||
@ -1,137 +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: bucket-backendbucket
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: present
|
|
||||||
register: bucket
|
|
||||||
- name: delete a backend bucket
|
|
||||||
gcp_compute_backend_bucket:
|
|
||||||
name: "{{ resource_name }}"
|
|
||||||
bucket_name: "{{ bucket.name }}"
|
|
||||||
description: A BackendBucket to connect LNB w/ Storage Bucket
|
|
||||||
enable_cdn: 'true'
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: absent
|
|
||||||
#----------------------------------------------------------
|
|
||||||
- name: create a backend bucket
|
|
||||||
gcp_compute_backend_bucket:
|
|
||||||
name: "{{ resource_name }}"
|
|
||||||
bucket_name: "{{ bucket.name }}"
|
|
||||||
description: A BackendBucket to connect LNB w/ Storage Bucket
|
|
||||||
enable_cdn: 'true'
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: present
|
|
||||||
register: result
|
|
||||||
- name: assert changed is true
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- result.changed == true
|
|
||||||
- name: verify that backend_bucket was created
|
|
||||||
gcp_compute_backend_bucket_info:
|
|
||||||
filters:
|
|
||||||
- name = {{ resource_name }}
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
scopes:
|
|
||||||
- https://www.googleapis.com/auth/compute
|
|
||||||
register: results
|
|
||||||
- name: verify that command succeeded
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- results['resources'] | length == 1
|
|
||||||
# ----------------------------------------------------------------------------
|
|
||||||
- name: create a backend bucket that already exists
|
|
||||||
gcp_compute_backend_bucket:
|
|
||||||
name: "{{ resource_name }}"
|
|
||||||
bucket_name: "{{ bucket.name }}"
|
|
||||||
description: A BackendBucket to connect LNB w/ Storage Bucket
|
|
||||||
enable_cdn: 'true'
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: present
|
|
||||||
register: result
|
|
||||||
- name: assert changed is false
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- result.changed == false
|
|
||||||
#----------------------------------------------------------
|
|
||||||
- name: delete a backend bucket
|
|
||||||
gcp_compute_backend_bucket:
|
|
||||||
name: "{{ resource_name }}"
|
|
||||||
bucket_name: "{{ bucket.name }}"
|
|
||||||
description: A BackendBucket to connect LNB w/ Storage Bucket
|
|
||||||
enable_cdn: 'true'
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: absent
|
|
||||||
register: result
|
|
||||||
- name: assert changed is true
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- result.changed == true
|
|
||||||
- name: verify that backend_bucket was deleted
|
|
||||||
gcp_compute_backend_bucket_info:
|
|
||||||
filters:
|
|
||||||
- name = {{ resource_name }}
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
scopes:
|
|
||||||
- https://www.googleapis.com/auth/compute
|
|
||||||
register: results
|
|
||||||
- name: verify that command succeeded
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- results['resources'] | length == 0
|
|
||||||
# ----------------------------------------------------------------------------
|
|
||||||
- name: delete a backend bucket that does not exist
|
|
||||||
gcp_compute_backend_bucket:
|
|
||||||
name: "{{ resource_name }}"
|
|
||||||
bucket_name: "{{ bucket.name }}"
|
|
||||||
description: A BackendBucket to connect LNB w/ Storage Bucket
|
|
||||||
enable_cdn: 'true'
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: absent
|
|
||||||
register: result
|
|
||||||
- name: assert changed is false
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- result.changed == false
|
|
||||||
#---------------------------------------------------------
|
|
||||||
# Post-test teardown
|
|
||||||
# If errors happen, don't crash the playbook!
|
|
||||||
- name: delete a bucket
|
|
||||||
gcp_storage_bucket:
|
|
||||||
name: bucket-backendbucket
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: absent
|
|
||||||
register: bucket
|
|
||||||
ignore_errors: true
|
|
||||||
|
|||||||
@ -0,0 +1,174 @@
|
|||||||
|
---
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
#
|
||||||
|
# *** 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 group
|
||||||
|
gcp_compute_instance_group:
|
||||||
|
name: instancegroup-backendservice
|
||||||
|
zone: us-central1-a
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: present
|
||||||
|
register: instancegroup
|
||||||
|
- name: create a HTTP health check
|
||||||
|
gcp_compute_http_health_check:
|
||||||
|
name: httphealthcheck-backendservice
|
||||||
|
healthy_threshold: 10
|
||||||
|
port: 8080
|
||||||
|
timeout_sec: 2
|
||||||
|
unhealthy_threshold: 5
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: present
|
||||||
|
register: healthcheck
|
||||||
|
- name: delete a backend service
|
||||||
|
gcp_compute_backend_service:
|
||||||
|
name: "{{ resource_name }}"
|
||||||
|
backends:
|
||||||
|
- group: "{{ instancegroup.selfLink }}"
|
||||||
|
health_checks:
|
||||||
|
- "{{ healthcheck.selfLink }}"
|
||||||
|
enable_cdn: 'true'
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: absent
|
||||||
|
#----------------------------------------------------------
|
||||||
|
- name: create a backend service
|
||||||
|
gcp_compute_backend_service:
|
||||||
|
name: "{{ resource_name }}"
|
||||||
|
backends:
|
||||||
|
- group: "{{ instancegroup.selfLink }}"
|
||||||
|
health_checks:
|
||||||
|
- "{{ healthcheck.selfLink }}"
|
||||||
|
enable_cdn: 'true'
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: present
|
||||||
|
register: result
|
||||||
|
- name: assert changed is true
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- result.changed == true
|
||||||
|
- name: verify that backend_service was created
|
||||||
|
gcp_compute_backend_service_info:
|
||||||
|
filters:
|
||||||
|
- name = {{ resource_name }}
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
scopes:
|
||||||
|
- https://www.googleapis.com/auth/compute
|
||||||
|
register: results
|
||||||
|
- name: verify that command succeeded
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- results['resources'] | length == 1
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
- name: create a backend service that already exists
|
||||||
|
gcp_compute_backend_service:
|
||||||
|
name: "{{ resource_name }}"
|
||||||
|
backends:
|
||||||
|
- group: "{{ instancegroup.selfLink }}"
|
||||||
|
health_checks:
|
||||||
|
- "{{ healthcheck.selfLink }}"
|
||||||
|
enable_cdn: 'true'
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: present
|
||||||
|
register: result
|
||||||
|
- name: assert changed is false
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- result.changed == false
|
||||||
|
#----------------------------------------------------------
|
||||||
|
- name: delete a backend service
|
||||||
|
gcp_compute_backend_service:
|
||||||
|
name: "{{ resource_name }}"
|
||||||
|
backends:
|
||||||
|
- group: "{{ instancegroup.selfLink }}"
|
||||||
|
health_checks:
|
||||||
|
- "{{ healthcheck.selfLink }}"
|
||||||
|
enable_cdn: 'true'
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: absent
|
||||||
|
register: result
|
||||||
|
- name: assert changed is true
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- result.changed == true
|
||||||
|
- name: verify that backend_service was deleted
|
||||||
|
gcp_compute_backend_service_info:
|
||||||
|
filters:
|
||||||
|
- name = {{ resource_name }}
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
scopes:
|
||||||
|
- https://www.googleapis.com/auth/compute
|
||||||
|
register: results
|
||||||
|
- name: verify that command succeeded
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- results['resources'] | length == 0
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
- name: delete a backend service that does not exist
|
||||||
|
gcp_compute_backend_service:
|
||||||
|
name: "{{ resource_name }}"
|
||||||
|
backends:
|
||||||
|
- group: "{{ instancegroup.selfLink }}"
|
||||||
|
health_checks:
|
||||||
|
- "{{ healthcheck.selfLink }}"
|
||||||
|
enable_cdn: 'true'
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: absent
|
||||||
|
register: result
|
||||||
|
- name: assert changed is false
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- result.changed == false
|
||||||
|
#---------------------------------------------------------
|
||||||
|
# Post-test teardown
|
||||||
|
# If errors happen, don't crash the playbook!
|
||||||
|
- name: delete a HTTP health check
|
||||||
|
gcp_compute_http_health_check:
|
||||||
|
name: httphealthcheck-backendservice
|
||||||
|
healthy_threshold: 10
|
||||||
|
port: 8080
|
||||||
|
timeout_sec: 2
|
||||||
|
unhealthy_threshold: 5
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: absent
|
||||||
|
register: healthcheck
|
||||||
|
ignore_errors: true
|
||||||
|
- name: delete a instance group
|
||||||
|
gcp_compute_instance_group:
|
||||||
|
name: instancegroup-backendservice
|
||||||
|
zone: us-central1-a
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: absent
|
||||||
|
register: instancegroup
|
||||||
|
ignore_errors: true
|
||||||
@ -1,174 +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 group
|
|
||||||
gcp_compute_instance_group:
|
|
||||||
name: instancegroup-backendservice
|
|
||||||
zone: us-central1-a
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: present
|
|
||||||
register: instancegroup
|
|
||||||
- name: create a HTTP health check
|
|
||||||
gcp_compute_http_health_check:
|
|
||||||
name: httphealthcheck-backendservice
|
|
||||||
healthy_threshold: 10
|
|
||||||
port: 8080
|
|
||||||
timeout_sec: 2
|
|
||||||
unhealthy_threshold: 5
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: present
|
|
||||||
register: healthcheck
|
|
||||||
- name: delete a backend service
|
|
||||||
gcp_compute_backend_service:
|
|
||||||
name: "{{ resource_name }}"
|
|
||||||
backends:
|
|
||||||
- group: "{{ instancegroup.selfLink }}"
|
|
||||||
health_checks:
|
|
||||||
- "{{ healthcheck.selfLink }}"
|
|
||||||
enable_cdn: 'true'
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: absent
|
|
||||||
#----------------------------------------------------------
|
|
||||||
- name: create a backend service
|
|
||||||
gcp_compute_backend_service:
|
|
||||||
name: "{{ resource_name }}"
|
|
||||||
backends:
|
|
||||||
- group: "{{ instancegroup.selfLink }}"
|
|
||||||
health_checks:
|
|
||||||
- "{{ healthcheck.selfLink }}"
|
|
||||||
enable_cdn: 'true'
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: present
|
|
||||||
register: result
|
|
||||||
- name: assert changed is true
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- result.changed == true
|
|
||||||
- name: verify that backend_service was created
|
|
||||||
gcp_compute_backend_service_info:
|
|
||||||
filters:
|
|
||||||
- name = {{ resource_name }}
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
scopes:
|
|
||||||
- https://www.googleapis.com/auth/compute
|
|
||||||
register: results
|
|
||||||
- name: verify that command succeeded
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- results['resources'] | length == 1
|
|
||||||
# ----------------------------------------------------------------------------
|
|
||||||
- name: create a backend service that already exists
|
|
||||||
gcp_compute_backend_service:
|
|
||||||
name: "{{ resource_name }}"
|
|
||||||
backends:
|
|
||||||
- group: "{{ instancegroup.selfLink }}"
|
|
||||||
health_checks:
|
|
||||||
- "{{ healthcheck.selfLink }}"
|
|
||||||
enable_cdn: 'true'
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: present
|
|
||||||
register: result
|
|
||||||
- name: assert changed is false
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- result.changed == false
|
|
||||||
#----------------------------------------------------------
|
|
||||||
- name: delete a backend service
|
|
||||||
gcp_compute_backend_service:
|
|
||||||
name: "{{ resource_name }}"
|
|
||||||
backends:
|
|
||||||
- group: "{{ instancegroup.selfLink }}"
|
|
||||||
health_checks:
|
|
||||||
- "{{ healthcheck.selfLink }}"
|
|
||||||
enable_cdn: 'true'
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: absent
|
|
||||||
register: result
|
|
||||||
- name: assert changed is true
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- result.changed == true
|
|
||||||
- name: verify that backend_service was deleted
|
|
||||||
gcp_compute_backend_service_info:
|
|
||||||
filters:
|
|
||||||
- name = {{ resource_name }}
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
scopes:
|
|
||||||
- https://www.googleapis.com/auth/compute
|
|
||||||
register: results
|
|
||||||
- name: verify that command succeeded
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- results['resources'] | length == 0
|
|
||||||
# ----------------------------------------------------------------------------
|
|
||||||
- name: delete a backend service that does not exist
|
|
||||||
gcp_compute_backend_service:
|
|
||||||
name: "{{ resource_name }}"
|
|
||||||
backends:
|
|
||||||
- group: "{{ instancegroup.selfLink }}"
|
|
||||||
health_checks:
|
|
||||||
- "{{ healthcheck.selfLink }}"
|
|
||||||
enable_cdn: 'true'
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: absent
|
|
||||||
register: result
|
|
||||||
- name: assert changed is false
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- result.changed == false
|
|
||||||
#---------------------------------------------------------
|
|
||||||
# Post-test teardown
|
|
||||||
# If errors happen, don't crash the playbook!
|
|
||||||
- name: delete a HTTP health check
|
|
||||||
gcp_compute_http_health_check:
|
|
||||||
name: httphealthcheck-backendservice
|
|
||||||
healthy_threshold: 10
|
|
||||||
port: 8080
|
|
||||||
timeout_sec: 2
|
|
||||||
unhealthy_threshold: 5
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: absent
|
|
||||||
register: healthcheck
|
|
||||||
ignore_errors: true
|
|
||||||
- name: delete a instance group
|
|
||||||
gcp_compute_instance_group:
|
|
||||||
name: instancegroup-backendservice
|
|
||||||
zone: us-central1-a
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: absent
|
|
||||||
register: instancegroup
|
|
||||||
ignore_errors: true
|
|
||||||
|
|||||||
@ -0,0 +1,124 @@
|
|||||||
|
---
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
#
|
||||||
|
# *** 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 disk
|
||||||
|
gcp_compute_disk:
|
||||||
|
name: "{{ resource_name }}"
|
||||||
|
size_gb: 50
|
||||||
|
disk_encryption_key:
|
||||||
|
raw_key: SGVsbG8gZnJvbSBHb29nbGUgQ2xvdWQgUGxhdGZvcm0=
|
||||||
|
zone: us-central1-a
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: absent
|
||||||
|
#----------------------------------------------------------
|
||||||
|
- name: create a disk
|
||||||
|
gcp_compute_disk:
|
||||||
|
name: "{{ resource_name }}"
|
||||||
|
size_gb: 50
|
||||||
|
disk_encryption_key:
|
||||||
|
raw_key: SGVsbG8gZnJvbSBHb29nbGUgQ2xvdWQgUGxhdGZvcm0=
|
||||||
|
zone: us-central1-a
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: present
|
||||||
|
register: result
|
||||||
|
- name: assert changed is true
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- result.changed == true
|
||||||
|
- name: verify that disk was created
|
||||||
|
gcp_compute_disk_info:
|
||||||
|
filters:
|
||||||
|
- name = {{ resource_name }}
|
||||||
|
zone: us-central1-a
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
scopes:
|
||||||
|
- https://www.googleapis.com/auth/compute
|
||||||
|
register: results
|
||||||
|
- name: verify that command succeeded
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- results['resources'] | length == 1
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
- name: create a disk that already exists
|
||||||
|
gcp_compute_disk:
|
||||||
|
name: "{{ resource_name }}"
|
||||||
|
size_gb: 50
|
||||||
|
disk_encryption_key:
|
||||||
|
raw_key: SGVsbG8gZnJvbSBHb29nbGUgQ2xvdWQgUGxhdGZvcm0=
|
||||||
|
zone: us-central1-a
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: present
|
||||||
|
register: result
|
||||||
|
- name: assert changed is false
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- result.changed == false
|
||||||
|
#----------------------------------------------------------
|
||||||
|
- name: delete a disk
|
||||||
|
gcp_compute_disk:
|
||||||
|
name: "{{ resource_name }}"
|
||||||
|
size_gb: 50
|
||||||
|
disk_encryption_key:
|
||||||
|
raw_key: SGVsbG8gZnJvbSBHb29nbGUgQ2xvdWQgUGxhdGZvcm0=
|
||||||
|
zone: us-central1-a
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: absent
|
||||||
|
register: result
|
||||||
|
- name: assert changed is true
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- result.changed == true
|
||||||
|
- name: verify that disk was deleted
|
||||||
|
gcp_compute_disk_info:
|
||||||
|
filters:
|
||||||
|
- name = {{ resource_name }}
|
||||||
|
zone: us-central1-a
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
scopes:
|
||||||
|
- https://www.googleapis.com/auth/compute
|
||||||
|
register: results
|
||||||
|
- name: verify that command succeeded
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- results['resources'] | length == 0
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
- name: delete a disk that does not exist
|
||||||
|
gcp_compute_disk:
|
||||||
|
name: "{{ resource_name }}"
|
||||||
|
size_gb: 50
|
||||||
|
disk_encryption_key:
|
||||||
|
raw_key: SGVsbG8gZnJvbSBHb29nbGUgQ2xvdWQgUGxhdGZvcm0=
|
||||||
|
zone: us-central1-a
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: absent
|
||||||
|
register: result
|
||||||
|
- name: assert changed is false
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- result.changed == false
|
||||||
@ -1,124 +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 disk
|
|
||||||
gcp_compute_disk:
|
|
||||||
name: "{{ resource_name }}"
|
|
||||||
size_gb: 50
|
|
||||||
disk_encryption_key:
|
|
||||||
raw_key: SGVsbG8gZnJvbSBHb29nbGUgQ2xvdWQgUGxhdGZvcm0=
|
|
||||||
zone: us-central1-a
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: absent
|
|
||||||
#----------------------------------------------------------
|
|
||||||
- name: create a disk
|
|
||||||
gcp_compute_disk:
|
|
||||||
name: "{{ resource_name }}"
|
|
||||||
size_gb: 50
|
|
||||||
disk_encryption_key:
|
|
||||||
raw_key: SGVsbG8gZnJvbSBHb29nbGUgQ2xvdWQgUGxhdGZvcm0=
|
|
||||||
zone: us-central1-a
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: present
|
|
||||||
register: result
|
|
||||||
- name: assert changed is true
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- result.changed == true
|
|
||||||
- name: verify that disk was created
|
|
||||||
gcp_compute_disk_info:
|
|
||||||
filters:
|
|
||||||
- name = {{ resource_name }}
|
|
||||||
zone: us-central1-a
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
scopes:
|
|
||||||
- https://www.googleapis.com/auth/compute
|
|
||||||
register: results
|
|
||||||
- name: verify that command succeeded
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- results['resources'] | length == 1
|
|
||||||
# ----------------------------------------------------------------------------
|
|
||||||
- name: create a disk that already exists
|
|
||||||
gcp_compute_disk:
|
|
||||||
name: "{{ resource_name }}"
|
|
||||||
size_gb: 50
|
|
||||||
disk_encryption_key:
|
|
||||||
raw_key: SGVsbG8gZnJvbSBHb29nbGUgQ2xvdWQgUGxhdGZvcm0=
|
|
||||||
zone: us-central1-a
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: present
|
|
||||||
register: result
|
|
||||||
- name: assert changed is false
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- result.changed == false
|
|
||||||
#----------------------------------------------------------
|
|
||||||
- name: delete a disk
|
|
||||||
gcp_compute_disk:
|
|
||||||
name: "{{ resource_name }}"
|
|
||||||
size_gb: 50
|
|
||||||
disk_encryption_key:
|
|
||||||
raw_key: SGVsbG8gZnJvbSBHb29nbGUgQ2xvdWQgUGxhdGZvcm0=
|
|
||||||
zone: us-central1-a
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: absent
|
|
||||||
register: result
|
|
||||||
- name: assert changed is true
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- result.changed == true
|
|
||||||
- name: verify that disk was deleted
|
|
||||||
gcp_compute_disk_info:
|
|
||||||
filters:
|
|
||||||
- name = {{ resource_name }}
|
|
||||||
zone: us-central1-a
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
scopes:
|
|
||||||
- https://www.googleapis.com/auth/compute
|
|
||||||
register: results
|
|
||||||
- name: verify that command succeeded
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- results['resources'] | length == 0
|
|
||||||
# ----------------------------------------------------------------------------
|
|
||||||
- name: delete a disk that does not exist
|
|
||||||
gcp_compute_disk:
|
|
||||||
name: "{{ resource_name }}"
|
|
||||||
size_gb: 50
|
|
||||||
disk_encryption_key:
|
|
||||||
raw_key: SGVsbG8gZnJvbSBHb29nbGUgQ2xvdWQgUGxhdGZvcm0=
|
|
||||||
zone: us-central1-a
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: absent
|
|
||||||
register: result
|
|
||||||
- name: assert changed is false
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- result.changed == false
|
|
||||||
|
|||||||
Loading…
Reference in New Issue